[x265] [PATCH] Introduce intra refine levels 1 and 2

bhavna at multicorewareinc.com bhavna at multicorewareinc.com
Thu Jun 29 10:29:36 CEST 2017


# HG changeset patch
# User Bhavna Hariharan <bhavna at multicorewareinc.com>
# Date 1498715657 -19800
#      Thu Jun 29 11:24:17 2017 +0530
# Node ID cfc95a9dc971aa5c417d9be2bb6eeae34e166505
# Parent  67dcf6e79090acb619c5ac499ef5da0b73c3a48b
Introduce intra refine levels 1 and 2

diff -r 67dcf6e79090 -r cfc95a9dc971 doc/reST/cli.rst
--- a/doc/reST/cli.rst	Wed Jun 28 11:54:05 2017 -0500
+++ b/doc/reST/cli.rst	Thu Jun 29 11:24:17 2017 +0530
@@ -893,11 +893,22 @@
        This option should be coupled with analysis-reuse-mode option, --analysis-reuse-level 10.
        The ctu size of load should be double the size of save. Default 0.
 
-.. option:: --refine-intra
+.. option:: --refine-intra <0|1|2>
 	
-	Enables refinement of intra blocks in current encode. Evaluates all 
-	intra modes for blocks of size one smaller than the min-cu-size of the 
-	incoming analysis data from the previous encode. Default disabled.
+	Enables refinement of intra blocks in current encode. 
+	
+	Level 0 - Forces both mode and depth from the previous encode.
+	
+	Level 1 - Evaluates all intra modes for blocks of size one smaller than 
+	the min-cu-size of the incoming analysis data from the previous encode, 
+	forces modes for blocks of larger size.
+	
+	Level 2 - Evaluates all intra modes for	blocks of size one smaller than 
+	the min-cu-size of the incoming analysis data from the previous encode. 
+	For larger blocks, force only depth when angular mode is chosen by the 
+	previous encode, force depth and mode when other intra modes are chosen.
+	
+	Default 0.
 	
 .. option:: --refine-inter-depth
 
diff -r 67dcf6e79090 -r cfc95a9dc971 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Wed Jun 28 11:54:05 2017 -0500
+++ b/source/CMakeLists.txt	Thu Jun 29 11:24:17 2017 +0530
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 128)
+set(X265_BUILD 129)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 67dcf6e79090 -r cfc95a9dc971 source/common/param.cpp
--- a/source/common/param.cpp	Wed Jun 28 11:54:05 2017 -0500
+++ b/source/common/param.cpp	Thu Jun 29 11:24:17 2017 +0530
@@ -969,7 +969,7 @@
         OPT("const-vbv") p->rc.bEnableConstVbv = atobool(value);
         OPT("ctu-info") p->bCTUInfo = atoi(value);
         OPT("scale-factor") p->scaleFactor = atoi(value);
-        OPT("refine-intra")p->intraRefine = atobool(value);
+        OPT("refine-intra")p->intraRefine = atoi(value);
         OPT("refine-inter")p->interRefine = atobool(value);
         OPT("refine-mv")p->mvRefine = atobool(value);
         else
diff -r 67dcf6e79090 -r cfc95a9dc971 source/encoder/analysis.cpp
--- a/source/encoder/analysis.cpp	Wed Jun 28 11:54:05 2017 -0500
+++ b/source/encoder/analysis.cpp	Thu Jun 29 11:24:17 2017 +0530
@@ -511,8 +511,11 @@
             Mode& mode = md.pred[0];
             md.bestMode = &mode;
             mode.cu.initSubCU(parentCTU, cuGeom, qp);
