[x265] [PATCH] fix for x265 abrladder seg fault with reuselevel 1 changed encoder.cpp to reset to the current encode settings.

Yaswanth Sastry yaswanth.sastry at multicorewareinc.com
Tue Dec 20 05:26:30 UTC 2022


>From 03d2f693cac67d7dba741309f7d508c9aa83a692 Mon Sep 17 00:00:00 2001
From: yaswanthsastry <yaswanth.sastry at multicorewareinc.com>
Date: Mon, 12 Dec 2022 12:03:33 +0530
Subject:[x265][PATCH] Fix for abrladder segfault with load reuse level 1
changed encoder.cpp to reset to the current encode settings.

---
 source/encoder/encoder.cpp | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp
index 607e64370..710e96999 100644
--- a/source/encoder/encoder.cpp
+++ b/source/encoder/encoder.cpp
@@ -4941,8 +4941,14 @@ void Encoder::readAnalysisFile(x265_analysis_data*
analysis, int curPoc, const x

     if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType ==
X265_TYPE_I)
     {
-        if (m_param->analysisLoadReuseLevel < 2)
-            return;
+         if (m_param->analysisLoadReuseLevel < 2)
+         {
+              /* Restore to the current encode's numPartitions and
numCUsInFrame */
+              analysis->numPartitions = m_param->num4x4Partitions;
+              analysis->numCUsInFrame = cuLoc.heightInCU * cuLoc.widthInCU;
+              analysis->numCuInHeight = cuLoc.heightInCU;
+              return;
+         }

         uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL,
*partSizes = NULL;
         int8_t *cuQPBuf = NULL;
@@ -5010,8 +5016,14 @@ void Encoder::readAnalysisFile(x265_analysis_data*
analysis, int curPoc, const x
         uint32_t numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;
         uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3;
         X265_FREAD((WeightParam*)analysis->wt, sizeof(WeightParam),
numPlanes * numDir, m_analysisFileIn, (picIn->analysisData.wt));
-        if (m_param->analysisLoadReuseLevel < 2)
-            return;
+         if (m_param->analysisLoadReuseLevel < 2)
+         {
+              /* Restore to the current encode's numPartitions and
numCUsInFrame */
+              analysis->numPartitions = m_param->num4x4Partitions;
+              analysis->numCUsInFrame = cuLoc.heightInCU * cuLoc.widthInCU;
+              analysis->numCuInHeight = cuLoc.heightInCU;
+              return;
+         }

         uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL,
*partSize = NULL, *mergeFlag = NULL;
         uint8_t *interDir = NULL, *chromaDir = NULL, *mvpIdx[2];
-- 
2.37.3.windows.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20221220/75491b89/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 2183 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20221220/75491b89/attachment-0001.obj>


More information about the x265-devel mailing list