[x265] [PATCH 1 of 4] cli: add option to support limit-TU
kavitha at multicorewareinc.com
kavitha at multicorewareinc.com
Tue Oct 4 11:20:43 CEST 2016
# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1475567868 -19800
# Tue Oct 04 13:27:48 2016 +0530
# Node ID c10ef341f4e65883243f78040f52ed06ace99535
# Parent 91ed7cb38e66c43116e1d279e94d087d462e71ce
cli: add option to support limit-TU
diff -r 91ed7cb38e66 -r c10ef341f4e6 doc/reST/cli.rst
--- a/doc/reST/cli.rst Mon Oct 03 12:33:19 2016 +0530
+++ b/doc/reST/cli.rst Tue Oct 04 13:27:48 2016 +0530
@@ -869,6 +869,16 @@
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>
+
+ Enables early exit from TU depth recursion. It has 2 levels.
+ 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.
+
+ Default: 0
+
.. option:: --nr-intra <integer>, --nr-inter <integer>
Noise reduction - an adaptive deadzone applied after DCT
diff -r 91ed7cb38e66 -r c10ef341f4e6 source/CMakeLists.txt
--- a/source/CMakeLists.txt Mon Oct 03 12:33:19 2016 +0530
+++ b/source/CMakeLists.txt Tue Oct 04 13:27:48 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 96)
+set(X265_BUILD 97)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 91ed7cb38e66 -r c10ef341f4e6 source/common/param.cpp
--- a/source/common/param.cpp Mon Oct 03 12:33:19 2016 +0530
+++ b/source/common/param.cpp Tue Oct 04 13:27:48 2016 +0530
@@ -176,6 +176,7 @@
param->maxNumReferences = 3;
param->bEnableTemporalMvp = 1;
param->bSourceReferenceEstimation = 0;
+ param->limitTU = 0;
/* Loop Filter */
param->bEnableLoopFilter = 1;
@@ -901,21 +902,14 @@
// solve "fatal error C1061: compiler limit : blocks nested too deeply"
if (bExtraParams)
{
- bExtraParams = false;
- if (0) ;
- OPT("slices") p->maxSlices = atoi(value);
- else
- bExtraParams = true;
- }
-
- if (bExtraParams)
- {
if (0) ;
OPT("qpmin") p->rc.qpMin = atoi(value);
OPT("analyze-src-pics") p->bSourceReferenceEstimation = atobool(value);
OPT("log2-max-poc-lsb") p->log2MaxPocLsb = atoi(value);
OPT("vui-timing-info") p->bEmitVUITimingInfo = atobool(value);
OPT("vui-hrd-info") p->bEmitVUIHRDInfo = atobool(value);
+ OPT("slices") p->maxSlices = atoi(value);
+ OPT("limit-TU") p->limitTU = atoi(value);
else
return X265_PARAM_BAD_NAME;
}
@@ -1122,6 +1116,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->maxNumMergeCand < 1, "MaxNumMergeCand must be 1 or greater.");
CHECK(param->maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller.");
@@ -1395,6 +1390,7 @@
TOOLVAL(param->noiseReductionInter, "nr-inter=%d");
TOOLOPT(param->bEnableTSkipFast, "tskip-fast");
TOOLOPT(!param->bEnableTSkipFast && param->bEnableTransformSkip, "tskip");
+ TOOLVAL(param->limitTU , "limitTU=%d");
TOOLOPT(param->bCULossless, "cu-lossless");
TOOLOPT(param->bEnableSignHiding, "signhide");
TOOLOPT(param->bEnableTemporalMvp, "tmvp");
@@ -1486,6 +1482,7 @@
s += sprintf(s, " rdoq-level=%d", p->rdoqLevel);
s += sprintf(s, " psy-rdoq=%.2f", p->psyRdoq);
s += sprintf(s, " log2-max-poc-lsb=%d", p->log2MaxPocLsb);
+ s += sprintf(s, " limit-TU=%d", p->limitTU);
BOOL(p->bEnableRdRefine, "rd-refine");
BOOL(p->bEnableSignHiding, "signhide");
BOOL(p->bEnableLoopFilter, "deblock");
diff -r 91ed7cb38e66 -r c10ef341f4e6 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Mon Oct 03 12:33:19 2016 +0530
+++ b/source/encoder/encoder.cpp Tue Oct 04 13:27:48 2016 +0530
@@ -1912,6 +1912,11 @@
x265_log(p, X265_LOG_WARNING, "--rd-refine disabled, requires RD level > 4 and adaptive quant\n");
}
+ if (p->limitTU && p->tuQTMaxInterDepth < 2)
+ {
+ p->limitTU = 0;
+ x265_log(p, X265_LOG_WARNING, "limit TU disabled, requires tu-inter-depth > 1\n");
+ }
bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;
if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv))
{
diff -r 91ed7cb38e66 -r c10ef341f4e6 source/x265.h
--- a/source/x265.h Mon Oct 03 12:33:19 2016 +0530
+++ b/source/x265.h Tue Oct 04 13:27:48 2016 +0530
@@ -352,6 +352,9 @@
#define X265_REF_LIMIT_DEPTH 1
#define X265_REF_LIMIT_CU 2
+#define X265_TU_LIMIT_BFS 1
+#define X265_TU_LIMIT_DFS 2
+
#define X265_BFRAME_MAX 16
#define X265_MAX_FRAME_THREADS 16
@@ -824,6 +827,10 @@
* compressed by the DCT transforms, at the expense of much more compute */
uint32_t tuQTMaxIntraDepth;
+ /* Enable early exit decisions for TU to avoid recursing to higher depths.
+ * Default: 0 */
+ uint32_t limitTU;
+
/* Set the amount of rate-distortion analysis to use within quant. 0 implies
* no rate-distortion optimization. At level 1 rate-distortion cost is used to
* find optimal rounding values for each level (and allows psy-rdoq to be
diff -r 91ed7cb38e66 -r c10ef341f4e6 source/x265cli.h
--- a/source/x265cli.h Mon Oct 03 12:33:19 2016 +0530
+++ b/source/x265cli.h Tue Oct 04 13:27:48 2016 +0530
@@ -85,6 +85,7 @@
{ "max-tu-size", required_argument, NULL, 0 },
{ "tu-intra-depth", required_argument, NULL, 0 },
{ "tu-inter-depth", required_argument, NULL, 0 },
+ { "limit-TU", required_argument, NULL, 0 },
{ "me", required_argument, NULL, 0 },
{ "subme", required_argument, NULL, 'm' },
{ "merange", required_argument, NULL, 0 },
@@ -319,6 +320,7 @@
H0(" --max-tu-size <32|16|8|4> Maximum TU size (WxH). Default %d\n", param->maxTUSize);
H0(" --tu-intra-depth <integer> Max TU recursive depth for intra CUs. Default %d\n", param->tuQTMaxIntraDepth);
H0(" --tu-inter-depth <integer> Max TU recursive depth for inter CUs. Default %d\n", param->tuQTMaxInterDepth);
+ H0(" --limit-TU <integer> Enable early exit from TU recursion. Default %d\n", param->limitTU);
H0("\nAnalysis:\n");
H0(" --rd <1..6> Level of RDO in mode decision 1:least....6:full RDO. Default %d\n", param->rdLevel);
H0(" --[no-]psy-rd <0..5.0> Strength of psycho-visual rate distortion optimization, 0 to disable. Default %.1f\n", param->psyRd);
More information about the x265-devel
mailing list