<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 25, 2017 at 6:55 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"># HG changeset patch<br>
# User Bhavna Hariharan <<a href="mailto:bhavna@multicorewareinc.com">bhavna@multicorewareinc.com</a>><br>
# Date 1485245762 -19800<br>
#      Tue Jan 24 13:46:02 2017 +0530<br>
# Node ID bdf2856cc3a1eafb9092bc52a2c232<wbr>3b4fe92a95<br>
# Parent  3737c70c3308c980259d60410c4231<wbr>c74e892d23<br>
cli: add options to support complex-analysis<br>
<br>
diff -r 3737c70c3308 -r bdf2856cc3a1 doc/reST/cli.rst<br>
--- a/doc/reST/cli.rst  Fri Jan 20 16:44:03 2017 +0530<br>
+++ b/doc/reST/cli.rst  Tue Jan 24 13:46:02 2017 +0530<br>
@@ -872,6 +872,7 @@<br>
 .. option:: --limit-tu <0..4><br>
<br>
        Enables early exit from TU depth recursion, for inter coded blocks.<br>
+<br>
        Level 1 - decides to recurse to next higher depth based on cost<br>
        comparison of full size TU and split TU.<br>
<br>
@@ -943,6 +944,15 @@<br>
        quad-tree begins at the same depth of the coded tree unit, but if the<br>
        maximum TU size is smaller than the CU size then transform QT begins<br>
        at the depth of the max-tu-size. Default: 32.<br>
+<br>
+.. option:: --complex-analysis <0..4><br>
+<br>
+       Increases the RD-level at points where the bitrate drops due to vbv.<br>
+       The number of CUs for which the RD is reconfigured is determined based<br>
+       on the strength. Strength 1 gives the best FPS, strength 4 gives the<br>
+       best SSIM. Strength 0 switches this feature off. Default: 0.<br>
+<br>
+       Effective for RD levels 4 and below.<br>
<br>
 .. option:: --ssim-rd, --no-ssim-rd<br>
<br>
diff -r 3737c70c3308 -r bdf2856cc3a1 source/CMakeLists.txt<br>
--- a/source/CMakeLists.txt     Fri Jan 20 16:44:03 2017 +0530<br>
+++ b/source/CMakeLists.txt     Tue Jan 24 13:46:02 2017 +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 107)<br>
+set(X265_BUILD 108)<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 3737c70c3308 -r bdf2856cc3a1 source/common/param.cpp<br>
--- a/source/common/param.cpp   Fri Jan 20 16:44:03 2017 +0530<br>
+++ b/source/common/param.cpp   Tue Jan 24 13:46:02 2017 +0530<br>
@@ -178,6 +178,7 @@<br>
     param->bEnableTemporalMvp = 1;<br>
     param-><wbr>bSourceReferenceEstimation = 0;<br>
     param->limitTU = 0;<br>
+    param->complexAnalysis = 0;<br>
<br>
     /* Loop Filter */<br>
     param->bEnableLoopFilter = 1;<br>
@@ -929,6 +930,7 @@<br>
         OPT("multi-pass-opt-analysis") p->analysisMultiPassRefine = atobool(value);<br>
         OPT("multi-pass-opt-<wbr>distortion") p->analysisMultiPassDistortion = atobool(value);<br>
         OPT("aq-motion") p->bAQMotion = atobool(value);<br>
+        OPT("complex-analysis") p->complexAnalysis = atof(value);<br>
         OPT("ssim-rd")<br>
         {<br>
             int bval = atobool(value);<br>
@@ -1167,6 +1169,8 @@<br>
           "RD Level is out of range");<br>
     CHECK(param->rdoqLevel < 0 || param->rdoqLevel > 2,<br>
         "RDOQ Level is out of range");<br>
