diff options
author | Neil Birkbeck <neil.birkbeck@gmail.com> | 2016-01-21 10:56:50 -0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-02-14 00:36:05 +0100 |
commit | 3b0974d3ef7f6f39a2e4c2af9ec2a2f9976ad46d (patch) | |
tree | b1e031ec8d374cfd46eb0c30b1c688545418714d /libavcodec/hevc_sei.c | |
parent | c33ffc7b21b9531a971b5da1edcae0b308fe88aa (diff) | |
download | ffmpeg-3b0974d3ef7f6f39a2e4c2af9ec2a2f9976ad46d.tar.gz |
lavc/hevc Parse SEI_TYPE_MASTERING_DISPLAY_INFO and propagate content into the AVMasteringDisplayMetadata side data.
Add support for parsing SEI_TYPE_MASTERING_DISPLAY_INFO and propagate contents into
the AVMasteringDisplayMetadata side data. Primaries are ordered in RGB order and
the values are converted to rationals ([0,1] for CEI 1931 Chroma coords,
and cd/m^2 for luma).
Signed-off-by: Neil Birkbeck <neil.birkbeck@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/hevc_sei.c')
-rw-r--r-- | libavcodec/hevc_sei.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index 07856f2414..40685fe5d8 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); |