shithub: libvpx

Download patch

ref: 26ed1ed4f0e621c178a1dd93de07a0431499ebe4
parent: 829d1b2098b54664e793723793ac21ddc905ab5c
author: Wan-Teh Chang <wtc@google.com>
date: Wed Jul 11 14:52:03 EDT 2018

Backport libaom bug fixes.

libaom commit 80a5b09337a80093e1e7ae5eb540020a22949805:
dec_free_mi: Reset cm->mi_alloc_size.

libaom commit fb0dd0bb80fc95ef016f1421b105a52fffa32816:
Clear cm->width and cm->height on alloc failure.

libaom commit ccb27264089a8cfa1334391ebbcb6a11b8dff442:
Misc. resize fixes along with the resize test
Note: only the change to enc_free_mi in av1/encoder/encoder.c
is merged.

Change-Id: I602813230d40125e59608fa013085dca3e160c33

--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -1148,9 +1148,15 @@
     // Allocations in vp9_alloc_context_buffers() depend on individual
     // dimensions as well as the overall size.
     if (new_mi_cols > cm->mi_cols || new_mi_rows > cm->mi_rows) {
-      if (vp9_alloc_context_buffers(cm, width, height))
+      if (vp9_alloc_context_buffers(cm, width, height)) {
+        // The cm->mi_* values have been cleared and any existing context
+        // buffers have been freed. Clear cm->width and cm->height to be
+        // consistent and to force a realloc next time.
+        cm->width = 0;
+        cm->height = 0;
         vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
                            "Failed to allocate context buffers");
+      }
     } else {
       vp9_set_mb_mi(cm, width, height);
     }
--- a/vp9/decoder/vp9_decoder.c
+++ b/vp9/decoder/vp9_decoder.c
@@ -69,6 +69,7 @@
   cm->mip = NULL;
   vpx_free(cm->mi_grid_base);
   cm->mi_grid_base = NULL;
+  cm->mi_alloc_size = 0;
 }
 
 VP9Decoder *vp9_decoder_create(BufferPool *const pool) {
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -843,6 +843,7 @@
   cm->mi_grid_base = NULL;
   vpx_free(cm->prev_mi_grid_base);
   cm->prev_mi_grid_base = NULL;
+  cm->mi_alloc_size = 0;
 }
 
 static void vp9_swap_mi_and_prev_mi(VP9_COMMON *cm) {