summaryrefslogtreecommitdiff
path: root/vp9/decoder
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2013-06-07 11:41:02 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2013-06-07 11:41:02 -0700
commit229f9a5f0942a7902bceb0d6a4149e17c9293447 (patch)
tree753d7a1a769bf880f0d0635788a4a387c0a8f832 /vp9/decoder
parent8c6bff6c0c819b68c8d24c82b0935e79924f063d (diff)
parente5b956f620ffc3b84c71b88e41e67c15095f7c1c (diff)
downloadlibvpx-229f9a5f0942a7902bceb0d6a4149e17c9293447.tar
libvpx-229f9a5f0942a7902bceb0d6a4149e17c9293447.tar.gz
libvpx-229f9a5f0942a7902bceb0d6a4149e17c9293447.tar.bz2
libvpx-229f9a5f0942a7902bceb0d6a4149e17c9293447.zip
Merge "Add bits for colorspace, profile" into experimental
Diffstat (limited to 'vp9/decoder')
-rw-r--r--vp9/decoder/vp9_decodframe.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index 3eb17b065..0d7ffaa80 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -916,6 +916,11 @@ static void error_handler(void *data, int bit_offset) {
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")
+
size_t read_uncompressed_header(VP9D_COMP *pbi,
struct vp9_read_bit_buffer *rb) {
VP9_COMMON *const cm = &pbi->common;
@@ -923,12 +928,17 @@ size_t read_uncompressed_header(VP9D_COMP *pbi,
int scaling_active, i;
cm->last_frame_type = cm->frame_type;
+ if (vp9_rb_read_literal(rb, 2) != 0x2)
+ vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
+ "Invalid frame marker");
+
+ cm->version = vp9_rb_read_bit(rb);
+ RESERVED;
+
cm->frame_type = (FRAME_TYPE) vp9_rb_read_bit(rb);
- cm->version = vp9_rb_read_literal(rb, 3);
cm->show_frame = vp9_rb_read_bit(rb);
scaling_active = vp9_rb_read_bit(rb);
- cm->subsampling_x = vp9_rb_read_bit(rb);
- cm->subsampling_y = vp9_rb_read_bit(rb);
+ RESERVED;
if (cm->frame_type == KEY_FRAME) {
if (vp9_rb_read_literal(rb, 8) != SYNC_CODE_0 ||
@@ -937,6 +947,14 @@ size_t read_uncompressed_header(VP9D_COMP *pbi,
vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
"Invalid frame sync code");
}
+ vp9_rb_read_literal(rb, 3); // colorspace
+ if (cm->version == 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
+ } else {
+ cm->subsampling_y = cm->subsampling_x = 1;
+ }
}
setup_frame_size(pbi, scaling_active, rb);