[x265] [PATCH] introduce multi-level recursion skip
santhoshini at multicorewareinc.com
santhoshini at multicorewareinc.com
Thu Jun 23 07:47:05 CEST 2016
# HG changeset patch
# User Santhoshini Sekar<santhoshini at multicorewareinc.com>
# Date 1466656132 -19800
# Thu Jun 23 09:58:52 2016 +0530
# Node ID bc0cbc5cb90c6f41e73c30b76fa7df1006581206
# Parent 626fcbac7ffba723dabd3a9f0507c4c80f3e7bc9
introduce multi-level recursion skip
diff -r 626fcbac7ffb -r bc0cbc5cb90c doc/reST/cli.rst
--- a/doc/reST/cli.rst Thu Jun 16 12:57:38 2016 +0530
+++ b/doc/reST/cli.rst Thu Jun 23 09:58:52 2016 +0530
@@ -732,12 +732,17 @@
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
+.. option:: --rskip <0|1|2>
- 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.
+ Enable different levels of recursion skip for different presets.
+
+ 0. disable recursion skip
+ 1. Enable recursion skip in rdlevels 5 and 6. At this level recursion
+ is allowed at depth 0. For depths > 0 measure 2Nx2N merge candidates
+ and compare it with inter2Nx2N;if no residual is found, then do not
+ recurse to higher depths.
+ 2. Enable recursion skip for rdlevels 0-4. At this level additional
+ heuristics such as neighbour costs are used to skip recursion.
.. option:: --fast-intra, --no-fast-intra
diff -r 626fcbac7ffb -r bc0cbc5cb90c source/CMakeLists.txt
--- a/source/CMakeLists.txt Thu Jun 16 12:57:38 2016 +0530
+++ b/source/CMakeLists.txt Thu Jun 23 09:58:52 2016 +0530
@@ -30,7 +30,7 @@
mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
# X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 86)
+set(X265_BUILD 87)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 626fcbac7ffb -r bc0cbc5cb90c source/common/param.cpp
--- a/source/common/param.cpp Thu Jun 16 12:57:38 2016 +0530
+++ b/source/common/param.cpp Thu Jun 23 09:58:52 2016 +0530
@@ -164,7 +164,7 @@
param->bEnableWeightedPred = 1;
param->bEnableWeightedBiPred = 0;
param->bEnableEarlySkip = 0;
- param->bEnableRecursionSkip = 1;
+ param->bEnableRecursionSkip = 2;
param->bEnableAMP = 0;
param->bEnableRectInter = 0;
param->rdLevel = 3;
@@ -368,6 +368,7 @@
param->maxNumMergeCand = 3;
param->searchMethod = X265_STAR_SEARCH;
param->maxNumReferences = 4;
+ param->bEnableRecursionSkip = 1;
param->limitReferences = 2;
param->limitModes = 1;
param->bIntraInBFrames = 1;
@@ -389,7 +390,7 @@
param->maxNumMergeCand = 4;
param->searchMethod = X265_STAR_SEARCH;
param->maxNumReferences = 5;
- param->bEnableRecursionSkip = 0;
+ param->bEnableRecursionSkip = 1;
param->limitReferences = 1;
param->limitModes = 1;
param->bIntraInBFrames = 1;
@@ -412,7 +413,7 @@
param->maxNumMergeCand = 5;
param->searchMethod = X265_STAR_SEARCH;
param->bEnableTransformSkip = 1;
- param->bEnableRecursionSkip = 0;
+ param->bEnableRecursionSkip = 1;
param->maxNumReferences = 5;
param->limitReferences = 0;
param->bIntraInBFrames = 1;
@@ -620,7 +621,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("rskip") p->bEnableRecursionSkip = atoi(value);
OPT("rdpenalty") p->rdPenalty = atoi(value);
OPT("tskip") p->bEnableTransformSkip = atobool(value);
OPT("no-tskip-fast") p->bEnableTSkipFast = atobool(value);
@@ -1109,6 +1110,8 @@
"RD Level is out of range");
CHECK(param->rdoqLevel < 0 || param->rdoqLevel > 2,
"RDOQ Level is out of range");
+ CHECK(param->bEnableRecursionSkip < 0 || param->bEnableRecursionSkip > 2,
+ "rskip is out of range");
CHECK(param->bframes && param->bframes >= param->lookaheadDepth && !param->rc.bStatRead,
"Lookahead depth must be greater than the max consecutive bframe count");
CHECK(param->bframes < 0,
@@ -1351,7 +1354,7 @@
TOOLVAL(param->psyRdoq, "psy-rdoq=%.2lf");
TOOLOPT(param->bEnableRdRefine, "rd-refine");
TOOLOPT(param->bEnableEarlySkip, "early-skip");
- TOOLOPT(param->bEnableRecursionSkip, "recursion-skip");
+ TOOLVAL(param->bEnableRecursionSkip, "rskip=%d");
TOOLVAL(param->noiseReductionIntra, "nr-intra=%d");
TOOLVAL(param->noiseReductionInter, "nr-inter=%d");
TOOLOPT(param->bEnableTSkipFast, "tskip-fast");
@@ -1410,7 +1413,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, "rskip=%d", p->bEnableRecursionSkip);
s += sprintf(s, " rdpenalty=%d", p->rdPenalty);
BOOL(p->bEnableTransformSkip, "tskip");
BOOL(p->bEnableTSkipFast, "tskip-fast");
diff -r 626fcbac7ffb -r bc0cbc5cb90c source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp Thu Jun 16 12:57:38 2016 +0530
+++ b/source/encoder/analysis.cpp Thu Jun 23 09:58:52 2016 +0530
@@ -949,7 +949,7 @@
skipRecursion = md.bestMode->cu.isSkipped(0);
if (mightSplit && depth >= minDepth && !skipRecursion)
{
- if (depth)
+ if (depth && m_param->bEnableRecursionSkip == 2)
skipRecursion = recursionDepthCheck(parentCTU, cuGeom, *md.bestMode);
if (m_bHD && !skipRecursion && m_param->rdLevel == 2 && md.fencYuv.m_size != MAX_CU_SIZE)
skipRecursion = complexityCheckCU(*md.bestMode);
@@ -1448,14 +1448,22 @@
splitData[2].initSplitCUData();
splitData[3].initSplitCUData();
+ uint32_t allSplitRefs = splitData[0].splitRefs | splitData[1].splitRefs | splitData[2].splitRefs | splitData[3].splitRefs;
+ uint32_t refMasks[2];
/* Step 1. Evaluate Merge/Skip candidates for likely early-outs */
if (mightNotSplit && !md.bestMode)
{
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 = m_param->bEnableRecursionSkip && md.bestMode && !md.bestMode->cu.getQtRootCbf(0);
skipModes = m_param->bEnableEarlySkip && md.bestMode && !md.bestMode->cu.getQtRootCbf(0);
+ refMasks[0] = allSplitRefs;
+ md.pred[PRED_2Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);
+ checkInter_rd5_6(md.pred[PRED_2Nx2N], cuGeom, SIZE_2Nx2N, refMasks);
+ checkBestMode(md.pred[PRED_2Nx2N], cuGeom.depth);
+
+ if (m_param->bEnableRecursionSkip == 1 && depth && m_modeDepth[depth - 1].bestMode)
+ skipRecursion = md.bestMode && !md.bestMode->cu.getQtRootCbf(0);
}
// estimate split cost
@@ -1511,7 +1519,7 @@
/* Split CUs
* 0 1
* 2 3 */
- uint32_t allSplitRefs = splitData[0].splitRefs | splitData[1].splitRefs | splitData[2].splitRefs | splitData[3].splitRefs;
+ allSplitRefs = splitData[0].splitRefs | splitData[1].splitRefs | splitData[2].splitRefs | splitData[3].splitRefs;
/* Step 3. Evaluate ME (2Nx2N, rect, amp) and intra modes at current depth */
if (mightNotSplit)
{
@@ -1522,9 +1530,6 @@
{
uint32_t refMasks[2];
refMasks[0] = allSplitRefs;
- md.pred[PRED_2Nx2N].cu.initSubCU(parentCTU, cuGeom, qp);
- checkInter_rd5_6(md.pred[PRED_2Nx2N], cuGeom, SIZE_2Nx2N, refMasks);
- checkBestMode(md.pred[PRED_2Nx2N], cuGeom.depth);
if (m_param->limitReferences & X265_REF_LIMIT_CU)
{
diff -r 626fcbac7ffb -r bc0cbc5cb90c source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Thu Jun 16 12:57:38 2016 +0530
+++ b/source/encoder/encoder.cpp Thu Jun 23 09:58:52 2016 +0530
@@ -2288,7 +2288,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->bEnableRecursionSkip, newParam->bEnableRecursionSkip, "rskip=%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 626fcbac7ffb -r bc0cbc5cb90c source/x265cli.h
--- a/source/x265cli.h Thu Jun 16 12:57:38 2016 +0530
+++ b/source/x265cli.h Thu Jun 23 09:58:52 2016 +0530
@@ -97,8 +97,7 @@
{ "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 },
+ { "rskip", required_argument, NULL, 0 },
{ "no-fast-cbf", no_argument, NULL, 0 },
{ "fast-cbf", no_argument, NULL, 0 },
{ "no-tskip", no_argument, NULL, 0 },
@@ -314,7 +313,9 @@
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));
+ H0(" --rskip <0..2> 0 - no early exit from recursion,");
+ H0(" 1 - Enable early exit from recursion in rd 5,6,");
+ H0(" 2 - Enable early exit from recursion in rd 0-4. 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");
More information about the x265-devel
mailing list