ref: b43b4fe3a23c49148d8a3f8efacc6b9ed280f210
parent: 99813843efa77a68415106c108da152ff59bfef3
parent: 423e8a9727b25d54de24630f9c042fd5bddf7c8d
author: Yaowu Xu <[email protected]>
date: Fri Jul 25 04:49:39 EDT 2014
Merge "Fix allocation of context buffers on frame resize"
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -627,9 +627,13 @@
"Width and height beyond allowed size.");
#endif
if (cm->width != width || cm->height != height) {
+ const int aligned_width = ALIGN_POWER_OF_TWO(width, MI_SIZE_LOG2);
+ const int aligned_height = ALIGN_POWER_OF_TWO(height, MI_SIZE_LOG2);
+
// Change in frame size (assumption: color format does not change).
if (cm->width == 0 || cm->height == 0 ||
- width * height > cm->width * cm->height) {
+ aligned_width > cm->width ||
+ aligned_width * aligned_height > cm->width * cm->height) {
if (vp9_alloc_context_buffers(cm, width, height))
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate frame buffers");