<div dir="ltr"><div dir="ltr"><div># HG changeset patch</div><div># User Praveen Tiwari <<a href="mailto:praveen@multicorewareinc.com">praveen@multicorewareinc.com</a>></div><div># Date 1537854295 -19800</div><div>#      Tue Sep 25 11:14:55 2018 +0530</div><div># Node ID 89457c901a6c41f390aef970a2936e3a5650b4f1</div><div># Parent  f74003e88622dafc62f6c3c50720872df4d928bc</div><div>added support for Dolby Vision profile 5</div><div><br></div><div>diff -r f74003e88622 -r 89457c901a6c doc/reST/cli.rst</div><div>--- a/doc/reST/cli.rst<span style="white-space:pre">  </span>Thu Nov 22 15:02:08 2018 +0530</div><div>+++ b/doc/reST/cli.rst<span style="white-space:pre">  </span>Tue Sep 25 11:14:55 2018 +0530</div><div>@@ -2195,6 +2195,19 @@</div><div> <span style="white-space:pre"> </span>Picture Timing SEI messages providing timing information to the</div><div> <span style="white-space:pre">     </span>decoder. Default disabled</div><div> </div><div>+.. option:: --dolby-vision-profile <integer|float></div><div>+</div><div>+    Generate bitstreams confirming to the specified Dolby Vision profile,</div><div>+    note that 0x7C01 makes RPU appear to be an unspecified NAL type in</div><div>+    HEVC stream. If BL is backward compatible, Dolby Vision single</div><div>+    layer VES will be equivalent to a backward compatible BL VES on legacy</div><div>+    device as RPU will be ignored.</div><div>+    </div><div>+    The value is specified as a float or as an integer with the profile times 10,</div><div>+    for example profile 5 is specified as "5" or "5.0" or "50".</div><div>+    </div><div>+    Currently only profile 5 enabled, Default 0 (disabled)</div><div>+</div><div> .. option:: --info, --no-info</div><div> </div><div> <span style="white-space:pre">        </span>Emit an informational SEI with the stream headers which describes</div><div>diff -r f74003e88622 -r 89457c901a6c source/CMakeLists.txt</div><div>--- a/source/CMakeLists.txt<span style="white-space:pre"> </span>Thu Nov 22 15:02:08 2018 +0530</div><div>+++ b/source/CMakeLists.txt<span style="white-space:pre">     </span>Tue Sep 25 11:14:55 2018 +0530</div><div>@@ -29,7 +29,7 @@</div><div> option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)</div><div> mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)</div><div> # X265_BUILD must be incremented each time the public API is changed</div><div>-set(X265_BUILD 165)</div><div>+set(X265_BUILD 166)</div><div> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265.def.in">x265.def.in</a>"</div><div>                "${PROJECT_BINARY_DIR}/x265.def")</div><div> configure_file("${PROJECT_SOURCE_DIR}/<a href="http://x265_config.h.in">x265_config.h.in</a>"</div><div>diff -r f74003e88622 -r 89457c901a6c source/common/param.cpp</div><div>--- a/source/common/param.cpp<span style="white-space:pre">      </span>Thu Nov 22 15:02:08 2018 +0530</div><div>+++ b/source/common/param.cpp<span style="white-space:pre">   </span>Tue Sep 25 11:14:55 2018 +0530</div><div>@@ -286,9 +286,9 @@</div><div>     param->bAQMotion = 0;</div><div>     param->bHDROpt = 0;</div><div>     param->analysisReuseLevel = 5;</div><div>-</div><div>     param->toneMapFile = NULL;</div><div>     param->bDhdr10opt = 0;</div><div>+    param->dolbyProfile = 0;</div><div>     param->bCTUInfo = 0;</div><div>     param->bUseRcStats = 0;</div><div>     param->scaleFactor = 0;</div><div>@@ -1050,6 +1050,15 @@</div><div>         OPT("chunk-start") p->chunkStart = atoi(value);</div><div>         OPT("chunk-end") p->chunkEnd = atoi(value);</div><div>         OPT("nalu-file") p->naluFile = strdup(value);</div><div>+        OPT("dolby-vision-profile")</div><div>+        {</div><div>+            if (atof(value) < 10)</div><div>+                p->dolbyProfile = (int)(10 * atof(value) + .5);</div><div>+            else if (atoi(value) < 100)</div><div>+                p->dolbyProfile = atoi(value);</div><div>+            else</div><div>+                bError = true;</div><div>+        }</div><div>         else</div><div>             return X265_PARAM_BAD_NAME;</div><div>     }</div><div>@@ -1407,6 +1416,15 @@</div><div>         "Invalid refine-intra value, refine-intra levels 0 to 3 supported");</div><div>     CHECK(param->maxAUSizeFactor < 0.5 || param->maxAUSizeFactor > 1.0,</div><div>         "Supported factor for controlling max AU size is from 0.5 to 1");</div><div>+    CHECK((param->dolbyProfile != 0) && (param->dolbyProfile != 50),</div><div>+        "Unsupported Dolby Vision profile, only profile 5 enabled");</div><div>+    if (param->dolbyProfile == 50)</div><div>+    {</div><div>+        CHECK((param->rc.vbvMaxBitrate < 0 && param->rc.vbvBufferSize < 0), "Dolby Vision requires VBV settings to enable HRD.\n");</div><div>+        CHECK((param->sourceWidth > 3840 || param->sourceHeight > 2160), "Maximum supported resolution for Dolby Vision profile - 5 is 4k UHD\n");</div><div>+        CHECK((param->internalBitDepth != 10), "Dolby Vision profile - 5 is Main10 only\n");</div><div>+        CHECK((param->internalCsp != X265_CSP_I420), "Dolby Vision profile - 5 requires YCbCr 4:2:0 color space\n");</div><div>+    }</div><div> #if !X86_64</div><div>     CHECK(param->searchMethod == X265_SEA && (param->sourceWidth > 840 || param->sourceHeight > 480),</div><div>         "SEA motion search does not support resolutions greater than 480p in 32 bit build");</div><div>diff -r f74003e88622 -r 89457c901a6c source/encoder/encoder.cpp</div><div>--- a/source/encoder/encoder.cpp<span style="white-space:pre">        </span>Thu Nov 22 15:02:08 2018 +0530</div><div>+++ b/source/encoder/encoder.cpp<span style="white-space:pre">        </span>Tue Sep 25 11:14:55 2018 +0530</div><div>@@ -3,6 +3,8 @@</div><div>  *</div><div>  * Authors: Steve Borho <<a href="mailto:steve@borho.org">steve@borho.org</a>></div><div>  *          Min Chen <<a href="mailto:chenm003@163.com">chenm003@163.com</a>></div><div>+ *          Praveen Kumar Tiwari <<a href="mailto:praveen@multicorewareinc.com">praveen@multicorewareinc.com</a>></div><div>+ *          Aruna Matheswaran <<a href="mailto:aruna@multicorewareinc.com">aruna@multicorewareinc.com</a>></div><div>  *</div><div>  * This program is free software; you can redistribute it and/or modify</div><div>  * it under the terms of the GNU General Public License as published by</div><div>@@ -3182,7 +3184,22 @@</div><div>         p->chunkStart = p->chunkEnd = 0;</div><div>         x265_log(p, X265_LOG_WARNING, "chunk-end cannot be less than chunk-start. Disabling chunking.\n");</div><div>     }</div><div>-</div><div>+    if (p->dolbyProfile)     // Default disabled.</div><div>+    {</div><div>+        if (p->dolbyProfile == 50)</div><div>+        {</div><div>+            p->bEmitHRDSEI = true;</div><div>+            p->vui.bEnableVideoSignalTypePresentFlag = 1;</div><div>+            p->vui.bEnableColorDescriptionPresentFlag = 1;</div><div>+            p->vui.transferCharacteristics = 2;</div><div>+            p->vui.colorPrimaries = 2;</div><div>+            p->vui.matrixCoeffs = 2;</div><div>+            p->vui.bEnableVideoFullRangeFlag = 1;</div><div>+            p->vui.videoFormat = 5;</div><div>+            p->bEnableAccessUnitDelimiters = 1;</div><div>+            p->bAnnexB = 1;</div><div>+        }</div><div>+    }</div><div> }</div><div> </div><div> void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc, const x265_picture* picIn, int paramBytes)</div><div>diff -r f74003e88622 -r 89457c901a6c source/x265.h</div><div>--- a/source/x265.h<span style="white-space:pre"> </span>Thu Nov 22 15:02:08 2018 +0530</div><div>+++ b/source/x265.h<span style="white-space:pre">     </span>Tue Sep 25 11:14:55 2018 +0530</div><div>@@ -1713,8 +1713,14 @@</div><div>     /* File containing base64 encoded SEI messages in POC order */</div><div>     const char*    naluFile;</div><div> </div><div>+    /* Generate bitstreams confirming to the specified dolby vision profile,</div><div>+     * note that 0x7C01 makes RPU appear to be an unspecified NAL type in</div><div>+     * HEVC stream. if BL is backward compatible, Dolby Vision single</div><div>+     * layer VES will be equivalent to a backward compatible BL VES on legacy</div><div>+     * device as RPU will be ignored. Default 0 (disabled) */</div><div>+    int dolbyProfile;</div><div>+</div><div> } x265_param;</div><div>-</div><div> /* x265_param_alloc:</div><div>  *  Allocates an x265_param instance. The returned param structure is not</div><div>  *  special in any way, but using this method together with x265_param_free()</div><div>diff -r f74003e88622 -r 89457c901a6c source/x265cli.h</div><div>--- a/source/x265cli.h<span style="white-space:pre">    </span>Thu Nov 22 15:02:08 2018 +0530</div><div>+++ b/source/x265cli.h<span style="white-space:pre">  </span>Tue Sep 25 11:14:55 2018 +0530</div><div>@@ -288,6 +288,7 @@</div><div>     { "dhdr10-info",    required_argument, NULL, 0 },</div><div>     { "dhdr10-opt",           no_argument, NULL, 0},</div><div>     { "no-dhdr10-opt",        no_argument, NULL, 0},</div><div>+    { "dolby-vision-profile",  required_argument, NULL, 0 },</div><div>     { "refine-mv",            no_argument, NULL, 0 },</div><div>     { "no-refine-mv",         no_argument, NULL, 0 },</div><div>     { "force-flush",    required_argument, NULL, 0 },</div><div>@@ -355,6 +356,7 @@</div><div>     H0("   --dhdr10-info <filename>      JSON file containing the Creative Intent Metadata to be encoded as Dynamic Tone Mapping\n");</div><div>     H0("   --[no-]dhdr10-opt             Insert tone mapping SEI only for IDR frames and when the tone mapping information changes. Default disabled\n");</div><div> #endif</div><div>+    H0("  --dolby-vision-profile <float|integer> Specifies Dolby Vision profile ID. Currently only profile 5 enabled. Specified as '5' or '50'. Default 0 (disabled).\n");</div><div>     H0("   --nalu-file <filename>        Text file containing SEI messages in the following format : <POC><space><PREFIX><space><NAL UNIT TYPE>/<SEI TYPE><space><SEI Payload>\n");</div><div>     H0("-f/--frames <integer>            Maximum number of frames to encode. Default all\n");</div><div>     H0("   --seek <integer>              First frame to encode\n");</div><div><br></div></div></div>