X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fhevc_sei.c;h=40685fe5d88c91419a20411d9f8fb21b6304c258;hb=b098e1a4697573d5c501aceb863d89ebf1fcd5fd;hp=07856f241457dba016e585537fef82978f5d18c0;hpb=4736f8115be411bb0cf24a4386d98c53553f919c;p=ffmpeg diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index 07856f24145..40685fe5d88 100644 --- a/libavcodec/hevc_sei.c +++ b/libavcodec/hevc_sei.c @@ -78,6 +78,30 @@ static int decode_nal_sei_decoded_picture_hash(HEVCContext *s) return 0; } +static int decode_nal_sei_mastering_display_info(HEVCContext *s) +{ + GetBitContext *gb = &s->HEVClc->gb; + int i; + // Mastering primaries + for (i = 0; i < 3; i++) { + s->display_primaries[i][0] = get_bits(gb, 16); + s->display_primaries[i][1] = get_bits(gb, 16); + } + // White point (x, y) + s->white_point[0] = get_bits(gb, 16); + s->white_point[1] = get_bits(gb, 16); + + // Max and min luminance of mastering display + s->max_mastering_luminance = get_bits_long(gb, 32); + s->min_mastering_luminance = get_bits_long(gb, 32); + + // As this SEI message comes before the first frame that references it, + // initialize the flag to 2 and decrement on IRAP access unit so it + // persists for the coded video sequence (e.g., between two IRAPs) + s->sei_mastering_display_info_present = 2; + return 0; +} + static int decode_nal_sei_frame_packing_arrangement(HEVCContext *s) { GetBitContext *gb = &s->HEVClc->gb; @@ -278,6 +302,8 @@ static int decode_nal_sei_prefix(HEVCContext *s, int type, int size) skip_bits(gb, 8 * size); return ret; } + case SEI_TYPE_MASTERING_DISPLAY_INFO: + return decode_nal_sei_mastering_display_info(s); case SEI_TYPE_ACTIVE_PARAMETER_SETS: active_parameter_sets(s); av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);