# HG changeset patch
# User Bhavna Hariharan <bha...@multicorewareinc.com>
# Date 1485245762 -19800
#      Tue Jan 24 13:46:02 2017 +0530
# Node ID bdf2856cc3a1eafb9092bc52a2c2323b4fe92a95
# Parent  3737c70c3308c980259d60410c4231c74e892d23
cli: add options to support complex-analysis

diff -r 3737c70c3308 -r bdf2856cc3a1 doc/reST/cli.rst
--- a/doc/reST/cli.rst  Fri Jan 20 16:44:03 2017 +0530
+++ b/doc/reST/cli.rst  Tue Jan 24 13:46:02 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 3737c70c3308 -r bdf2856cc3a1 source/CMakeLists.txt
--- a/source/CMakeLists.txt     Fri Jan 20 16:44:03 2017 +0530
+++ b/source/CMakeLists.txt     Tue Jan 24 13:46:02 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 3737c70c3308 -r bdf2856cc3a1 source/common/param.cpp
--- a/source/common/param.cpp   Fri Jan 20 16:44:03 2017 +0530
+++ b/source/common/param.cpp   Tue Jan 24 13:46:02 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 > 4,
+        "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 3737c70c3308 -r bdf2856cc3a1 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp        Fri Jan 20 16:44:03 2017 +0530
+++ b/source/encoder/encoder.cpp        Tue Jan 24 13:46:02 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 3737c70c3308 -r bdf2856cc3a1 source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp    Fri Jan 20 16:44:03 2017 +0530
+++ b/source/encoder/ratecontrol.cpp    Tue Jan 24 13:46:02 2017 +0530
@@ -228,6 +228,11 @@
             x265_log(m_param, X265_LOG_WARNING, "VBV is incompatible with 
constant QP, ignored.\n");
             m_param->rc.vbvBufferSize = 0;
             m_param->rc.vbvMaxBitrate = 0;
+            if (m_param->complexAnalysis)
+            {
+                x265_log(m_param, X265_LOG_WARNING, "Complex analysis requires 
VBV, complex analysis disabled.\n");
+                m_param->complexAnalysis = 0;
+            }
         }
         else if (m_param->rc.vbvMaxBitrate == 0)
         {
diff -r 3737c70c3308 -r bdf2856cc3a1 source/x265.h
--- a/source/x265.h     Fri Jan 20 16:44:03 2017 +0530
+++ b/source/x265.h     Tue Jan 24 13:46:02 2017 +0530
@@ -856,6 +856,9 @@
      * RDOQ is at level 2. Default: 0 */
     int       rdoqLevel;
 
+    /* Increase RD at points where bitrate drops due to vbv. Default 0 */
+    double    complexAnalysis;
+
     /* Enable the implicit signaling of the sign bit of the last coefficient of
      * each transform unit. This saves one bit per TU at the expense of 
figuring
      * out which coefficient can be toggled with the least distortion.
diff -r 3737c70c3308 -r bdf2856cc3a1 source/x265cli.h
--- a/source/x265cli.h  Fri Jan 20 16:44:03 2017 +0530
+++ b/source/x265cli.h  Tue Jan 24 13:46:02 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 %.1f\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));
_______________________________________________
x265-devel mailing list
x265-devel@videolan.org
https://mailman.videolan.org/listinfo/x265-devel

Reply via email to