ref: 4d5c914809625031d4ca91302849543f8f06971d
parent: c72f0ee35b1de7258b81f9fefb2d990bfdd701d6
parent: 7b2177ce9ca1c82d992decd75ca6de878ecc785f
author: Adrian Grange <[email protected]>
date: Thu Aug 21 11:25:34 EDT 2014
Merge "Fix bug 837 (Part 2): Handle increase in frame width"
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -627,11 +627,12 @@
"Width and height beyond allowed size.");
#endif
if (cm->width != width || cm->height != height) {
- const int new_rows = ALIGN_POWER_OF_TWO(height,
- MI_SIZE_LOG2) >> MI_SIZE_LOG2;
- const int new_cols = ALIGN_POWER_OF_TWO(width,
- MI_SIZE_LOG2) >> MI_SIZE_LOG2;
- if (calc_mi_size(new_rows) * calc_mi_size(new_cols) > cm->mi_alloc_size) {
+ const int new_mi_rows =
+ calc_mi_size(ALIGN_POWER_OF_TWO(height, MI_SIZE_LOG2) >> MI_SIZE_LOG2);
+ const int new_mi_cols =
+ calc_mi_size(ALIGN_POWER_OF_TWO(width, MI_SIZE_LOG2) >> MI_SIZE_LOG2);
+ if (new_mi_cols > cm->mi_stride ||
+ (new_mi_rows * new_mi_cols > cm->mi_alloc_size)) {
if (vp9_alloc_context_buffers(cm, width, height))
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate context buffers");