<div dir="ltr"><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">From 03d2f693cac67d7dba741309f7d508c9aa83a692 Mon Sep 17 00:00:00 2001</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">From: yaswanthsastry <<a href="mailto:yaswanth.sastry@multicorewareinc.com" target="_blank">yaswanth.sastry@multicorewareinc.com</a>></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">Date: Mon, 12 Dec 2022 12:03:33 +0530</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">Subject:[x265][PATCH] Fix for abrladder segfault with load reuse level 1 changed encoder.cpp to reset to the current encode settings.</div><br style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">---</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"> source/encoder/encoder.cpp | 20 ++++++++++++++++----</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"> 1 file changed, 16 insertions(+), 4 deletions(-)</div><br style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(0,0,128)">diff --git a/source/encoder/encoder.cpp b/source/encoder/encoder.cpp</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">index 607e64370..710e96999 100644</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(0,0,128)">--- a/source/encoder/encoder.cpp</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(0,0,128)">+++ b/source/encoder/encoder.cpp</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">@@ -4941,8 +4941,14 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"> </div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">     if (analysis->sliceType == X265_TYPE_IDR || analysis->sliceType == X265_TYPE_I)</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">     {</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(163,21,21)">-        if (m_param->analysisLoadReuseLevel < 2)</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(163,21,21)">-            return;</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+         if (m_param->analysisLoadReuseLevel < 2)</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+         {</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+              /* Restore to the current encode's numPartitions and numCUsInFrame */</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+              analysis->numPartitions = m_param->num4x4Partitions;</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+              analysis->numCUsInFrame = cuLoc.heightInCU * cuLoc.widthInCU;</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+              analysis->numCuInHeight = cuLoc.heightInCU;</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+              return;</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+         }</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"> </div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">         uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL, *partSizes = NULL;</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">         int8_t *cuQPBuf = NULL;</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">@@ -5010,8 +5016,14 @@ void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">         uint32_t numDir = analysis->sliceType == X265_TYPE_P ? 1 : 2;</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">         uint32_t numPlanes = m_param->internalCsp == X265_CSP_I400 ? 1 : 3;</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">         X265_FREAD((WeightParam*)analysis->wt, sizeof(WeightParam), numPlanes * numDir, m_analysisFileIn, (picIn->analysisData.wt));</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(163,21,21)">-        if (m_param->analysisLoadReuseLevel < 2)</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(163,21,21)">-            return;</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+         if (m_param->analysisLoadReuseLevel < 2)</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+         {</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+              /* Restore to the current encode's numPartitions and numCUsInFrame */</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+              analysis->numPartitions = m_param->num4x4Partitions;</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+              analysis->numCUsInFrame = cuLoc.heightInCU * cuLoc.widthInCU;</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+              analysis->numCuInHeight = cuLoc.heightInCU;</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+              return;</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(9,134,88)">+         }</span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"> </div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">         uint8_t *tempBuf = NULL, *depthBuf = NULL, *modeBuf = NULL, *partSize = NULL, *mergeFlag = NULL;</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">         uint8_t *interDir = NULL, *chromaDir = NULL, *mvpIdx[2];</div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap"><span style="color:rgb(163,21,21)">-- </span></div><div style="color:rgb(0,0,0);font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">2.37.3.windows.1</div></div>