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

Aarthi at videolan.org Aarthi at videolan.org
Fri Mar 6 16:24:43 CET 2015


details:   http://hg.videolan.org/x265/rev/e0603bbe919f
branches:  
changeset: 9645:e0603bbe919f
user:      Aarthi Thirumalai
date:      Fri Mar 06 12:13:48 2015 +0530
description:
rc: fix crash in strict cbr when totalFrames = 0

diffstat:

 source/encoder/encoder.cpp     |  2 +-
 source/encoder/ratecontrol.cpp |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 45deb0125890 -r e0603bbe919f 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 @@ void Encoder::configure(x265_param *p)
     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 e0603bbe919f 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 @@ RateControl::RateControl(x265_param& p)
         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-commits mailing list