diff options
author | Jan Ekström <jeebjp@gmail.com> | 2013-11-03 19:45:02 +0000 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2013-11-04 16:03:11 +0100 |
commit | 885ec9242554ad25922258a595ec5e317922a412 (patch) | |
tree | 6505d59d116550d71707d023ff742567e2e2c496 /libavcodec/hevc_ps.c | |
parent | cd8f772d0678a90957f4dfd5ce51af9d22e3f212 (diff) | |
download | ffmpeg-885ec9242554ad25922258a595ec5e317922a412.tar.gz |
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_ps.c')
-rw-r--r-- | libavcodec/hevc_ps.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 15f73be9bf..9c0d0ee753 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -453,6 +453,14 @@ static void decode_vui(HEVCContext *s, HEVCSPS *sps) vui->colour_primaries = get_bits(gb, 8); vui->transfer_characteristic = get_bits(gb, 8); vui->matrix_coeffs = get_bits(gb, 8); + + // Set invalid values to "unspecified" + if (vui->colour_primaries >= AVCOL_PRI_NB) + vui->colour_primaries = AVCOL_PRI_UNSPECIFIED; + if (vui->transfer_characteristic >= AVCOL_TRC_NB) + vui->transfer_characteristic = AVCOL_TRC_UNSPECIFIED; + if (vui->matrix_coeffs >= AVCOL_SPC_NB) + vui->matrix_coeffs = AVCOL_SPC_UNSPECIFIED; } } |