[x265] [PATCH 1 of 2] hdr-opt: Replace --hdr-opt with --hdr10-opt

Aruna Matheswaran aruna at multicorewareinc.com
Tue Jan 7 13:14:45 CET 2020


# HG changeset patch
# User Aruna Matheswaran <aruna at multicorewareinc.com>
# Date 1578287653 -19800
#      Mon Jan 06 10:44:13 2020 +0530
# Node ID 542653f9c733c0b41d33e204497bed1126455d17
# Parent  b82891180e7e9e13545791f739837d977d472d43
hdr-opt: Replace --hdr-opt with --hdr10-opt

This patch deprecates the existing option '--hdr-opt' as the name sounds generic
even though the feature does QP optimizations only for HDR10 content and
introduces '--hdr10-opt' as an alternate.

This patch also fixes nits in a warning message.

Note: '--hdr-opt' will be removed in the upcoming major release of x265.

diff -r b82891180e7e -r 542653f9c733 doc/reST/cli.rst
--- a/doc/reST/cli.rst	Mon Jan 06 23:08:36 2020 +0530
+++ b/doc/reST/cli.rst	Mon Jan 06 10:44:13 2020 +0530
@@ -2259,11 +2259,13 @@
 	specified. Useful when there is a desire to signal 0 values for max-cll
 	and max-fall. Default disabled.
 
-.. option:: --hdr-opt, --no-hdr-opt
-
-	Add luma and chroma offsets for HDR/WCG content.
-	Input video should be 10 bit 4:2:0. Applicable for HDR content. It is recommended
-	that AQ-mode be enabled along with this feature. Default disabled.
+.. option:: --hdr10-opt, --no-hdr10-opt
+
+	Enable block-level luma and chroma QP optimization for HDR10 content
+	as suggested in ITU-T H-series Recommendations – Supplement 15.
+	Source video should have HDR10 characteristics such as 10-bit depth 4:2:0
+	with Bt.2020 color primaries and SMPTE ST.2084 transfer characteristics.
+	It is recommended that AQ-mode be enabled along with this feature. Default disabled.
 
 .. option:: --dhdr10-info <filename>
 
diff -r b82891180e7e -r 542653f9c733 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Mon Jan 06 23:08:36 2020 +0530
+++ b/source/CMakeLists.txt	Mon Jan 06 10:44:13 2020 +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 186)
+set(X265_BUILD 187)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r b82891180e7e -r 542653f9c733 source/common/param.cpp
--- a/source/common/param.cpp	Mon Jan 06 23:08:36 2020 +0530
+++ b/source/common/param.cpp	Mon Jan 06 10:44:13 2020 +0530
@@ -322,7 +322,8 @@
     param->bOptRefListLengthPPS = 0;
     param->bOptCUDeltaQP        = 0;
     param->bAQMotion = 0;
-    param->bHDROpt = 0;
+    param->bHDROpt = 0; /*DEPRECATED*/
+    param->bHDR10Opt = 0;
     param->analysisReuseLevel = 0;  /*DEPRECATED*/
     param->analysisSaveReuseLevel = 0;
     param->analysisLoadReuseLevel = 0;
@@ -1244,7 +1245,8 @@
             }
         }
         OPT("hdr") p->bEmitHDRSEI = atobool(value);
-        OPT("hdr-opt") p->bHDROpt = atobool(value);
+        OPT("hdr-opt") p->bHDR10Opt = atobool(value); /*DEPRECATED*/
+        OPT("hdr10-opt") p->bHDR10Opt = atobool(value);
         OPT("limit-sao") p->bLimitSAO = atobool(value);
         OPT("dhdr10-info") p->toneMapFile = strdup(value);
         OPT("dhdr10-opt") p->bDhdr10opt = atobool(value);
@@ -2169,7 +2171,7 @@
     BOOL(p->bOptCUDeltaQP, "opt-cu-delta-qp");
     BOOL(p->bAQMotion, "aq-motion");
     BOOL(p->bEmitHDRSEI, "hdr");
-    BOOL(p->bHDROpt, "hdr-opt");
+    BOOL(p->bHDR10Opt, "hdr10-opt");
     BOOL(p->bDhdr10opt, "dhdr10-opt");
     BOOL(p->bEmitIDRRecoverySEI, "idr-recovery-sei");
     if (p->analysisSave)
