<div dir="ltr">From 041f00b36f4313b969463f4801e989f72486255d Mon Sep 17 00:00:00 2001<br>From: Mahesh Pittala <<a href="mailto:mahesh@multicorewareinc.com" target="_blank">mahesh@multicorewareinc.com</a>><br>Date: Mon, 20 Jun 2022 11:57:00 +0530<br>Subject: [PATCH] Fix crash for main10 and main12 build when source resolution<br> is not multiple of minCuSize<br><br>---<br> source/encoder/encoder.cpp | 6 +++---<br> 1 file changed, 3 insertions(+), 3 deletions(-)<br><br>diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp<br>index f33a6d053..a54b0e197 100644<br>--- a/source/encoder/encoder.cpp<br>+++ b/source/encoder/encoder.cpp<br>@@ -252,9 +252,9 @@ void Encoder::create()<br> <br>     if (m_param->bHistBasedSceneCut)<br>     {<br>-        m_planeSizes[0] = (m_param->sourceWidth >> x265_cli_csps[p->internalCsp].width[0]) * (m_param->sourceHeight >> x265_cli_csps[m_param->internalCsp].height[0]);<br>+        uint32_t planeSize = (m_param->sourceWidth >> x265_cli_csps[p->internalCsp].width[0]) * (m_param->sourceHeight >> x265_cli_csps[m_param->internalCsp].height[0]);<br>         uint32_t pixelbytes = m_param->internalBitDepth > 8 ? 2 : 1;<br>-        m_edgePic = X265_MALLOC(pixel, m_planeSizes[0] * pixelbytes);<br>+        m_edgePic = X265_MALLOC(pixel, planeSize * pixelbytes);<br>         m_edgeHistThreshold = m_param->edgeTransitionThreshold;<br>         m_chromaHistThreshold = x265_min(m_edgeHistThreshold * 10.0, MAX_SCENECUT_THRESHOLD);<br>         m_scaledEdgeThreshold = x265_min(m_edgeHistThreshold * SCENECUT_STRENGTH_FACTOR, MAX_SCENECUT_THRESHOLD);<br>@@ -1664,7 +1664,7 @@ int Encoder::encode(const x265_picture* pic_in, x265_picture* pic_out)<br>             if (pic->poc == 0)<br>             {<br>                 /* for entire encode compute the chroma plane sizes only once */<br>-                for (int i = 1; i < x265_cli_csps[m_param->internalCsp].planes; i++)<br>+                for (int i = 0; i < x265_cli_csps[m_param->internalCsp].planes; i++)<br>                     m_planeSizes[i] = (pic->width >> x265_cli_csps[m_param->internalCsp].width[i]) * (pic->height >> x265_cli_csps[m_param->internalCsp].height[i]);<br>             }<font color="#888888"><br> </font><br></div>