-            memcpy(mode.cu.m_lumaIntraDir, parentCTU.m_lumaIntraDir + cuGeom.absPartIdx, cuGeom.numPartitions);
-            memcpy(mode.cu.m_chromaIntraDir, parentCTU.m_chromaIntraDir + cuGeom.absPartIdx, cuGeom.numPartitions);
+            if (m_param->intraRefine != 2 || parentCTU.m_lumaIntraDir[cuGeom.absPartIdx] <= 1)
+            {
+                memcpy(mode.cu.m_lumaIntraDir, parentCTU.m_lumaIntraDir + cuGeom.absPartIdx, cuGeom.numPartitions);
+                memcpy(mode.cu.m_chromaIntraDir, parentCTU.m_chromaIntraDir + cuGeom.absPartIdx, cuGeom.numPartitions);
+            }
             checkIntra(mode, cuGeom, (PartSize)parentCTU.m_partSize[cuGeom.absPartIdx]);
 
             if (m_bTryLossless)
@@ -2250,8 +2253,11 @@
         PartSize size = (PartSize)parentCTU.m_partSize[cuGeom.absPartIdx];
         if (parentCTU.isIntra(cuGeom.absPartIdx))
         {
-            memcpy(mode.cu.m_lumaIntraDir, parentCTU.m_lumaIntraDir + cuGeom.absPartIdx, cuGeom.numPartitions);
-            memcpy(mode.cu.m_chromaIntraDir, parentCTU.m_chromaIntraDir + cuGeom.absPartIdx, cuGeom.numPartitions);
+            if (m_param->intraRefine != 2 || parentCTU.m_lumaIntraDir[cuGeom.absPartIdx] <= 1)
+            {
+                memcpy(mode.cu.m_lumaIntraDir, parentCTU.m_lumaIntraDir + cuGeom.absPartIdx, cuGeom.numPartitions);
+                memcpy(mode.cu.m_chromaIntraDir, parentCTU.m_chromaIntraDir + cuGeom.absPartIdx, cuGeom.numPartitions);
+            }
             checkIntra(mode, cuGeom, size);
         }
         else
diff -r 67dcf6e79090 -r cfc95a9dc971 source/x265cli.h
--- a/source/x265cli.h	Wed Jun 28 11:54:05 2017 -0500
+++ b/source/x265cli.h	Thu Jun 29 11:24:17 2017 +0530
@@ -254,8 +254,7 @@
     { "analysis-reuse-file",  required_argument, NULL, 0 },
     { "analysis-reuse-level", required_argument, NULL, 0 },
     { "scale-factor",   required_argument, NULL, 0 },
-    { "refine-intra",   no_argument, NULL, 0 },
-    { "no-refine-intra",no_argument, NULL, 0 },
+    { "refine-intra",   required_argument, NULL, 0 },
     { "refine-inter",   no_argument, NULL, 0 },
     { "no-refine-inter",no_argument, NULL, 0 },
     { "strict-cbr",           no_argument, NULL, 0 },
@@ -450,7 +449,7 @@
     H0("   --analysis-reuse-file <filename>    Specify file name used for either dumping or reading analysis data. Deault x265_analysis.dat\n");
     H0("   --analysis-reuse-level <1..10>      Level of analysis reuse indicates amount of info stored/reused in save/load mode, 1:least..10:most. Default %d\n", param->analysisReuseLevel);
     H0("   --scale-factor <int>          Specify factor by which input video is scaled down for analysis save mode. Default %d\n", param->scaleFactor);
-    H0("   --[no-]refine-intra           Enable intra refinement for load mode. Default %s\n", OPT(param->intraRefine));
+    H0("   --refine-intra <int>          Enable intra refinement for load mode. Default %d\n", param->intraRefine);
     H0("   --[no-]refine-inter           Enable inter refinement for load mode. Default %s\n", OPT(param->interRefine));
     H0("   --[no-]refine-mv              Enable mv refinement for load mode. Default %s\n", OPT(param->mvRefine));
     H0("   --aq-mode <integer>           Mode for Adaptive Quantization - 0:none 1:uniform AQ 2:auto variance 3:auto variance with bias to dark scenes. Default %d\n", param->rc.aqMode);


More information about the x265-devel mailing list