From 1e12d19bbfbf4cc5a7ddce394b40f3ba00a4ec15 Mon Sep 17 00:00:00 2001 From: Angie Chiang Date: Wed, 6 Feb 2019 18:21:07 -0800 Subject: [PATCH] Check the new mv diff in discount_newmv_test() Change-Id: I38c5d4de93bebfd3f46bcc01716a0cc4a76af950 --- vp9/encoder/vp9_rdopt.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 87b7f1a7d..a9c2c32d0 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -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; } -- 2.40.0