<div dir="ltr">This patch does not apply. <br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 22, 2015 at 11:50 AM, <span dir="ltr"><<a href="mailto:aarthi@multicorewareinc.com" target="_blank">aarthi@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Aarthi Thirumalai<br>
# Date 1442909407 -19800<br>
# Tue Sep 22 13:40:07 2015 +0530<br>
# Node ID 5a3c92b92a049f49e7712ad3d2ba458937e0c55d<br>
# Parent 819f8cf72d15c6a3dba77383881b8f4c1140542c<br>
rc: don't update predictors from previous frames, after reset at scenecut.<br>
<br>
diff -r 819f8cf72d15 -r 5a3c92b92a04 source/encoder/ratecontrol.cpp<br>
--- a/source/encoder/ratecontrol.cpp Tue Sep 22 13:33:13 2015 +0530<br>
+++ b/source/encoder/ratecontrol.cpp Tue Sep 22 13:40:07 2015 +0530<br>
@@ -182,6 +182,7 @@<br>
m_finalFrameCount = 0;<br>
m_numEntries = 0;<br>
m_isSceneTransition = false;<br>
+ m_lastPredictorReset = 0;<br>
if (m_param->rc.rateControlMode == X265_RC_CRF)<br>
{<br>
m_param->rc.qp = (int)m_param->rc.rfConstant;<br>
@@ -961,10 +962,11 @@<br>
copyRceData(rce, &m_rce2Pass[rce->poc]);<br>
}<br>
rce->isActive = true;<br>
- bool isframeAfterKeyframe = m_sliceType != I_SLICE && m_curSlice->m_refFrameList[0][0]->m_encData->m_slice->m_sliceType == I_SLICE;<br>
+ bool isRefFrameScenecut = m_sliceType!= I_SLICE && m_curSlice->m_refFrameList[0][0]->m_lowres.bScenecut == 1;<br>
if (curFrame->m_lowres.bScenecut)<br>
{<br>
m_isSceneTransition = true;<br>
+ m_lastPredictorReset = rce->encodeOrder;<br>
/* Frame Predictors and Row predictors used in vbv */<br>
for (int i = 0; i < 4; i++)<br>
{<br>
@@ -974,10 +976,20 @@<br>
m_pred[i].offset = 0.0;<br>
}<br>
m_pred[0].coeff = m_pred[3].coeff = 0.75;<br></blockquote><div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ if (m_param->rc.qCompress >= 0.8) // when tuned for grain<br>
+ {<br>
+ m_pred[1].coeff = 0.75;<br>
+ m_pred[0].coeff = m_pred[3].coeff = 0.50;<br>
+ }<br></blockquote><div><br></div><div>You need another module initPredictor, which can be called from init() and ratecontrolStart.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
}<br>
- else if (m_sliceType != B_SLICE && !isframeAfterKeyframe)<br>
+ else if (m_sliceType != B_SLICE && !isRefFrameScenecut)<br>
m_isSceneTransition = false;<br>
<br>
+ if (rce->encodeOrder < m_lastPredictorReset + m_param->frameNumThreads)<br>
+ {<br>
+ rce->rowPreds[0][0].count = 0;<br>
+ }<br>
+<br>
rce->bLastMiniGopBFrame = curFrame->m_lowres.bLastMiniGopBFrame;<br>
rce->bufferRate = m_bufferRate;<br>
rce->rowCplxrSum = 0.0;<br>
@@ -2149,7 +2161,7 @@<br>
{<br>
int predType = rce->sliceType;<br>
predType = rce->sliceType == B_SLICE && rce->keptAsRef ? 3 : predType;<br>
- if (rce->lastSatd >= m_ncu)<br>
+ if (rce->lastSatd >= m_ncu && rce->encodeOrder >= m_lastPredictorReset)<br>
updatePredictor(&m_pred[predType], x265_qp2qScale(rce->qpaRc), (double)rce->lastSatd, (double)bits);<br>
if (!m_isVbv)<br>
return;<br>
@@ -2205,6 +2217,7 @@<br>
}<br>
else<br>
curEncData.m_avgQpAq = curEncData.m_avgQpRc;<br>
+ rce->qpAq = curEncData.m_avgQpAq;<br></blockquote><div><br></div><div>rce->qpAq is not used anywhere at this point. Is this a bug? <br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
}<br>
<br>
if (m_isAbr)<br>
diff -r 819f8cf72d15 -r 5a3c92b92a04 source/encoder/ratecontrol.h<br>
--- a/source/encoder/ratecontrol.h Tue Sep 22 13:33:13 2015 +0530<br>
+++ b/source/encoder/ratecontrol.h Tue Sep 22 13:40:07 2015 +0530<br>
@@ -173,6 +173,7 @@<br>
int m_numBframesInPattern;<br>
bool m_isPatternPresent;<br>
bool m_isSceneTransition;<br>
+ int m_lastPredictorReset;<br>
<br>
/* a common variable on which rateControlStart, rateControlEnd and rateControUpdateStats waits to<br>
* sync the calls to these functions. For example<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br></div></div>