Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Birkbeck <neil.birkbeck@gmail.com>2016-01-21 21:56:50 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2016-02-14 02:36:05 +0300
commit3b0974d3ef7f6f39a2e4c2af9ec2a2f9976ad46d (patch)
treeb1e031ec8d374cfd46eb0c30b1c688545418714d /libavcodec/hevc_sei.c
parentc33ffc7b21b9531a971b5da1edcae0b308fe88aa (diff)
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.c26
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);