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