[x265] [PATCH] bug fix

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Sat Sep 7 17:07:16 CEST 2013


# HG changeset patch
# User Aarthi Thirumalai<aarthi at multicorewareinc.com>
# Date 1378566417 -19800
#      Sat Sep 07 20:36:57 2013 +0530
# Node ID bd931757d3acadb6a1b546b7a34b406592e3e1e7
# Parent  385c0b29be4fe35f78746574fd26608e125fd314
bug fix
bug fix : qp for ABR cant exceed MAX_QP  = 51

diff -r 385c0b29be4f -r bd931757d3ac source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Fri Sep 06 15:29:50 2013 -0500
+++ b/source/encoder/ratecontrol.cpp	Sat Sep 07 20:36:57 2013 +0530
@@ -79,7 +79,7 @@
 #define ABR_INIT_QP (24  + QP_BD_OFFSET)
         accumPNorm = .01;
         accumPQp = (ABR_INIT_QP)*accumPNorm;
-        /* estimated ratio that produces a reasonable QP for the first I-frame  - needs to be tweaked for x265*/
+        /* estimated ratio that produces a reasonable QP for the first I-frame  */
         cplxrSum = .01 * pow(7.0e5, qCompress) * pow(2 *ncu, 0.5);
         wantedBitsWindow = bitrate * frameDuration;
         lastNonBPictType = I_SLICE;
@@ -90,7 +90,7 @@
     {
         lastQScaleFor[i] = qp2qScale(ABR_INIT_QP);
         lmin[i] = qp2qScale(MIN_QP);
-        lmax[i] = qp2qScale(MAX_QP + 18);  // maxQP val in x264 = 51+18
+        lmax[i] = qp2qScale(MAX_QP);  
     }
 
     if (rateControlMode == X265_RC_CQP)
@@ -117,9 +117,9 @@
     {
     case X265_RC_ABR:
         q = qScale2qp(rateEstimateQscale());
-        q = Clip3((double)MIN_QP, (double)(MAX_QP + 18), q);
-        qp = Clip3(0, (MAX_QP + 18), (int)(q + 0.5f));
-        qpaRc = qpm = q;    // qpaRc is set in the rate_control_mb call in x264. we are updating here itself.
+        q = Clip3((double)MIN_QP, (double)(MAX_QP ), q);
+        qp = Clip3(0, (MAX_QP ), (int)(q + 0.5f));
+        qpaRc = qpm = q;    
         if (rce)
             rce->newQp = qp;
         accumPQpUpdate();


More information about the x265-devel mailing list