[x265] [PATCH] rc: rename variable vbvMinRate to isCbr

santhoshini at multicorewareinc.com santhoshini at multicorewareinc.com
Thu May 22 08:13:49 CEST 2014


# HG changeset patch
# User Santhoshini Sekar <santhoshini at multicorewareinc.com>
# Date 1400738849 -19800
#      Thu May 22 11:37:29 2014 +0530
# Node ID 8ac70ae728744dabf2df5ad62aee3c3e6574ba5a
# Parent  dadb646a7266f377cbfa33747ecb0a97f50a00f9
rc: rename variable vbvMinRate to isCbr

diff -r dadb646a7266 -r 8ac70ae72874 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Wed May 21 11:23:29 2014 -0500
+++ b/source/encoder/ratecontrol.cpp	Thu May 22 11:37:29 2014 +0530
@@ -245,7 +245,7 @@
     param->rc.vbvBufferSize = Clip3(0, 2000000, param->rc.vbvBufferSize);
     param->rc.vbvMaxBitrate = Clip3(0, 2000000, param->rc.vbvMaxBitrate);
     param->rc.vbvBufferInit = Clip3(0.0, 2000000.0, param->rc.vbvBufferInit);
-    vbvMinRate = 0;
+    isCbr = false;
     singleFrameVbv = 0;
     if (param->rc.vbvBufferSize)
     {
@@ -305,7 +305,7 @@
             param->rc.vbvBufferInit = Clip3(0.0, 1.0, param->rc.vbvBufferInit / param->rc.vbvBufferSize);
         param->rc.vbvBufferInit = Clip3(0.0, 1.0, X265_MAX(param->rc.vbvBufferInit, bufferRate / bufferSize));
         bufferFillFinal = bufferSize * param->rc.vbvBufferInit;
-        vbvMinRate = /*!rc->b_2pass && */ param->rc.rateControlMode == X265_RC_ABR
+        isCbr = param->rc.rateControlMode == X265_RC_ABR
             && param->rc.vbvMaxBitrate <= param->rc.bitrate;
     }
 
@@ -545,7 +545,7 @@
             /* ABR code can potentially be counterproductive in CBR, so just
              * don't bother.  Don't run it if the frame complexity is zero
              * either. */
-            if (!vbvMinRate && currentSatd)
+            if (!isCbr && currentSatd)
             {
                 /* use framesDone instead of POC as poc count is not serial with bframes enabled */
                 double timeDone = (double)(framesDone - param->frameNumThreads + 1) * frameDuration;
@@ -700,7 +700,7 @@
             }
             /* Try to get the buffer no more than 80% filled, but don't set an impossible goal. */
             targetFill = Clip3(bufferSize * 0.8, bufferSize, bufferFill - totalDuration * vbvMaxRate * 0.5);
-            if (vbvMinRate && bufferFillCur > targetFill)
+            if (isCbr && bufferFillCur > targetFill)
             {
                 q /= 1.01;
                 terminate |= 2;
@@ -763,7 +763,7 @@
         }
         q = X265_MAX(q0 / 2, q);
     }
-    if (!vbvMinRate)
+    if (!isCbr)
         q = X265_MAX(q0, q);
 
     if (rateFactorMaxIncrement)
@@ -910,7 +910,7 @@
         if (rce->sliceType != I_SLICE)
             rcTol *= 0.5;
 
-        if (!vbvMinRate)
+        if (!isCbr)
             qpMin = X265_MAX(qpMin, rce->qpNoVbv);
 
         while (qpVbv < qpMax
diff -r dadb646a7266 -r 8ac70ae72874 source/encoder/ratecontrol.h
--- a/source/encoder/ratecontrol.h	Wed May 21 11:23:29 2014 -0500
+++ b/source/encoder/ratecontrol.h	Thu May 22 11:37:29 2014 +0530
@@ -93,7 +93,7 @@
     double bufferFill;       /* planned buffer, if all in-progress frames hit their bit budget */
     double bufferRate;       /* # of bits added to buffer_fill after each frame */
     double vbvMaxRate;       /* in kbps */
-    double vbvMinRate;       /* in kbps */
+    bool   isCbr;
     bool singleFrameVbv;
     double rateFactorMaxIncrement; /* Don't allow RF above (CRF + this value). */
     double rateFactorMaxDecrement; /* don't allow RF below (this value). */


More information about the x265-devel mailing list