Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3f9288e authored by wenchangliu's avatar wenchangliu Committed by Wen Chang Liu
Browse files

Do not use max/min luminance if it's 0

Do not set SMPTE2086 if max/min luminance fields are 0,
these may indicate that max/min luminance is not present
in the bitstream. Let GPU composition use default if needed.

Bug: 153847809
Test: Play Netflix HDR content in GPU composition.
Change-Id: Ibce5319f7832095314fe07b0ce13600658ce4627
parent ffba173b
Loading
Loading
Loading
Loading
+23 −20
Original line number Diff line number Diff line
@@ -851,6 +851,10 @@ status_t CCodecBufferChannel::renderOutputBuffer(
    if (hdrStaticInfo || hdr10PlusInfo) {
        HdrMetadata hdr;
        if (hdrStaticInfo) {
            // If mastering max and min luminance fields are 0, do not use them.
            // It indicates the value may not be present in the stream.
            if (hdrStaticInfo->mastering.maxLuminance > 0.0f &&
                hdrStaticInfo->mastering.minLuminance > 0.0f) {
                struct android_smpte2086_metadata smpte2086_meta = {
                    .displayPrimaryRed = {
                        hdrStaticInfo->mastering.red.x, hdrStaticInfo->mastering.red.y
@@ -867,10 +871,9 @@ status_t CCodecBufferChannel::renderOutputBuffer(
                    .maxLuminance = hdrStaticInfo->mastering.maxLuminance,
                    .minLuminance = hdrStaticInfo->mastering.minLuminance,
                };

                hdr.validTypes = HdrMetadata::SMPTE2086;
                hdr.smpte2086 = smpte2086_meta;

            }
            // If the content light level fields are 0, do not use them, it
            // indicates the value may not be present in the stream.
            if (hdrStaticInfo->maxCll > 0.0f && hdrStaticInfo->maxFall > 0.0f) {