[x265] [PATCH] rc: fix bug in predicting B frame bits in vbv

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Wed Aug 27 14:24:47 CEST 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1409142176 -19800
#      Wed Aug 27 17:52:56 2014 +0530
# Node ID 0cb9aa3445d605d234d70420988214428c7101ba
# Parent  77fe0cc583e8ec10275bc1b3c4bb116d5ceb51ac
rc: fix bug in predicting B frame bits in vbv

diff -r 77fe0cc583e8 -r 0cb9aa3445d6 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Wed Aug 27 14:25:17 2014 +0530
+++ b/source/encoder/ratecontrol.cpp	Wed Aug 27 17:52:56 2014 +0530
@@ -1740,12 +1740,12 @@
          if (m_leadingBframes <= 5 && m_sliceType == P_SLICE && !m_singleFrameVbv)
          {
              int nb = m_leadingBframes;
-             double bits = predictSize(&m_pred[m_sliceType], q, (double)m_currentSatd);
+             double space, pbbits;
+             double bits = pbbits = predictSize(&m_pred[m_sliceType], q, (double)m_currentSatd);
              double bbits = predictSize(&m_predBfromP, q * m_param->rc.pbFactor, (double)m_currentSatd);
-             double space;
              if (bbits > m_bufferRate)
                  nb = 0;
-             double pbbits = nb * bbits;
+             pbbits += nb * bbits;
 
              space = m_bufferFill + (1 + nb) * m_bufferRate - m_bufferSize;
              if (pbbits < space)


More information about the x265-devel mailing list