[x265] [PATCH] slicetype: fix crash when rc-lookahead = bframes

aarthi at multicorewareinc.com aarthi at multicorewareinc.com
Mon Mar 9 07:55:12 CET 2015


# HG changeset patch
# User Aarthi Thirumalai
# Date 1425883938 -19800
#      Mon Mar 09 12:22:18 2015 +0530
# Node ID 520ab30492f631b5502b309183f47efc0b8a9768
# Parent  043c2418864b0a3ada6f597e6def6ead73d90b5f
slicetype: fix crash when rc-lookahead = bframes.

diff -r 043c2418864b -r 520ab30492f6 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Fri Mar 06 13:15:55 2015 -0600
+++ b/source/encoder/slicetype.cpp	Mon Mar 09 12:22:18 2015 +0530
@@ -484,7 +484,7 @@
     memset(m_preframes, 0, sizeof(m_preframes));
     m_preTotal = m_preAcquired = m_preCompleted = 0;
     m_sliceTypeBusy = false;
-    m_fullQueueSize = m_param->lookaheadDepth;
+    m_fullQueueSize = X265_MAX(m_param->lookaheadDepth, m_param->bframes + 1);
     m_bAdaptiveQuant = m_param->rc.aqMode || m_param->bEnableWeightedPred || m_param->bEnableWeightedBiPred;
 
     /* If we have a thread pool and are using --b-adapt 2, it is generally
@@ -835,7 +835,7 @@
 {
     Lowres *frames[X265_LOOKAHEAD_MAX];
     Frame *list[X265_LOOKAHEAD_MAX];
-    int maxSearch = X265_MIN(m_param->lookaheadDepth, X265_LOOKAHEAD_MAX);
+    int maxSearch = X265_MIN(X265_MAX(m_param->lookaheadDepth, m_param->bframes + 1), X265_LOOKAHEAD_MAX);
 
     memset(frames, 0, sizeof(frames));
     memset(list, 0, sizeof(list));


More information about the x265-devel mailing list