diff options
author | Deb Mukherjee <debargha@google.com> | 2014-04-08 22:19:38 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@gerrit.golo.chromium.org> | 2014-04-08 22:19:38 -0700 |
commit | 0cca5dd8d7bbeb001544d81ccf2112d9f52e7f87 (patch) | |
tree | 201ba4a9f935110a4876771d82f6c0d2d016537c /vp9/decoder | |
parent | c27bdb9bc1d8313daee99e46955361544109192f (diff) | |
parent | d35df2d8eaa74d7f9640f380f23e057fd7d83c35 (diff) | |
download | libvpx-0cca5dd8d7bbeb001544d81ccf2112d9f52e7f87.tar libvpx-0cca5dd8d7bbeb001544d81ccf2112d9f52e7f87.tar.gz libvpx-0cca5dd8d7bbeb001544d81ccf2112d9f52e7f87.tar.bz2 libvpx-0cca5dd8d7bbeb001544d81ccf2112d9f52e7f87.zip |
Merge "High-level hooks for Profile 2 (10/12 bit)"
Diffstat (limited to 'vp9/decoder')
-rw-r--r-- | vp9/decoder/vp9_decodeframe.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index 0b0b41e75..a9af86d33 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -1009,10 +1009,11 @@ static void error_handler(void *data) { vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, "Truncated packet"); } -#define RESERVED \ - if (vp9_rb_read_bit(rb)) \ - vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, \ - "Reserved bit must be unset") +static BITSTREAM_PROFILE read_profile(struct vp9_read_bit_buffer *rb) { + int profile = vp9_rb_read_bit(rb); + profile |= vp9_rb_read_bit(rb) << 1; + return (BITSTREAM_PROFILE) profile; +} static size_t read_uncompressed_header(VP9Decoder *pbi, struct vp9_read_bit_buffer *rb) { @@ -1026,8 +1027,10 @@ static size_t read_uncompressed_header(VP9Decoder *pbi, vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, "Invalid frame marker"); - cm->version = vp9_rb_read_bit(rb); - RESERVED; + cm->profile = read_profile(rb); + if (cm->profile >= MAX_PROFILES) + vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, + "Unsupported bitstream profile"); cm->show_existing_frame = vp9_rb_read_bit(rb); if (cm->show_existing_frame) { @@ -1052,11 +1055,12 @@ static size_t read_uncompressed_header(VP9Decoder *pbi, if (cm->frame_type == KEY_FRAME) { check_sync_code(cm, rb); - + if (cm->profile > PROFILE_1) + cm->bit_depth = vp9_rb_read_bit(rb) ? BITS_12 : BITS_10; cm->color_space = (COLOR_SPACE)vp9_rb_read_literal(rb, 3); if (cm->color_space != SRGB) { vp9_rb_read_bit(rb); // [16,235] (including xvycc) vs [0,255] range - if (cm->version == 1) { + if (cm->profile >= PROFILE_1) { cm->subsampling_x = vp9_rb_read_bit(rb); cm->subsampling_y = vp9_rb_read_bit(rb); vp9_rb_read_bit(rb); // has extra plane @@ -1064,7 +1068,7 @@ static size_t read_uncompressed_header(VP9Decoder *pbi, cm->subsampling_y = cm->subsampling_x = 1; } } else { - if (cm->version == 1) { + if (cm->profile >= PROFILE_1) { cm->subsampling_y = cm->subsampling_x = 0; vp9_rb_read_bit(rb); // has extra plane } else { |