#undef CHECK_POINT
#undef CHECK_BETTER
-int vp9_full_range_search_c(MACROBLOCK *x, int_mv *ref_mv, int_mv *best_mv,
+int vp9_full_range_search_c(MACROBLOCK *x, MV *ref_mv, MV *best_mv,
int search_param, int sad_per_bit, int *num00,
vp9_variance_fn_ptr_t *fn_ptr, int *mvjcost,
- int *mvcost[2], int_mv *center_mv) {
+ int *mvcost[2], const MV *center_mv) {
const MACROBLOCKD* const xd = &x->e_mbd;
uint8_t *what = x->plane[0].src.buf;
int what_stride = x->plane[0].src.stride;
int in_what_stride = xd->plane[0].pre[0].stride;
uint8_t *best_address;
- int_mv this_mv;
+ MV this_mv;
int bestsad = INT_MAX;
int ref_row, ref_col;
uint8_t *check_here;
int thissad;
- int_mv fcenter_mv;
+ MV fcenter_mv;
int *mvjsadcost = x->nmvjointsadcost;
int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
int start_row, end_row;
int i;
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
+ fcenter_mv.row = center_mv->row >> 3;
+ fcenter_mv.col = center_mv->col >> 3;
- clamp_mv(&ref_mv->as_mv,
- x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
- ref_row = ref_mv->as_mv.row;
- ref_col = ref_mv->as_mv.col;
+ clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
+ ref_row = ref_mv->row;
+ ref_col = ref_mv->col;
*num00 = 11;
- best_mv->as_mv.row = ref_row;
- best_mv->as_mv.col = ref_col;
+ best_mv->row = ref_row;
+ best_mv->col = ref_col;
// Work out the start point for the search
in_what = (uint8_t *)(xd->plane[0].pre[0].buf +
// Check the starting position
bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv.as_mv,
+ + mvsad_err_cost(best_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
start_row = MAX(-range, x->mv_row_min - ref_row);
for (i = 0; i < 4; ++i) {
if (sad_array[i] < bestsad) {
- this_mv.as_mv.row = ref_row + tr;
- this_mv.as_mv.col = ref_col + tc + i;
+ this_mv.row = ref_row + tr;
+ this_mv.col = ref_col + tc + i;
thissad = sad_array[i] +
- mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
bestsad);
if (thissad < bestsad) {
- this_mv.as_mv.row = ref_row + tr;
- this_mv.as_mv.col = ref_col + tc + i;
- thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.row = ref_row + tr;
+ this_mv.col = ref_col + tc + i;
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
}
}
- best_mv->as_mv.row += best_tr;
- best_mv->as_mv.col += best_tc;
+ best_mv->row += best_tr;
+ best_mv->col += best_tc;
- this_mv.as_mv.row = best_mv->as_mv.row * 8;
- this_mv.as_mv.col = best_mv->as_mv.col * 8;
+ this_mv.row = best_mv->row * 8;
+ this_mv.col = best_mv->col * 8;
if (bestsad == INT_MAX)
return INT_MAX;
return fn_ptr->vf(what, what_stride, best_address, in_what_stride,
(unsigned int *)(&thissad)) +
- mv_err_cost(&this_mv.as_mv, ¢er_mv->as_mv,
+ mv_err_cost(&this_mv, center_mv,
mvjcost, mvcost, x->errorperbit);
}
int vp9_diamond_search_sad_c(MACROBLOCK *x,
- int_mv *ref_mv, int_mv *best_mv,
+ MV *ref_mv, MV *best_mv,
int search_param, int sad_per_bit, int *num00,
vp9_variance_fn_ptr_t *fn_ptr, int *mvjcost,
- int *mvcost[2], int_mv *center_mv) {
+ int *mvcost[2], const MV *center_mv) {
int i, j, step;
const MACROBLOCKD* const xd = &x->e_mbd;
uint8_t *best_address;
int tot_steps;
- int_mv this_mv;
+ MV this_mv;
int bestsad = INT_MAX;
int best_site = 0;
int *mvjsadcost = x->nmvjointsadcost;
int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
+ fcenter_mv.as_mv.row = center_mv->row >> 3;
+ fcenter_mv.as_mv.col = center_mv->col >> 3;
- clamp_mv(&ref_mv->as_mv,
- x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
- ref_row = ref_mv->as_mv.row;
- ref_col = ref_mv->as_mv.col;
+ clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
+ ref_row = ref_mv->row;
+ ref_col = ref_mv->col;
*num00 = 0;
- best_mv->as_mv.row = ref_row;
- best_mv->as_mv.col = ref_col;
+ best_mv->row = ref_row;
+ best_mv->col = ref_col;
// Work out the start point for the search
in_what = (uint8_t *)(xd->plane[0].pre[0].buf +
// Check the starting position
bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv.as_mv,
+ + mvsad_err_cost(best_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
// search_param determines the length of the initial step and hence the number
for (step = 0; step < tot_steps; step++) {
for (j = 0; j < x->searches_per_step; j++) {
// Trap illegal vectors
- this_row_offset = best_mv->as_mv.row + ss[i].mv.row;
- this_col_offset = best_mv->as_mv.col + ss[i].mv.col;
+ this_row_offset = best_mv->row + ss[i].mv.row;
+ this_col_offset = best_mv->col + ss[i].mv.col;
if ((this_col_offset > x->mv_col_min) &&
(this_col_offset < x->mv_col_max) &&
bestsad);
if (thissad < bestsad) {
- this_mv.as_mv.row = this_row_offset;
- this_mv.as_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.row = this_row_offset;
+ this_mv.col = this_col_offset;
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
}
if (best_site != last_site) {
- best_mv->as_mv.row += ss[best_site].mv.row;
- best_mv->as_mv.col += ss[best_site].mv.col;
+ best_mv->row += ss[best_site].mv.row;
+ best_mv->col += ss[best_site].mv.col;
best_address += ss[best_site].offset;
last_site = best_site;
#if defined(NEW_DIAMOND_SEARCH)
while (1) {
- this_row_offset = best_mv->as_mv.row + ss[best_site].mv.row;
- this_col_offset = best_mv->as_mv.col + ss[best_site].mv.col;
+ this_row_offset = best_mv->row + ss[best_site].mv.row;
+ this_col_offset = best_mv->col + ss[best_site].mv.col;
if ((this_col_offset > x->mv_col_min) &&
(this_col_offset < x->mv_col_max) &&
(this_row_offset > x->mv_row_min) &&
thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride,
bestsad);
if (thissad < bestsad) {
- this_mv.as_mv.row = this_row_offset;
- this_mv.as_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.row = this_row_offset;
+ this_mv.col = this_col_offset;
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
- best_mv->as_mv.row += ss[best_site].mv.row;
- best_mv->as_mv.col += ss[best_site].mv.col;
+ best_mv->row += ss[best_site].mv.row;
+ best_mv->col += ss[best_site].mv.col;
best_address += ss[best_site].offset;
continue;
}
}
}
- this_mv.as_mv.row = best_mv->as_mv.row * 8;
- this_mv.as_mv.col = best_mv->as_mv.col * 8;
+ this_mv.row = best_mv->row * 8;
+ this_mv.col = best_mv->col * 8;
if (bestsad == INT_MAX)
return INT_MAX;
return fn_ptr->vf(what, what_stride, best_address, in_what_stride,
(unsigned int *)(&thissad)) +
- mv_err_cost(&this_mv.as_mv, ¢er_mv->as_mv,
+ mv_err_cost(&this_mv, center_mv,
mvjcost, mvcost, x->errorperbit);
}
int vp9_diamond_search_sadx4(MACROBLOCK *x,
- int_mv *ref_mv, int_mv *best_mv, int search_param,
+ MV *ref_mv, MV *best_mv, int search_param,
int sad_per_bit, int *num00,
vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2], int_mv *center_mv) {
+ int *mvjcost, int *mvcost[2],
+ const MV *center_mv) {
int i, j, step;
const MACROBLOCKD* const xd = &x->e_mbd;
uint8_t *best_address;
int tot_steps;
- int_mv this_mv;
+ MV this_mv;
unsigned int bestsad = INT_MAX;
int best_site = 0;
int *mvjsadcost = x->nmvjointsadcost;
int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
+ fcenter_mv.as_mv.row = center_mv->row >> 3;
+ fcenter_mv.as_mv.col = center_mv->col >> 3;
- clamp_mv(&ref_mv->as_mv,
- x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
- ref_row = ref_mv->as_mv.row;
- ref_col = ref_mv->as_mv.col;
+ clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
+ ref_row = ref_mv->row;
+ ref_col = ref_mv->col;
*num00 = 0;
- best_mv->as_mv.row = ref_row;
- best_mv->as_mv.col = ref_col;
+ best_mv->row = ref_row;
+ best_mv->col = ref_col;
// Work out the start point for the search
in_what = (uint8_t *)(xd->plane[0].pre[0].buf +
// Check the starting position
bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv.as_mv,
+ + mvsad_err_cost(best_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
// search_param determines the length of the initial step and hence the number
// All_in is true if every one of the points we are checking are within
// the bounds of the image.
- all_in &= ((best_mv->as_mv.row + ss[i].mv.row) > x->mv_row_min);
- all_in &= ((best_mv->as_mv.row + ss[i + 1].mv.row) < x->mv_row_max);
- all_in &= ((best_mv->as_mv.col + ss[i + 2].mv.col) > x->mv_col_min);
- all_in &= ((best_mv->as_mv.col + ss[i + 3].mv.col) < x->mv_col_max);
+ all_in &= ((best_mv->row + ss[i].mv.row) > x->mv_row_min);
+ all_in &= ((best_mv->row + ss[i + 1].mv.row) < x->mv_row_max);
+ all_in &= ((best_mv->col + ss[i + 2].mv.col) > x->mv_col_min);
+ all_in &= ((best_mv->col + ss[i + 3].mv.col) < x->mv_col_max);
// If all the pixels are within the bounds we don't check whether the
// search point is valid in this loop, otherwise we check each point
for (t = 0; t < 4; t++, i++) {
if (sad_array[t] < bestsad) {
- this_mv.as_mv.row = best_mv->as_mv.row + ss[i].mv.row;
- this_mv.as_mv.col = best_mv->as_mv.col + ss[i].mv.col;
- sad_array[t] += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.row = best_mv->row + ss[i].mv.row;
+ this_mv.col = best_mv->col + ss[i].mv.col;
+ sad_array[t] += mvsad_err_cost(&this_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (sad_array[t] < bestsad) {
} else {
for (j = 0; j < x->searches_per_step; j++) {
// Trap illegal vectors
- this_row_offset = best_mv->as_mv.row + ss[i].mv.row;
- this_col_offset = best_mv->as_mv.col + ss[i].mv.col;
+ this_row_offset = best_mv->row + ss[i].mv.row;
+ this_col_offset = best_mv->col + ss[i].mv.col;
if ((this_col_offset > x->mv_col_min) &&
(this_col_offset < x->mv_col_max) &&
bestsad);
if (thissad < bestsad) {
- this_mv.as_mv.row = this_row_offset;
- this_mv.as_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.row = this_row_offset;
+ this_mv.col = this_col_offset;
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
}
}
if (best_site != last_site) {
- best_mv->as_mv.row += ss[best_site].mv.row;
- best_mv->as_mv.col += ss[best_site].mv.col;
+ best_mv->row += ss[best_site].mv.row;
+ best_mv->col += ss[best_site].mv.col;
best_address += ss[best_site].offset;
last_site = best_site;
#if defined(NEW_DIAMOND_SEARCH)
while (1) {
- this_row_offset = best_mv->as_mv.row + ss[best_site].mv.row;
- this_col_offset = best_mv->as_mv.col + ss[best_site].mv.col;
+ this_row_offset = best_mv->row + ss[best_site].mv.row;
+ this_col_offset = best_mv->col + ss[best_site].mv.col;
if ((this_col_offset > x->mv_col_min) &&
(this_col_offset < x->mv_col_max) &&
(this_row_offset > x->mv_row_min) &&
thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride,
bestsad);
if (thissad < bestsad) {
- this_mv.as_mv.row = this_row_offset;
- this_mv.as_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.row = this_row_offset;
+ this_mv.col = this_col_offset;
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
- best_mv->as_mv.row += ss[best_site].mv.row;
- best_mv->as_mv.col += ss[best_site].mv.col;
+ best_mv->row += ss[best_site].mv.row;
+ best_mv->col += ss[best_site].mv.col;
best_address += ss[best_site].offset;
continue;
}
}
}
- this_mv.as_mv.row = best_mv->as_mv.row * 8;
- this_mv.as_mv.col = best_mv->as_mv.col * 8;
+ this_mv.row = best_mv->row * 8;
+ this_mv.col = best_mv->col * 8;
if (bestsad == INT_MAX)
return INT_MAX;
return fn_ptr->vf(what, what_stride, best_address, in_what_stride,
(unsigned int *)(&thissad)) +
- mv_err_cost(&this_mv.as_mv, ¢er_mv->as_mv,
+ mv_err_cost(&this_mv, center_mv,
mvjcost, mvcost, x->errorperbit);
}
int_mv *ref_mv, int_mv *dst_mv) {
int_mv temp_mv;
int thissme, n, num00;
- int bestsme = cpi->diamond_search_sad(x, mvp_full, &temp_mv,
+ int bestsme = cpi->diamond_search_sad(x, &mvp_full->as_mv, &temp_mv.as_mv,
step_param, sadpb, &num00,
fn_ptr, x->nmvjointcost,
- x->mvcost, ref_mv);
+ x->mvcost, &ref_mv->as_mv);
dst_mv->as_int = temp_mv.as_int;
n = num00;
if (num00) {
num00--;
} else {
- thissme = cpi->diamond_search_sad(x, mvp_full, &temp_mv,
+ thissme = cpi->diamond_search_sad(x, &mvp_full->as_mv, &temp_mv.as_mv,
step_param + n, sadpb, &num00,
fn_ptr, x->nmvjointcost, x->mvcost,
- ref_mv);
+ &ref_mv->as_mv);
/* check to see if refining search is needed. */
if (num00 > (further_steps - n))
int search_range = 8;
int_mv best_mv;
best_mv.as_int = dst_mv->as_int;
- thissme = cpi->refining_search_sad(x, &best_mv, sadpb, search_range,
+ thissme = cpi->refining_search_sad(x, &best_mv.as_mv, sadpb, search_range,
fn_ptr, x->nmvjointcost, x->mvcost,
- ref_mv);
+ &ref_mv->as_mv);
if (thissme < bestsme) {
bestsme = thissme;
return bestsme;
}
-int vp9_full_search_sad_c(MACROBLOCK *x, int_mv *ref_mv,
+int vp9_full_search_sad_c(MACROBLOCK *x, MV *ref_mv,
int sad_per_bit, int distance,
vp9_variance_fn_ptr_t *fn_ptr, int *mvjcost,
int *mvcost[2],
- int_mv *center_mv, int n) {
+ const MV *center_mv, int n) {
const MACROBLOCKD* const xd = &x->e_mbd;
uint8_t *what = x->plane[0].src.buf;
int what_stride = x->plane[0].src.stride;
int mv_stride = xd->plane[0].pre[0].stride;
uint8_t *bestaddress;
int_mv *best_mv = &x->e_mbd.mi_8x8[0]->bmi[n].as_mv[0];
- int_mv this_mv;
+ MV this_mv;
int bestsad = INT_MAX;
int r, c;
uint8_t *check_here;
int thissad;
- int ref_row = ref_mv->as_mv.row;
- int ref_col = ref_mv->as_mv.col;
+ int ref_row = ref_mv->row;
+ int ref_col = ref_mv->col;
int row_min = ref_row - distance;
int row_max = ref_row + distance;
int col_min = ref_col - distance;
int col_max = ref_col + distance;
- int_mv fcenter_mv;
+ MV fcenter_mv;
int *mvjsadcost = x->nmvjointsadcost;
int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
+ fcenter_mv.row = center_mv->row >> 3;
+ fcenter_mv.col = center_mv->col >> 3;
// Work out the mid point for the search
in_what = xd->plane[0].pre[0].buf;
// Baseline value at the centre
bestsad = fn_ptr->sdf(what, what_stride, bestaddress,
in_what_stride, 0x7fffffff)
- + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv.as_mv,
+ + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
// Apply further limits to prevent us looking using vectors that stretch
row_max = MIN(row_max, x->mv_row_max);
for (r = row_min; r < row_max; r++) {
- this_mv.as_mv.row = r;
+ this_mv.row = r;
check_here = r * mv_stride + in_what + col_min;
for (c = col_min; c < col_max; c++) {
thissad = fn_ptr->sdf(what, what_stride, check_here, in_what_stride,
bestsad);
- this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.col = c;
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
}
}
- this_mv.as_mv.row = best_mv->as_mv.row * 8;
- this_mv.as_mv.col = best_mv->as_mv.col * 8;
+ this_mv.row = best_mv->as_mv.row * 8;
+ this_mv.col = best_mv->as_mv.col * 8;
if (bestsad < INT_MAX)
return fn_ptr->vf(what, what_stride, bestaddress, in_what_stride,
(unsigned int *)(&thissad)) +
- mv_err_cost(&this_mv.as_mv, ¢er_mv->as_mv,
+ mv_err_cost(&this_mv, center_mv,
mvjcost, mvcost, x->errorperbit);
else
return INT_MAX;
}
-int vp9_full_search_sadx3(MACROBLOCK *x, int_mv *ref_mv,
+int vp9_full_search_sadx3(MACROBLOCK *x, MV *ref_mv,
int sad_per_bit, int distance,
vp9_variance_fn_ptr_t *fn_ptr, int *mvjcost,
- int *mvcost[2], int_mv *center_mv, int n) {
+ int *mvcost[2], const MV *center_mv, int n) {
const MACROBLOCKD* const xd = &x->e_mbd;
uint8_t *what = x->plane[0].src.buf;
int what_stride = x->plane[0].src.stride;
int mv_stride = xd->plane[0].pre[0].stride;
uint8_t *bestaddress;
int_mv *best_mv = &x->e_mbd.mi_8x8[0]->bmi[n].as_mv[0];
- int_mv this_mv;
+ MV this_mv;
unsigned int bestsad = INT_MAX;
int r, c;
uint8_t *check_here;
unsigned int thissad;
- int ref_row = ref_mv->as_mv.row;
- int ref_col = ref_mv->as_mv.col;
+ int ref_row = ref_mv->row;
+ int ref_col = ref_mv->col;
int row_min = ref_row - distance;
int row_max = ref_row + distance;
int col_max = ref_col + distance;
unsigned int sad_array[3];
- int_mv fcenter_mv;
+ MV fcenter_mv;
int *mvjsadcost = x->nmvjointsadcost;
int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
+ fcenter_mv.row = center_mv->row >> 3;
+ fcenter_mv.col = center_mv->col >> 3;
// Work out the mid point for the search
in_what = xd->plane[0].pre[0].buf;
// Baseline value at the centre
bestsad = fn_ptr->sdf(what, what_stride,
bestaddress, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv.as_mv,
+ + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
// Apply further limits to prevent us looking using vectors that stretch
row_max = MIN(row_max, x->mv_row_max);
for (r = row_min; r < row_max; r++) {
- this_mv.as_mv.row = r;
+ this_mv.row = r;
check_here = r * mv_stride + in_what + col_min;
c = col_min;
thissad = sad_array[i];
if (thissad < bestsad) {
- this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.col = c;
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
bestsad);
if (thissad < bestsad) {
- this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.col = c;
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
}
}
- this_mv.as_mv.row = best_mv->as_mv.row * 8;
- this_mv.as_mv.col = best_mv->as_mv.col * 8;
+ this_mv.row = best_mv->as_mv.row * 8;
+ this_mv.col = best_mv->as_mv.col * 8;
if (bestsad < INT_MAX)
return fn_ptr->vf(what, what_stride, bestaddress, in_what_stride,
(unsigned int *)(&thissad)) +
- mv_err_cost(&this_mv.as_mv, ¢er_mv->as_mv,
+ mv_err_cost(&this_mv, center_mv,
mvjcost, mvcost, x->errorperbit);
else
return INT_MAX;
}
-int vp9_full_search_sadx8(MACROBLOCK *x, int_mv *ref_mv,
+int vp9_full_search_sadx8(MACROBLOCK *x, MV *ref_mv,
int sad_per_bit, int distance,
vp9_variance_fn_ptr_t *fn_ptr,
int *mvjcost, int *mvcost[2],
- int_mv *center_mv, int n) {
+ const MV *center_mv, int n) {
const MACROBLOCKD* const xd = &x->e_mbd;
uint8_t *what = x->plane[0].src.buf;
int what_stride = x->plane[0].src.stride;
int mv_stride = xd->plane[0].pre[0].stride;
uint8_t *bestaddress;
int_mv *best_mv = &x->e_mbd.mi_8x8[0]->bmi[n].as_mv[0];
- int_mv this_mv;
+ MV this_mv;
unsigned int bestsad = INT_MAX;
int r, c;
uint8_t *check_here;
unsigned int thissad;
- int ref_row = ref_mv->as_mv.row;
- int ref_col = ref_mv->as_mv.col;
+ int ref_row = ref_mv->row;
+ int ref_col = ref_mv->col;
int row_min = ref_row - distance;
int row_max = ref_row + distance;
DECLARE_ALIGNED_ARRAY(16, uint32_t, sad_array8, 8);
unsigned int sad_array[3];
- int_mv fcenter_mv;
+ MV fcenter_mv;
int *mvjsadcost = x->nmvjointsadcost;
int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
+ fcenter_mv.row = center_mv->row >> 3;
+ fcenter_mv.col = center_mv->col >> 3;
// Work out the mid point for the search
in_what = xd->plane[0].pre[0].buf;
// Baseline value at the centre
bestsad = fn_ptr->sdf(what, what_stride,
bestaddress, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv.as_mv,
+ + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
// Apply further limits to prevent us looking using vectors that stretch
row_max = MIN(row_max, x->mv_row_max);
for (r = row_min; r < row_max; r++) {
- this_mv.as_mv.row = r;
+ this_mv.row = r;
check_here = r * mv_stride + in_what + col_min;
c = col_min;
thissad = (unsigned int)sad_array8[i];
if (thissad < bestsad) {
- this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.col = c;
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
thissad = sad_array[i];
if (thissad < bestsad) {
- this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.col = c;
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
bestsad);
if (thissad < bestsad) {
- this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.col = c;
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
}
}
- this_mv.as_mv.row = best_mv->as_mv.row * 8;
- this_mv.as_mv.col = best_mv->as_mv.col * 8;
+ this_mv.row = best_mv->as_mv.row * 8;
+ this_mv.col = best_mv->as_mv.col * 8;
if (bestsad < INT_MAX)
return fn_ptr->vf(what, what_stride, bestaddress, in_what_stride,
(unsigned int *)(&thissad)) +
- mv_err_cost(&this_mv.as_mv, ¢er_mv->as_mv,
+ mv_err_cost(&this_mv, center_mv,
mvjcost, mvcost, x->errorperbit);
else
return INT_MAX;
}
int vp9_refining_search_sad_c(MACROBLOCK *x,
- int_mv *ref_mv, int error_per_bit,
+ MV *ref_mv, int error_per_bit,
int search_range, vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2], int_mv *center_mv) {
+ int *mvjcost, int *mvcost[2],
+ const MV *center_mv) {
const MACROBLOCKD* const xd = &x->e_mbd;
MV neighbors[4] = {{ -1, 0}, {0, -1}, {0, 1}, {1, 0}};
int i, j;
int in_what_stride = xd->plane[0].pre[0].stride;
uint8_t *what = x->plane[0].src.buf;
uint8_t *best_address = xd->plane[0].pre[0].buf +
- (ref_mv->as_mv.row * xd->plane[0].pre[0].stride) +
- ref_mv->as_mv.col;
+ (ref_mv->row * xd->plane[0].pre[0].stride) +
+ ref_mv->col;
uint8_t *check_here;
unsigned int thissad;
- int_mv this_mv;
+ MV this_mv;
unsigned int bestsad = INT_MAX;
- int_mv fcenter_mv;
+ MV fcenter_mv;
int *mvjsadcost = x->nmvjointsadcost;
int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
+ fcenter_mv.row = center_mv->row >> 3;
+ fcenter_mv.col = center_mv->col >> 3;
bestsad = fn_ptr->sdf(what, what_stride, best_address,
in_what_stride, 0x7fffffff) +
- mvsad_err_cost(&ref_mv->as_mv, &fcenter_mv.as_mv,
+ mvsad_err_cost(ref_mv, &fcenter_mv,
mvjsadcost, mvsadcost, error_per_bit);
for (i = 0; i < search_range; i++) {
int best_site = -1;
for (j = 0; j < 4; j++) {
- this_row_offset = ref_mv->as_mv.row + neighbors[j].row;
- this_col_offset = ref_mv->as_mv.col + neighbors[j].col;
+ this_row_offset = ref_mv->row + neighbors[j].row;
+ this_col_offset = ref_mv->col + neighbors[j].col;
if ((this_col_offset > x->mv_col_min) &&
(this_col_offset < x->mv_col_max) &&
bestsad);
if (thissad < bestsad) {
- this_mv.as_mv.row = this_row_offset;
- this_mv.as_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.row = this_row_offset;
+ this_mv.col = this_col_offset;
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, error_per_bit);
if (thissad < bestsad) {
if (best_site == -1) {
break;
} else {
- ref_mv->as_mv.row += neighbors[best_site].row;
- ref_mv->as_mv.col += neighbors[best_site].col;
+ ref_mv->row += neighbors[best_site].row;
+ ref_mv->col += neighbors[best_site].col;
best_address += (neighbors[best_site].row) * in_what_stride +
neighbors[best_site].col;
}
}
- this_mv.as_mv.row = ref_mv->as_mv.row * 8;
- this_mv.as_mv.col = ref_mv->as_mv.col * 8;
+ this_mv.row = ref_mv->row * 8;
+ this_mv.col = ref_mv->col * 8;
if (bestsad < INT_MAX)
return fn_ptr->vf(what, what_stride, best_address, in_what_stride,
(unsigned int *)(&thissad)) +
- mv_err_cost(&this_mv.as_mv, ¢er_mv->as_mv,
+ mv_err_cost(&this_mv, center_mv,
mvjcost, mvcost, x->errorperbit);
else
return INT_MAX;
}
int vp9_refining_search_sadx4(MACROBLOCK *x,
- int_mv *ref_mv, int error_per_bit,
+ MV *ref_mv, int error_per_bit,
int search_range, vp9_variance_fn_ptr_t *fn_ptr,
- int *mvjcost, int *mvcost[2], int_mv *center_mv) {
+ int *mvjcost, int *mvcost[2],
+ const MV *center_mv) {
const MACROBLOCKD* const xd = &x->e_mbd;
MV neighbors[4] = {{ -1, 0}, {0, -1}, {0, 1}, {1, 0}};
int i, j;
int in_what_stride = xd->plane[0].pre[0].stride;
uint8_t *what = x->plane[0].src.buf;
uint8_t *best_address = xd->plane[0].pre[0].buf +
- (ref_mv->as_mv.row * xd->plane[0].pre[0].stride) +
- ref_mv->as_mv.col;
+ (ref_mv->row * xd->plane[0].pre[0].stride) +
+ ref_mv->col;
uint8_t *check_here;
unsigned int thissad;
- int_mv this_mv;
+ MV this_mv;
unsigned int bestsad = INT_MAX;
- int_mv fcenter_mv;
+ MV fcenter_mv;
int *mvjsadcost = x->nmvjointsadcost;
int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
- fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
- fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
+ fcenter_mv.row = center_mv->row >> 3;
+ fcenter_mv.col = center_mv->col >> 3;
bestsad = fn_ptr->sdf(what, what_stride, best_address,
in_what_stride, 0x7fffffff) +
- mvsad_err_cost(&ref_mv->as_mv, &fcenter_mv.as_mv,
+ mvsad_err_cost(ref_mv, &fcenter_mv,
mvjsadcost, mvsadcost, error_per_bit);
for (i = 0; i < search_range; i++) {
int best_site = -1;
- int all_in = ((ref_mv->as_mv.row - 1) > x->mv_row_min) &
- ((ref_mv->as_mv.row + 1) < x->mv_row_max) &
- ((ref_mv->as_mv.col - 1) > x->mv_col_min) &
- ((ref_mv->as_mv.col + 1) < x->mv_col_max);
+ int all_in = ((ref_mv->row - 1) > x->mv_row_min) &
+ ((ref_mv->row + 1) < x->mv_row_max) &
+ ((ref_mv->col - 1) > x->mv_col_min) &
+ ((ref_mv->col + 1) < x->mv_col_max);
if (all_in) {
unsigned int sad_array[4];
for (j = 0; j < 4; j++) {
if (sad_array[j] < bestsad) {
- this_mv.as_mv.row = ref_mv->as_mv.row + neighbors[j].row;
- this_mv.as_mv.col = ref_mv->as_mv.col + neighbors[j].col;
- sad_array[j] += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.row = ref_mv->row + neighbors[j].row;
+ this_mv.col = ref_mv->col + neighbors[j].col;
+ sad_array[j] += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, error_per_bit);
if (sad_array[j] < bestsad) {
}
} else {
for (j = 0; j < 4; j++) {
- this_row_offset = ref_mv->as_mv.row + neighbors[j].row;
- this_col_offset = ref_mv->as_mv.col + neighbors[j].col;
+ this_row_offset = ref_mv->row + neighbors[j].row;
+ this_col_offset = ref_mv->col + neighbors[j].col;
if ((this_col_offset > x->mv_col_min) &&
(this_col_offset < x->mv_col_max) &&
bestsad);
if (thissad < bestsad) {
- this_mv.as_mv.row = this_row_offset;
- this_mv.as_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ this_mv.row = this_row_offset;
+ this_mv.col = this_col_offset;
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, error_per_bit);
if (thissad < bestsad) {
if (best_site == -1) {
break;
} else {
- ref_mv->as_mv.row += neighbors[best_site].row;
- ref_mv->as_mv.col += neighbors[best_site].col;
+ ref_mv->row += neighbors[best_site].row;
+ ref_mv->col += neighbors[best_site].col;
best_address += (neighbors[best_site].row) * in_what_stride +
neighbors[best_site].col;
}
}
- this_mv.as_mv.row = ref_mv->as_mv.row * 8;
- this_mv.as_mv.col = ref_mv->as_mv.col * 8;
+ this_mv.row = ref_mv->row * 8;
+ this_mv.col = ref_mv->col * 8;
if (bestsad < INT_MAX)
return fn_ptr->vf(what, what_stride, best_address, in_what_stride,
(unsigned int *)(&thissad)) +
- mv_err_cost(&this_mv.as_mv, ¢er_mv->as_mv,
+ mv_err_cost(&this_mv, center_mv,
mvjcost, mvcost, x->errorperbit);
else
return INT_MAX;