Commit 672c355a authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Replacing int_mv with MV.

Change-Id: Ifd432fa3741ba47102d298e0b348eb00f5a9ce53
parent f16b186b
......@@ -22,7 +22,7 @@
static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
int_mv *ref_mv,
const MV *ref_mv,
int_mv *dst_mv,
int mb_row,
int mb_col) {
......@@ -42,15 +42,14 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
(cpi->speed < 8 ? (cpi->speed > 5 ? 1 : 0) : 2);
step_param = MIN(step_param, (cpi->sf.max_step_search_steps - 2));
vp9_set_mv_search_range(x, &ref_mv->as_mv);
vp9_set_mv_search_range(x, ref_mv);
ref_full.as_mv.col = ref_mv->as_mv.col >> 3;
ref_full.as_mv.row = ref_mv->as_mv.row >> 3;
ref_full.as_mv.col = ref_mv->col >> 3;
ref_full.as_mv.row = ref_mv->row >> 3;
/*cpi->sf.search_method == HEX*/
best_err = vp9_hex_search(x, &ref_full.as_mv, step_param, x->errorperbit,
0, &v_fn_ptr,
0, &ref_mv->as_mv, &dst_mv->as_mv);
0, &v_fn_ptr, 0, ref_mv, &dst_mv->as_mv);
// Try sub-pixel MC
// if (bestsme > error_thresh && bestsme < INT_MAX)
......@@ -59,7 +58,7 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
unsigned int sse;
best_err = cpi->find_fractional_mv_step(
x,
&dst_mv->as_mv, &ref_mv->as_mv,
&dst_mv->as_mv, ref_mv,
cpi->common.allow_high_precision_mv,
x->errorperbit, &v_fn_ptr,
0, cpi->sf.subpel_iters_per_step, NULL, NULL,
......@@ -81,8 +80,8 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
return best_err;
}
static int do_16x16_motion_search(VP9_COMP *cpi, int_mv *ref_mv, int_mv *dst_mv,
int mb_row, int mb_col) {
static int do_16x16_motion_search(VP9_COMP *cpi, const int_mv *ref_mv,
int_mv *dst_mv, int mb_row, int mb_col) {
MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
unsigned int err, tmp_err;
......@@ -97,7 +96,8 @@ static int do_16x16_motion_search(VP9_COMP *cpi, int_mv *ref_mv, int_mv *dst_mv,
// Test last reference frame using the previous best mv as the
// starting point (best reference) for the search
tmp_err = do_16x16_motion_iteration(cpi, ref_mv, &tmp_mv, mb_row, mb_col);
tmp_err = do_16x16_motion_iteration(cpi, &ref_mv->as_mv, &tmp_mv,
mb_row, mb_col);
if (tmp_err < err) {
err = tmp_err;
dst_mv->as_int = tmp_mv.as_int;
......@@ -110,7 +110,7 @@ static int do_16x16_motion_search(VP9_COMP *cpi, int_mv *ref_mv, int_mv *dst_mv,
int_mv zero_ref_mv, tmp_mv;
zero_ref_mv.as_int = 0;
tmp_err = do_16x16_motion_iteration(cpi, &zero_ref_mv, &tmp_mv,
tmp_err = do_16x16_motion_iteration(cpi, &zero_ref_mv.as_mv, &tmp_mv,
mb_row, mb_col);
if (tmp_err < err) {
dst_mv->as_int = tmp_mv.as_int;
......
......@@ -23,7 +23,7 @@
// #define NEW_DIAMOND_SEARCH
void vp9_set_mv_search_range(MACROBLOCK *x, MV *mv) {
void vp9_set_mv_search_range(MACROBLOCK *x, const MV *mv) {
const int col_min = (mv->col >> 3) - MAX_FULL_PEL_VAL + (mv->col & 7 ? 1 : 0);
const int row_min = (mv->row >> 3) - MAX_FULL_PEL_VAL + (mv->row & 7 ? 1 : 0);
const int col_max = (mv->col >> 3) + MAX_FULL_PEL_VAL;
......@@ -1312,16 +1312,16 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
refining search */
int vp9_full_pixel_diamond(VP9_COMP *cpi, MACROBLOCK *x,
int_mv *mvp_full, int step_param,
MV *mvp_full, int step_param,
int sadpb, int further_steps,
int do_refine, vp9_variance_fn_ptr_t *fn_ptr,
int_mv *ref_mv, int_mv *dst_mv) {
const MV *ref_mv, int_mv *dst_mv) {
int_mv temp_mv;
int thissme, n, num00;
int bestsme = cpi->diamond_search_sad(x, &mvp_full->as_mv, &temp_mv.as_mv,
int bestsme = cpi->diamond_search_sad(x, mvp_full, &temp_mv.as_mv,
step_param, sadpb, &num00,
fn_ptr, x->nmvjointcost,
x->mvcost, &ref_mv->as_mv);
x->mvcost, ref_mv);
dst_mv->as_int = temp_mv.as_int;
n = num00;
......@@ -1338,10 +1338,10 @@ int vp9_full_pixel_diamond(VP9_COMP *cpi, MACROBLOCK *x,
if (num00) {
num00--;
} else {
thissme = cpi->diamond_search_sad(x, &mvp_full->as_mv, &temp_mv.as_mv,
thissme = cpi->diamond_search_sad(x, mvp_full, &temp_mv.as_mv,
step_param + n, sadpb, &num00,
fn_ptr, x->nmvjointcost, x->mvcost,
&ref_mv->as_mv);
ref_mv);
/* check to see if refining search is needed. */
if (num00 > (further_steps - n))
......@@ -1361,7 +1361,7 @@ int vp9_full_pixel_diamond(VP9_COMP *cpi, MACROBLOCK *x,
best_mv.as_int = dst_mv->as_int;
thissme = cpi->refining_search_sad(x, &best_mv.as_mv, sadpb, search_range,
fn_ptr, x->nmvjointcost, x->mvcost,
&ref_mv->as_mv);
ref_mv);
if (thissme < bestsme) {
bestsme = thissme;
......
......@@ -28,7 +28,7 @@
#define BORDER_MV_PIXELS_B16 (16 + VP9_INTERP_EXTEND)
void vp9_set_mv_search_range(MACROBLOCK *x, MV *mv);
void vp9_set_mv_search_range(MACROBLOCK *x, const MV *mv);
int vp9_mv_bit_cost(const MV *mv, const MV *ref,
const int *mvjcost, int *mvcost[2], int weight);
void vp9_init_dsmotion_compensation(MACROBLOCK *x, int stride);
......@@ -39,10 +39,10 @@ int vp9_init_search_range(struct VP9_COMP *cpi, int size);
// Runs sequence of diamond searches in smaller steps for RD
int vp9_full_pixel_diamond(struct VP9_COMP *cpi, MACROBLOCK *x,
int_mv *mvp_full, int step_param,
MV *mvp_full, int step_param,
int sadpb, int further_steps, int do_refine,
vp9_variance_fn_ptr_t *fn_ptr,
int_mv *ref_mv, int_mv *dst_mv);
const MV *ref_mv, int_mv *dst_mv);
int vp9_hex_search(MACROBLOCK *x,
MV *ref_mv,
......
......@@ -1742,7 +1742,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
int further_steps;
int thissme, bestsme = INT_MAX;
int sadpb = x->sadperbit4;
int_mv mvp_full;
MV mvp_full;
int max_mv;
/* Is the best so far sufficiently good that we cant justify doing
......@@ -1773,12 +1773,12 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
step_param = cpi->mv_step_param;
}
mvp_full.as_mv.row = bsi->mvp.as_mv.row >> 3;
mvp_full.as_mv.col = bsi->mvp.as_mv.col >> 3;
mvp_full.row = bsi->mvp.as_mv.row >> 3;
mvp_full.col = bsi->mvp.as_mv.col >> 3;
if (cpi->sf.adaptive_motion_search && cpi->common.show_frame) {
mvp_full.as_mv.row = x->pred_mv[mbmi->ref_frame[0]].as_mv.row >> 3;
mvp_full.as_mv.col = x->pred_mv[mbmi->ref_frame[0]].as_mv.col >> 3;
mvp_full.row = x->pred_mv[mbmi->ref_frame[0]].as_mv.row >> 3;
mvp_full.col = x->pred_mv[mbmi->ref_frame[0]].as_mv.col >> 3;
step_param = MAX(step_param, 8);
}
......@@ -1789,19 +1789,19 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
vp9_set_mv_search_range(x, &bsi->ref_mv->as_mv);
if (cpi->sf.search_method == HEX) {
bestsme = vp9_hex_search(x, &mvp_full.as_mv,
bestsme = vp9_hex_search(x, &mvp_full,
step_param,
sadpb, 1, v_fn_ptr, 1,
&bsi->ref_mv->as_mv,
&mode_mv[NEWMV].as_mv);
} else if (cpi->sf.search_method == SQUARE) {
bestsme = vp9_square_search(x, &mvp_full.as_mv,
bestsme = vp9_square_search(x, &mvp_full,
step_param,
sadpb, 1, v_fn_ptr, 1,
&bsi->ref_mv->as_mv,
&mode_mv[NEWMV].as_mv);
} else if (cpi->sf.search_method == BIGDIA) {
bestsme = vp9_bigdia_search(x, &mvp_full.as_mv,
bestsme = vp9_bigdia_search(x, &mvp_full,
step_param,
sadpb, 1, v_fn_ptr, 1,
&bsi->ref_mv->as_mv,
......@@ -1809,16 +1809,17 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
} else {
bestsme = vp9_full_pixel_diamond(cpi, x, &mvp_full, step_param,
sadpb, further_steps, 0, v_fn_ptr,
bsi->ref_mv, &mode_mv[NEWMV]);
&bsi->ref_mv->as_mv,
&mode_mv[NEWMV]);
}
// Should we do a full search (best quality only)
if (cpi->compressor_speed == 0) {
/* Check if mvp_full is within the range. */
clamp_mv(&mvp_full.as_mv, x->mv_col_min, x->mv_col_max,
clamp_mv(&mvp_full, x->mv_col_min, x->mv_col_max,
x->mv_row_min, x->mv_row_max);
thissme = cpi->full_search_sad(x, &mvp_full.as_mv,
thissme = cpi->full_search_sad(x, &mvp_full,
sadpb, 16, v_fn_ptr,
x->nmvjointcost, x->mvcost,
&bsi->ref_mv->as_mv, i);
......@@ -2439,10 +2440,10 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
&cpi->fn_ptr[bsize], 1,
&ref_mv.as_mv, &tmp_mv->as_mv);
} else {
bestsme = vp9_full_pixel_diamond(cpi, x, &mvp_full, step_param,
bestsme = vp9_full_pixel_diamond(cpi, x, &mvp_full.as_mv, step_param,
sadpb, further_steps, 1,
&cpi->fn_ptr[bsize],
&ref_mv, tmp_mv);
&ref_mv.as_mv, tmp_mv);
}
x->mv_col_min = tmp_col_min;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment