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

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Wed Jun 4 15:49:59 CEST 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1401889775 -19800
#      Wed Jun 04 19:19:35 2014 +0530
# Node ID 42110cd284f1438d09b5c4415443d3d018ff0f29
# Parent  4ecd1bfebb7294d70b288ea77eba570c850f769c
rc: fixes to improve quality in vbv

diff -r 4ecd1bfebb72 -r 42110cd284f1 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Wed Jun 04 19:17:39 2014 +0530
+++ b/source/encoder/frameencoder.cpp	Wed Jun 04 19:19:35 2014 +0530
@@ -1207,7 +1207,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 4ecd1bfebb72 -r 42110cd284f1 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Wed Jun 04 19:17:39 2014 +0530
+++ b/source/encoder/ratecontrol.cpp	Wed Jun 04 19:19:35 2014 +0530
@@ -406,6 +406,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)
@@ -693,10 +694,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