Merge "Replacing int_mv with MV."
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
|
|
||||||
static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
|
static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
|
||||||
int_mv *ref_mv,
|
const MV *ref_mv,
|
||||||
int_mv *dst_mv,
|
int_mv *dst_mv,
|
||||||
int mb_row,
|
int mb_row,
|
||||||
int mb_col) {
|
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);
|
(cpi->speed < 8 ? (cpi->speed > 5 ? 1 : 0) : 2);
|
||||||
step_param = MIN(step_param, (cpi->sf.max_step_search_steps - 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.col = ref_mv->col >> 3;
|
||||||
ref_full.as_mv.row = ref_mv->as_mv.row >> 3;
|
ref_full.as_mv.row = ref_mv->row >> 3;
|
||||||
|
|
||||||
/*cpi->sf.search_method == HEX*/
|
/*cpi->sf.search_method == HEX*/
|
||||||
best_err = vp9_hex_search(x, &ref_full.as_mv, step_param, x->errorperbit,
|
best_err = vp9_hex_search(x, &ref_full.as_mv, step_param, x->errorperbit,
|
||||||
0, &v_fn_ptr,
|
0, &v_fn_ptr, 0, ref_mv, &dst_mv->as_mv);
|
||||||
0, &ref_mv->as_mv, &dst_mv->as_mv);
|
|
||||||
|
|
||||||
// Try sub-pixel MC
|
// Try sub-pixel MC
|
||||||
// if (bestsme > error_thresh && bestsme < INT_MAX)
|
// if (bestsme > error_thresh && bestsme < INT_MAX)
|
||||||
@@ -59,7 +58,7 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
|
|||||||
unsigned int sse;
|
unsigned int sse;
|
||||||
best_err = cpi->find_fractional_mv_step(
|
best_err = cpi->find_fractional_mv_step(
|
||||||
x,
|
x,
|
||||||
&dst_mv->as_mv, &ref_mv->as_mv,
|
&dst_mv->as_mv, ref_mv,
|
||||||
cpi->common.allow_high_precision_mv,
|
cpi->common.allow_high_precision_mv,
|
||||||
x->errorperbit, &v_fn_ptr,
|
x->errorperbit, &v_fn_ptr,
|
||||||
0, cpi->sf.subpel_iters_per_step, NULL, NULL,
|
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;
|
return best_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_16x16_motion_search(VP9_COMP *cpi, int_mv *ref_mv, int_mv *dst_mv,
|
static int do_16x16_motion_search(VP9_COMP *cpi, const int_mv *ref_mv,
|
||||||
int mb_row, int mb_col) {
|
int_mv *dst_mv, int mb_row, int mb_col) {
|
||||||
MACROBLOCK *const x = &cpi->mb;
|
MACROBLOCK *const x = &cpi->mb;
|
||||||
MACROBLOCKD *const xd = &x->e_mbd;
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
unsigned int err, tmp_err;
|
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
|
// Test last reference frame using the previous best mv as the
|
||||||
// starting point (best reference) for the search
|
// 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) {
|
if (tmp_err < err) {
|
||||||
err = tmp_err;
|
err = tmp_err;
|
||||||
dst_mv->as_int = tmp_mv.as_int;
|
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;
|
int_mv zero_ref_mv, tmp_mv;
|
||||||
|
|
||||||
zero_ref_mv.as_int = 0;
|
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);
|
mb_row, mb_col);
|
||||||
if (tmp_err < err) {
|
if (tmp_err < err) {
|
||||||
dst_mv->as_int = tmp_mv.as_int;
|
dst_mv->as_int = tmp_mv.as_int;
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
// #define NEW_DIAMOND_SEARCH
|
// #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 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 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;
|
const int col_max = (mv->col >> 3) + MAX_FULL_PEL_VAL;
|
||||||
@@ -1303,16 +1303,16 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
|
|||||||
refining search */
|
refining search */
|
||||||
|
|
||||||
int vp9_full_pixel_diamond(VP9_COMP *cpi, MACROBLOCK *x,
|
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 sadpb, int further_steps,
|
||||||
int do_refine, vp9_variance_fn_ptr_t *fn_ptr,
|
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_mv temp_mv;
|
||||||
int thissme, n, num00;
|
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,
|
step_param, sadpb, &num00,
|
||||||
fn_ptr, x->nmvjointcost,
|
fn_ptr, x->nmvjointcost,
|
||||||
x->mvcost, &ref_mv->as_mv);
|
x->mvcost, ref_mv);
|
||||||
dst_mv->as_int = temp_mv.as_int;
|
dst_mv->as_int = temp_mv.as_int;
|
||||||
|
|
||||||
n = num00;
|
n = num00;
|
||||||
@@ -1329,10 +1329,10 @@ int vp9_full_pixel_diamond(VP9_COMP *cpi, MACROBLOCK *x,
|
|||||||
if (num00) {
|
if (num00) {
|
||||||
num00--;
|
num00--;
|
||||||
} else {
|
} 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,
|
step_param + n, sadpb, &num00,
|
||||||
fn_ptr, x->nmvjointcost, x->mvcost,
|
fn_ptr, x->nmvjointcost, x->mvcost,
|
||||||
&ref_mv->as_mv);
|
ref_mv);
|
||||||
|
|
||||||
/* check to see if refining search is needed. */
|
/* check to see if refining search is needed. */
|
||||||
if (num00 > (further_steps - n))
|
if (num00 > (further_steps - n))
|
||||||
@@ -1352,7 +1352,7 @@ int vp9_full_pixel_diamond(VP9_COMP *cpi, MACROBLOCK *x,
|
|||||||
best_mv.as_int = dst_mv->as_int;
|
best_mv.as_int = dst_mv->as_int;
|
||||||
thissme = cpi->refining_search_sad(x, &best_mv.as_mv, sadpb, search_range,
|
thissme = cpi->refining_search_sad(x, &best_mv.as_mv, sadpb, search_range,
|
||||||
fn_ptr, x->nmvjointcost, x->mvcost,
|
fn_ptr, x->nmvjointcost, x->mvcost,
|
||||||
&ref_mv->as_mv);
|
ref_mv);
|
||||||
|
|
||||||
if (thissme < bestsme) {
|
if (thissme < bestsme) {
|
||||||
bestsme = thissme;
|
bestsme = thissme;
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#define BORDER_MV_PIXELS_B16 (16 + VP9_INTERP_EXTEND)
|
#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,
|
int vp9_mv_bit_cost(const MV *mv, const MV *ref,
|
||||||
const int *mvjcost, int *mvcost[2], int weight);
|
const int *mvjcost, int *mvcost[2], int weight);
|
||||||
void vp9_init_dsmotion_compensation(MACROBLOCK *x, int stride);
|
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
|
// Runs sequence of diamond searches in smaller steps for RD
|
||||||
int vp9_full_pixel_diamond(struct VP9_COMP *cpi, MACROBLOCK *x,
|
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,
|
int sadpb, int further_steps, int do_refine,
|
||||||
vp9_variance_fn_ptr_t *fn_ptr,
|
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,
|
int vp9_hex_search(MACROBLOCK *x,
|
||||||
MV *ref_mv,
|
MV *ref_mv,
|
||||||
|
@@ -1742,7 +1742,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
|
|||||||
int further_steps;
|
int further_steps;
|
||||||
int thissme, bestsme = INT_MAX;
|
int thissme, bestsme = INT_MAX;
|
||||||
int sadpb = x->sadperbit4;
|
int sadpb = x->sadperbit4;
|
||||||
int_mv mvp_full;
|
MV mvp_full;
|
||||||
int max_mv;
|
int max_mv;
|
||||||
|
|
||||||
/* Is the best so far sufficiently good that we cant justify doing
|
/* 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;
|
step_param = cpi->mv_step_param;
|
||||||
}
|
}
|
||||||
|
|
||||||
mvp_full.as_mv.row = bsi->mvp.as_mv.row >> 3;
|
mvp_full.row = bsi->mvp.as_mv.row >> 3;
|
||||||
mvp_full.as_mv.col = bsi->mvp.as_mv.col >> 3;
|
mvp_full.col = bsi->mvp.as_mv.col >> 3;
|
||||||
|
|
||||||
if (cpi->sf.adaptive_motion_search && cpi->common.show_frame) {
|
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.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.col = x->pred_mv[mbmi->ref_frame[0]].as_mv.col >> 3;
|
||||||
step_param = MAX(step_param, 8);
|
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);
|
vp9_set_mv_search_range(x, &bsi->ref_mv->as_mv);
|
||||||
|
|
||||||
if (cpi->sf.search_method == HEX) {
|
if (cpi->sf.search_method == HEX) {
|
||||||
bestsme = vp9_hex_search(x, &mvp_full.as_mv,
|
bestsme = vp9_hex_search(x, &mvp_full,
|
||||||
step_param,
|
step_param,
|
||||||
sadpb, 1, v_fn_ptr, 1,
|
sadpb, 1, v_fn_ptr, 1,
|
||||||
&bsi->ref_mv->as_mv,
|
&bsi->ref_mv->as_mv,
|
||||||
&mode_mv[NEWMV].as_mv);
|
&mode_mv[NEWMV].as_mv);
|
||||||
} else if (cpi->sf.search_method == SQUARE) {
|
} 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,
|
step_param,
|
||||||
sadpb, 1, v_fn_ptr, 1,
|
sadpb, 1, v_fn_ptr, 1,
|
||||||
&bsi->ref_mv->as_mv,
|
&bsi->ref_mv->as_mv,
|
||||||
&mode_mv[NEWMV].as_mv);
|
&mode_mv[NEWMV].as_mv);
|
||||||
} else if (cpi->sf.search_method == BIGDIA) {
|
} 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,
|
step_param,
|
||||||
sadpb, 1, v_fn_ptr, 1,
|
sadpb, 1, v_fn_ptr, 1,
|
||||||
&bsi->ref_mv->as_mv,
|
&bsi->ref_mv->as_mv,
|
||||||
@@ -1809,16 +1809,17 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
|
|||||||
} else {
|
} else {
|
||||||
bestsme = vp9_full_pixel_diamond(cpi, x, &mvp_full, step_param,
|
bestsme = vp9_full_pixel_diamond(cpi, x, &mvp_full, step_param,
|
||||||
sadpb, further_steps, 0, v_fn_ptr,
|
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)
|
// Should we do a full search (best quality only)
|
||||||
if (cpi->compressor_speed == 0) {
|
if (cpi->compressor_speed == 0) {
|
||||||
/* Check if mvp_full is within the range. */
|
/* 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);
|
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,
|
sadpb, 16, v_fn_ptr,
|
||||||
x->nmvjointcost, x->mvcost,
|
x->nmvjointcost, x->mvcost,
|
||||||
&bsi->ref_mv->as_mv, i);
|
&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,
|
&cpi->fn_ptr[bsize], 1,
|
||||||
&ref_mv.as_mv, &tmp_mv->as_mv);
|
&ref_mv.as_mv, &tmp_mv->as_mv);
|
||||||
} else {
|
} 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,
|
sadpb, further_steps, 1,
|
||||||
&cpi->fn_ptr[bsize],
|
&cpi->fn_ptr[bsize],
|
||||||
&ref_mv, tmp_mv);
|
&ref_mv.as_mv, tmp_mv);
|
||||||
}
|
}
|
||||||
|
|
||||||
x->mv_col_min = tmp_col_min;
|
x->mv_col_min = tmp_col_min;
|
||||||
|
Reference in New Issue
Block a user