[x265] [PATCH] ratecontrol: cleanup, repetitive code

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Fri Feb 14 12:29:35 CET 2014


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1392377014 -19800
# Node ID 72d92469559d7a4b9aa894b1f4af37537bca6fc4
# Parent  ed28c1935087ddf2c7aae6c5b491592fa6162d7e
ratecontrol: cleanup, repetitive code

diff -r ed28c1935087 -r 72d92469559d source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Fri Feb 14 15:32:00 2014 +0530
+++ b/source/encoder/ratecontrol.cpp	Fri Feb 14 16:53:34 2014 +0530
@@ -318,26 +318,22 @@
     bframes = cfg->param.bframes;
     bframeBits = 0;
     leadingNoBSatd = 0;
+    accumPNorm = .01;
+    /* estimated ratio that produces a reasonable QP for the first I-frame */
+    cplxrSum = .01 * pow(7.0e5, qCompress) * pow(ncu, 0.5);
+    wantedBitsWindow = bitrate * frameDuration;
 
     if (cfg->param.rc.rateControlMode == X265_RC_ABR)
     {
         /* Adjust the first frame in order to stabilize the quality level compared to the rest */
 #define ABR_INIT_QP_MIN (24 + QP_BD_OFFSET)
 #define ABR_INIT_QP_MAX (34 + QP_BD_OFFSET)
-        accumPNorm = .01;
-        accumPQp = (ABR_INIT_QP_MIN)*accumPNorm;
-        /* estimated ratio that produces a reasonable QP for the first I-frame */
-        cplxrSum = .01 * pow(7.0e5, qCompress) * pow(ncu, 0.5);
-        wantedBitsWindow = bitrate * frameDuration;
+        accumPQp = (ABR_INIT_QP_MIN)*accumPNorm;    
     }
     else if (cfg->param.rc.rateControlMode == X265_RC_CRF)
     {
 #define ABR_INIT_QP ((int)cfg->param.rc.rfConstant + QP_BD_OFFSET)
-        accumPNorm = .01;
-        accumPQp = ABR_INIT_QP * accumPNorm;
-        /* estimated ratio that produces a reasonable QP for the first I-frame */
-        cplxrSum = .01 * pow(7.0e5, qCompress) * pow(ncu, 0.5);
-        wantedBitsWindow = bitrate * frameDuration;
+        accumPQp = ABR_INIT_QP * accumPNorm;        
     }
 
     ipOffset = 6.0 * X265_LOG2(cfg->param.rc.ipFactor);


More information about the x265-devel mailing list