]> granicus.if.org Git - libvpx/commitdiff
Allocate memory for mv_mode_arr[]
authorAngie Chiang <angiebird@google.com>
Tue, 29 Jan 2019 23:36:38 +0000 (15:36 -0800)
committerAngie Chiang <angiebird@google.com>
Tue, 29 Jan 2019 23:36:38 +0000 (15:36 -0800)
Change-Id: Ib9fdf65e263dbaace8d4c86766eba2c6f35f652b

vp9/encoder/vp9_encoder.c

index eaeb3d96e62aea77a9fe4dda422592efa34eefad..a6117b1903d351558f8ba916dacff0a059c061b6 100644 (file)
@@ -2583,6 +2583,7 @@ void vp9_remove_compressor(VP9_COMP *cpi) {
       for (sqr_bsize = 0; sqr_bsize < SQUARE_BLOCK_SIZES; ++sqr_bsize) {
         vpx_free(cpi->tpl_stats[frame].pyramid_mv_arr[rf_idx][sqr_bsize]);
       }
+      vpx_free(cpi->tpl_stats[frame].mv_mode_arr[rf_idx]);
     }
 #endif
     vpx_free(cpi->tpl_stats[frame].tpl_stats_ptr);
@@ -6783,6 +6784,11 @@ static void init_tpl_buffer(VP9_COMP *cpi) {
                 sizeof(
                     *cpi->tpl_stats[frame].pyramid_mv_arr[rf_idx][sqr_bsize])));
       }
+      vpx_free(cpi->tpl_stats[frame].mv_mode_arr[rf_idx]);
+      CHECK_MEM_ERROR(
+          cm, cpi->tpl_stats[frame].mv_mode_arr[rf_idx],
+          vpx_calloc(mi_rows * mi_cols * 4,
+                     sizeof(*cpi->tpl_stats[frame].mv_mode_arr[rf_idx])));
     }
 #endif
     vpx_free(cpi->tpl_stats[frame].tpl_stats_ptr);