[x265] [PATCH] introduce multi-level recursion skip

santhoshini at multicorewareinc.com santhoshini at multicorewareinc.com
Thu Jun 23 13:12:02 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 efd68483f9f2de5e0c61d63b9d0dac1782b0d7c1
# Parent  626fcbac7ffba723dabd3a9f0507c4c80f3e7bc9
introduce multi-level recursion skip

diff -r 626fcbac7ffb -r efd68483f9f2 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,14 @@
 	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, --no-rskip
 
-	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.
+	In rdlevels 5 and 6 measure 2Nx2N merge candidates and compare it with
+	inter2Nx2N;if no residual is found, then do not recurse to higher depths
+	for depths > 0. At depth 0 recursion is allowed even when the residual is zero.
+	In rdlevels 4 and below additional heuristics such as neighbour costs 
+	are used to skip recursion when there is no residual after measuring 2Nx2N merge
+	candidates.
 
 .. option:: --fast-intra, --no-fast-intra
 
diff -r 626fcbac7ffb -r efd68483f9f2 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 efd68483f9f2 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
@@ -389,7 +389,6 @@
             param->maxNumMergeCand = 4;
             param->searchMethod = X265_STAR_SEARCH;
             param->maxNumReferences = 5;
-            param->bEnableRecursionSkip = 0;
             param->limitReferences = 1;
             param->limitModes = 1;
             param->bIntraInBFrames = 1;
@@ -620,7 +619,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 = atobool(value);
     OPT("rdpenalty") p->rdPenalty = atoi(value);
     OPT("tskip") p->bEnableTransformSkip = atobool(value);
     OPT("no-tskip-fast") p->bEnableTSkipFast = atobool(value);
@@ -1351,7 +1350,7 @@
     TOOLVAL(param->psyRdoq, "psy-rdoq=%.2lf");
     TOOLOPT(param->bEnableRdRefine, "rd-refine");
     TOOLOPT(param->bEnableEarlySkip, "early-skip");
-    TOOLOPT(param->bEnableRecursionSkip, "recursion-skip");
+    TOOLOPT(param->bEnableRecursionSkip, "rskip");
     TOOLVAL(param->noiseReductionIntra, "nr-intra=%d");
     TOOLVAL(param->noiseReductionInter, "nr-inter=%d");
     TOOLOPT(param->bEnableTSkipFast, "tskip-fast");
@@ -1410,7 +1409,7 @@
     s += sprintf(s, " max-merge=%d", p->maxNumMergeCand);
     BOOL(p->bEnableTemporalMvp, "temporal-mvp");
     BOOL(p->bEnableEarlySkip, "early-skip");
-    BOOL(p->bEnableRecursionSkip, "recursion-skip");
+    BOOL(p->bEnableRecursionSkip, "rskip");
     s += sprintf(s, " rdpenalty=%d", p->rdPenalty);
     BOOL(p->bEnableTransformSkip, "tskip");
     BOOL(p->bEnableTSkipFast, "tskip-fast");
diff -r 626fcbac7ffb -r efd68483f9f2 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
@@ -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 && 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 efd68483f9f2 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 efd68483f9f2 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,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-rskip",             no_argument, NULL, 0 },
+    { "rskip",                no_argument, NULL, 0 },
     { "no-fast-cbf",          no_argument, NULL, 0 },
     { "fast-cbf",             no_argument, NULL, 0 },
     { "no-tskip",             no_argument, NULL, 0 },
@@ -314,7 +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));
+    H0("   --[no-]rskip                  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");


More information about the x265-devel mailing list