[x265] [PATCH] cli: Enable new --hdr option to force signaling HDR parameters
Pradeep Ramachandran
pradeep at multicorewareinc.com
Thu Feb 9 05:28:47 CET 2017
# HG changeset patch
# User Pradeep Ramachandran <pradeep at multicorewareinc.com>
# Date 1486614490 -19800
# Thu Feb 09 09:58:10 2017 +0530
# Node ID 0729b3a4a0ccddd1c16d637e4aa5ee03cbef7ea2
# Parent bed9f6cbca0921e96e5d92493319413031fa0f0e
cli: Enable new --hdr option to force signaling HDR parameters
Useful when there is a desire to signal --max-cll 0,0 in the bitstream.
diff -r bed9f6cbca09 -r 0729b3a4a0cc doc/reST/cli.rst
--- a/doc/reST/cli.rst Tue Feb 07 12:46:38 2017 +0530
+++ b/doc/reST/cli.rst Thu Feb 09 09:58:10 2017 +0530
@@ -1809,7 +1809,8 @@
where %hu are unsigned 16bit integers and %u are unsigned 32bit
integers. The SEI includes X,Y display primaries for RGB channels
and white point (WP) in units of 0.00002 and max,min luminance (L)
- values in units of 0.0001 candela per meter square. (HDR)
+ values in units of 0.0001 candela per meter square. Applicable for HDR
+ content.
Example for a P3D65 1000-nits monitor, where G(x=0.265, y=0.690),
B(x=0.150, y=0.060), R(x=0.680, y=0.320), WP(x=0.3127, y=0.3290),
@@ -1830,7 +1831,7 @@
emitted. The string format is "%hu,%hu" where %hu are unsigned 16bit
integers. The first value is the max content light level (or 0 if no
maximum is indicated), the second value is the maximum picture
- average light level (or 0). (HDR)
+ average light level (or 0). Applicable for HDR content.
Example for MaxCLL=1000 candela per square meter, MaxFALL=400
candela per square meter:
@@ -1840,6 +1841,13 @@
Note that this string value will need to be escaped or quoted to
protect against shell expansion on many platforms. No default.
+.. option:: --hdr, --no-hdr
+
+ Force signalling of HDR parameters in SEI packets. Enabled
+ automatically when :option`--master-display` or :option`--max-cll` is
+ specified. Useful when there is a desire to signal 0 values for max-cll
+ and max-fall. Default disabled.
+
.. option:: --min-luma <integer>
Minimum luma value allowed for input pictures. Any values below min-luma
diff -r bed9f6cbca09 -r 0729b3a4a0cc source/CMakeLists.txt
--- a/source/CMakeLists.txt Tue Feb 07 12:46:38 2017 +0530
+++ b/source/CMakeLists.txt Thu Feb 09 09:58:10 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 108)
+set(X265_BUILD 109)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
"${PROJECT_BINARY_DIR}/x265.def")
configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r bed9f6cbca09 -r 0729b3a4a0cc source/common/param.cpp
--- a/source/common/param.cpp Tue Feb 07 12:46:38 2017 +0530
+++ b/source/common/param.cpp Thu Feb 09 09:58:10 2017 +0530
@@ -131,6 +131,7 @@
param->bEnableAccessUnitDelimiters = 0;
param->bEmitHRDSEI = 0;
param->bEmitInfoSEI = 1;
+ param->bEmitHDRSEI = 0;
/* CU definitions */
param->maxCUSize = 64;
@@ -941,6 +942,7 @@
p->bSsimRd = atobool(value);
}
}
+ OPT("hdr") p->bEmitHDRSEI = atobool(value);
else
return X265_PARAM_BAD_NAME;
}
@@ -1283,6 +1285,10 @@
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");
#endif
+
+ if (param->masteringDisplayColorVolume || param->maxFALL || param->maxCLL)
+ param->bEmitHDRSEI = 1;
+
return check_failed;
}
@@ -1641,6 +1647,7 @@
s += sprintf(s, " scenecut-bias=%.2f", p->scenecutBias);
BOOL(p->bOptCUDeltaQP, "opt-cu-delta-qp");
BOOL(p->bAQMotion, "aq-motion");
+ BOOL(p->bEmitHDRSEI, "hdr");
#undef BOOL
return buf;
}
diff -r bed9f6cbca09 -r 0729b3a4a0cc source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Tue Feb 07 12:46:38 2017 +0530
+++ b/source/encoder/encoder.cpp Thu Feb 09 09:58:10 2017 +0530
@@ -1654,21 +1654,7 @@
bs.writeByteAlignment();
list.serialize(NAL_UNIT_PPS, bs);
- if (m_param->masteringDisplayColorVolume)
- {
- SEIMasteringDisplayColorVolume mdsei;
- if (mdsei.parse(m_param->masteringDisplayColorVolume))
- {
- bs.resetBits();
- mdsei.write(bs, m_sps);
- bs.writeByteAlignment();
- list.serialize(NAL_UNIT_PREFIX_SEI, bs);
- }
- else
- x265_log(m_param, X265_LOG_WARNING, "unable to parse mastering display color volume info\n");
- }
-
- if (m_emitCLLSEI)
+ if (m_param->bEmitHDRSEI)
{
SEIContentLightLevel cllsei;
cllsei.max_content_light_level = m_param->maxCLL;
@@ -1677,6 +1663,20 @@
cllsei.write(bs, m_sps);
bs.writeByteAlignment();
list.serialize(NAL_UNIT_PREFIX_SEI, bs);
+
+ if (m_param->masteringDisplayColorVolume)
+ {
+ SEIMasteringDisplayColorVolume mdsei;
+ if (mdsei.parse(m_param->masteringDisplayColorVolume))
+ {
+ bs.resetBits();
+ mdsei.write(bs, m_sps);
+ bs.writeByteAlignment();
+ list.serialize(NAL_UNIT_PREFIX_SEI, bs);
+ }
+ else
+ x265_log(m_param, X265_LOG_WARNING, "unable to parse mastering display color volume info\n");
+ }
}
if (m_param->bEmitInfoSEI)
diff -r bed9f6cbca09 -r 0729b3a4a0cc source/x265.h
--- a/source/x265.h Tue Feb 07 12:46:38 2017 +0530
+++ b/source/x265.h Thu Feb 09 09:58:10 2017 +0530
@@ -1375,6 +1375,10 @@
/* Increase RD at points where bitrate drops due to vbv. Default 0 */
double complexAnalysis;
+ /* Enables the emitting of HDR SEI packets which contains HDR-specific params.
+ * Auto-enabled when max-cll, max-fall, or mastering display info is specified.
+ * Default is disabled */
+ int bEmitHDRSEI;
} x265_param;
/* x265_param_alloc:
diff -r bed9f6cbca09 -r 0729b3a4a0cc source/x265cli.h
--- a/source/x265cli.h Tue Feb 07 12:46:38 2017 +0530
+++ b/source/x265cli.h Thu Feb 09 09:58:10 2017 +0530
@@ -257,10 +257,12 @@
{ "analyze-src-pics", no_argument, NULL, 0 },
{ "no-analyze-src-pics", no_argument, NULL, 0 },
{ "slices", required_argument, NULL, 0 },
- { "aq-motion", no_argument, NULL, 0 },
- { "no-aq-motion", no_argument, NULL, 0 },
- { "ssim-rd", no_argument, NULL, 0 },
- { "no-ssim-rd", no_argument, NULL, 0 },
+ { "aq-motion", no_argument, NULL, 0 },
+ { "no-aq-motion", no_argument, NULL, 0 },
+ { "ssim-rd", no_argument, NULL, 0 },
+ { "no-ssim-rd", no_argument, NULL, 0 },
+ { "hdr", no_argument, NULL, 0 },
+ { "no-hdr", no_argument, NULL, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
@@ -468,6 +470,7 @@
H0(" --master-display <string> SMPTE ST 2086 master display color volume info SEI (HDR)\n");
H0(" format: G(x,y)B(x,y)R(x,y)WP(x,y)L(max,min)\n");
H0(" --max-cll <string> Emit content light level info SEI as \"cll,fall\" (HDR)\n");
+ 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(" --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.patch
Type: text/x-patch
Size: 7662 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20170209/1ff037f1/attachment.bin>
More information about the x265-devel
mailing list