<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 9, 2018 at 7:12 PM, <span dir="ltr"><<a href="mailto:bhavna@multicorewareinc.com" target="_blank">bhavna@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"># HG changeset patch<br>
# User Bhavna Hariharan <<a href="mailto:bhavna@multicorewareinc.com">bhavna@multicorewareinc.com</a>><br>
# Date 1520568893 -19800<br>
# Fri Mar 09 09:44:53 2018 +0530<br>
# Node ID d292dacb81d8607ce0b2fb106b7383<wbr>b360863e9d<br>
# Parent b7c8bfabc808a933cf6bdcef63bf49<wbr>c8177851a6<br>
dynamic-refine: add cli and param options to support dynamic refinement.<br>
<br>
diff -r b7c8bfabc808 -r d292dacb81d8 doc/reST/cli.rst<br>
--- a/doc/reST/cli.rst Thu Mar 08 15:38:14 2018 +0530<br>
+++ b/doc/reST/cli.rst Fri Mar 09 09:44:53 2018 +0530<br>
@@ -955,6 +955,12 @@<br>
Level 3 - Perform analysis of inter modes while reusing depths from the save encode.<br>
<br>
Default 0.<br>
+<br>
+.. option:: --dynamic-refine, --no-dynamic-refine<br>
+<br>
+ Dynamically switches :option:`--refine-inter` levels 0-3 based on the content and<br>
+ the encoder settings. It is recommended to use :option:`--refine-intra` 4 with dynamic<br>
+ refinement. Default disabled.<br>
<br>
.. option:: --refine-mv<br>
<br>
diff -r b7c8bfabc808 -r d292dacb81d8 source/CMakeLists.txt<br>
--- a/source/CMakeLists.txt Thu Mar 08 15:38:14 2018 +0530<br>
+++ b/source/CMakeLists.txt Fri Mar 09 09:44:53 2018 +0530<br>
@@ -29,7 +29,7 @@<br>
option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)<br>
mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)<br>
# X265_BUILD must be incremented each time the public API is changed<br>
-set(X265_BUILD 155)<br>
+set(X265_BUILD 156)<br>
configure_file("${PROJECT_<wbr>SOURCE_DIR}/<a href="http://x265.def.in" rel="noreferrer" target="_blank">x265.def.in</a>"<br>
"${PROJECT_BINARY_DIR}/x265.<wbr>def")<br>
configure_file("${PROJECT_<wbr>SOURCE_DIR}/<a href="http://x265_config.h.in" rel="noreferrer" target="_blank">x265_config.h.in</a>"<br>
diff -r b7c8bfabc808 -r d292dacb81d8 source/common/param.cpp<br>
--- a/source/common/param.cpp Thu Mar 08 15:38:14 2018 +0530<br>
+++ b/source/common/param.cpp Fri Mar 09 09:44:53 2018 +0530<br>
@@ -289,6 +289,7 @@<br>
param->scaleFactor = 0;<br>
param->intraRefine = 0;<br>
param->interRefine = 0;<br>
+ param->bDynamicRefine = 0;<br>
param->mvRefine = 0;<br>
param->bUseAnalysisFile = 1;<br>
param->csvfpt = NULL;<br>
@@ -1015,6 +1016,7 @@<br>
OPT("analysis-load") p->analysisLoad = strdup(value);<br>
OPT("radl") p->radl = atoi(value);<br>
OPT("max-ausize-factor") p->maxAUSizeFactor = atof(value);<br>
+ OPT("dynamic-refine") p->bDynamicRefine = atobool(value);<br>
else<br>
return X265_PARAM_BAD_NAME;<br>
}<br>
@@ -1509,6 +1511,7 @@<br>
TOOLVAL(param->bCTUInfo, "ctu-info=%d");<br>
if (param->bMVType == AVC_INFO)<br>
TOOLOPT(param->bMVType, "refine-mv-type=avc");<br>
+ TOOLOPT(param->bDynamicRefine, "dynamic-refine");<br>
if (param->maxSlices > 1)<br>
TOOLVAL(param->maxSlices, "slices=%d");<br>
if (param->bEnableLoopFilter)<br>
@@ -1747,6 +1750,7 @@<br>
s += sprintf(s, " refine-mv-type=%d", p->bMVType);<br>
s += sprintf(s, " copy-pic=%d", p->bCopyPicToFrame);<br>
s += sprintf(s, " max-ausize-factor=%.1f", p->maxAUSizeFactor);<br>
+ BOOL(p->bDynamicRefine, "dynamic-refine");<br>
#undef BOOL<br>
return buf;<br>
}<br>
diff -r b7c8bfabc808 -r d292dacb81d8 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp Thu Mar 08 15:38:14 2018 +0530<br>
+++ b/source/encoder/encoder.cpp Fri Mar 09 09:44:53 2018 +0530<br>
@@ -2688,7 +2688,21 @@<br>
}<br>
}<br>
<br>
- if (p->limitTU && p->interRefine)<br>
+ if (p->bDynamicRefine)<br>
+ {<br>
+ if (!p->analysisLoad || p->analysisReuseLevel < 10 || !p->scaleFactor)<br>
+ {<br>
+ x265_log(p, X265_LOG_WARNING, "Dynamic refinement requires analysis load, analysis-reuse-level 10, scale factor. Disabling dynamic refine.\n");<br>
+ p->bDynamicRefine = 0;<br>
+ }<br>
+ if (p->interRefine)<br>
+ {<br>
+ x265_log(p, X265_LOG_WARNING, "Inter refine cannot be used with dynamic refine. Disabling refine-inter.\n");<br>
+ p->interRefine = 0;<br>
+ }<br>
+ }<br>
+<br>
+ if (p->limitTU && (p->interRefine || p->bDynamicRefine))<br>
{<br>
x265_log(p, X265_LOG_WARNING, "Inter refinement does not support limitTU. Disabling limitTU.\n");<br>
p->limitTU = 0;<br>
diff -r b7c8bfabc808 -r d292dacb81d8 source/x265.h<br>
--- a/source/x265.h Thu Mar 08 15:38:14 2018 +0530<br>
+++ b/source/x265.h Fri Mar 09 09:44:53 2018 +0530<br>
@@ -466,6 +466,8 @@<br>
<br>
#define x265_ADAPT_RD_STRENGTH 4<br>
<br>
+#define X265_REFINE_INTER_LEVELS 4<br>
+<br>
/* NOTE! For this release only X265_CSP_I420 and X265_CSP_I444 are supported */<br>
<br>
/* Supported internal color space types (according to semantics of chroma_format_idc) */<br>
@@ -1562,6 +1564,9 @@<br>
* at each IDR frame describing poc of the recovery point, exact matching flag<br>
* and broken link flag. Default is disabled. */<br>
int bEmitIDRRecoverySEI;<br>
+<br>
+ /* Dynamically change refine-inter at block level*/<br>
+ int bDynamicRefine;<br>
} x265_param;<br>
<br>
/* x265_param_alloc:<br>
diff -r b7c8bfabc808 -r d292dacb81d8 source/x265cli.h<br>
--- a/source/x265cli.h Thu Mar 08 15:38:14 2018 +0530<br>
+++ b/source/x265cli.h Fri Mar 09 09:44:53 2018 +0530<br>
@@ -263,6 +263,8 @@<br>
{ "scale-factor", required_argument, NULL, 0 },<br>
{ "refine-intra", required_argument, NULL, 0 },<br>
{ "refine-inter", required_argument, NULL, 0 },<br>
+ { "dynamic-refine", no_argument, NULL, 0 },<br>
+ { "no-dynamic-refine", no_argument, NULL, 0 },<br>
{ "strict-cbr", no_argument, NULL, 0 },<br>
{ "temporal-layers", no_argument, NULL, 0 },<br>
{ "no-temporal-layers", no_argument, NULL, 0 },<br>
@@ -492,6 +494,7 @@<br>
" - 2 : Functionality of (1) + irrespective of size restrict the modes evaluated when specific modes are decided as the best mode by the save encode.\n"<br>
" - 3 : Functionality of (1) + irrespective of size evaluate all inter modes.\n"<br>
" Default:%d\n", param->interRefine);<br>
+ H0(" --[no-]dynamic-refine Dynamically changes refine-inter level for each CU. Default %s\n", OPT(param->bDynamicRefine));<br>
H0(" --[no-]refine-mv Enable mv refinement for load mode. Default %s\n", OPT(param->mvRefine));<br>
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);<br>
H0(" --aq-strength <float> Reduces blocking and blurring in flat and textured areas (0 to 3.0). Default %.2f\n", param->rc.aqStrength);<br>
</div></div><br>______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
<br></blockquote></div><br></div><div class="gmail_extra">Pushed.</div></div>