[x265] [PATCH] rc: remove vbv condition for updating framesizePlanned

Divya Manivannan divya at multicorewareinc.com
Fri May 27 16:06:07 CEST 2016


# HG changeset patch
# User Divya Manivannan <divya at multicorewareinc.com>
# Date 1464265165 -19800
#      Thu May 26 17:49:25 2016 +0530
# Node ID be8836157d4506770427d8de6d97e5b97231d536
# Parent  aeade2e8d8688ebffb8455b8948d89d6a72e2c38
rc: remove vbv condition for updating framesizePlanned

diff -r aeade2e8d868 -r be8836157d45 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Thu May 26 16:45:09 2016 +0530
+++ b/source/encoder/ratecontrol.cpp	Thu May 26 17:49:25 2016 +0530
@@ -1619,15 +1619,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)
@@ -1834,7 +1837,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