diff options
author | Jan Ekström <jeebjp@gmail.com> | 2013-11-03 23:45:02 +0400 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2013-11-04 19:03:11 +0400 |
commit | 885ec9242554ad25922258a595ec5e317922a412 (patch) | |
tree | 6505d59d116550d71707d023ff742567e2e2c496 /libavcodec/hevc.c | |
parent | cd8f772d0678a90957f4dfd5ce51af9d22e3f212 (diff) |
hevc: Use parsed VUI colorimetry in avcodec
Also limit the parsed VUI values to known valid ones.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/hevc.c')
-rw-r--r-- | libavcodec/hevc.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index 276f3fdfbe..e01db16868 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -401,6 +401,22 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps) s->avctx->sample_aspect_ratio = sps->vui.sar; s->avctx->has_b_frames = sps->temporal_layer[sps->max_sub_layers - 1].num_reorder_pics; + if (sps->vui.video_signal_type_present_flag) + s->avctx->color_range = sps->vui.video_full_range_flag ? AVCOL_RANGE_JPEG + : AVCOL_RANGE_MPEG; + else + s->avctx->color_range = AVCOL_RANGE_MPEG; + + if (sps->vui.colour_description_present_flag) { + s->avctx->color_primaries = sps->vui.colour_primaries; + s->avctx->color_trc = sps->vui.transfer_characteristic; + s->avctx->colorspace = sps->vui.matrix_coeffs; + } else { + s->avctx->color_primaries = AVCOL_PRI_UNSPECIFIED; + s->avctx->color_trc = AVCOL_TRC_UNSPECIFIED; + s->avctx->colorspace = AVCOL_SPC_UNSPECIFIED; + } + ff_hevc_pred_init(&s->hpc, sps->bit_depth); ff_hevc_dsp_init (&s->hevcdsp, sps->bit_depth); ff_videodsp_init (&s->vdsp, sps->bit_depth); |