[x265] [PATCH 3 of 4] rc: update logic in clipQScale for vbv, when vbv lookahead is done,

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


# HG changeset patch
# User Aarthi Thirumalai
# Date 1399573469 -19800
#      Thu May 08 23:54:29 2014 +0530
# Node ID 164e47dc38c4b89492fb98177248fb8254a9d54a
# Parent  7ae5c6b44e111240f8b0727254db0c2ca91c0506
rc: update logic in clipQScale for vbv, when vbv lookahead is done,

diff -r 7ae5c6b44e11 -r 164e47dc38c4 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Thu May 08 23:51:49 2014 +0530
+++ b/source/encoder/ratecontrol.cpp	Thu May 08 23:54:29 2014 +0530
@@ -662,8 +662,15 @@
     // B-frames are not directly subject to VBV,
     // since they are controlled by the P-frames' QPs.
     double q0 = q;
-    if (param->lookaheadDepth)
+
+    if (param->lookaheadDepth || param->rc.cuTree ||
+       param->scenecutThreshold ||
+       (param->bFrameAdaptive && param->bframes))
     {
+       /* Lookahead VBV: If lookahead is done, raise the quantizer as necessary such that no frames in
+       the lookahead overflow and such that the buffer is in a reasonable state
+       by the end of the lookahead. */
+
         int terminate = 0;
 
         /* Avoid an infinite loop. */
@@ -712,6 +719,7 @@
     }
     else
     {
+        /* Fallback to old purely-reactive algorithm: no lookahead. */
         if ((sliceType == P_SLICE ||
                 (sliceType == I_SLICE && lastNonBPictType == I_SLICE)) &&
             bufferFill / bufferSize < 0.5)


More information about the x265-devel mailing list