<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 31, 2017 at 4:31 PM, <span dir="ltr"><<a href="mailto:bhavna@multicorewareinc.com" target="_blank">bhavna@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span># HG changeset patch<br>
# User Bhavna Hariharan <<a href="mailto:bhavna@multicorewareinc.com" target="_blank">bhavna@multicorewareinc.com</a>><br>
# Date 1503468675 -19800<br>
# Wed Aug 23 11:41:15 2017 +0530<br>
</span># Node ID f5d669bfb2b209f73406cede50878a<wbr>06eef52fd4<br>
<span># Parent fcd9154fa4e28ae9e3c11e16bfae20<wbr>dbdb89101d<br>
Re-evaluate vbv lookahead in the encode that uses<br>
--analysis-reuse-mode load.<br></span></blockquote><div><br></div><div>Pushed to default branch. thanks!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>
<br>
Evaluate inter modes in encode that uses --analysis-reuse-mode load when<br>
intra-in-inter blocks are chosen with --refine-inter 2 in the previous pass.<br>
<br>
</span>diff -r fcd9154fa4e2 -r f5d669bfb2b2 source/encoder/analysis.cpp<br>
<span>--- a/source/encoder/analysis.cpp Mon Aug 21 11:50:36 2017 +0530<br>
+++ b/source/encoder/analysis.cpp Wed Aug 23 11:41:15 2017 +0530<br>
</span>@@ -1150,13 +1150,11 @@<br>
bool chooseMerge = false;<br>
bool bCtuInfoCheck = false;<br>
int sameContentRef = 0;<br>
- bool checkRefineInter = false;<br>
<br>
if (m_evaluateInter)<br>
{<br>
<span> if (m_param->interRefine == 2)<br>
{<br>
</span>- checkRefineInter = true;<br>
<span> if (parentCTU.m_predMode[cuGeom.a<wbr>bsPartIdx] == MODE_SKIP)<br>
skipModes = true;<br>
if (parentCTU.m_partSize[cuGeom.a<wbr>bsPartIdx] == SIZE_2Nx2N)<br>
</span>@@ -1279,7 +1277,7 @@<br>
md.pred[PRED_SKIP].cu.initSub<wbr>CU(parentCTU, cuGeom, qp);<br>
checkMerge2Nx2N_rd0_4(md.<wbr>pred[PRED_SKIP], md.pred[PRED_MERGE], cuGeom);<br>
if (m_param->rdLevel)<br>
- skipModes = (m_param->bEnableEarlySkip || checkRefineInter)<br>
+ skipModes = (m_param->bEnableEarlySkip || m_param->interRefine == 2)<br>
&& md.bestMode && md.bestMode->cu.isSkipped(0); // TODO: sa8d threshold per depth<br>
}<br>
<br>
@@ -1539,7 +1537,7 @@<br>
}<br>
}<br>
}<br>
- bool bTryIntra = (m_slice->m_sliceType != B_SLICE || m_param->bIntraInBFrames) && cuGeom.log2CUSize != MAX_LOG2_CU_SIZE && !((m_param->bCTUInfo & 4) && bCtuInfoCheck) && !checkRefineInter;<br>
+ bool bTryIntra = (m_slice->m_sliceType != B_SLICE || m_param->bIntraInBFrames) && cuGeom.log2CUSize != MAX_LOG2_CU_SIZE && !((m_param->bCTUInfo & 4) && bCtuInfoCheck);<br>
if (m_param->rdLevel >= 3)<br>
{<br>
/* Calculate RD cost of best inter option */<br>
@@ -1784,13 +1782,11 @@<br>
bool skipRectAmp = false;<br>
bool bCtuInfoCheck = false;<br>
int sameContentRef = 0;<br>
- bool checkRefineInter = false;<br>
<br>
if (m_evaluateInter)<br>
{<br>
<span> if (m_param->interRefine == 2)<br>
{<br>
</span>- checkRefineInter = true;<br>
<span> if (parentCTU.m_predMode[cuGeom.a<wbr>bsPartIdx] == MODE_SKIP)<br>
skipModes = true;<br>
if (parentCTU.m_partSize[cuGeom.a<wbr>bsPartIdx] == SIZE_2Nx2N)<br>
</span>@@ -1919,7 +1915,7 @@<br>
md.pred[PRED_SKIP].cu.initSub<wbr>CU(parentCTU, cuGeom, qp);<br>
md.pred[PRED_MERGE].cu.initSu<wbr>bCU(parentCTU, cuGeom, qp);<br>
checkMerge2Nx2N_rd5_6(md.<wbr>pred[PRED_SKIP], md.pred[PRED_MERGE], cuGeom);<br>
- skipModes = (m_param->bEnableEarlySkip || checkRefineInter) &&<br>
+ skipModes = (m_param->bEnableEarlySkip || m_param->interRefine == 2) &&<br>
md.bestMode && !md.bestMode->cu.getQtRootCbf(<wbr>0);<br>
refMasks[0] = allSplitRefs;<br>
md.pred[PRED_2Nx2N].cu.initSu<wbr>bCU(parentCTU, cuGeom, qp);<br>
@@ -2172,7 +2168,7 @@<br>
}<br>
}<br>
<br>
- if ((m_slice->m_sliceType != B_SLICE || m_param->bIntraInBFrames) && (cuGeom.log2CUSize != MAX_LOG2_CU_SIZE) && !((m_param->bCTUInfo & 4) && bCtuInfoCheck) && !checkRefineInter)<br>
+ if ((m_slice->m_sliceType != B_SLICE || m_param->bIntraInBFrames) && (cuGeom.log2CUSize != MAX_LOG2_CU_SIZE) && !((m_param->bCTUInfo & 4) && bCtuInfoCheck))<br>
{<br>
if (!m_param->limitReferences || splitIntra)<br>
{<br>
@@ -2288,7 +2284,7 @@<br>
<span> md.bestMode = &mode;<br>
mode.cu.initSubCU(parentCTU, cuGeom, qp);<br>
PartSize size = (PartSize)parentCTU.m_partSize<wbr>[cuGeom.absPartIdx];<br>
- if (parentCTU.isIntra(cuGeom.absP<wbr>artIdx))<br>
</span>+ if (parentCTU.isIntra(cuGeom.absP<wbr>artIdx) && m_param->interRefine < 2)<br>
<span> {<br>
bool reuseModes = !((m_param->intraRefine == 3) ||<br>
(m_param->intraRefine == 2 && parentCTU.m_lumaIntraDir[cuGeo<wbr>m.absPartIdx] > DC_IDX));<br>
</span>@@ -2299,7 +2295,7 @@<br>
<span> }<br>
checkIntra(mode, cuGeom, size);<br>
}<br>
- else if (m_param->interRefine < 2)<br>
</span>+ else if (!parentCTU.isIntra(cuGeom.abs<wbr>PartIdx) && m_param->interRefine < 2)<br>
<span> {<br>
mode.cu.copyFromPic(<wbr>parentCTU, cuGeom, m_csp, false);<br>
uint32_t numPU = parentCTU.getNumPartInter(cuGe<wbr>om.absPartIdx);<br>
</span>@@ -2367,7 +2363,7 @@<br>
checkDQP(mode, cuGeom);<br>
}<br>
<br>
- if (m_param->interRefine < 2 || parentCTU.isIntra(cuGeom.absPa<wbr>rtIdx))<br>
+ if (m_param->interRefine < 2)<br>
{<br>
if (m_bTryLossless)<br>
tryLossless(cuGeom);<br>
@@ -2379,10 +2375,11 @@<br>
<span> checkDQPForSplitPred(*md.best<wbr>Mode, cuGeom);<br>
}<br>
<br>
- if (!parentCTU.isIntra(cuGeom.abs<wbr>PartIdx) && ( m_param->interRefine > 1 || (m_param->interRefine && parentCTU.m_predMode[cuGeom.ab<wbr>sPartIdx] == MODE_SKIP && !mode.cu.isSkipped(0))))<br>
</span>+ if (m_param->interRefine > 1 || (m_param->interRefine && parentCTU.m_predMode[cuGeom.ab<wbr>sPartIdx] == MODE_SKIP && !mode.cu.isSkipped(0)))<br>
<span> {<br>
m_evaluateInter = 1;<br>
m_param->rdLevel > 4 ? compressInterCU_rd5_6(parentCT<wbr>U, cuGeom, qp) : compressInterCU_rd0_4(parentCT<wbr>U, cuGeom, qp);<br>
+ m_evaluateInter = 0;<br>
}<br>
}<br>
if (!bDecidedDepth || split)<br>
</span>diff -r fcd9154fa4e2 -r f5d669bfb2b2 source/encoder/slicetype.cpp<br>
<div class="m_-2109998258633348456HOEnZb"><div class="m_-2109998258633348456h5">--- a/source/encoder/slicetype.<wbr>cpp Mon Aug 21 11:50:36 2017 +0530<br>
+++ b/source/encoder/slicetype.<wbr>cpp Wed Aug 23 11:41:15 2017 +0530<br>
@@ -1036,6 +1036,18 @@<br>
(m_param->lookaheadDepth && m_param->rc.vbvBufferSize)))<br>
{<br>
slicetypeAnalyse(frames, false);<br>
+ bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;<br>
+ if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->scaleFactor && bIsVbv)<br>
+ {<br>
+ int numFrames;<br>
+ for (numFrames = 0; numFrames < maxSearch; numFrames++)<br>
+ {<br>
+ Lowres *fenc = frames[numFrames + 1];<br>
+ if (!fenc)<br>
+ break;<br>
+ }<br>
+ vbvLookahead(frames, numFrames, true);<br>
+ }<br>
}<br>
<br>
int bframes, brefs;<br>
@@ -1219,6 +1231,18 @@<br>
<br>
frames[j + 1] = NULL;<br>
slicetypeAnalyse(frames, true);<br>
+ bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;<br>
+ if (m_param->analysisReuseMode == X265_ANALYSIS_LOAD && m_param->scaleFactor && bIsVbv)<br>
+ {<br>
+ int numFrames;<br>
+ for (numFrames = 0; numFrames < maxSearch; numFrames++)<br>
+ {<br>
+ Lowres *fenc = frames[numFrames + 1];<br>
+ if (!fenc)<br>
+ break;<br>
+ }<br>
+ vbvLookahead(frames, numFrames, true);<br>
+ }<br>
}<br>
m_outputLock.release();<br>
}<br>
</div></div><br>______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/l<wbr>istinfo/x265-devel</a><br>
<br></blockquote></div><br></div></div>