[x265] [PATCH 1 of 2] cli: add --rd-refine option to enable QP based RD refinement
Kavitha Sampath
kavitha at multicorewareinc.com
Sun Dec 27 12:22:29 CET 2015
# HG changeset patch
# User Kavitha Sampath<kavitha at multicorewareinc.com>
# Date 1449825829 -19800
# Fri Dec 11 14:53:49 2015 +0530
# Node ID a161c580095a1ae08813912c0dbc9838695a7800
# Parent 1471e4e433ccccf71f39a6eb93507c349fb8539e
cli: add --rd-refine option to enable QP based RD refinement
The option is effective for rdLevels greater than 4
diff -r 1471e4e433cc -r a161c580095a doc/reST/cli.rst
--- a/doc/reST/cli.rst Tue Dec 22 19:25:58 2015 +0530
+++ b/doc/reST/cli.rst Fri Dec 11 14:53:49 2015 +0530
@@ -756,6 +756,14 @@
evaluate if luma used tskip. Inter block tskip analysis is
unmodified. Default disabled
+.. option:: --rd-refine, --no-rd-refine
+
+ For each analysed CU, calculate R-D cost on the best partition mode
+ for a range of QP values, to find the optimal rounding effect.
+ Default disabled.
+
+ Only effective at RD levels 5 and 6
+
Analysis re-use options, to improve performance when encoding the same
sequence multiple times (presumably at varying bitrates). The encoder
will not reuse analysis if the resolution and slice type parameters do
diff -r 1471e4e433cc -r a161c580095a source/CMakeLists.txt
--- a/source/CMakeLists.txt Tue Dec 22 19:25:58 2015 +0530
+++ b/source/CMakeLists.txt Fri Dec 11 14:53:49 2015 +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 79)
+set(X265_BUILD 80)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 1471e4e433cc -r a161c580095a source/common/param.cpp
--- a/source/common/param.cpp Tue Dec 22 19:25:58 2015 +0530
+++ b/source/common/param.cpp Fri Dec 11 14:53:49 2015 +0530
@@ -193,6 +193,7 @@
param->bLossless = 0;
param->bCULossless = 0;
param->bEnableTemporalSubLayers = 0;
+ param->bEnableRdRefine = 0;
/* Rate control options */
param->rc.vbvMaxBitrate = 0;
@@ -702,6 +703,7 @@
else
p->psyRdoq = 0.0;
}
+ OPT("rd-refine") p->bEnableRdRefine = atobool(value);
OPT("signhide") p->bEnableSignHiding = atobool(value);
OPT("b-intra") p->bIntraInBFrames = atobool(value);
OPT("lft") p->bEnableLoopFilter = atobool(value); /* DEPRECATED */
@@ -1336,6 +1338,7 @@
TOOLVAL(param->psyRd, "psy-rd=%.2lf");
TOOLVAL(param->rdoqLevel, "rdoq=%d");
TOOLVAL(param->psyRdoq, "psy-rdoq=%.2lf");
+ TOOLOPT(param->bEnableRdRefine, "rd-refine");
TOOLOPT(param->bEnableEarlySkip, "early-skip");
TOOLVAL(param->noiseReductionIntra, "nr-intra=%d");
TOOLVAL(param->noiseReductionInter, "nr-inter=%d");
@@ -1465,6 +1468,7 @@
s += sprintf(s, " psy-rd=%.2f", p->psyRd);
s += sprintf(s, " rdoq-level=%d", p->rdoqLevel);
s += sprintf(s, " psy-rdoq=%.2f", p->psyRdoq);
+ BOOL(p->bEnableRdRefine, "rd-refine");
BOOL(p->bEnableSignHiding, "signhide");
BOOL(p->bEnableLoopFilter, "deblock");
if (p->bEnableLoopFilter && (p->deblockingFilterBetaOffset || p->deblockingFilterTCOffset))
diff -r 1471e4e433cc -r a161c580095a source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Tue Dec 22 19:25:58 2015 +0530
+++ b/source/encoder/encoder.cpp Fri Dec 11 14:53:49 2015 +0530
@@ -1830,6 +1830,11 @@
p->analysisMode = X265_ANALYSIS_OFF;
x265_log(p, X265_LOG_WARNING, "Analysis save and load mode not supported for distributed mode analysis\n");
}
+ if (p->bEnableRdRefine && (p->rdLevel < 5 || !p->rc.aqMode))
+ {
+ p->bEnableRdRefine = false;
+ x265_log(p, X265_LOG_WARNING, "--rd-refine disabled, requires RD level > 4 and adaptive quant\n");
+ }
bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;
if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv))
diff -r 1471e4e433cc -r a161c580095a source/x265.h
--- a/source/x265.h Tue Dec 22 19:25:58 2015 +0530
+++ b/source/x265.h Fri Dec 11 14:53:49 2015 +0530
@@ -951,6 +951,12 @@
* between 0 and 50, 1.0 is typical. Default 1.0 */
double psyRdoq;
+ /* Perform quantisation parameter based RD refinement. RD cost is calculated
+ * on the best CU partitions, chosen after the CU analysis, for a range of QPs
+ * to find the optimal rounding effect. Only effective at rd-levels 5 and 6.
+ * Default disabled */
+ int bEnableRdRefine;
+
/* If X265_ANALYSIS_SAVE, write per-frame analysis information into analysis
* buffers. if X265_ANALYSIS_LOAD, read analysis information into analysis
* buffer and use this analysis information to reduce the amount of work
diff -r 1471e4e433cc -r a161c580095a source/x265cli.h
--- a/source/x265cli.h Tue Dec 22 19:25:58 2015 +0530
+++ b/source/x265cli.h Fri Dec 11 14:53:49 2015 +0530
@@ -159,6 +159,8 @@
{ "psy-rdoq", required_argument, NULL, 0 },
{ "no-psy-rd", no_argument, NULL, 0 },
{ "no-psy-rdoq", no_argument, NULL, 0 },
+ { "rd-refine", no_argument, NULL, 0 },
+ { "no-rd-refine", no_argument, NULL, 0 },
{ "scaling-list", required_argument, NULL, 0 },
{ "lossless", no_argument, NULL, 0 },
{ "no-lossless", no_argument, NULL, 0 },
@@ -300,6 +302,7 @@
H0(" --[no-]psy-rd <0..2.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(" --[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));
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");
More information about the x265-devel
mailing list