[x265] [PATCH] rc: bug fix for encoder crash

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Mon Feb 24 13:56:35 CET 2014


# HG changeset patch
# User Aarthi Thirumalai
# Date 1393244587 -19800
#      Mon Feb 24 17:53:07 2014 +0530
# Node ID 3abef12d5b47106005c813bfd60ea49c31048f12
# Parent  dce74082c20eea1f7ef9eb10f9a9addc5e7c7bb7
rc: bug fix for encoder crash

diff -r dce74082c20e -r 3abef12d5b47 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Mon Feb 24 17:50:55 2014 +0530
+++ b/source/encoder/ratecontrol.cpp	Mon Feb 24 17:53:07 2014 +0530
@@ -409,7 +409,9 @@
         /* Update rce for use in rate control VBV later */
         rce->lastSatd = currentSatd;
         double q = qScale2qp(rateEstimateQscale(pic, rce));
-        qp = Clip3(MIN_QP, MAX_MAX_QP, (int)(q + 0.5));
+
+        q = Clip3((double)MIN_QP, (double)MAX_MAX_QP, q);
+        qp = int(q + 0.5);
         rce->qpaRc = pic->m_avgQpRc = q;
         /* copy value of lastRceq into thread local rce struct *to be used in RateControlEnd() */
         rce->qRceq = lastRceq;
@@ -585,10 +587,10 @@
             if (qCompress != 1 && framesDone == 0)
                 q = qp2qScale(ABR_INIT_QP) / fabs(cfg->param.rc.ipFactor);
         }
-        qpNoVbv = qScale2qp(q);
         double lmin1 = lmin[sliceType];
         double lmax1 = lmax[sliceType];
         q = Clip3(lmin1, lmax1, q);
+        qpNoVbv = qScale2qp(q);
 
         q = clipQscale(pic, q);
 


More information about the x265-devel mailing list