<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 10, 2018 at 2:22 PM <<a href="mailto:aruna@multicorewareinc.com">aruna@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Aruna Matheswaran <<a href="mailto:aruna@multicorewareinc.com" target="_blank">aruna@multicorewareinc.com</a>><br>
# Date 1539151768 -19800<br>
#      Wed Oct 10 11:39:28 2018 +0530<br>
# Node ID 9f74ae7aa489ed0c981dbf1f4a8dddd771046490<br>
# Parent  fd517ae68f93dbfdd1bff45a9dd8e626523542b6<br>
rc: Fix rowStat computation in const-vbv<br>
<br>
diff -r fd517ae68f93 -r 9f74ae7aa489 source/encoder/frameencoder.cpp<br>
--- a/source/encoder/frameencoder.cpp   Tue Sep 25 16:02:31 2018 +0530<br>
+++ b/source/encoder/frameencoder.cpp   Wed Oct 10 11:39:28 2018 +0530<br>
@@ -1599,11 +1599,11 @@<br>
             if (!m_param->bEnableWavefront && col == numCols - 1)<br>
             {<br>
                 double qpBase = curEncData.m_cuStat[cuAddr].baseQp;<br>
-                int reEncode = m_top->m_rateControl->rowVbvRateControl(m_frame, row, &m_rce, qpBase, m_sliceBaseRow, sliceId);<br>
+                curRow.reEncode = m_top->m_rateControl->rowVbvRateControl(m_frame, row, &m_rce, qpBase, m_sliceBaseRow, sliceId);<br>
                 qpBase = x265_clip3((double)m_param->rc.qpMin, (double)m_param->rc.qpMax, qpBase);<br>
                 curEncData.m_rowStat[row].rowQp = qpBase;<br>
                 curEncData.m_rowStat[row].rowQpScale = x265_qp2qScale(qpBase);<br>
-                if (reEncode < 0)<br>
+                if (curRow.reEncode < 0)<br>
                 {<br>
                     x265_log(m_param, X265_LOG_DEBUG, "POC %d row %d - encode restart required for VBV, to %.2f from %.2f\n",<br>
                         m_frame->m_poc, row, qpBase, curEncData.m_cuStat[cuAddr].baseQp);<br>
@@ -1642,17 +1642,19 @@<br>
                             curEncData.m_rowStat[r].sumQpRc += curEncData.m_cuStat[c].baseQp;<br>
                             curEncData.m_rowStat[r].numEncodedCUs = c;<br>
                         }<br>
+                        if (curRow.reEncode < 0)<br>
+                            break;<br>
                         startCuAddr = EndCuAddr - numCols;<br>
                         EndCuAddr = startCuAddr + 1;<br>
                     }<br>
                 }<br>
                 double qpBase = curEncData.m_cuStat[cuAddr].baseQp;<br>
-                int reEncode = m_top->m_rateControl->rowVbvRateControl(m_frame, row, &m_rce, qpBase, m_sliceBaseRow, sliceId);<br>
+                curRow.reEncode = m_top->m_rateControl->rowVbvRateControl(m_frame, row, &m_rce, qpBase, m_sliceBaseRow, sliceId);<br>
                 qpBase = x265_clip3((double)m_param->rc.qpMin, (double)m_param->rc.qpMax, qpBase);<br>
                 curEncData.m_rowStat[row].rowQp = qpBase;<br>
                 curEncData.m_rowStat[row].rowQpScale = x265_qp2qScale(qpBase);<br>
<br>
-                if (reEncode < 0)<br>
+                if (curRow.reEncode < 0)<br>
                 {<br>
                     x265_log(m_param, X265_LOG_DEBUG, "POC %d row %d - encode restart required for VBV, to %.2f from %.2f\n",<br>
                              m_frame->m_poc, row, qpBase, curEncData.m_cuStat[cuAddr].baseQp);<br>
diff -r fd517ae68f93 -r 9f74ae7aa489 source/encoder/frameencoder.h<br>
--- a/source/encoder/frameencoder.h     Tue Sep 25 16:02:31 2018 +0530<br>
+++ b/source/encoder/frameencoder.h     Wed Oct 10 11:39:28 2018 +0530<br>
@@ -97,6 +97,8 @@<br>
     volatile uint32_t completed;<br>
     volatile uint32_t avgQPComputed;<br>
<br>
+    volatile int      reEncode;<br>
+<br>
     /* called at the start of each frame to initialize state */<br>
     void init(Entropy& initContext, unsigned int sid)<br>
     {<br>
@@ -105,6 +107,7 @@<br>
         completed = 0;<br>
         avgQPComputed = 0;<br>
         sliceId = sid;<br>
+        reEncode = 0;<br>
         memset(&rowStats, 0, sizeof(rowStats));<br>
         rowGoOnCoder.load(initContext);<br>
     }<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a></blockquote><div><br></div><div><br></div><div>Thank you. Pushed to stable. </div></div></div>