[x265] [PATCH] dhdr: comply to HDR10+ LLC spec
Ashok Kumar Mishra
ashok at multicorewareinc.com
Fri Feb 16 11:37:39 CET 2018
On Fri, Feb 16, 2018 at 1:50 PM, <bhavna at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Bhavna Hariharan <bhavna at multicorewareinc.com>
> # Date 1518761265 -19800
> # Fri Feb 16 11:37:45 2018 +0530
> # Node ID a92fd62210b87f112f5fe087ede1a0e8f0eb8027
> # Parent 36ab263cc891e0cb5d3dd5ce2c80e35faa0ce996
> dhdr: comply to HDR10+ LLC spec
>
> This patch does the following -
> 1) Consider Json files without Bezier Curve data as valid and inject them
> correctly without errors.
> 2) The numWindows values is now taken from the numWindows JSON value,
> instead
> of taking it from 1+ellipsesNum. Add numWindows to the dictionary.
> 3) Changed hardcoded applicationVersion value to 1 due to LLC requirement.
>
> diff -r 36ab263cc891 -r a92fd62210b8 source/dynamicHDR10/
> SeiMetadataDictionary.cpp
> --- a/source/dynamicHDR10/SeiMetadataDictionary.cpp Wed Feb 14
> 15:45:29 2018 +0530
> +++ b/source/dynamicHDR10/SeiMetadataDictionary.cpp Fri Feb 16
> 11:37:45 2018 +0530
> @@ -28,6 +28,7 @@
>
> const std::string JsonDataKeys::LocalParameters =
> std::string("LocalParameters");
> const std::string JsonDataKeys::TargetDisplayLuminance = std::string("
> TargetedSystemDisplayMaximumLuminance");
> +const std::string JsonDataKeys::NumberOfWindows =
> std::string("NumberOfWindows");
>
> const std::string BezierCurveNames::TagName =
> std::string("BezierCurveData");
> const std::string BezierCurveNames::NumberOfAnchors =
> std::string("NumberOfAnchors");
> diff -r 36ab263cc891 -r a92fd62210b8 source/dynamicHDR10/
> SeiMetadataDictionary.h
> --- a/source/dynamicHDR10/SeiMetadataDictionary.h Wed Feb 14
> 15:45:29 2018 +0530
> +++ b/source/dynamicHDR10/SeiMetadataDictionary.h Fri Feb 16
> 11:37:45 2018 +0530
> @@ -37,6 +37,7 @@
> public:
> static const std::string LocalParameters;
> static const std::string TargetDisplayLuminance;
> + static const std::string NumberOfWindows;
> };
>
> //Bezier Curve Data
> diff -r 36ab263cc891 -r a92fd62210b8 source/dynamicHDR10/
> metadataFromJson.cpp
> --- a/source/dynamicHDR10/metadataFromJson.cpp Wed Feb 14 15:45:29 2018
> +0530
> +++ b/source/dynamicHDR10/metadataFromJson.cpp Fri Feb 16 11:37:45 2018
> +0530
> @@ -372,7 +372,7 @@
> const uint16_t terminalProviderCode = 0x003C;
> const uint16_t terminalProviderOrientedCode = 0x0001;
> const uint8_t applicationIdentifier = 4;
> - const uint8_t applicationVersion = 0;
> + const uint8_t applicationVersion = 1;
>
> mPimpl->appendBits(metadata, countryCode, 8);
> mPimpl->appendBits(metadata, terminalProviderCode, 16);
> @@ -384,9 +384,7 @@
> //Note: Validated only add up to two local selections, ignore the rest
> JsonArray jsonArray = fileData[frame][JsonDataKeys::
> LocalParameters].array_items();
> int ellipsesNum = static_cast<int>(jsonArray.size() > 2 ? 2 :
> jsonArray.size());
> -
> - uint16_t numWindows = 1 + static_cast<uint16_t>(ellipsesNum);
> -
> + uint16_t numWindows = (uint16_t)fileData[frame][
> JsonDataKeys::NumberOfWindows].int_value();
> mPimpl->appendBits(metadata, numWindows, 2);
> for (int i = 0; i < ellipsesNum; ++i)
> {
> @@ -426,16 +424,15 @@
>
> mPimpl->appendBits(metadata, semimajorExternalAxis, 16);
> mPimpl->appendBits(metadata, semiminorExternalAxis, 16);
> - /*bool*/ uint8_t overlapProcessOption = static_cast<uint8_t>(
> ellipseJsonObject[EllipseNames::OverlapProcessOption].int_value()); //1;
> + uint8_t overlapProcessOption = static_cast<uint8_t>(
> ellipseJsonObject[EllipseNames::OverlapProcessOption].int_value());
> //TODO: Uses Layering method, the value is "1"
> mPimpl->appendBits(metadata, overlapProcessOption, 1);
> }
> /* Targeted System Display Data */
> - uint32_t TEMPmonitorPeak = fileData[frame][JsonDataKeys::
> TargetDisplayLuminance].int_value(); //500;
> - mPimpl->appendBits(metadata, TEMPmonitorPeak, 27);
> -
> + uint32_t monitorPeak = fileData[frame][JsonDataKeys::
> TargetDisplayLuminance].int_value(); //500;
> + mPimpl->appendBits(metadata, monitorPeak, 27);
> //NOTE: Set as false for now, as requested
> - /*bool*/uint8_t targetedSystemDisplayActualPeakLuminanceFlag = 0;
> /*false*/
> + uint8_t targetedSystemDisplayActualPeakLuminanceFlag = 0;
> mPimpl->appendBits(metadata, targetedSystemDisplayActualPeakLuminanceFlag,
> 1);
> if (targetedSystemDisplayActualPeakLuminanceFlag)
> {
> @@ -463,7 +460,6 @@
> mPimpl->appendBits(metadata, static_cast<uint16_t>((int)luminanceData.maxGLuminance
> & 0xFFFF), 16);
> mPimpl->appendBits(metadata, static_cast<uint8_t>(((int)luminanceData.maxBLuminance
> & 0x10000) >> 16), 1);
> mPimpl->appendBits(metadata, static_cast<uint16_t>((int)luminanceData.maxBLuminance
> & 0xFFFF), 16);
> - /* changed from maxRGBLuminance to average luminance to match
> stms implementation */
> mPimpl->appendBits(metadata, static_cast<uint8_t>(((int)luminanceData.averageLuminance
> & 0x10000) >> 16), 1);
> mPimpl->appendBits(metadata, static_cast<uint16_t>((int)luminanceData.averageLuminance
> & 0xFFFF), 16);
>
> @@ -478,7 +474,7 @@
> uint8_t distributionMaxrgbPercentage = static_cast<uint8_t>(
> percentilPercentages.at(i));
> mPimpl->appendBits(metadata, distributionMaxrgbPercentage, 7);
>
> - // 17bits: 1bit then 16
> + /* 17bits: 1bit then 16 */
> unsigned int ithPercentile = luminanceData.percentiles.at(i);
> uint8_t highValue = static_cast<uint8_t>((ithPercentile &
> 0x10000) >> 16);
> uint16_t lowValue = static_cast<uint16_t>(ithPercentile &
> 0xFFFF);
> @@ -499,33 +495,32 @@
> {
> //TODO
> }
> - // BEZIER CURVE DATA
> + /* Bezier Curve Data */
> for (int w = 0; w < numWindows; ++w)
> {
> - //TODO:
> uint8_t toneMappingFlag = 1;
> + /* Check if the window contains tone mapping bezier curve
> data and set toneMappingFlag appropriately */
> + //Json bezierData = fileData[frame][
> BezierCurveNames::TagName];
> + BezierCurveData curveData;
> + /* Select curve data based on global window */
> + if (w == 0)
> + {
> + if (!mPimpl->bezierCurveFromJson(fileData[frame][BezierCurveNames::TagName],
> curveData))
> + {
> + toneMappingFlag = 0;
> + }
> + }
> + /* Select curve data based on local window */
> + else
> + {
> + if (!mPimpl->bezierCurveFromJson(jsonArray[w -
> 1][BezierCurveNames::TagName], curveData))
> + {
> + toneMappingFlag = 0;
> + }
> + }
> mPimpl->appendBits(metadata, toneMappingFlag, 1);
> if (toneMappingFlag)
> {
> - Json bezierData = fileData[frame][BezierCurveNames::TagName];
> - BezierCurveData curveData;
> -
> - /* Select curve data based on global window or local window */
> - if (w == 0)
> - {
> - if (!mPimpl->bezierCurveFromJson(bezierData, curveData))
> - {
> - std::cout << "error parsing bezierCurve frame: " << w
> << std::endl;
> - }
> - }
> - else
> - {
> - if (!mPimpl->bezierCurveFromJson(jsonArray[w -
> 1][BezierCurveNames::TagName], curveData))
> - {
> - std::cout << "error parsing bezierCurve ellipse: " <<
> w - 1 << std::endl;
> - }
> - }
> -
> uint16_t kneePointX = static_cast<uint16_t>(curveData.sPx);
> mPimpl->appendBits(metadata, kneePointX, 12);
> uint16_t kneePointY = static_cast<uint16_t>(curveData.sPy);
> @@ -541,7 +536,7 @@
> mPimpl->appendBits(metadata, anchor, 10);
> }
> }
> - }
> + }
> /* Set to false as requested */
> bool colorSaturationMappingFlag = 0;
> mPimpl->appendBits(metadata, colorSaturationMappingFlag, 1);
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
>
Pushed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20180216/cd6beef0/attachment-0001.html>
More information about the x265-devel
mailing list