<div dir="ltr"># HG changeset patch<br># User Deepthi Nandakumar <<a href="mailto:deepthi@multicorewareinc.com">deepthi@multicorewareinc.com</a>><br># Date 1463052339 -19800<br># Thu May 12 16:55:39 2016 +0530<br># Node ID 912e46145616b349d039810e3c2e94ec2af0e652<br># Parent d2de32f15de0713d2c0514e7bac95f827a33e87f<br>analysis: introduce recursion skip<br><br>Earlier, analysis would exit recursion if a skip was found. This option provides<br>the ability to control when early exit from recursion needs to be turned on<br><br>diff -r d2de32f15de0 -r 912e46145616 doc/reST/cli.rst<br>--- a/doc/reST/cli.rst Fri May 06 17:30:24 2016 +0530<br>+++ b/doc/reST/cli.rst Thu May 12 16:55:39 2016 +0530<br>@@ -734,6 +734,13 @@<br> Measure 2Nx2N merge candidates first; if no residual is found, <br> additional modes at that depth are not analysed. Default disabled<br> <br>+.. option:: --recursion-skip, --no-recursion-skip<br>+<br>+ Measure 2Nx2N merge candidates first; if no residual is found, then<br>+ do not recurse to higher depths. In rdlevels 4 and lower, additional <br>+ heuristics such as neighbour costs are used to skip recursion. <br>+ Default enabled.<br>+<br> .. option:: --fast-intra, --no-fast-intra<br> <br> Perform an initial scan of every fifth intra angular mode, then<br>diff -r d2de32f15de0 -r 912e46145616 source/common/param.cpp<br>--- a/source/common/param.cpp Fri May 06 17:30:24 2016 +0530<br>+++ b/source/common/param.cpp Thu May 12 16:55:39 2016 +0530<br>@@ -164,6 +164,7 @@<br> param->bEnableWeightedPred = 1;<br> param->bEnableWeightedBiPred = 0;<br> param->bEnableEarlySkip = 0;<br>+ param->bEnableRecursionSkip = 1;<br> param->bEnableAMP = 0;<br> param->bEnableRectInter = 0;<br> param->rdLevel = 3;<br>@@ -614,6 +615,7 @@<br> OPT("max-merge") p->maxNumMergeCand = (uint32_t)atoi(value);<br> OPT("temporal-mvp") p->bEnableTemporalMvp = atobool(value);<br> OPT("early-skip") p->bEnableEarlySkip = atobool(value);<br>+ OPT("recursion-skip") p->bEnableRecursionSkip = atobool(value);<br> OPT("rdpenalty") p->rdPenalty = atoi(value);<br> OPT("tskip") p->bEnableTransformSkip = atobool(value);<br> OPT("no-tskip-fast") p->bEnableTSkipFast = atobool(value);<br>@@ -1344,6 +1346,7 @@<br> TOOLVAL(param->psyRdoq, "psy-rdoq=%.2lf");<br> TOOLOPT(param->bEnableRdRefine, "rd-refine");<br> TOOLOPT(param->bEnableEarlySkip, "early-skip");<br>+ TOOLOPT(param->bEnableRecursionSkip, "recursion-skip");<br> TOOLVAL(param->noiseReductionIntra, "nr-intra=%d");<br> TOOLVAL(param->noiseReductionInter, "nr-inter=%d");<br> TOOLOPT(param->bEnableTSkipFast, "tskip-fast");<br>@@ -1402,6 +1405,7 @@<br> s += sprintf(s, " max-merge=%d", p->maxNumMergeCand);<br> BOOL(p->bEnableTemporalMvp, "temporal-mvp");<br> BOOL(p->bEnableEarlySkip, "early-skip");<br>+ BOOL(p->bEnableRecursionSkip, "recursion-skip");<br> s += sprintf(s, " rdpenalty=%d", p->rdPenalty);<br> BOOL(p->bEnableTransformSkip, "tskip");<br> BOOL(p->bEnableTSkipFast, "tskip-fast");<br>diff -r d2de32f15de0 -r 912e46145616 source/encoder/analysis.cpp<br>--- a/source/encoder/analysis.cpp Fri May 06 17:30:24 2016 +0530<br>+++ b/source/encoder/analysis.cpp Thu May 12 16:55:39 2016 +0530<br>@@ -915,7 +915,7 @@<br> md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);<br> checkMerge2Nx2N_rd0_4(md.pred[PRED_SKIP], md.pred[PRED_MERGE], cuGeom);<br> <br>- skipRecursion = true;<br>+ skipRecursion = !!m_param->bEnableRecursionSkip;<br> if (m_param->rdLevel)<br> skipModes = m_param->bEnableEarlySkip && md.bestMode;<br> }<br>@@ -931,7 +931,7 @@<br> }<br> <br> /* Step 1. Evaluate Merge/Skip candidates for likely early-outs, if skip mode was not set above */<br>- if (mightNotSplit && depth >= minDepth && !skipRecursion)<br>+ if (mightNotSplit && depth >= minDepth && !skipRecursion) /* TODO: Re-evaluate if analysis load/save still works */<br> {<br> /* Compute Merge Cost */<br> md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);<br>@@ -941,7 +941,7 @@<br> skipModes = m_param->bEnableEarlySkip && md.bestMode && md.bestMode->cu.isSkipped(0); // TODO: sa8d threshold per depth<br> }<br> <br>- if (md.bestMode)<br>+ if (md.bestMode && m_param->bEnableRecursionSkip)<br> {<br> skipRecursion = md.bestMode->cu.isSkipped(0);<br> if (mightSplit && depth && depth >= minDepth && !skipRecursion)<br>@@ -1419,7 +1419,7 @@<br> md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);<br> checkMerge2Nx2N_rd5_6(md.pred[PRED_SKIP], md.pred[PRED_MERGE], cuGeom);<br> <br>- skipRecursion = true;<br>+ skipRecursion = !!m_param->bEnableRecursionSkip;<br> skipModes = !!m_param->bEnableEarlySkip;<br> }<br> if (m_reusePartSize[cuGeom.absPartIdx] == SIZE_2Nx2N)<br>@@ -1439,8 +1439,8 @@<br> md.pred[PRED_SKIP].cu.initSubCU(parentCTU, cuGeom, qp);<br> md.pred[PRED_MERGE].cu.initSubCU(parentCTU, cuGeom, qp);<br> checkMerge2Nx2N_rd5_6(md.pred[PRED_SKIP], md.pred[PRED_MERGE], cuGeom);<br>- skipRecursion = md.bestMode && !md.bestMode->cu.getQtRootCbf(0);<br>- skipModes = m_param->bEnableEarlySkip && skipRecursion;<br>+ skipRecursion = m_param->bEnableRecursionSkip && md.bestMode && !md.bestMode->cu.getQtRootCbf(0);<br>+ skipModes = m_param->bEnableEarlySkip && md.bestMode && !md.bestMode->cu.getQtRootCbf(0);<br> }<br> <br> // estimate split cost<br>diff -r d2de32f15de0 -r 912e46145616 source/encoder/encoder.cpp<br>--- a/source/encoder/encoder.cpp Fri May 06 17:30:24 2016 +0530<br>+++ b/source/encoder/encoder.cpp Thu May 12 16:55:39 2016 +0530<br>@@ -903,6 +903,7 @@<br> encParam->maxNumReferences = param->maxNumReferences; // never uses more refs than specified in stream headers<br> encParam->bEnableFastIntra = param->bEnableFastIntra;<br> encParam->bEnableEarlySkip = param->bEnableEarlySkip;<br>+ encParam->bEnableRecursionSkip = param->bEnableRecursionSkip;<br> encParam->searchMethod = param->searchMethod;<br> /* Scratch buffer prevents me_range from being increased for esa/tesa */<br> if (param->searchRange < encParam->searchRange)<br>@@ -2280,6 +2281,7 @@<br> TOOLCMP(oldParam->maxNumReferences, newParam->maxNumReferences, "ref=%d to %d\n");<br> TOOLCMP(oldParam->bEnableFastIntra, newParam->bEnableFastIntra, "fast-intra=%d to %d\n");<br> TOOLCMP(oldParam->bEnableEarlySkip, newParam->bEnableEarlySkip, "early-skip=%d to %d\n");<br>+ TOOLCMP(oldParam->bEnableRecursionSkip, newParam->bEnableRecursionSkip, "recursion-skip=%d to %d\n");<br> TOOLCMP(oldParam->searchMethod, newParam->searchMethod, "me=%d to %d\n");<br> TOOLCMP(oldParam->searchRange, newParam->searchRange, "merange=%d to %d\n");<br> TOOLCMP(oldParam->subpelRefine, newParam->subpelRefine, "subme= %d to %d\n");<br>diff -r d2de32f15de0 -r 912e46145616 source/x265.h<br>--- a/source/x265.h Fri May 06 17:30:24 2016 +0530<br>+++ b/source/x265.h Thu May 12 16:55:39 2016 +0530<br>@@ -938,10 +938,14 @@<br> * performance. Default is 3 */<br> int rdLevel;<br> <br>- /* Enable early skip decisions to avoid intra and inter analysis in likely<br>+ /* Enable early skip decisions to avoid analysing additional modes in likely<br> * skip blocks. Default is disabled */<br> int bEnableEarlySkip;<br> <br>+ /* Enable early CU size decisions to avoid recursing to higher depths. <br>+ * Default is enabled */<br>+ int bEnableRecursionSkip;<br>+<br> /* Use a faster search method to find the best intra mode. Default is 0 */<br> int bEnableFastIntra;<br> <br>diff -r d2de32f15de0 -r 912e46145616 source/x265cli.h<br>--- a/source/x265cli.h Fri May 06 17:30:24 2016 +0530<br>+++ b/source/x265cli.h Thu May 12 16:55:39 2016 +0530<br>@@ -97,6 +97,8 @@<br> { "amp", no_argument, NULL, 0 },<br> { "no-early-skip", no_argument, NULL, 0 },<br> { "early-skip", no_argument, NULL, 0 },<br>+ { "no-recursion-skip", no_argument, NULL, 0 },<br>+ { "recursion-skip", no_argument, NULL, 0 },<br> { "no-fast-cbf", no_argument, NULL, 0 },<br> { "fast-cbf", no_argument, NULL, 0 },<br> { "no-tskip", no_argument, NULL, 0 },<br>@@ -312,6 +314,7 @@<br> H0(" --[no-]psy-rdoq <0..50.0> Strength of psycho-visual optimization in RDO quantization, 0 to disable. Default %.1f\n", param->psyRdoq);<br> H0(" --[no-]rd-refine Enable QP based RD refinement for rd levels 5 and 6. Default %s\n", OPT(param->bEnableRdRefine));<br> H0(" --[no-]early-skip Enable early SKIP detection. Default %s\n", OPT(param->bEnableEarlySkip));<br>+ H0(" --[no-]recursion-skip Enable early exit from recursion. Default %s\n", OPT(param->bEnableRecursionSkip));<br> H1(" --[no-]tskip-fast Enable fast intra transform skipping. Default %s\n", OPT(param->bEnableTSkipFast));<br> H1(" --nr-intra <integer> An integer value in range of 0 to 2000, which denotes strength of noise reduction in intra CUs. Default 0\n");<br> H1(" --nr-inter <integer> An integer value in range of 0 to 2000, which denotes strength of noise reduction in inter CUs. Default 0\n");<br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div>Deepthi Nandakumar<br></div>Engineering Manager, x265<br></div>Multicoreware, Inc<br></div></div>
</div>