]> granicus.if.org Git - libvpx/commitdiff
Build pyramid motion field
authorAngie Chiang <angiebird@google.com>
Sun, 23 Dec 2018 00:42:28 +0000 (16:42 -0800)
committerAngie Chiang <angiebird@google.com>
Fri, 4 Jan 2019 01:53:14 +0000 (17:53 -0800)
Change-Id: I43fd61f7946a8a96d444dab5e94a9b01483ffab7

vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_encoder.h

index 88353e43a8cbd04555048df0bc989933cb206e0e..339aa4eed333bba19a70fd31d810bb9960540fd5 100644 (file)
@@ -6188,6 +6188,17 @@ static void build_motion_field(VP9_COMP *cpi, MACROBLOCKD *xd, int frame_idx,
   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 @@ static void mc_flow_dispenser(VP9_COMP *cpi, GF_PICTURE *gf_picture,
   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 @@ static void mc_flow_dispenser(VP9_COMP *cpi, GF_PICTURE *gf_picture,
   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) {
index e4175f6ed9fa9401192007d569e159b05af13614..18adfebfec6fba96e0edfb43471d8b5bfbee061d 100644 (file)
@@ -342,6 +342,24 @@ static INLINE int get_square_block_idx(BLOCK_SIZE bsize) {
   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)]