[x265] [PATCH 3 of 4] cli: add --rd-refine option to enable QP based RD refinement

kavitha at multicorewareinc.com kavitha at multicorewareinc.com
Wed Oct 14 08:35:47 CEST 2015


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1444737413 -19800
#      Tue Oct 13 17:26:53 2015 +0530
# Node ID cab9ae709e7bdd5451b0d8d3ddfbdd201e802b8b
# Parent  5f8702e3362b152eddf6fdf69278fc717dc7d41b
cli: add --rd-refine option to enable QP based RD refinement

The option is enabled for rdLevels 5 and 6

diff -r 5f8702e3362b -r cab9ae709e7b doc/reST/cli.rst
--- a/doc/reST/cli.rst	Thu Oct 08 17:36:42 2015 +0530
+++ b/doc/reST/cli.rst	Tue Oct 13 17:26:53 2015 +0530
@@ -746,6 +746,14 @@
 	evaluate if luma used tskip. Inter block tskip analysis is
 	unmodified. Default disabled
 
+.. option:: --rd-refine, --no-rd-refine
+
+	For each analysed CU of I-slice, 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 5f8702e3362b -r cab9ae709e7b source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu Oct 08 17:36:42 2015 +0530
+++ b/source/CMakeLists.txt	Tue Oct 13 17:26:53 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 75)
+set(X265_BUILD 76)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 5f8702e3362b -r cab9ae709e7b source/common/param.cpp
--- a/source/common/param.cpp	Thu Oct 08 17:36:42 2015 +0530
+++ b/source/common/param.cpp	Tue Oct 13 17:26:53 2015 +0530
@@ -192,6 +192,7 @@
     param->bLossless = 0;
     param->bCULossless = 0;
     param->bEnableTemporalSubLayers = 0;
+    param->bEnableRdRefine = 0;
 
     /* Rate control options */
     param->rc.vbvMaxBitrate = 0;
@@ -364,6 +365,7 @@
             param->maxNumMergeCand = 3;
             param->searchMethod = X265_STAR_SEARCH;
             param->bIntraInBFrames = 1;
+            param->bEnableRdRefine = 1;
         }
         else if (!strcmp(preset, "veryslow"))
         {
@@ -382,6 +384,7 @@
             param->searchMethod = X265_STAR_SEARCH;
             param->maxNumReferences = 5;
             param->bIntraInBFrames = 1;
+            param->bEnableRdRefine = 1;
         }
         else if (!strcmp(preset, "placebo"))
         {
@@ -403,6 +406,7 @@
             param->maxNumReferences = 5;
             param->rc.bEnableSlowFirstPass = 1;
             param->bIntraInBFrames = 1;
+            param->bEnableRdRefine = 1;
             // TODO: optimized esa
         }
         else
@@ -686,6 +690,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 */
@@ -1317,6 +1322,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");
@@ -1445,6 +1451,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 5f8702e3362b -r cab9ae709e7b source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Thu Oct 08 17:36:42 2015 +0530
+++ b/source/encoder/encoder.cpp	Tue Oct 13 17:26:53 2015 +0530
@@ -1711,6 +1711,9 @@
         x265_log(p, X265_LOG_WARNING, "Analysis save and load mode not supported for distributed mode analysis\n");
     }
 
+    if (!p->rc.aqMode)
+        p->bEnableRdRefine = false;
+
     bool bIsVbv = m_param->rc.vbvBufferSize > 0 && m_param->rc.vbvMaxBitrate > 0;
     if (!m_param->bLossless && (m_param->rc.aqMode || bIsVbv))
     {
diff -r 5f8702e3362b -r cab9ae709e7b source/x265.h
--- a/source/x265.h	Thu Oct 08 17:36:42 2015 +0530
+++ b/source/x265.h	Tue Oct 13 17:26:53 2015 +0530
@@ -940,6 +940,12 @@
      * between 0 and 50, 1.0 is typical. Default 1.0 */
     double    psyRdoq;
 
+    /* Perform quantisation parameter based RD refinement on Intra slices for
+     * RD levels 5 and 6. 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. 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 5f8702e3362b -r cab9ae709e7b source/x265cli.h
--- a/source/x265cli.h	Thu Oct 08 17:36:42 2015 +0530
+++ b/source/x265cli.h	Tue Oct 13 17:26:53 2015 +0530
@@ -156,6 +156,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 },
@@ -297,6 +299,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 on Intra frames 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