[x265] [PATCH][master] Fix crash for main10 and main12 build when source resolution is not multiple of minCuSize for hist-scenecut

Mahesh Pittala mahesh at multicorewareinc.com
Wed Jun 22 11:02:28 UTC 2022


>From 041f00b36f4313b969463f4801e989f72486255d Mon Sep 17 00:00:00 2001
From: Mahesh Pittala <mahesh at multicorewareinc.com>
Date: Mon, 20 Jun 2022 11:57:00 +0530
Subject: [PATCH] Fix crash for main10 and main12 build when source
resolution
 is not multiple of minCuSize

---
 source/encoder/encoder.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
index f33a6d053..a54b0e197 100644
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -252,9 +252,9 @@ void Encoder::create()

     if (m_param->bHistBasedSceneCut)
     {
-        m_planeSizes[0] = (m_param->sourceWidth >>
x265_cli_csps[p->internalCsp].width[0]) * (m_param->sourceHeight >>
x265_cli_csps[m_param->internalCsp].height[0]);
+        uint32_t planeSize = (m_param->sourceWidth >>
x265_cli_csps[p->internalCsp].width[0]) * (m_param->sourceHeight >>
x265_cli_csps[m_param->internalCsp].height[0]);
         uint32_t pixelbytes = m_param->internalBitDepth > 8 ? 2 : 1;
-        m_edgePic = X265_MALLOC(pixel, m_planeSizes[0] * pixelbytes);
+        m_edgePic = X265_MALLOC(pixel, planeSize * pixelbytes);
         m_edgeHistThreshold = m_param->edgeTransitionThreshold;
         m_chromaHistThreshold = x265_min(m_edgeHistThreshold * 10.0,
MAX_SCENECUT_THRESHOLD);
         m_scaledEdgeThreshold = x265_min(m_edgeHistThreshold *
SCENECUT_STRENGTH_FACTOR, MAX_SCENECUT_THRESHOLD);
@@ -1664,7 +1664,7 @@ int Encoder::encode(const x265_picture* pic_in,
x265_picture* pic_out)
             if (pic->poc == 0)
             {
                 /* for entire encode compute the chroma plane sizes only
once */
-                for (int i = 1; i <
x265_cli_csps[m_param->internalCsp].planes; i++)
+                for (int i = 0; i <
x265_cli_csps[m_param->internalCsp].planes; i++)
                     m_planeSizes[i] = (pic->width >>
x265_cli_csps[m_param->internalCsp].width[i]) * (pic->height >>
x265_cli_csps[m_param->internalCsp].height[i]);
             }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20220622/b05f141c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fix_crash_for_main10_main12_build_when_sourceResolution_not_multiple_of_minCuSize (1).diff
Type: application/octet-stream
Size: 2040 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20220622/b05f141c/attachment.obj>


More information about the x265-devel mailing list