]> granicus.if.org Git - libvpx/commitdiff
Move vp9_alloc_motion_field_info
authorAngie Chiang <angiebird@google.com>
Wed, 18 Sep 2019 01:11:01 +0000 (18:11 -0700)
committerAngie Chiang <angiebird@google.com>
Wed, 18 Sep 2019 19:20:51 +0000 (12:20 -0700)
Move vp9_alloc_motion_field_info out of init_tpl_buffer, so that
vp9_alloc_motion_field_info will be called even though there is
not alternate reference frame.

This fix the crash with shields_720p50 at bitrate 2000

Change-Id: If2877e8d0b8a834556be12d239b7b58ad1fc8c73

vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_rdopt.c

index 25464b3b8d89aff0886e2a3f523bb4607a4bb56b..36de9a400c54c4db0fe5e530afe5953f6c12b57d 100644 (file)
@@ -7140,12 +7140,6 @@ static void init_tpl_buffer(VP9_COMP *cpi) {
 
   // TODO(angiebird): This probably needs further modifications to support
   // frame scaling later on.
-  Status status = vp9_alloc_motion_field_info(
-      &cpi->motion_field_info, MAX_ARF_GOP_SIZE, mi_rows, mi_cols);
-  if (status == STATUS_FAILED) {
-    vpx_internal_error(&(cm)->error, VPX_CODEC_MEM_ERROR,
-                       "vp9_alloc_motion_field_info failed");
-  }
 
   if (cpi->feature_score_loc_alloc == 0) {
     // The smallest block size of motion field is 4x4, but the mi_unit is 8x8,
@@ -7477,6 +7471,19 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
     cpi->kmeans_data_arr_alloc = 1;
   }
 
+#if CONFIG_NON_GREEDY_MV
+  {
+    const int mi_cols = mi_cols_aligned_to_sb(cm->mi_cols);
+    const int mi_rows = mi_cols_aligned_to_sb(cm->mi_rows);
+    Status status = vp9_alloc_motion_field_info(
+        &cpi->motion_field_info, MAX_ARF_GOP_SIZE, mi_rows, mi_cols);
+    if (status == STATUS_FAILED) {
+      vpx_internal_error(&(cm)->error, VPX_CODEC_MEM_ERROR,
+                         "vp9_alloc_motion_field_info failed");
+    }
+  }
+#endif  // CONFIG_NON_GREEDY_MV
+
   if (gf_group_index == 1 &&
       cpi->twopass.gf_group.update_type[gf_group_index] == ARF_UPDATE &&
       cpi->sf.enable_tpl_model) {
index 1104c20bb3e4741445ba31af5fe103469b40bd73..fa7472ca612a20755db96d825f1aa3bf094cec32 100644 (file)
@@ -2499,7 +2499,7 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
   int gf_group_idx = cpi->twopass.gf_group.index;
   int gf_rf_idx = ref_frame_to_gf_rf_idx(ref);
   BLOCK_SIZE square_bsize = get_square_block_size(bsize);
-  int_mv nb_full_mvs[NB_MVS_NUM];
+  int_mv nb_full_mvs[NB_MVS_NUM] = { 0 };
   MotionField *motion_field = vp9_motion_field_info_get_motion_field(
       &cpi->motion_field_info, gf_group_idx, gf_rf_idx, square_bsize);
   const int nb_full_mv_num =