}
static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
- int_mv *ref_mv, MV *best_mv,
+ MV *ref_mv, MV *best_mv,
YV12_BUFFER_CONFIG *recon_buffer,
int *best_motion_err, int recon_yoffset) {
MACROBLOCKD *const xd = &x->e_mbd;
int num00;
- int_mv tmp_mv;
- int_mv ref_mv_full;
+ MV tmp_mv = {0, 0};
+ MV ref_mv_full;
int tmp_err;
int step_param = 3;
xd->plane[0].pre[0].buf = recon_buffer->y_buffer + recon_yoffset;
// Initial step/diamond search centred on best mv
- tmp_mv.as_int = 0;
- ref_mv_full.as_mv.col = ref_mv->as_mv.col >> 3;
- ref_mv_full.as_mv.row = ref_mv->as_mv.row >> 3;
- tmp_err = cpi->diamond_search_sad(x, &ref_mv_full.as_mv, &tmp_mv.as_mv,
+ ref_mv_full.col = ref_mv->col >> 3;
+ ref_mv_full.row = ref_mv->row >> 3;
+ tmp_err = cpi->diamond_search_sad(x, &ref_mv_full, &tmp_mv,
step_param,
x->sadperbit16, &num00, &v_fn_ptr,
x->nmvjointcost,
- x->mvcost, &ref_mv->as_mv);
+ x->mvcost, ref_mv);
if (tmp_err < INT_MAX - new_mv_mode_penalty)
tmp_err += new_mv_mode_penalty;
if (tmp_err < *best_motion_err) {
*best_motion_err = tmp_err;
- best_mv->row = tmp_mv.as_mv.row;
- best_mv->col = tmp_mv.as_mv.col;
+ best_mv->row = tmp_mv.row;
+ best_mv->col = tmp_mv.col;
}
// Further step/diamond searches as necessary
if (num00) {
num00--;
} else {
- tmp_err = cpi->diamond_search_sad(x, &ref_mv_full.as_mv, &tmp_mv.as_mv,
+ tmp_err = cpi->diamond_search_sad(x, &ref_mv_full, &tmp_mv,
step_param + n, x->sadperbit16,
&num00, &v_fn_ptr,
x->nmvjointcost,
- x->mvcost, &ref_mv->as_mv);
+ x->mvcost, ref_mv);
if (tmp_err < INT_MAX - new_mv_mode_penalty)
tmp_err += new_mv_mode_penalty;
if (tmp_err < *best_motion_err) {
*best_motion_err = tmp_err;
- best_mv->row = tmp_mv.as_mv.row;
- best_mv->col = tmp_mv.as_mv.col;
+ best_mv->row = tmp_mv.row;
+ best_mv->col = tmp_mv.col;
}
}
}
// Test last reference frame using the previous best mv as the
// starting point (best reference) for the search
- first_pass_motion_search(cpi, x, &best_ref_mv,
- &mv.as_mv, lst_yv12,
- &motion_error, recon_yoffset);
+ first_pass_motion_search(cpi, x, &best_ref_mv.as_mv, &mv.as_mv,
+ lst_yv12, &motion_error, recon_yoffset);
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
vp9_clear_system_state(); // __asm emms;
motion_error *= error_weight;
// based search as well.
if (best_ref_mv.as_int) {
tmp_err = INT_MAX;
- first_pass_motion_search(cpi, x, &zero_ref_mv, &tmp_mv.as_mv,
+ first_pass_motion_search(cpi, x, &zero_ref_mv.as_mv, &tmp_mv.as_mv,
lst_yv12, &tmp_err, recon_yoffset);
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
vp9_clear_system_state(); // __asm emms;
// Simple 0,0 motion with no mv overhead
gf_motion_error = zz_motion_search(cpi, x, gld_yv12, recon_yoffset);
- first_pass_motion_search(cpi, x, &zero_ref_mv,
- &tmp_mv.as_mv, gld_yv12,
- &gf_motion_error, recon_yoffset);
+ first_pass_motion_search(cpi, x, &zero_ref_mv.as_mv, &tmp_mv.as_mv,
+ gld_yv12, &gf_motion_error, recon_yoffset);
if (cpi->oxcf.aq_mode == VARIANCE_AQ) {
vp9_clear_system_state(); // __asm emms;
gf_motion_error *= error_weight;
if (thissad < bestsad)\
{\
if (use_mvcost) \
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv.as_mv, \
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv, \
mvjsadcost, mvsadcost, \
sad_per_bit);\
if (thissad < bestsad)\
int k = -1;
int all_in;
int best_site = -1;
- int_mv fcenter_mv;
+ MV fcenter_mv;
int best_init_s = search_param_to_steps[search_param];
int *mvjsadcost = x->nmvjointsadcost;
int *mvsadcost[2] = {x->nmvsadcost[0], x->nmvsadcost[1]};
- fcenter_mv.as_mv.row = center_mv->row >> 3;
- fcenter_mv.as_mv.col = center_mv->col >> 3;
+ fcenter_mv.row = center_mv->row >> 3;
+ fcenter_mv.col = center_mv->col >> 3;
// adjust ref_mv to make sure it is within MV range
clamp_mv(ref_mv, x->mv_col_min, x->mv_col_max, x->mv_row_min, x->mv_row_max);
this_mv.row = br;
this_mv.col = bc;
bestsad = vfp->sdf(what, what_stride, this_offset, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(&this_mv, &fcenter_mv.as_mv,
+ + mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
// Search all possible scales upto the search param around the center point
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]};
- fcenter_mv.as_mv.row = center_mv->row >> 3;
- fcenter_mv.as_mv.col = center_mv->col >> 3;
+ fcenter_mv.row = center_mv->row >> 3;
+ fcenter_mv.col = center_mv->col >> 3;
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;
// Check the starting position
bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv.as_mv,
+ + mvsad_err_cost(best_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
// search_param determines the length of the initial step and hence the number
if (thissad < bestsad) {
this_mv.row = this_row_offset;
this_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv.as_mv,
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
if (thissad < bestsad) {
this_mv.row = this_row_offset;
this_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv.as_mv,
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
uint8_t *check_here;
unsigned int thissad;
- 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->row >> 3;
- fcenter_mv.as_mv.col = center_mv->col >> 3;
+ fcenter_mv.row = center_mv->row >> 3;
+ fcenter_mv.col = center_mv->col >> 3;
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;
// Check the starting position
bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv.as_mv,
+ + mvsad_err_cost(best_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
// search_param determines the length of the initial step and hence the number
if (sad_array[t] < bestsad) {
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,
+ sad_array[t] += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (sad_array[t] < bestsad) {
if (thissad < bestsad) {
this_mv.row = this_row_offset;
this_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv.as_mv,
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
if (thissad < bestsad) {
this_mv.row = this_row_offset;
this_mv.col = this_col_offset;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv.as_mv,
+ thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
int in_what_stride = xd->plane[0].pre[0].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];
+ MV *best_mv = &x->e_mbd.mi_8x8[0]->bmi[n].as_mv[0].as_mv;
MV this_mv;
int bestsad = INT_MAX;
int r, c;
in_what = xd->plane[0].pre[0].buf;
bestaddress = in_what + (ref_row * xd->plane[0].pre[0].stride) + ref_col;
- best_mv->as_mv.row = ref_row;
- best_mv->as_mv.col = ref_col;
+ best_mv->row = ref_row;
+ best_mv->col = ref_col;
// 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,
+ + mvsad_err_cost(best_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
// Apply further limits to prevent us looking using vectors that stretch
if (thissad < bestsad) {
bestsad = thissad;
- best_mv->as_mv.row = r;
- best_mv->as_mv.col = c;
+ best_mv->row = r;
+ best_mv->col = c;
bestaddress = check_here;
}
}
}
- this_mv.row = best_mv->as_mv.row * 8;
- this_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 fn_ptr->vf(what, what_stride, bestaddress, in_what_stride,
int in_what_stride = xd->plane[0].pre[0].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];
+ MV *best_mv = &x->e_mbd.mi_8x8[0]->bmi[n].as_mv[0].as_mv;
MV this_mv;
unsigned int bestsad = INT_MAX;
int r, c;
in_what = xd->plane[0].pre[0].buf;
bestaddress = in_what + (ref_row * xd->plane[0].pre[0].stride) + ref_col;
- best_mv->as_mv.row = ref_row;
- best_mv->as_mv.col = ref_col;
+ best_mv->row = ref_row;
+ best_mv->col = ref_col;
// 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,
+ + mvsad_err_cost(best_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
// Apply further limits to prevent us looking using vectors that stretch
if (thissad < bestsad) {
bestsad = thissad;
- best_mv->as_mv.row = r;
- best_mv->as_mv.col = c;
+ best_mv->row = r;
+ best_mv->col = c;
bestaddress = check_here;
}
}
if (thissad < bestsad) {
bestsad = thissad;
- best_mv->as_mv.row = r;
- best_mv->as_mv.col = c;
+ best_mv->row = r;
+ best_mv->col = c;
bestaddress = check_here;
}
}
}
}
- this_mv.row = best_mv->as_mv.row * 8;
- this_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 fn_ptr->vf(what, what_stride, bestaddress, in_what_stride,
int in_what_stride = xd->plane[0].pre[0].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];
+ MV *best_mv = &x->e_mbd.mi_8x8[0]->bmi[n].as_mv[0].as_mv;
MV this_mv;
unsigned int bestsad = INT_MAX;
int r, c;
in_what = xd->plane[0].pre[0].buf;
bestaddress = in_what + (ref_row * xd->plane[0].pre[0].stride) + ref_col;
- best_mv->as_mv.row = ref_row;
- best_mv->as_mv.col = ref_col;
+ best_mv->row = ref_row;
+ best_mv->col = ref_col;
- // Baseline value at the centre
+ // Baseline value at the center
bestsad = fn_ptr->sdf(what, what_stride,
bestaddress, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv,
+ + mvsad_err_cost(best_mv, &fcenter_mv,
mvjsadcost, mvsadcost, sad_per_bit);
// Apply further limits to prevent us looking using vectors that stretch
if (thissad < bestsad) {
bestsad = thissad;
- best_mv->as_mv.row = r;
- best_mv->as_mv.col = c;
+ best_mv->row = r;
+ best_mv->col = c;
bestaddress = check_here;
}
}
if (thissad < bestsad) {
bestsad = thissad;
- best_mv->as_mv.row = r;
- best_mv->as_mv.col = c;
+ best_mv->row = r;
+ best_mv->col = c;
bestaddress = check_here;
}
}
if (thissad < bestsad) {
bestsad = thissad;
- best_mv->as_mv.row = r;
- best_mv->as_mv.col = c;
+ best_mv->row = r;
+ best_mv->col = c;
bestaddress = check_here;
}
}
}
}
- this_mv.row = best_mv->as_mv.row * 8;
- this_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 fn_ptr->vf(what, what_stride, bestaddress, in_what_stride,
* mode.
*/
int vp9_refining_search_8p_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 uint8_t *second_pred, int w, int h) {
const MACROBLOCKD* const xd = &x->e_mbd;
MV neighbors[8] = {{-1, 0}, {0, -1}, {0, 1}, {1, 0},
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;
/* Get compound pred by averaging two pred blocks. */
bestsad = fn_ptr->sdaf(what, what_stride, best_address, in_what_stride,
second_pred, 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 < 8; 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) &&
second_pred, 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) {
bestsad = thissad;
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) {
// FIXME(rbultje, yunqing): add full-pixel averaging variance functions
// so we don't have to use the subpixel with xoff=0,yoff=0 here.
return fn_ptr->svaf(best_address, in_what_stride, 0, 0, what, what_stride,
(unsigned int *)(&thissad), second_pred) +
- 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;