[x265] [PATCH] rc: fix crash in strict cbr when totalFrames = 0

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Fri Mar 6 08:11:45 CET 2015


# HG changeset patch
# User Aarthi Thirumalai
# Date 1425624228 -19800
#      Fri Mar 06 12:13:48 2015 +0530
# Node ID fa0034f0e38d127fbf8343b63a54798b8350083e
# Parent  45deb0125890ab0211d0e256c74d91ede78d12d3
rc: fix crash in strict cbr when totalFrames = 0

diff -r 45deb0125890 -r fa0034f0e38d source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Thu Mar 05 20:39:08 2015 -0600
+++ b/source/encoder/encoder.cpp	Fri Mar 06 12:13:48 2015 +0530
@@ -1667,7 +1667,7 @@
     if (p->rc.aqMode == X265_AQ_NONE && p->rc.cuTree == 0)
         p->rc.aqStrength = 0;
 
-    if (p->totalFrames <= 2 * ((float)p->fpsNum) / p->fpsDenom && p->rc.bStrictCbr)
+    if (p->totalFrames && p->totalFrames <= 2 * ((float)p->fpsNum) / p->fpsDenom && p->rc.bStrictCbr)
         p->lookaheadDepth = p->totalFrames;
 
     if (p->scalingLists && p->internalCsp == X265_CSP_I444)
diff -r 45deb0125890 -r fa0034f0e38d source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Thu Mar 05 20:39:08 2015 -0600
+++ b/source/encoder/ratecontrol.cpp	Fri Mar 06 12:13:48 2015 +0530
@@ -272,7 +272,7 @@
         x265_log(m_param, X265_LOG_WARNING, "strict CBR set without CBR mode, ignored\n");
         m_param->rc.bStrictCbr = 0;
     }
-    if (m_param->totalFrames <= 2 * m_fps && m_param->rc.bStrictCbr) /* Strict CBR segment encode */
+    if (m_param->totalFrames && m_param->totalFrames <= 2 * m_fps && m_param->rc.bStrictCbr) /* Strict CBR segment encode */
     {
         m_amortizeFraction = 0.85;
         m_amortizeFrames = m_param->totalFrames / 2;


More information about the x265-devel mailing list