@@ -2495,7 +2497,8 @@
     dst->dynamicRd = src->dynamicRd;
     dst->bEmitHDRSEI = src->bEmitHDRSEI;
     dst->bEmitHRDSEI = src->bEmitHRDSEI;
-    dst->bHDROpt = src->bHDROpt;
+    dst->bHDROpt = src->bHDROpt; /*DEPRECATED*/
+    dst->bHDR10Opt = src->bHDR10Opt;
     dst->analysisReuseLevel = src->analysisReuseLevel;
     dst->analysisSaveReuseLevel = src->analysisSaveReuseLevel;
     dst->analysisLoadReuseLevel = src->analysisLoadReuseLevel;
diff -r b82891180e7e -r 542653f9c733 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Mon Jan 06 23:08:36 2020 +0530
+++ b/source/encoder/encoder.cpp	Mon Jan 06 10:44:13 2020 +0530
@@ -3281,7 +3281,7 @@
 
     pps->chromaQpOffset[0] = m_param->cbQpOffset;
     pps->chromaQpOffset[1] = m_param->crQpOffset;
-    pps->pps_slice_chroma_qp_offsets_present_flag = m_param->bHDROpt;
+    pps->pps_slice_chroma_qp_offsets_present_flag = m_param->bHDR10Opt;
 
     pps->bConstrainedIntraPred = m_param->bEnableConstrainedIntra;
     pps->bUseWeightPred = m_param->bEnableWeightedPred;
@@ -3747,7 +3747,7 @@
 
     if (!p->rc.bStatWrite && !p->rc.bStatRead && (p->analysisMultiPassRefine || p->analysisMultiPassDistortion))
     {
-        x265_log(p, X265_LOG_WARNING, "analysis-multi-pass/distortion is enabled only when rc multi pass is enabled. Disabling multi-pass-opt-analysis and multi-pass-opt-distortion");
+        x265_log(p, X265_LOG_WARNING, "analysis-multi-pass/distortion is enabled only when rc multi pass is enabled. Disabling multi-pass-opt-analysis and multi-pass-opt-distortion\n");
         p->analysisMultiPassRefine = 0;
         p->analysisMultiPassDistortion = 0;
     }
@@ -4072,21 +4072,21 @@
         x265_log(p, X265_LOG_WARNING, "maxSlices can not be more than min(rows, MAX_NAL_UNITS-1), force set to %d\n", slicesLimit);
         p->maxSlices = slicesLimit;
     }
-    if (p->bHDROpt)
+    if (p->bHDR10Opt)
     {
         if (p->internalCsp != X265_CSP_I420 || p->internalBitDepth != 10 || p->vui.colorPrimaries != 9 ||
             p->vui.transferCharacteristics != 16 || p->vui.matrixCoeffs != 9)
         {
-            x265_log(p, X265_LOG_ERROR, "Recommended Settings for HDR: colour primaries should be BT.2020,\n"
+            x265_log(p, X265_LOG_ERROR, "Recommended Settings for HDR10-opt: colour primaries should be BT.2020,\n"
                                         "                                            transfer characteristics should be SMPTE ST.2084,\n"
                                         "                                            matrix coeffs should be BT.2020,\n"
                                         "                                            the input video should be 10 bit 4:2:0\n"
-                                        "                                            Disabling offset tuning for HDR videos\n");
-            p->bHDROpt = 0;
+                                        "                                            Disabling hdr10-opt.\n");
+            p->bHDR10Opt = 0;
         }
     }
 
