[x265] [PATCH] added support for Dolby Vision profile 5

Aruna Matheswaran aruna at multicorewareinc.com
Mon Dec 10 10:57:32 CET 2018


# HG changeset patch
# User Praveen Tiwari <praveen at multicorewareinc.com>
# Date 1537854295 -19800
#      Tue Sep 25 11:14:55 2018 +0530
# Node ID 89457c901a6c41f390aef970a2936e3a5650b4f1
# Parent  f74003e88622dafc62f6c3c50720872df4d928bc
added support for Dolby Vision profile 5

diff -r f74003e88622 -r 89457c901a6c doc/reST/cli.rst
--- a/doc/reST/cli.rst Thu Nov 22 15:02:08 2018 +0530
+++ b/doc/reST/cli.rst Tue Sep 25 11:14:55 2018 +0530
@@ -2195,6 +2195,19 @@
  Picture Timing SEI messages providing timing information to the
  decoder. Default disabled

+.. option:: --dolby-vision-profile <integer|float>
+
+    Generate bitstreams confirming to the specified Dolby Vision profile,
+    note that 0x7C01 makes RPU appear to be an unspecified NAL type in
+    HEVC stream. If BL is backward compatible, Dolby Vision single
+    layer VES will be equivalent to a backward compatible BL VES on legacy
+    device as RPU will be ignored.
+
+    The value is specified as a float or as an integer with the profile
times 10,
+    for example profile 5 is specified as "5" or "5.0" or "50".
+
+    Currently only profile 5 enabled, Default 0 (disabled)
+
 .. option:: --info, --no-info

  Emit an informational SEI with the stream headers which describes
diff -r f74003e88622 -r 89457c901a6c source/CMakeLists.txt
--- a/source/CMakeLists.txt Thu Nov 22 15:02:08 2018 +0530
+++ b/source/CMakeLists.txt Tue Sep 25 11:14:55 2018 +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 165)
+set(X265_BUILD 166)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r f74003e88622 -r 89457c901a6c source/common/param.cpp
--- a/source/common/param.cpp Thu Nov 22 15:02:08 2018 +0530
+++ b/source/common/param.cpp Tue Sep 25 11:14:55 2018 +0530
@@ -286,9 +286,9 @@
     param->bAQMotion = 0;
     param->bHDROpt = 0;
     param->analysisReuseLevel = 5;
-
     param->toneMapFile = NULL;
     param->bDhdr10opt = 0;
+    param->dolbyProfile = 0;
     param->bCTUInfo = 0;
     param->bUseRcStats = 0;
     param->scaleFactor = 0;
@@ -1050,6 +1050,15 @@
         OPT("chunk-start") p->chunkStart = atoi(value);
         OPT("chunk-end") p->chunkEnd = atoi(value);
         OPT("nalu-file") p->naluFile = strdup(value);
+        OPT("dolby-vision-profile")
+        {
+            if (atof(value) < 10)
+                p->dolbyProfile = (int)(10 * atof(value) + .5);
+            else if (atoi(value) < 100)
+                p->dolbyProfile = atoi(value);
+            else
+                bError = true;
+        }
         else
             return X265_PARAM_BAD_NAME;
     }
@@ -1407,6 +1416,15 @@
         "Invalid refine-intra value, refine-intra levels 0 to 3
supported");
     CHECK(param->maxAUSizeFactor < 0.5 || param->maxAUSizeFactor > 1.0,
         "Supported factor for controlling max AU size is from 0.5 to 1");
