[x265] [PATCH 1 of 4] cli: add option to support limitTU 3 and 4

bhavna at multicorewareinc.com bhavna at multicorewareinc.com
Thu Nov 17 12:36:07 CET 2016


# HG changeset patch
# User Bhavna Hariharan <bhavna at multicorewareinc.com>
# Date 1479189846 -19800
#      Tue Nov 15 11:34:06 2016 +0530
# Node ID da1c770fa6e905fe341705b3f95a201a1a31fcf9
# Parent  4c1652f3884fba9fab4c589dd057b12e6bf33d5b
cli: add option to support limitTU 3 and 4

diff -r 4c1652f3884f -r da1c770fa6e9 doc/reST/cli.rst
--- a/doc/reST/cli.rst	Tue Nov 15 11:16:04 2016 +0530
+++ b/doc/reST/cli.rst	Tue Nov 15 11:34:06 2016 +0530
@@ -869,13 +869,18 @@
 	partitions, in which case a TU split is implied and thus the
 	residual quad-tree begins one layer below the CU quad-tree.
 
-.. option:: --limit-tu <0|1|2>
+.. option:: --limit-tu <0..4>
 
 	Enables early exit from TU depth recursion, for inter coded blocks.
 	Level 1 - decides to recurse to next higher depth based on cost 
 	comparison of full size TU and split TU.
 	Level 2 - based on first split subTU's depth, limits recursion of
 	other split subTUs.
+	Level 3 - based on the average depth of the co-located and the neighbor
+	CUs' TU depth, limits recursion of the current CU.
+	Level 4 - uses the depth of the neighbouring/ co-located CUs TU depth 
+	to limit the 1st subTU depth. The 1st subTU depth is taken as the 
+	limiting depth for the other subTUs.
 
 	Default: 0
 
diff -r 4c1652f3884f -r da1c770fa6e9 source/common/param.cpp
--- a/source/common/param.cpp	Tue Nov 15 11:16:04 2016 +0530
+++ b/source/common/param.cpp	Tue Nov 15 11:34:06 2016 +0530
@@ -1126,7 +1126,7 @@
           "QuadtreeTUMaxDepthInter must be less than or equal to the difference between log2(maxCUSize) and QuadtreeTULog2MinSize plus 1");
     CHECK((param->maxTUSize != 32 && param->maxTUSize != 16 && param->maxTUSize != 8 && param->maxTUSize != 4),
           "max TU size must be 4, 8, 16, or 32");
-    CHECK(param->limitTU > 2, "Invalid limit-tu option, limit-TU must be 0, 1 or 2");
+    CHECK(param->limitTU > 4, "Invalid limit-tu option, limit-TU must be between 0 and 4");
     CHECK(param->maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater.");
     CHECK(param->maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller.");
 
diff -r 4c1652f3884f -r da1c770fa6e9 source/encoder/search.cpp
--- a/source/encoder/search.cpp	Tue Nov 15 11:16:04 2016 +0530
+++ b/source/encoder/search.cpp	Tue Nov 15 11:34:06 2016 +0530
@@ -94,6 +94,13 @@
     uint32_t sizeC = sizeL >> (m_hChromaShift + m_vChromaShift);
     uint32_t numPartitions = 1 << (maxLog2CUSize - LOG2_UNIT_SIZE) * 2;
 
+    if (m_param->limitTU <= 2)
+        limitTU = m_param->limitTU;
+    else if (m_param->limitTU == 3)
+        limitTU = X265_TU_LIMIT_NEIGH;
+    else
+        limitTU = X265_TU_LIMIT_DFS_NEIGH;
+
     /* these are indexed by qtLayer (log2size - 2) so nominally 0=4x4, 1=8x8, 2=16x16, 3=32x32
      * the coeffRQT and reconQtYuv are allocated to the max CU size at every depth. The parts
      * which are reconstructed at each depth are valid. At the end, the transform depth table
diff -r 4c1652f3884f -r da1c770fa6e9 source/encoder/search.h
--- a/source/encoder/search.h	Tue Nov 15 11:16:04 2016 +0530
+++ b/source/encoder/search.h	Tue Nov 15 11:34:06 2016 +0530
@@ -277,6 +277,7 @@
     uint32_t        m_numLayers;
     uint32_t        m_refLagPixels;
     uint32_t        m_maxTUDepth;
+    uint16_t        limitTU;
 
     int16_t         m_sliceMaxY;
     int16_t         m_sliceMinY;
diff -r 4c1652f3884f -r da1c770fa6e9 source/x265.h
--- a/source/x265.h	Tue Nov 15 11:16:04 2016 +0530
+++ b/source/x265.h	Tue Nov 15 11:34:06 2016 +0530
@@ -357,6 +357,8 @@
 
 #define X265_TU_LIMIT_BFS       1
 #define X265_TU_LIMIT_DFS       2
+#define X265_TU_LIMIT_NEIGH     4
+#define X265_TU_LIMIT_DFS_NEIGH 6
 
 #define X265_BFRAME_MAX         16
 #define X265_MAX_FRAME_THREADS  16


More information about the x265-devel mailing list