-    if (m_param->toneMapFile || p->bHDROpt || p->bEmitHDRSEI)
+    if (m_param->toneMapFile || p->bHDR10Opt || p->bEmitHDRSEI)
     {
         if (!p->bRepeatHeaders)
         {
diff -r b82891180e7e -r 542653f9c733 source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Mon Jan 06 23:08:36 2020 +0530
+++ b/source/encoder/frameencoder.cpp	Mon Jan 06 10:44:13 2020 +0530
@@ -591,7 +591,7 @@
 
     /* Clip slice QP to 0-51 spec range before encoding */
     slice->m_sliceQp = x265_clip3(-QP_BD_OFFSET, QP_MAX_SPEC, qp);
-    if (m_param->bHDROpt)
+    if (m_param->bHDR10Opt)
     {
         int qpCb = x265_clip3(-12, 0, (int)floor((m_top->m_cB * ((-.46) * qp + 9.26)) + 0.5 ));
         int qpCr = x265_clip3(-12, 0, (int)floor((m_top->m_cR * ((-.46) * qp + 9.26)) + 0.5 ));
diff -r b82891180e7e -r 542653f9c733 source/encoder/slicetype.cpp
--- a/source/encoder/slicetype.cpp	Mon Jan 06 23:08:36 2020 +0530
+++ b/source/encoder/slicetype.cpp	Mon Jan 06 10:44:13 2020 +0530
@@ -593,7 +593,7 @@
                             qp_adj = strength * (X265_LOG2(X265_MAX(energy, 1)) - (modeOneConst + 2 * (X265_DEPTH - 8)));
                         }
 
-                        if (param->bHDROpt)
+                        if (param->bHDR10Opt)
                         {
                             uint32_t sum = lumaSumCu(curFrame, blockX, blockY, param->rc.qgSize);
                             uint32_t lumaAvg = sum / (loopIncr * loopIncr);
diff -r b82891180e7e -r 542653f9c733 source/x265.h
--- a/source/x265.h	Mon Jan 06 23:08:36 2020 +0530
+++ b/source/x265.h	Mon Jan 06 10:44:13 2020 +0530
@@ -1653,7 +1653,7 @@
     int       bEmitHDRSEI;
 
     /* Enable luma and chroma offsets for HDR/WCG content.
-     * Default is disabled */
+     * Default is disabled. Now deprecated.*/
     int       bHDROpt;
 
     /* A value between 1 and 10 (both inclusive) determines the level of
@@ -1893,6 +1893,9 @@
     * from the corresponding analysis-save. */
 
     int      confWinBottomOffset;
+
+    /* Block-level QP optimization for HDR10 content. Default is disabled.*/
+    int       bHDR10Opt;
 } x265_param;
 
 /* x265_param_alloc:
diff -r b82891180e7e -r 542653f9c733 source/x265cli.h
--- a/source/x265cli.h	Mon Jan 06 23:08:36 2020 +0530
+++ b/source/x265cli.h	Mon Jan 06 10:44:13 2020 +0530
@@ -301,6 +301,8 @@
     { "no-hdr",               no_argument, NULL, 0 },
     { "hdr-opt",              no_argument, NULL, 0 },
     { "no-hdr-opt",           no_argument, NULL, 0 },
+    { "hdr10-opt",            no_argument, NULL, 0 },
+    { "no-hdr10-opt",         no_argument, NULL, 0 },
     { "limit-sao",            no_argument, NULL, 0 },
     { "no-limit-sao",         no_argument, NULL, 0 },
     { "dhdr10-info",    required_argument, NULL, 0 },
@@ -635,7 +637,8 @@
     H0("   --max-cll <string>            Specify content light level info SEI as \"cll,fall\" (HDR).\n");
     H0("   --[no-]cll                    Emit content light level info SEI. Default %s\n", OPT(param->bEmitCLL));
     H0("   --[no-]hdr                    Control dumping of HDR SEI packet. If max-cll or master-display has non-zero values, this is enabled. Default %s\n", OPT(param->bEmitHDRSEI));
-    H0("   --[no-]hdr-opt                Add luma and chroma offsets for HDR/WCG content. Default %s\n", OPT(param->bHDROpt));
+    H0("   --[no-]hdr-opt                Add luma and chroma offsets for HDR/WCG content. Default %s. Now deprecated.\n", OPT(param->bHDROpt));
+    H0("   --[no-]HDR10-opt              Block-level QP optimization for HDR10 content. Default %s.\n", OPT(param->bHDR10Opt));
     H0("   --min-luma <integer>          Minimum luma plane value of input source picture\n");
     H0("   --max-luma <integer>          Maximum luma plane value of input source picture\n");
     H0("\nBitstream options:\n");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265_push-1.patch
Type: text/x-patch
Size: 10399 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20200107/284e6874/attachment-0001.bin>


More information about the x265-devel mailing list