Upstream version 10.38.208.0
[platform/framework/web/crosswalk.git] / src / third_party / libvpx / source / libvpx / vp9 / decoder / vp9_decodeframe.c
index 28c674a..debe22d 100644 (file)
@@ -627,12 +627,16 @@ static void resize_context_buffers(VP9_COMMON *cm, int width, int height) {
                        "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");
+                           "Failed to allocate context buffers");
     } else {
       vp9_set_mb_mi(cm, width, height);
     }