+    CHECK((param->dolbyProfile != 0) && (param->dolbyProfile != 50),
+        "Unsupported Dolby Vision profile, only profile 5 enabled");
+    if (param->dolbyProfile == 50)
+    {
+        CHECK((param->rc.vbvMaxBitrate < 0 && param->rc.vbvBufferSize <
0), "Dolby Vision requires VBV settings to enable HRD.\n");
+        CHECK((param->sourceWidth > 3840 || param->sourceHeight > 2160),
"Maximum supported resolution for Dolby Vision profile - 5 is 4k UHD\n");
+        CHECK((param->internalBitDepth != 10), "Dolby Vision profile - 5
is Main10 only\n");
+        CHECK((param->internalCsp != X265_CSP_I420), "Dolby Vision profile
- 5 requires YCbCr 4:2:0 color space\n");
+    }
 #if !X86_64
     CHECK(param->searchMethod == X265_SEA && (param->sourceWidth > 840 ||
param->sourceHeight > 480),
         "SEA motion search does not support resolutions greater than 480p
in 32 bit build");
diff -r f74003e88622 -r 89457c901a6c source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Thu Nov 22 15:02:08 2018 +0530
+++ b/source/encoder/encoder.cpp Tue Sep 25 11:14:55 2018 +0530
@@ -3,6 +3,8 @@
  *
  * Authors: Steve Borho <steve at borho.org>
  *          Min Chen <chenm003 at 163.com>
+ *          Praveen Kumar Tiwari <praveen at multicorewareinc.com>
+ *          Aruna Matheswaran <aruna at multicorewareinc.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -3182,7 +3184,22 @@
         p->chunkStart = p->chunkEnd = 0;
         x265_log(p, X265_LOG_WARNING, "chunk-end cannot be less than
chunk-start. Disabling chunking.\n");
     }
-
+    if (p->dolbyProfile)     // Default disabled.
+    {
+        if (p->dolbyProfile == 50)
+        {
+            p->bEmitHRDSEI = true;
+            p->vui.bEnableVideoSignalTypePresentFlag = 1;
+            p->vui.bEnableColorDescriptionPresentFlag = 1;
+            p->vui.transferCharacteristics = 2;
+            p->vui.colorPrimaries = 2;
+            p->vui.matrixCoeffs = 2;
+            p->vui.bEnableVideoFullRangeFlag = 1;
+            p->vui.videoFormat = 5;
+            p->bEnableAccessUnitDelimiters = 1;
+            p->bAnnexB = 1;
+        }
+    }
 }

 void Encoder::readAnalysisFile(x265_analysis_data* analysis, int curPoc,
const x265_picture* picIn, int paramBytes)
diff -r f74003e88622 -r 89457c901a6c source/x265.h
--- a/source/x265.h Thu Nov 22 15:02:08 2018 +0530
+++ b/source/x265.h Tue Sep 25 11:14:55 2018 +0530
@@ -1713,8 +1713,14 @@
     /* File containing base64 encoded SEI messages in POC order */
     const char*    naluFile;

+    /* Generate bitstreams confirming to the specified dolby vision
profile,
+     * note that 0x7C01 makes RPU appear to be an unspecified NAL type in
+     * HEVC stream. if BL is backward compatible, Dolby Vision single
+     * layer VES will be equivalent to a backward compatible BL VES on
legacy
+     * device as RPU will be ignored. Default 0 (disabled) */
+    int dolbyProfile;
+
 } x265_param;
-
 /* x265_param_alloc:
  *  Allocates an x265_param instance. The returned param structure is not
  *  special in any way, but using this method together with
x265_param_free()
diff -r f74003e88622 -r 89457c901a6c source/x265cli.h
--- a/source/x265cli.h Thu Nov 22 15:02:08 2018 +0530
+++ b/source/x265cli.h Tue Sep 25 11:14:55 2018 +0530
@@ -288,6 +288,7 @@
     { "dhdr10-info",    required_argument, NULL, 0 },
     { "dhdr10-opt",           no_argument, NULL, 0},
     { "no-dhdr10-opt",        no_argument, NULL, 0},
+    { "dolby-vision-profile",  required_argument, NULL, 0 },
     { "refine-mv",            no_argument, NULL, 0 },
     { "no-refine-mv",         no_argument, NULL, 0 },
     { "force-flush",    required_argument, NULL, 0 },
@@ -355,6 +356,7 @@
     H0("   --dhdr10-info <filename>      JSON file containing the Creative
Intent Metadata to be encoded as Dynamic Tone Mapping\n");
     H0("   --[no-]dhdr10-opt             Insert tone mapping SEI only for
IDR frames and when the tone mapping information changes. Default
disabled\n");
 #endif
+    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");
     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");
     H0("-f/--frames <integer>            Maximum number of frames to
encode. Default all\n");
     H0("   --seek <integer>              First frame to encode\n");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20181210/d218ceae/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x265_clone_12435.patch
Type: application/octet-stream
Size: 7741 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20181210/d218ceae/attachment-0001.obj>


More information about the x265-devel mailing list