int col_max = (mv->col >> 3) + MAX_FULL_PEL_VAL;
int row_max = (mv->row >> 3) + MAX_FULL_PEL_VAL;
- col_min = MAX(col_min, (MV_LOW >> 3) + 1);
- row_min = MAX(row_min, (MV_LOW >> 3) + 1);
- col_max = MIN(col_max, (MV_UPP >> 3) - 1);
- row_max = MIN(row_max, (MV_UPP >> 3) - 1);
+ col_min = VPXMAX(col_min, (MV_LOW >> 3) + 1);
+ row_min = VPXMAX(row_min, (MV_LOW >> 3) + 1);
+ col_max = VPXMIN(col_max, (MV_UPP >> 3) - 1);
+ row_max = VPXMIN(row_max, (MV_UPP >> 3) - 1);
// Get intersection of UMV window and valid MV window to reduce # of checks
// in diamond search.
int vp10_init_search_range(int size) {
int sr = 0;
// Minimum search size no matter what the passed in value.
- size = MAX(16, size);
+ size = VPXMAX(16, size);
while ((size << sr) < MAX_FULL_PEL_VAL)
sr++;
- sr = MIN(sr, MAX_MVSEARCH_STEPS - 2);
+ sr = VPXMIN(sr, MAX_MVSEARCH_STEPS - 2);
return sr;
}
int br = bestmv->row * 8; \
int bc = bestmv->col * 8; \
int hstep = 4; \
- const int minc = MAX(x->mv_col_min * 8, ref_mv->col - MV_MAX); \
- const int maxc = MIN(x->mv_col_max * 8, ref_mv->col + MV_MAX); \
- const int minr = MAX(x->mv_row_min * 8, ref_mv->row - MV_MAX); \
- const int maxr = MIN(x->mv_row_max * 8, ref_mv->row + MV_MAX); \
+ const int minc = VPXMAX(x->mv_col_min * 8, ref_mv->col - MV_MAX); \
+ const int maxc = VPXMIN(x->mv_col_max * 8, ref_mv->col + MV_MAX); \
+ const int minr = VPXMAX(x->mv_row_min * 8, ref_mv->row - MV_MAX); \
+ const int maxr = VPXMIN(x->mv_row_max * 8, ref_mv->row + MV_MAX); \
int tr = br; \
int tc = bc; \
\
int bc = bestmv->col * 8;
int hstep = 4;
int iter, round = 3 - forced_stop;
- const int minc = MAX(x->mv_col_min * 8, ref_mv->col - MV_MAX);
- const int maxc = MIN(x->mv_col_max * 8, ref_mv->col + MV_MAX);
- const int minr = MAX(x->mv_row_min * 8, ref_mv->row - MV_MAX);
- const int maxr = MIN(x->mv_row_max * 8, ref_mv->row + MV_MAX);
+ const int minc = VPXMAX(x->mv_col_min * 8, ref_mv->col - MV_MAX);
+ const int maxc = VPXMIN(x->mv_col_max * 8, ref_mv->col + MV_MAX);
+ const int minr = VPXMAX(x->mv_row_min * 8, ref_mv->row - MV_MAX);
+ const int maxr = VPXMIN(x->mv_row_max * 8, ref_mv->row + MV_MAX);
int tr = br;
int tc = bc;
const MV *search_step = search_step_table;
int use_mvcost,
const MV *center_mv,
MV *best_mv) {
- return vp10_hex_search(x, ref_mv, MAX(MAX_MVSEARCH_STEPS - 2, search_param),
- sad_per_bit, do_init_search, cost_list, vfp, use_mvcost,
- center_mv, best_mv);
+ return vp10_hex_search(
+ x, ref_mv, VPXMAX(MAX_MVSEARCH_STEPS - 2, search_param), sad_per_bit,
+ do_init_search, cost_list, vfp, use_mvcost, center_mv, best_mv);
}
int vp10_fast_dia_search(const MACROBLOCK *x,
int use_mvcost,
const MV *center_mv,
MV *best_mv) {
- return vp10_bigdia_search(x, ref_mv, MAX(MAX_MVSEARCH_STEPS - 2, search_param),
- sad_per_bit, do_init_search, cost_list, vfp,
- use_mvcost, center_mv, best_mv);
+ return vp10_bigdia_search(
+ x, ref_mv, VPXMAX(MAX_MVSEARCH_STEPS - 2, search_param), sad_per_bit,
+ do_init_search, cost_list, vfp, use_mvcost, center_mv, best_mv);
}
#undef CHECK_BETTER
best_sad = fn_ptr->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, ref_mv), in_what->stride) +
mvsad_err_cost(x, ref_mv, &fcenter_mv, sad_per_bit);
- start_row = MAX(-range, x->mv_row_min - ref_mv->row);
- start_col = MAX(-range, x->mv_col_min - ref_mv->col);
- end_row = MIN(range, x->mv_row_max - ref_mv->row);
- end_col = MIN(range, x->mv_col_max - ref_mv->col);
+ start_row = VPXMAX(-range, x->mv_row_min - ref_mv->row);
+ start_col = VPXMAX(-range, x->mv_col_min - ref_mv->col);
+ end_row = VPXMIN(range, x->mv_row_max - ref_mv->row);
+ end_col = VPXMIN(range, x->mv_col_max - ref_mv->col);
for (r = start_row; r <= end_row; ++r) {
for (c = start_col; c <= end_col; c += 4) {
{-1, 0}, {0, -1}, {0, 1}, {1, 0},
};
-unsigned int vp10_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x,
+unsigned int vp10_int_pro_motion_estimation(const VP10_COMP *cpi, MACROBLOCK *x,
BLOCK_SIZE bsize,
int mi_row, int mi_col) {
MACROBLOCKD *xd = &x->e_mbd;
/* do_refine: If last step (1-away) of n-step search doesn't pick the center
point as the best match, we will do a final 1-away diamond
refining search */
-int vp10_full_pixel_diamond(const VP9_COMP *cpi, MACROBLOCK *x,
+int vp10_full_pixel_diamond(const VP10_COMP *cpi, MACROBLOCK *x,
MV *mvp_full, int step_param,
int sadpb, int further_steps, int do_refine,
int *cost_list,
const MACROBLOCKD *const xd = &x->e_mbd;
const struct buf_2d *const what = &x->plane[0].src;
const struct buf_2d *const in_what = &xd->plane[0].pre[0];
- const int row_min = MAX(ref_mv->row - distance, x->mv_row_min);
- const int row_max = MIN(ref_mv->row + distance, x->mv_row_max);
- const int col_min = MAX(ref_mv->col - distance, x->mv_col_min);
- const int col_max = MIN(ref_mv->col + distance, x->mv_col_max);
+ const int row_min = VPXMAX(ref_mv->row - distance, x->mv_row_min);
+ const int row_max = VPXMIN(ref_mv->row + distance, x->mv_row_max);
+ const int col_min = VPXMAX(ref_mv->col - distance, x->mv_col_min);
+ const int col_max = VPXMIN(ref_mv->col + distance, x->mv_col_max);
const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
int best_sad = fn_ptr->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, ref_mv), in_what->stride) +
const MACROBLOCKD *const xd = &x->e_mbd;
const struct buf_2d *const what = &x->plane[0].src;
const struct buf_2d *const in_what = &xd->plane[0].pre[0];
- const int row_min = MAX(ref_mv->row - distance, x->mv_row_min);
- const int row_max = MIN(ref_mv->row + distance, x->mv_row_max);
- const int col_min = MAX(ref_mv->col - distance, x->mv_col_min);
- const int col_max = MIN(ref_mv->col + distance, x->mv_col_max);
+ const int row_min = VPXMAX(ref_mv->row - distance, x->mv_row_min);
+ const int row_max = VPXMIN(ref_mv->row + distance, x->mv_row_max);
+ const int col_min = VPXMAX(ref_mv->col - distance, x->mv_col_min);
+ const int col_max = VPXMIN(ref_mv->col + distance, x->mv_col_max);
const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
unsigned int best_sad = fn_ptr->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, ref_mv), in_what->stride) +
const MACROBLOCKD *const xd = &x->e_mbd;
const struct buf_2d *const what = &x->plane[0].src;
const struct buf_2d *const in_what = &xd->plane[0].pre[0];
- const int row_min = MAX(ref_mv->row - distance, x->mv_row_min);
- const int row_max = MIN(ref_mv->row + distance, x->mv_row_max);
- const int col_min = MAX(ref_mv->col - distance, x->mv_col_min);
- const int col_max = MIN(ref_mv->col + distance, x->mv_col_max);
+ const int row_min = VPXMAX(ref_mv->row - distance, x->mv_row_min);
+ const int row_max = VPXMIN(ref_mv->row + distance, x->mv_row_max);
+ const int col_min = VPXMAX(ref_mv->col - distance, x->mv_col_min);
+ const int col_max = VPXMIN(ref_mv->col + distance, x->mv_col_max);
const MV fcenter_mv = {center_mv->row >> 3, center_mv->col >> 3};
unsigned int best_sad = fn_ptr->sdf(what->buf, what->stride,
get_buf_from_mv(in_what, ref_mv), in_what->stride) +
return best_sad;
}
-int vp10_full_pixel_search(VP9_COMP *cpi, MACROBLOCK *x,
+int vp10_full_pixel_search(VP10_COMP *cpi, MACROBLOCK *x,
BLOCK_SIZE bsize, MV *mvp_full,
int step_param, int error_per_bit,
int *cost_list,