[x265] [PATCH 3 of 3] rc: fixes to improve quality in vbv

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Thu Jun 5 05:59:25 CEST 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1401889775 -19800
#      Wed Jun 04 19:19:35 2014 +0530
# Branch stable
# Node ID cbc5d3289a789cce199b6c7d8c7f7a69510ca182
# Parent  641274167691f037c955ab0145822db961fb1bb9
rc: fixes to improve quality in vbv

diff -r 641274167691 -r cbc5d3289a78 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Thu Jun 05 09:28:18 2014 +0530
+++ b/source/encoder/frameencoder.cpp	Wed Jun 04 19:19:35 2014 +0530
@@ -1147,7 +1147,10 @@
         if (bIsVbv)
         {
             if (!row)
+            {
                 m_pic->m_rowDiagQp[row] = m_pic->m_avgQpRc;
+                m_pic->m_rowDiagQScale[row] = x265_qp2qScale(m_pic->m_avgQpRc);
+            }
 
             if (row >= col && row && m_vbvResetTriggerRow != row)
                 cu->m_baseQp = m_pic->getCU(cuAddr - numCols + 1)->m_baseQp;
diff -r 641274167691 -r cbc5d3289a78 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Thu Jun 05 09:28:18 2014 +0530
+++ b/source/encoder/ratecontrol.cpp	Wed Jun 04 19:19:35 2014 +0530
@@ -350,6 +350,7 @@
 {
     totalBits = 0;
     framesDone = 0;
+    residualCost = 0;
     double tuneCplxFactor = 1;
     /* 720p videos seem to be a good cutoff for cplxrSum */
     if (param->rc.cuTree && ncu > 3600)
@@ -601,10 +602,11 @@
 
         lastQScaleFor[sliceType] = q;
 
-        if (curSlice->getPOC() == 0 || (isAbrReset && sliceType == I_SLICE))
+        if (curSlice->getPOC() == 0 || lastQScaleFor[P_SLICE] < q )
             lastQScaleFor[P_SLICE] = q * fabs(param->rc.ipFactor);
 
         rce->frameSizePlanned = predictSize(&pred[sliceType], q, (double)currentSatd);
+        rce->frameSizeEstimated = rce->frameSizePlanned;
         /* Always use up the whole VBV in this case. */
         if (singleFrameVbv)
             rce->frameSizePlanned = bufferRate;


More information about the x265-devel mailing list