[x265] [PATCH] rc: frameSizePlanned is calculated from the predictors for vbv case

Divya Manivannan divya at multicorewareinc.com
Thu Dec 8 05:24:49 CET 2016


# HG changeset patch
# User Divya Manivannan <divya at multicorewareinc.com>
# Date 1464265165 -19800
#      Thu May 26 17:49:25 2016 +0530
# Node ID b3123ce4e9e3ff9a3ba958d45e7811edaf0bfd74
# Parent  b2d360143d966de3832a05d8af1c824ecb5b8c5f
rc: frameSizePlanned is calculated from the predictors for vbv case

diff -r b2d360143d96 -r b3123ce4e9e3 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Mon Dec 05 11:11:53 2016 +0530
+++ b/source/encoder/ratecontrol.cpp	Thu May 26 17:49:25 2016 +0530
@@ -1674,15 +1674,18 @@
                 if (m_pred[m_predType].count == 1)
                     qScale = x265_clip3(lmin, lmax, qScale);
                 m_lastQScaleFor[m_sliceType] = qScale;
-                rce->frameSizePlanned = predictSize(&m_pred[m_predType], qScale, (double)m_currentSatd);
             }
-            else
-                rce->frameSizePlanned = qScale2bits(rce, qScale);
+        }
 
-            /* Limit planned size by MinCR */
+        if (m_2pass)
+            rce->frameSizePlanned = qScale2bits(rce, qScale);
+        else
+            rce->frameSizePlanned = predictSize(&m_pred[m_predType], qScale, (double)m_currentSatd);
+
+        /* Limit planned size by MinCR */
+        if (m_isVbv)
             rce->frameSizePlanned = X265_MIN(rce->frameSizePlanned, rce->frameSizeMaximum);
-            rce->frameSizeEstimated = rce->frameSizePlanned;
-        }
+        rce->frameSizeEstimated = rce->frameSizePlanned;
 
         rce->newQScale = qScale;
         if(rce->bLastMiniGopBFrame)
@@ -1900,7 +1903,7 @@
         if ((m_curSlice->m_poc == 0 || m_lastQScaleFor[P_SLICE] < q) && !(m_2pass && !m_isVbv))
             m_lastQScaleFor[P_SLICE] = q * fabs(m_param->rc.ipFactor);
 
-        if (m_2pass && m_isVbv)
+        if (m_2pass)
             rce->frameSizePlanned = qScale2bits(rce, q);
         else
             rce->frameSizePlanned = predictSize(&m_pred[m_predType], q, (double)m_currentSatd);


More information about the x265-devel mailing list