[x265] [PATCH 4 of 4] rc: add minor changes in flow when singleFrameVbv, rateFactorMax values are set

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Thu May 8 20:28:27 CEST 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1399573648 -19800
#      Thu May 08 23:57:28 2014 +0530
# Node ID 7b6c39cff2b1804cc1353ca12fe0d512d060a4a1
# Parent  164e47dc38c4b89492fb98177248fb8254a9d54a
rc: add minor changes in flow when singleFrameVbv, rateFactorMax values are set.

diff -r 164e47dc38c4 -r 7b6c39cff2b1 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Thu May 08 23:54:29 2014 +0530
+++ b/source/encoder/ratecontrol.cpp	Thu May 08 23:57:28 2014 +0530
@@ -613,6 +613,9 @@
             lastQScaleFor[P_SLICE] = q * fabs(param->rc.ipFactor);
 
         rce->frameSizePlanned = predictSize(&pred[sliceType], q, (double)currentSatd);
+        /* Always use up the whole VBV in this case. */
+        if (singleFrameVbv)
+            rce->frameSizePlanned = bufferRate;
 
         return q;
     }
@@ -754,7 +757,7 @@
 
     // Check B-frame complexity, and use up any bits that would
     // overflow before the next P-frame.
-    if (sliceType == P_SLICE)
+    if (sliceType == P_SLICE && !singleFrameVbv)
     {
         int nb = bframes;
         double bits = predictSize(&pred[sliceType], q, (double)currentSatd);
@@ -773,6 +776,14 @@
     }
     if (!vbvMinRate)
         q = X265_MAX(q0, q);
+
+    if (rateFactorMaxIncrement)
+    {
+        double qpNoVbv = x265_qScale2qp(q0);
+        double qmax = X265_MIN(MAX_MAX_QPSCALE,x265_qp2qScale(qpNoVbv + rateFactorMaxIncrement));
+        return Clip3(MIN_QPSCALE, qmax, q);
+    }
+
     return Clip3(MIN_QPSCALE, MAX_MAX_QPSCALE, q);
 }
 


More information about the x265-devel mailing list