summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
authorAlex Converse <aconverse@google.com>2014-09-09 12:28:37 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2014-09-09 12:28:37 -0700
commitf353da9374597341a6a5f8870943b6a08a6e148f (patch)
treee7a3c53f0323c5a0e7d563616cff3288c6b22d28 /vp9
parent619951af97b1d4902ff90ad254b3f39ad6f9e142 (diff)
parentb932c6c5dd1b6c510877e0d42d500470fed5e56d (diff)
downloadlibvpx-f353da9374597341a6a5f8870943b6a08a6e148f.tar
libvpx-f353da9374597341a6a5f8870943b6a08a6e148f.tar.gz
libvpx-f353da9374597341a6a5f8870943b6a08a6e148f.tar.bz2
libvpx-f353da9374597341a6a5f8870943b6a08a6e148f.zip
Merge "BITSTREAM CLARIFICATION: Forbid referencing across color spaces."
Diffstat (limited to 'vp9')
-rw-r--r--vp9/decoder/vp9_decodeframe.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c
index a9c03f0cc..aecd906f2 100644
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -668,6 +668,15 @@ static void setup_frame_size(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate frame buffer");
}
+ cm->frame_bufs[cm->new_fb_idx].buf.bit_depth = (unsigned int)cm->bit_depth;
+}
+
+static INLINE int valid_ref_frame_img_fmt(vpx_bit_depth_t ref_bit_depth,
+ int ref_xss, int ref_yss,
+ vpx_bit_depth_t this_bit_depth,
+ int this_xss, int this_yss) {
+ return ref_bit_depth == this_bit_depth && ref_xss == this_xss &&
+ ref_yss == this_yss;
}
static void setup_frame_size_with_refs(VP9_COMMON *cm,
@@ -707,6 +716,18 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm,
if (!has_valid_ref_frame)
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
"Referenced frame has invalid size");
+ for (i = 0; i < REFS_PER_FRAME; ++i) {
+ RefBuffer *const ref_frame = &cm->frame_refs[i];
+ if (!valid_ref_frame_img_fmt(
+ ref_frame->buf->bit_depth,
+ ref_frame->buf->uv_crop_width < ref_frame->buf->y_crop_width,
+ ref_frame->buf->uv_crop_height < ref_frame->buf->y_crop_height,
+ cm->bit_depth,
+ cm->subsampling_x,
+ cm->subsampling_y))
+ vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
+ "Referenced frame has incompatible color space");
+ }
resize_context_buffers(cm, width, height);
setup_display_size(cm, rb);
@@ -723,6 +744,7 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm,
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate frame buffer");
}
+ cm->frame_bufs[cm->new_fb_idx].buf.bit_depth = (unsigned int)cm->bit_depth;
}
static void setup_tile_info(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) {