]> granicus.if.org Git - libvpx/commitdiff
Check the new mv diff in discount_newmv_test()
authorAngie Chiang <angiebird@google.com>
Thu, 7 Feb 2019 02:21:07 +0000 (18:21 -0800)
committerAngie Chiang <angiebird@google.com>
Wed, 13 Feb 2019 19:10:48 +0000 (11:10 -0800)
Change-Id: I38c5d4de93bebfd3f46bcc01716a0cc4a76af950

vp9/encoder/vp9_rdopt.c

index 87b7f1a7d933e82b846cc5bd81847e8b3ab919c4..a9c2c32d0ba801de361d8a99a7688ac25e581a26 100644 (file)
@@ -2555,8 +2555,15 @@ static int discount_newmv_test(const VP9_COMP *cpi, int this_mode,
         tpl_frame
             .mv_mode_arr[gf_rf_idx][tpl_mi_row * tpl_frame.stride + tpl_mi_col];
     if (mv_mode == NEW_MV_MODE) {
-      // TODO(angiebird): Compare this_mv with the motion field.
-      return 1;
+      int_mv tpl_new_mv = *get_pyramid_mv(&tpl_frame, gf_rf_idx, cpi->tpl_bsize,
+                                          tpl_mi_row, tpl_mi_col);
+      int row_diff = abs(tpl_new_mv.as_mv.row - this_mv.as_mv.row);
+      int col_diff = abs(tpl_new_mv.as_mv.col - this_mv.as_mv.col);
+      if (VPXMAX(row_diff, col_diff) <= 8) {
+        return 1;
+      } else {
+        return 0;
+      }
     } else {
       return 0;
     }