Revert "[NORMATIVE] Extend full-pixel motion vectors to 12 bits" This reverts commit f552a3172600aa2e8569f458ada41f389ac28943. Change-Id: I0c88ee9a6dfac41439fe52982a7cb802ad1fddd8
diff --git a/av1/common/entropymv.h b/av1/common/entropymv.h index 5f5b108..be3aefc 100644 --- a/av1/common/entropymv.h +++ b/av1/common/entropymv.h
@@ -71,7 +71,7 @@ #define MV_MAX ((1 << MV_MAX_BITS) - 1) #define MV_VALS ((MV_MAX << 1) + 1) -#define MV_IN_USE_BITS 15 +#define MV_IN_USE_BITS 14 #define MV_UPP ((1 << MV_IN_USE_BITS) - 1) #define MV_LOW (-(1 << MV_IN_USE_BITS))
diff --git a/av1/common/mv.h b/av1/common/mv.h index cd341cb..5f218f8 100644 --- a/av1/common/mv.h +++ b/av1/common/mv.h
@@ -318,12 +318,6 @@ mv->row = clamp(mv->row, min_row, max_row); } -static INLINE void clamp_mv32(MV32 *mv, int min_col, int max_col, int min_row, - int max_row) { - mv->col = clamp(mv->col, min_col, max_col); - mv->row = clamp(mv->row, min_row, max_row); -} - static INLINE int mv_has_subpel(const MV *mv) { return (mv->row & SUBPEL_MASK) || (mv->col & SUBPEL_MASK); }
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c index 5510ad5..1941038 100644 --- a/av1/common/reconinter.c +++ b/av1/common/reconinter.c
@@ -781,8 +781,8 @@ int p_row, int plane, enum mv_precision precision, int x, int y, const MACROBLOCKD *xd, int can_use_previous) { const int is_q4 = precision == MV_PRECISION_Q4; - const MV32 mv_q4 = { is_q4 ? src_mv->row : src_mv->row * 2, - is_q4 ? src_mv->col : src_mv->col * 2 }; + const MV mv_q4 = { is_q4 ? src_mv->row : src_mv->row * 2, + is_q4 ? src_mv->col : src_mv->col * 2 }; MV32 mv = av1_scale_mv(&mv_q4, x, y, sf); mv.col += SCALE_EXTRA_OFF; mv.row += SCALE_EXTRA_OFF; @@ -809,8 +809,8 @@ enum mv_precision precision, int x, int y, const MACROBLOCKD *xd, int can_use_previous) { const int is_q4 = precision == MV_PRECISION_Q4; - const MV32 mv_q4 = { is_q4 ? src_mv->row : src_mv->row * 2, - is_q4 ? src_mv->col : src_mv->col * 2 }; + const MV mv_q4 = { is_q4 ? src_mv->row : src_mv->row * 2, + is_q4 ? src_mv->col : src_mv->col * 2 }; MV32 mv = av1_scale_mv(&mv_q4, x, y, sf); mv.col += SCALE_EXTRA_OFF; mv.row += SCALE_EXTRA_OFF; @@ -1022,7 +1022,7 @@ xs = sf->x_step_q4; ys = sf->y_step_q4; } else { - const MV32 mv_q4 = clamp_mv_to_umv_border_sb( + const MV mv_q4 = clamp_mv_to_umv_border_sb( xd, &mv, bw, bh, pd->subsampling_x, pd->subsampling_y); xs = ys = SCALE_SUBPEL_SHIFTS; subpel_x = (mv_q4.col & SUBPEL_MASK) << SCALE_EXTRA_BITS; @@ -1105,7 +1105,7 @@ subpel_params[ref].xs = sf->x_step_q4; subpel_params[ref].ys = sf->y_step_q4; } else { - const MV32 mv_q4 = clamp_mv_to_umv_border_sb( + const MV mv_q4 = clamp_mv_to_umv_border_sb( xd, &mv, bw, bh, pd->subsampling_x, pd->subsampling_y); subpel_params[ref].subpel_x = (mv_q4.col & SUBPEL_MASK) << SCALE_EXTRA_BITS; @@ -1952,7 +1952,7 @@ xs = sf->x_step_q4; ys = sf->y_step_q4; } else { - const MV32 mv_q4 = clamp_mv_to_umv_border_sb( + const MV mv_q4 = clamp_mv_to_umv_border_sb( xd, &mv, bw, bh, pd->subsampling_x, pd->subsampling_y); xs = ys = SCALE_SUBPEL_SHIFTS; subpel_x = (mv_q4.col & SUBPEL_MASK) << SCALE_EXTRA_BITS;
diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h index d5475d3..1b53338 100644 --- a/av1/common/reconinter.h +++ b/av1/common/reconinter.h
@@ -198,9 +198,9 @@ int p_row, int ref, MACROBLOCKD *xd, int can_use_previous); // TODO(jkoleszar): yet another mv clamping function :-( -static INLINE MV32 clamp_mv_to_umv_border_sb(const MACROBLOCKD *xd, - const MV *src_mv, int bw, int bh, - int ss_x, int ss_y) { +static INLINE MV clamp_mv_to_umv_border_sb(const MACROBLOCKD *xd, + const MV *src_mv, int bw, int bh, + int ss_x, int ss_y) { // If the MV points so far into the UMV border that no visible pixels // are used for reconstruction, the subpel part of the MV can be // discarded and the MV limited to 16 pixels with equivalent results. @@ -208,15 +208,15 @@ const int spel_right = spel_left - SUBPEL_SHIFTS; const int spel_top = (AOM_INTERP_EXTEND + bh) << SUBPEL_BITS; const int spel_bottom = spel_top - SUBPEL_SHIFTS; - MV32 clamped_mv = { (int32_t)(src_mv->row * (1 << (1 - ss_y))), - (int32_t)(src_mv->col * (1 << (1 - ss_x))) }; + MV clamped_mv = { (int16_t)(src_mv->row * (1 << (1 - ss_y))), + (int16_t)(src_mv->col * (1 << (1 - ss_x))) }; assert(ss_x <= 1); assert(ss_y <= 1); - clamp_mv32(&clamped_mv, xd->mb_to_left_edge * (1 << (1 - ss_x)) - spel_left, - xd->mb_to_right_edge * (1 << (1 - ss_x)) + spel_right, - xd->mb_to_top_edge * (1 << (1 - ss_y)) - spel_top, - xd->mb_to_bottom_edge * (1 << (1 - ss_y)) + spel_bottom); + clamp_mv(&clamped_mv, xd->mb_to_left_edge * (1 << (1 - ss_x)) - spel_left, + xd->mb_to_right_edge * (1 << (1 - ss_x)) + spel_right, + xd->mb_to_top_edge * (1 << (1 - ss_y)) - spel_top, + xd->mb_to_bottom_edge * (1 << (1 - ss_y)) + spel_bottom); return clamped_mv; }
diff --git a/av1/common/scale.c b/av1/common/scale.c index 4750fe7..e7e53b2 100644 --- a/av1/common/scale.c +++ b/av1/common/scale.c
@@ -53,7 +53,7 @@ } // Note: x and y are integer precision, mvq4 is q4 precision. -MV32 av1_scale_mv(const MV32 *mvq4, int x, int y, +MV32 av1_scale_mv(const MV *mvq4, int x, int y, const struct scale_factors *sf) { const int x_off_q4 = scaled_x(x << SUBPEL_BITS, sf); const int y_off_q4 = scaled_y(y << SUBPEL_BITS, sf);
diff --git a/av1/common/scale.h b/av1/common/scale.h index 7db2ac2..5f02fdb 100644 --- a/av1/common/scale.h +++ b/av1/common/scale.h
@@ -40,7 +40,7 @@ aom_highbd_convolve_fn_t highbd_convolve[2][2][2]; }; -MV32 av1_scale_mv(const MV32 *mv, int x, int y, const struct scale_factors *sf); +MV32 av1_scale_mv(const MV *mv, int x, int y, const struct scale_factors *sf); void av1_setup_scale_factors_for_frame(struct scale_factors *sf, int other_w, int other_h, int this_w, int this_h);