+    CHECK(param->complexAnalysis < 0 || param->complexAnalysis > 4,<br>
+        "Complex analysis strength must be between 0 and 4");<br>
     CHECK(param->bframes && param->bframes >= param->lookaheadDepth && !param->rc.bStatRead,<br>
           "Lookahead depth must be greater than the max consecutive bframe count");<br>
     CHECK(param->bframes < 0,<br>
@@ -1412,6 +1416,7 @@<br>
     TOOLOPT(param->bEnableAMP, "amp");<br>
     TOOLOPT(param->limitModes, "limit-modes");<br>
     TOOLVAL(param->rdLevel, "rd=%d");<br>
+    TOOLVAL(param-><wbr>complexAnalysis, "complex-analysis=%.2f");<br>
     TOOLVAL(param->psyRd, "psy-rd=%.2lf");<br>
     TOOLVAL(param->rdoqLevel, "rdoq=%d");<br>
     TOOLVAL(param->psyRdoq, "psy-rdoq=%.2lf");<br>
@@ -1511,6 +1516,7 @@<br>
     s += sprintf(s, " tu-intra-depth=%d", p->tuQTMaxIntraDepth);<br>
     s += sprintf(s, " limit-tu=%d", p->limitTU);<br>
     s += sprintf(s, " rdoq-level=%d", p->rdoqLevel);<br>
+    s += sprintf(s, " complex-analysis=%.2f", p->complexAnalysis);<br>
     BOOL(p->bEnableSignHiding, "signhide");<br>
     BOOL(p->bEnableTransformSkip, "tskip");<br>
     s += sprintf(s, " nr-intra=%d", p->noiseReductionIntra);<br>
diff -r 3737c70c3308 -r bdf2856cc3a1 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp        Fri Jan 20 16:44:03 2017 +0530<br>
+++ b/source/encoder/encoder.cpp        Tue Jan 24 13:46:02 2017 +0530<br>
@@ -2157,6 +2157,12 @@<br>
     else<br>
         m_param->rc.qgSize = p->maxCUSize;<br>
<br>
+    if (m_param->complexAnalysis && (!bIsVbv || !p->rc.aqMode || p->rdLevel > 4))<br>
+    {<br>
+        p->complexAnalysis = 0;<br>
+        x265_log(p, X265_LOG_WARNING, "Complex-analysis disabled, requires RD > 4, VBV and aq-mode enabled\n");<br></blockquote><div><br></div><div>Doesn't complex-analysis require rd level <=4 to work? Your message seems incorrect.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    }<br>
+<br>
     if (p->uhdBluray)<br>
     {<br>
         p->bEnableAccessUnitDelimiters = 1;<br>
diff -r 3737c70c3308 -r bdf2856cc3a1 source/encoder/ratecontrol.cpp<br>
--- a/source/encoder/ratecontrol.<wbr>cpp    Fri Jan 20 16:44:03 2017 +0530<br>
+++ b/source/encoder/ratecontrol.<wbr>cpp    Tue Jan 24 13:46:02 2017 +0530<br>
@@ -228,6 +228,11 @@<br>
             x265_log(m_param, X265_LOG_WARNING, "VBV is incompatible with constant QP, ignored.\n");<br>
             m_param->rc.vbvBufferSize = 0;<br>
             m_param->rc.vbvMaxBitrate = 0;<br>
+            if (m_param->complexAnalysis)<br>
+            {<br>
+                x265_log(m_param, X265_LOG_WARNING, "Complex analysis requires VBV, complex analysis disabled.\n");<br>
+                m_param->complexAnalysis = 0;<br>
+            }<br>
         }<br>
         else if (m_param->rc.vbvMaxBitrate == 0)<br>
         {<br>
diff -r 3737c70c3308 -r bdf2856cc3a1 source/x265.h<br>
--- a/source/x265.h     Fri Jan 20 16:44:03 2017 +0530<br>
+++ b/source/x265.h     Tue Jan 24 13:46:02 2017 +0530<br>
@@ -856,6 +856,9 @@<br>
      * RDOQ is at level 2. Default: 0 */<br>
     int       rdoqLevel;<br>
<br>
+    /* Increase RD at points where bitrate drops due to vbv. Default 0 */<br>
+    double    complexAnalysis;<br>
+<br></blockquote><div><br></div><div>Always add new parameters to the end of x265_param_t to ensure backwards compatibility with existing API.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
     /* Enable the implicit signaling of the sign bit of the last coefficient of<br>
      * each transform unit. This saves one bit per TU at the expense of figuring<br>
      * out which coefficient can be toggled with the least distortion.<br>
diff -r 3737c70c3308 -r bdf2856cc3a1 source/x265cli.h<br>
--- a/source/x265cli.h  Fri Jan 20 16:44:03 2017 +0530<br>
+++ b/source/x265cli.h  Tue Jan 24 13:46:02 2017 +0530<br>
@@ -166,6 +166,7 @@<br>
     { "rd",             required_argument, NULL, 0 },<br>
     { "rdoq-level",     required_argument, NULL, 0 },<br>
     { "no-rdoq-level",        no_argument, NULL, 0 },<br>
+    { "complex-analysis", required_argument, NULL, 0 },<br>
     { "psy-rd",         required_argument, NULL, 0 },<br>
     { "psy-rdoq",       required_argument, NULL, 0 },<br>
     { "no-psy-rd",            no_argument, NULL, 0 },<br>
@@ -344,6 +345,7 @@<br>
     H0("   --[no-]psy-rd <0..5.0>        Strength of psycho-visual rate distortion optimization, 0 to disable. Default %.1f\n", param->psyRd);<br>
     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);<br>
     H0("   --[no-]psy-rdoq <0..50.0>     Strength of psycho-visual optimization in RDO quantization, 0 to disable. Default %.1f\n", param->psyRdoq);<br>
+    H0("   --complex-analysis <0..4.0>   Strength of complex analysis, 0 to disable. Default %.1f\n", param->complexAnalysis);<br>
     H0("   --[no-]ssim-rd                Enable ssim rate distortion optimization, 0 to disable. Default %s\n", OPT(param->bSsimRd));<br>
     H0("   --[no-]rd-refine              Enable QP based RD refinement for rd levels 5 and 6. Default %s\n", OPT(param->bEnableRdRefine));<br>
     H0("   --[no-]early-skip             Enable early SKIP detection. Default %s\n", OPT(param->bEnableEarlySkip));<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>
</blockquote></div><br></div></div>