Consolidate conversion between full and half mv
Change-Id: I8a2e88bb1fa5506fff22655c5462bbf7a81e70ca
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 33553b5..51bf97f 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -699,10 +699,10 @@
}
static INLINE int mv_check_bounds(const MvLimits *mv_limits, const MV *mv) {
- return (mv->row >> 3) < mv_limits->row_min ||
- (mv->row >> 3) > mv_limits->row_max ||
- (mv->col >> 3) < mv_limits->col_min ||
- (mv->col >> 3) > mv_limits->col_max;
+ return GET_MV_RAWPEL(mv->row) < mv_limits->row_min ||
+ GET_MV_RAWPEL(mv->row) > mv_limits->row_max ||
+ GET_MV_RAWPEL(mv->col) < mv_limits->col_min ||
+ GET_MV_RAWPEL(mv->col) > mv_limits->col_max;
}
static INLINE PREDICTION_MODE get_single_mode(PREDICTION_MODE this_mode,
diff --git a/av1/encoder/tpl_model.c b/av1/encoder/tpl_model.c
index 2d656b1..e6f9283 100644
--- a/av1/encoder/tpl_model.c
+++ b/av1/encoder/tpl_model.c
@@ -541,10 +541,10 @@
&tpl_frame[tpl_frame[frame_idx].ref_map_index[ref_frame_index]];
TplDepStats *ref_stats_ptr = ref_tpl_frame->tpl_stats_ptr;
- const int ref_pos_row =
- mi_row * MI_SIZE + (tpl_stats_ptr->mv[ref_frame_index].as_mv.row >> 3);
- const int ref_pos_col =
- mi_col * MI_SIZE + (tpl_stats_ptr->mv[ref_frame_index].as_mv.col >> 3);
+ const FULLPEL_MV full_mv =
+ get_fullmv_from_mv(&tpl_stats_ptr->mv[ref_frame_index].as_mv);
+ const int ref_pos_row = mi_row * MI_SIZE + full_mv.row;
+ const int ref_pos_col = mi_col * MI_SIZE + full_mv.col;
const int bw = 4 << mi_size_wide_log2[bsize];
const int bh = 4 << mi_size_high_log2[bsize];