[x265] [PATCH 2 of 6] rc: tune midframe vbv logic for B frames

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Wed Nov 26 19:41:48 CET 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1416389001 -19800
#      Wed Nov 19 14:53:21 2014 +0530
# Node ID 58f220140bc59d8373d253f97959bd02541f6338
# Parent  3eff27c39259ee0ecf7eca715c5a754a584dae37
rc: tune midframe vbv logic for B frames

diff -r 3eff27c39259 -r 58f220140bc5 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Fri Nov 21 18:07:42 2014 +0530
+++ b/source/encoder/ratecontrol.cpp	Wed Nov 19 14:53:21 2014 +0530
@@ -1885,13 +1885,15 @@
                 }
                 totalSatdBits += int32_t(pred_s);
             }
-            else
+            else if (picType == P_SLICE)
             {
                 /* Our QP is lower than the reference! */
                 double pred_intra = predictSize(rce->rowPred[1], qScale, intraCost);
                 /* Sum: better to overestimate than underestimate by using only one of the two predictors. */
                 totalSatdBits += int32_t(pred_intra + pred_s);
             }
+            else
+              totalSatdBits += int32_t(pred_s);
         }
     }
 
@@ -1946,14 +1948,6 @@
 
     if (row < sps.numCuInHeight - 1)
     {
-        /* B-frames shouldn't use lower QP than their reference frames. */
-        if (rce->sliceType == B_SLICE)
-        {
-            Frame* refSlice1 = curEncData.m_slice->m_refPicList[0][0];
-            Frame* refSlice2 = curEncData.m_slice->m_refPicList[1][0];
-            qpMin = X265_MAX(qpMin, X265_MAX(refSlice1->m_encData->m_rowStat[row].diagQp, refSlice2->m_encData->m_rowStat[row].diagQp));
-            qpVbv = X265_MAX(qpVbv, qpMin);
-        }
         /* More threads means we have to be more cautious in letting ratecontrol use up extra bits. */
         double rcTol = bufferLeftPlanned / m_param->frameNumThreads * m_param->rc.rateTolerance;
         int32_t encodedBitsSoFar = 0;


More information about the x265-devel mailing list