[x265-commits] [x265] ratecontrol: more dead code removed

Deepthi Nandakumar deepthi at multicorewareinc.com
Thu Apr 10 04:40:53 CEST 2014


details:   http://hg.videolan.org/x265/rev/e2df2309e6f1
branches:  
changeset: 6684:e2df2309e6f1
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Wed Apr 09 14:47:15 2014 +0530
description:
ratecontrol: more dead code removed
Subject: [x265] ratecontrol: cleanup, replace (unnecessary) constant arrays with constants.

details:   http://hg.videolan.org/x265/rev/db15b6bee7f4
branches:  
changeset: 6685:db15b6bee7f4
user:      Deepthi Nandakumar <deepthi at multicorewareinc.com>
date:      Thu Apr 10 06:58:46 2014 +0530
description:
ratecontrol: cleanup, replace (unnecessary) constant arrays with constants.
Subject: [x265] level: fix MinGW warning

details:   http://hg.videolan.org/x265/rev/51c627e235bc
branches:  
changeset: 6686:51c627e235bc
user:      Steve Borho <steve at borho.org>
date:      Wed Apr 09 21:37:38 2014 -0500
description:
level: fix MinGW warning

diffstat:

 source/Lib/TLibCommon/CommonDef.h |   3 +++
 source/encoder/level.cpp          |   2 +-
 source/encoder/ratecontrol.cpp    |  16 ++++------------
 source/encoder/ratecontrol.h      |   2 --
 4 files changed, 8 insertions(+), 15 deletions(-)

diffs (84 lines):

diff -r bd987db26d5d -r 51c627e235bc source/Lib/TLibCommon/CommonDef.h
--- a/source/Lib/TLibCommon/CommonDef.h	Wed Apr 09 11:15:33 2014 -0500
+++ b/source/Lib/TLibCommon/CommonDef.h	Wed Apr 09 21:37:38 2014 -0500
@@ -137,6 +137,9 @@
 #define MAX_QP                      51
 #define MAX_MAX_QP                  69
 
+#define MIN_QPSCALE                 0.21249999999999999
+#define MAX_MAX_QPSCALE             615.46574234477100
+
 #define NOT_VALID                  -1
 
 // ====================================================================================================================
diff -r bd987db26d5d -r 51c627e235bc source/encoder/level.cpp
--- a/source/encoder/level.cpp	Wed Apr 09 11:15:33 2014 -0500
+++ b/source/encoder/level.cpp	Wed Apr 09 21:37:38 2014 -0500
@@ -52,7 +52,7 @@ LevelSpec levels[] = {
     { 8912896,  1069547520, 60000,    240000,   8, Level::LEVEL5_2, "5.2" },
     { 35651584, 1069547520, 60000,    240000,   8, Level::LEVEL6,   "6" },
     { 35651584, 2139095040, 120000,   480000,   8, Level::LEVEL6_1, "6.1" },
-    { 35651584, 4278190080, 240000,   800000,   6, Level::LEVEL6_2, "6.2" },
+    { 35651584, 4278190080U, 240000,  800000,   6, Level::LEVEL6_2, "6.2" },
     { 0, 0, 0, 0, 0, Level::NONE, "\0"}
 };
 
diff -r bd987db26d5d -r 51c627e235bc source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Wed Apr 09 11:15:33 2014 -0500
+++ b/source/encoder/ratecontrol.cpp	Wed Apr 09 21:37:38 2014 -0500
@@ -327,9 +327,7 @@ RateControl::RateControl(Encoder * _cfg)
     pbOffset = 6.0 * X265_LOG2(param->rc.pbFactor);
     for (int i = 0; i < 3; i++)
     {
-        lastQScaleFor[i] = x265_qp2qScale(param->rc.rateControlMode == X265_RC_CRF ? ABR_INIT_QP : ABR_INIT_QP_MIN);
-        lmin[i] = x265_qp2qScale(MIN_QP);
-        lmax[i] = x265_qp2qScale(MAX_MAX_QP);
+        lastQScaleFor[i] = x265_qp2qScale(param->rc.rateControlMode == X265_RC_CRF ? ABR_INIT_QP : ABR_INIT_QP_MIN);      
     }
 
     if (param->rc.rateControlMode == X265_RC_CQP)
@@ -582,9 +580,8 @@ double RateControl::rateEstimateQscale(T
             if (qCompress != 1 && framesDone == 0)
                 q = x265_qp2qScale(ABR_INIT_QP) / fabs(param->rc.ipFactor);
         }
-        double lmin1 = lmin[sliceType];
-        double lmax1 = lmax[sliceType];
-        q = Clip3(lmin1, lmax1, q);
+        
+        q = Clip3(MIN_QPSCALE, MAX_MAX_QPSCALE, q);
         qpNoVbv = x265_qScale2qp(q);
 
         q = clipQscale(pic, q);
@@ -641,8 +638,6 @@ double RateControl::predictSize(Predicto
 
 double RateControl::clipQscale(TComPic* pic, double q)
 {
-    double lmin1 = lmin[sliceType];
-    double lmax1 = lmax[sliceType];
     double q0 = q;
 
     // B-frames are not directly subject to VBV,
@@ -754,10 +749,7 @@ double RateControl::clipQscale(TComPic* 
             q = X265_MAX(q0, q);
     }
 
-    if (lmin1 == lmax1)
-        return lmin1;
-
-    return Clip3(lmin1, lmax1, q);
+    return Clip3(MIN_QPSCALE, MAX_MAX_QPSCALE, q);
 }
 
 double RateControl::predictRowsSizeSum(TComPic* pic, RateControlEntry* rce, double qpVbv, int32_t & encodedBitsSoFar)
diff -r bd987db26d5d -r 51c627e235bc source/encoder/ratecontrol.h
--- a/source/encoder/ratecontrol.h	Wed Apr 09 11:15:33 2014 -0500
+++ b/source/encoder/ratecontrol.h	Wed Apr 09 21:37:38 2014 -0500
@@ -116,8 +116,6 @@ struct RateControl
     double accumPNorm;
     double lastQScaleFor[3];  /* last qscale for a specific pict type, used for max_diff & ipb factor stuff */
     double lstep;
-    double lmin[3];           /* min qscale by frame type */
-    double lmax[3];
     double shortTermCplxSum;
     double shortTermCplxCount;
     int64_t totalBits;        /* totalbits used for already encoded frames */


More information about the x265-commits mailing list