shithub: libvpx

Download patch

ref: 23f8b831776824e2b95db70979addd1e4623b746
parent: c4c5c1d7e49d8a63e1f5f102587ec1951b368f4f
author: Angie Chiang <angiebird@google.com>
date: Sat Dec 22 11:42:28 EST 2018

Build pyramid motion field

Change-Id: I43fd61f7946a8a96d444dab5e94a9b01483ffab7

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -6188,6 +6188,17 @@
   qsort(cpi->feature_score_loc_sort, fs_loc_sort_size,
         sizeof(*cpi->feature_score_loc_sort), compare_feature_score);
 
+  for (mi_row = 0; mi_row < cm->mi_rows; mi_row += mi_height) {
+    for (mi_col = 0; mi_col < cm->mi_cols; mi_col += mi_width) {
+      int rf_idx;
+      for (rf_idx = 0; rf_idx < 3; ++rf_idx) {
+        TplDepStats *tpl_stats =
+            &tpl_frame->tpl_stats_ptr[mi_row * tpl_frame->stride + mi_col];
+        tpl_stats->ready[rf_idx] = 0;
+      }
+    }
+  }
+
 #if CHANGE_MV_SEARCH_ORDER
 #if !USE_PQSORT
   for (i = 0; i < fs_loc_sort_size; ++i) {
@@ -6253,6 +6264,9 @@
   const int mi_height = num_8x8_blocks_high_lookup[bsize];
   const int mi_width = num_8x8_blocks_wide_lookup[bsize];
   int64_t recon_error, sse;
+#if CONFIG_NON_GREEDY_MV
+  int square_block_idx;
+#endif
 
   // Setup scaling factor
 #if CONFIG_VP9_HIGHBITDEPTH
@@ -6293,7 +6307,11 @@
   vp9_frame_init_quantizer(cpi);
 
 #if CONFIG_NON_GREEDY_MV
-  build_motion_field(cpi, xd, frame_idx, ref_frame, bsize);
+  for (square_block_idx = 0; square_block_idx < SQUARE_BLOCK_SIZES;
+       ++square_block_idx) {
+    BLOCK_SIZE square_bsize = square_block_idx_to_bsize(square_block_idx);
+    build_motion_field(cpi, xd, frame_idx, ref_frame, square_bsize);
+  }
 #endif
 
   for (mi_row = 0; mi_row < cm->mi_rows; mi_row += mi_height) {
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -342,6 +342,24 @@
   return -1;
 }
 
+static INLINE BLOCK_SIZE square_block_idx_to_bsize(int square_block_idx) {
+  if (square_block_idx == 0) {
+    return BLOCK_4X4;
+  }
+  if (square_block_idx == 1) {
+    return BLOCK_8X8;
+  }
+  if (square_block_idx == 2) {
+    return BLOCK_16X16;
+  }
+  if (square_block_idx == 3) {
+    return BLOCK_32X32;
+  }
+  printf("ERROR: invalid square_block_idx\n");
+  assert(0);
+  return BLOCK_INVALID;
+}
+
 static INLINE int_mv *get_pyramid_mv(const TplDepFrame *tpl_frame, int rf_idx,
                                      BLOCK_SIZE bsize, int mi_row, int mi_col) {
   return &tpl_frame->pyramid_mv_arr[rf_idx][get_square_block_idx(bsize)]