shithub: libvpx

Download patch

ref: 4c79c104168ce59a4b2bc352b743d4de9490b6d8
parent: f9ffc19ecb4e1e4a22cd00895614c441d8c28451
parent: b3a42feb0cdd51daa09b06ce0bb49c030cabcc65
author: Angie Chiang <angiebird@google.com>
date: Wed Sep 18 17:52:06 EDT 2019

Merge "Move vp9_alloc_motion_field_info"

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -7133,12 +7133,6 @@
 
   // 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,
@@ -7469,6 +7463,19 @@
     cpi->kmeans_data_stride = mi_cols;
     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 &&
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2499,7 +2499,7 @@
   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 =