diff options
author | Vasantha Balla <vballa@codeaurora.org> | 2021-01-18 15:20:31 +0530 |
---|---|---|
committer | Vasantha Balla <vballa@codeaurora.org> | 2021-01-19 12:10:34 +0530 |
commit | 7df9be54b539e87646eeb18945a30c1480605135 (patch) | |
tree | 7122f51a9202579bdfc9e2ab07849beffdfa6169 | |
parent | c0681dd10927a429e58f9162d6a09f6446920c06 (diff) | |
download | media-7df9be54b539e87646eeb18945a30c1480605135.tar.gz |
mm-video-v4l2: Use default value for max luminance.
Use the default max luminance value if the value from the bitstream is
less than 100 cd/m^2.
Change-Id: Ia51ef1fb105ba687e5d34d88a8485fb71918c9e0
-rw-r--r-- | mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp index 68b48073..5db344ad 100644 --- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp +++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp @@ -145,6 +145,7 @@ extern "C" { #endif #define LUMINANCE_DIV_FACTOR 10000.0 +#define LUMINANCE_MAXDISPLAY_CDM2 1000 /* defined in mp-ctl.h */ #define MPCTLV3_VIDEO_DECODE_PB_HINT 0x41C04000 @@ -11104,10 +11105,24 @@ bool omx_vdec::handle_mastering_display_color_info(void* data) (hdr_info->sType1.mW.y != mastering_display_payload->nWhitePointY); /* Maximum Display Luminance from the bitstream is in 0.0001 cd/m2 while the HDRStaticInfo extension - requires it in cd/m2, so dividing by 10000 and rounding the value after division + requires it in cd/m2, so dividing by 10000 and rounding the value after division. + Check if max luminance is at least 100 cd/m^2.This check is required for few bistreams where + max luminance is not in correct scale. Use the default max luminance value if the value from + the bitstream is less than 100 cd/m^2. */ - uint16_t max_display_luminance_cd_m2 = + + uint16_t max_display_luminance_cd_m2; + if ((mastering_display_payload->nMaxDisplayMasteringLuminance > 0) && + ((mastering_display_payload->nMaxDisplayMasteringLuminance / LUMINANCE_DIV_FACTOR) < 100)) { + max_display_luminance_cd_m2 = LUMINANCE_MAXDISPLAY_CDM2; + DEBUG_PRINT_HIGH("Invalid maxLuminance value from SEI [%.4f]. Using default [%u]", + (mastering_display_payload->nMaxDisplayMasteringLuminance / LUMINANCE_DIV_FACTOR), + LUMINANCE_MAXDISPLAY_CDM2); + } else { + max_display_luminance_cd_m2 = static_cast<int>((mastering_display_payload->nMaxDisplayMasteringLuminance / LUMINANCE_DIV_FACTOR) + 0.5); + } + internal_disp_changed_flag |= (hdr_info->sType1.mMaxDisplayLuminance != max_display_luminance_cd_m2) || (hdr_info->sType1.mMinDisplayLuminance != mastering_display_payload->nMinDisplayMasteringLuminance); |