[x265] [PATCH 1 of 3] cli: add options to support complex-analysis
bhavna at multicorewareinc.com
bhavna at multicorewareinc.com
Fri Jan 27 08:08:10 CET 2017
# HG changeset patch
# User Bhavna Hariharan <bhavna at multicorewareinc.com>
# Date 1485500436 -19800
# Fri Jan 27 12:30:36 2017 +0530
# Node ID 09a7c884054aa74f7a3c09978fc8a766164d35dd
# Parent d1f6d9b8d6be1fb44d7d1dad7dd642c7ae95b226
cli: add options to support complex-analysis
diff -r d1f6d9b8d6be -r 09a7c884054a doc/reST/cli.rst
--- a/doc/reST/cli.rst Fri Jan 20 10:27:41 2017 +0530
+++ b/doc/reST/cli.rst Fri Jan 27 12:30:36 2017 +0530
@@ -872,6 +872,7 @@
.. 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.
@@ -943,6 +944,15 @@
quad-tree begins at the same depth of the coded tree unit, but if the
maximum TU size is smaller than the CU size then transform QT begins
at the depth of the max-tu-size. Default: 32.
+
+.. option:: --complex-analysis <0..4>
+
+ Increases the RD-level at points where the bitrate drops due to vbv.
+ The number of CUs for which the RD is reconfigured is determined based
+ on the strength. Strength 1 gives the best FPS, strength 4 gives the
+ best SSIM. Strength 0 switches this feature off. Default: 0.
+
+ Effective for RD levels 4 and below.
.. option:: --ssim-rd, --no-ssim-rd
diff -r d1f6d9b8d6be -r 09a7c884054a source/CMakeLists.txt
--- a/source/CMakeLists.txt Fri Jan 20 10:27:41 2017 +0530
+++ b/source/CMakeLists.txt Fri Jan 27 12:30:36 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 107)
+set(X265_BUILD 108)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r d1f6d9b8d6be -r 09a7c884054a source/common/param.cpp
--- a/source/common/param.cpp Fri Jan 20 10:27:41 2017 +0530
+++ b/source/common/param.cpp Fri Jan 27 12:30:36 2017 +0530
@@ -178,6 +178,7 @@
param->bEnableTemporalMvp = 1;
param->bSourceReferenceEstimation = 0;
param->limitTU = 0;
+ param->complexAnalysis = 0;
/* Loop Filter */
param->bEnableLoopFilter = 1;
@@ -929,6 +930,7 @@
OPT("multi-pass-opt-analysis") p->analysisMultiPassRefine = atobool(value);
OPT("multi-pass-opt-distortion") p->analysisMultiPassDistortion = atobool(value);
OPT("aq-motion") p->bAQMotion = atobool(value);
+ OPT("complex-analysis") p->complexAnalysis = atof(value);
OPT("ssim-rd")
{
int bval = atobool(value);
@@ -1167,6 +1169,8 @@
"RD Level is out of range");
CHECK(param->rdoqLevel < 0 || param->rdoqLevel > 2,
"RDOQ Level is out of range");
+ CHECK(param->complexAnalysis < 0 || param->complexAnalysis > X265_MAX_ANALYSIS_STRENGTH,
+ "Complex analysis strength must be between 0 and 4");
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,
@@ -1412,6 +1416,7 @@
TOOLOPT(param->bEnableAMP, "amp");
TOOLOPT(param->limitModes, "limit-modes");
TOOLVAL(param->rdLevel, "rd=%d");
+ TOOLVAL(param->complexAnalysis, "complex-analysis=%.2f");
TOOLVAL(param->psyRd, "psy-rd=%.2lf");
TOOLVAL(param->rdoqLevel, "rdoq=%d");
TOOLVAL(param->psyRdoq, "psy-rdoq=%.2lf");
@@ -1511,6 +1516,7 @@
s += sprintf(s, " tu-intra-depth=%d", p->tuQTMaxIntraDepth);
s += sprintf(s, " limit-tu=%d", p->limitTU);
s += sprintf(s, " rdoq-level=%d", p->rdoqLevel);
+ s += sprintf(s, " complex-analysis=%.2f", p->complexAnalysis);
BOOL(p->bEnableSignHiding, "signhide");
BOOL(p->bEnableTransformSkip, "tskip");
s += sprintf(s, " nr-intra=%d", p->noiseReductionIntra);
diff -r d1f6d9b8d6be -r 09a7c884054a source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Fri Jan 20 10:27:41 2017 +0530
+++ b/source/encoder/encoder.cpp Fri Jan 27 12:30:36 2017 +0530
@@ -2157,6 +2157,12 @@
else
m_param->rc.qgSize = p->maxCUSize;
+ if (m_param->complexAnalysis && (!bIsVbv || !p->rc.aqMode || p->rdLevel > 4))
+ {
+ p->complexAnalysis = 0;
+ x265_log(p, X265_LOG_WARNING, "Complex-analysis disabled, requires RD <= 4, VBV and aq-mode enabled\n");
+ }
+
if (p->uhdBluray)
{
p->bEnableAccessUnitDelimiters = 1;
diff -r d1f6d9b8d6be -r 09a7c884054a source/x265.h
--- a/source/x265.h Fri Jan 20 10:27:41 2017 +0530
+++ b/source/x265.h Fri Jan 27 12:30:36 2017 +0530
@@ -390,6 +390,8 @@
#define X265_AQ_AUTO_VARIANCE 2
#define X265_AQ_AUTO_VARIANCE_BIASED 3
+#define X265_MAX_ANALYSIS_STRENGTH 4
+
/* NOTE! For this release only X265_CSP_I420 and X265_CSP_I444 are supported */
/* Supported internal color space types (according to semantics of chroma_format_idc) */
@@ -1369,6 +1371,10 @@
* selection during analysis of CTUs, can achieve significant gain in terms of
* objective quality metrics SSIM and PSNR */
int bSsimRd;
+
+ /* Increase RD at points where bitrate drops due to vbv. Default 0 */
+ double complexAnalysis;
+
} x265_param;
/* x265_param_alloc:
diff -r d1f6d9b8d6be -r 09a7c884054a source/x265cli.h
--- a/source/x265cli.h Fri Jan 20 10:27:41 2017 +0530
+++ b/source/x265cli.h Fri Jan 27 12:30:36 2017 +0530
@@ -166,6 +166,7 @@
{ "rd", required_argument, NULL, 0 },
{ "rdoq-level", required_argument, NULL, 0 },
{ "no-rdoq-level", no_argument, NULL, 0 },
+ { "complex-analysis", required_argument, NULL, 0 },
{ "psy-rd", required_argument, NULL, 0 },
{ "psy-rdoq", required_argument, NULL, 0 },
{ "no-psy-rd", no_argument, NULL, 0 },
@@ -344,6 +345,7 @@
H0(" --[no-]psy-rd <0..5.0> Strength of psycho-visual rate distortion optimization, 0 to disable. Default %.1f\n", param->psyRd);
H0(" --[no-]rdoq-level <0|1|2> Level of RDO in quantization 0:none, 1:levels, 2:levels & coding groups. Default %d\n", param->rdoqLevel);
H0(" --[no-]psy-rdoq <0..50.0> Strength of psycho-visual optimization in RDO quantization, 0 to disable. Default %.1f\n", param->psyRdoq);
+ H0(" --complex-analysis <0..4.0> Strength of complex analysis, 0 to disable. Default %.2f\n", param->complexAnalysis);
H0(" --[no-]ssim-rd Enable ssim rate distortion optimization, 0 to disable. Default %s\n", OPT(param->bSsimRd));
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));
More information about the x265-devel
mailing list