ref: 30888742f42dd3faef6453cfadcb480e614cc3d2
parent: 71cfaaa689c0a3fdecd63109481681e87f5ba38a
parent: e51e7a0e8d4aed20ac11a68debe67d08460e7adf
author: Dmitry Kovalev <[email protected]>
date: Tue Sep 24 08:25:56 EDT 2013
Merge "Moving from int_mv to MV."
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -59,38 +59,39 @@
return sr;
}
-int vp9_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvjcost, int *mvcost[2],
- int weight) {
- MV v;
- v.row = mv->as_mv.row - ref->as_mv.row;
- v.col = mv->as_mv.col - ref->as_mv.col;
- return ROUND_POWER_OF_TWO((mvjcost[vp9_get_mv_joint(&v)] +
- mvcost[0][v.row] +
- mvcost[1][v.col]) * weight, 7);
+static INLINE int mv_cost(const MV *mv,
+ const int *joint_cost, int *comp_cost[2]) {
+ return joint_cost[vp9_get_mv_joint(mv)] +
+ comp_cost[0][mv->row] + comp_cost[1][mv->col];
}
-static int mv_err_cost(int_mv *mv, int_mv *ref, int *mvjcost, int *mvcost[2],
+int vp9_mv_bit_cost(const MV *mv, const MV *ref,
+ const int *mvjcost, int *mvcost[2], int weight) {
+ const MV diff = { mv->row - ref->row,
+ mv->col - ref->col };
+ return ROUND_POWER_OF_TWO(mv_cost(&diff, mvjcost, mvcost) * weight, 7);
+}
+
+static int mv_err_cost(const MV *mv, const MV *ref,
+ const int *mvjcost, int *mvcost[2],
int error_per_bit) {
if (mvcost) {
- MV v;
- v.row = mv->as_mv.row - ref->as_mv.row;
- v.col = mv->as_mv.col - ref->as_mv.col;
- return ROUND_POWER_OF_TWO((mvjcost[vp9_get_mv_joint(&v)] +
- mvcost[0][v.row] +
- mvcost[1][v.col]) * error_per_bit, 13);
+ const MV diff = { mv->row - ref->row,
+ mv->col - ref->col };
+ return ROUND_POWER_OF_TWO(mv_cost(&diff, mvjcost, mvcost) *
+ error_per_bit, 13);
}
return 0;
}
-static int mvsad_err_cost(int_mv *mv, int_mv *ref, int *mvjsadcost,
- int *mvsadcost[2], int error_per_bit) {
+static int mvsad_err_cost(const MV *mv, const MV *ref,
+ const int *mvjsadcost, int *mvsadcost[2],
+ int error_per_bit) {
if (mvsadcost) {
- MV v;
- v.row = mv->as_mv.row - ref->as_mv.row;
- v.col = mv->as_mv.col - ref->as_mv.col;
- return ROUND_POWER_OF_TWO((mvjsadcost[vp9_get_mv_joint(&v)] +
- mvsadcost[0][v.row] +
- mvsadcost[1][v.col]) * error_per_bit, 8);
+ const MV diff = { mv->row - ref->row,
+ mv->col - ref->col };
+ return ROUND_POWER_OF_TWO(mv_cost(&diff, mvjsadcost, mvsadcost) *
+ error_per_bit, 8);
}
return 0;
}
@@ -317,7 +318,8 @@
// calculate central point error
besterr = vfp->vf(y, y_stride, z, src_stride, sse1);
*distortion = besterr;
- besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit);
+ besterr += mv_err_cost(&bestmv->as_mv, &ref_mv->as_mv,
+ mvjcost, mvcost, error_per_bit);
// TODO: Each subsequent iteration checks at least one point in
// common with the last iteration could be 2 ( if diag selected)
@@ -414,7 +416,8 @@
// calculate central point error
besterr = vfp->vf(y, y_stride, z, src_stride, sse1);
*distortion = besterr;
- besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit);
+ besterr += mv_err_cost(&bestmv->as_mv, &ref_mv->as_mv,
+ mvjcost, mvcost, error_per_bit);
// 1/2 pel
FIRST_LEVEL_CHECKS;
@@ -513,7 +516,8 @@
comp_avg_pred(comp_pred, second_pred, w, h, y, y_stride);
besterr = vfp->vf(comp_pred, w, z, src_stride, sse1);
*distortion = besterr;
- besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit);
+ besterr += mv_err_cost(&bestmv->as_mv, &ref_mv->as_mv,
+ mvjcost, mvcost, error_per_bit);
// Each subsequent iteration checks at least one point in
// common with the last iteration could be 2 ( if diag selected)
@@ -615,7 +619,8 @@
comp_avg_pred(comp_pred, second_pred, w, h, y, y_stride);
besterr = vfp->vf(comp_pred, w, z, src_stride, sse1);
*distortion = besterr;
- besterr += mv_err_cost(bestmv, ref_mv, mvjcost, mvcost, error_per_bit);
+ besterr += mv_err_cost(&bestmv->as_mv, &ref_mv->as_mv,
+ mvjcost, mvcost, error_per_bit);
// Each subsequent iteration checks at least one point in
// common with the last iteration could be 2 ( if diag selected)
@@ -690,7 +695,7 @@
if (thissad < bestsad)\
{\
if (use_mvcost) \
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv, \
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv, \
mvjsadcost, mvsadcost, \
sad_per_bit);\
if (thissad < bestsad)\
@@ -762,10 +767,9 @@
this_offset = base_offset + (br * in_what_stride) + bc;
this_mv.as_mv.row = br;
this_mv.as_mv.col = bc;
- bestsad = vfp->sdf(what, what_stride, this_offset,
- in_what_stride, 0x7fffffff)
- + mvsad_err_cost(&this_mv, &fcenter_mv, mvjsadcost, mvsadcost,
- sad_per_bit);
+ bestsad = vfp->sdf(what, what_stride, this_offset, in_what_stride, 0x7fffffff)
+ + mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, sad_per_bit);
// Search all possible scales upto the search param around the center point
// pick the scale of the point that is best as the starting scale of
@@ -944,11 +948,12 @@
this_mv.as_mv.col = best_mv->as_mv.col * 8;
if (bestsad == INT_MAX)
return INT_MAX;
- return
- vfp->vf(what, what_stride, this_offset, in_what_stride,
- (unsigned int *)(&bestsad)) +
- use_mvcost ? mv_err_cost(&this_mv, center_mv, x->nmvjointcost, x->mvcost,
- x->errorperbit) : 0;
+
+ return vfp->vf(what, what_stride, this_offset, in_what_stride,
+ (unsigned int *)&bestsad) +
+ use_mvcost ? mv_err_cost(&this_mv.as_mv, ¢er_mv->as_mv,
+ x->nmvjointcost, x->mvcost, x->errorperbit)
+ : 0;
}
@@ -1124,10 +1129,9 @@
best_address = in_what;
// Check the starting position
- bestsad = fn_ptr->sdf(what, what_stride, in_what,
- in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvjsadcost, mvsadcost,
- sad_per_bit);
+ bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, 0x7fffffff)
+ + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, sad_per_bit);
// search_param determines the length of the initial step and hence the number of iterations
// 0 = initial step (MAX_FIRST_STEP) pel : 1 = (MAX_FIRST_STEP/2) pel, 2 = (MAX_FIRST_STEP/4) pel... etc.
@@ -1153,7 +1157,7 @@
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, &fcenter_mv,
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
@@ -1185,7 +1189,7 @@
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, &fcenter_mv,
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
@@ -1210,8 +1214,9 @@
return INT_MAX;
return fn_ptr->vf(what, what_stride, best_address, in_what_stride,
- (unsigned int *)(&thissad)) + mv_err_cost(&this_mv, center_mv, mvjcost,
- mvcost, x->errorperbit);
+ (unsigned int *)(&thissad)) +
+ mv_err_cost(&this_mv.as_mv, ¢er_mv->as_mv,
+ mvjcost, mvcost, x->errorperbit);
}
int vp9_diamond_search_sadx4(MACROBLOCK *x,
@@ -1265,10 +1270,9 @@
best_address = in_what;
// Check the starting position
- bestsad = fn_ptr->sdf(what, what_stride,
- in_what, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvjsadcost, mvsadcost,
- sad_per_bit);
+ bestsad = fn_ptr->sdf(what, what_stride, in_what, in_what_stride, 0x7fffffff)
+ + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, sad_per_bit);
// search_param determines the length of the initial step and hence the number of iterations
// 0 = initial step (MAX_FIRST_STEP) pel : 1 = (MAX_FIRST_STEP/2) pel, 2 = (MAX_FIRST_STEP/4) pel... etc.
@@ -1303,7 +1307,7 @@
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, &fcenter_mv,
+ sad_array[t] += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (sad_array[t] < bestsad) {
@@ -1327,7 +1331,7 @@
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, &fcenter_mv,
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
@@ -1358,7 +1362,7 @@
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, &fcenter_mv,
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
@@ -1383,8 +1387,9 @@
return INT_MAX;
return fn_ptr->vf(what, what_stride, best_address, in_what_stride,
- (unsigned int *)(&thissad)) + mv_err_cost(&this_mv,
- center_mv, mvjcost, mvcost, x->errorperbit);
+ (unsigned int *)(&thissad)) +
+ mv_err_cost(&this_mv.as_mv, ¢er_mv->as_mv,
+ mvjcost, mvcost, x->errorperbit);
}
/* do_refine: If last step (1-away) of n-step search doesn't pick the center
@@ -1495,8 +1500,8 @@
// Baseline value at the centre
bestsad = fn_ptr->sdf(what, what_stride, bestaddress,
in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvjsadcost, mvsadcost,
- sad_per_bit);
+ + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, sad_per_bit);
// Apply further limits to prevent us looking using vectors that stretch
// beyond the UMV border
@@ -1513,8 +1518,8 @@
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, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
@@ -1531,10 +1536,10 @@
this_mv.as_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, center_mv, mvjcost, mvcost, x->errorperbit);
+ 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,
+ mvjcost, mvcost, x->errorperbit);
else
return INT_MAX;
}
@@ -1585,8 +1590,8 @@
// Baseline value at the centre
bestsad = fn_ptr->sdf(what, what_stride,
bestaddress, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvjsadcost, mvsadcost,
- sad_per_bit);
+ + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, sad_per_bit);
// Apply further limits to prevent us looking using vectors that stretch
// beyond the UMV border
@@ -1610,8 +1615,8 @@
if (thissad < bestsad) {
this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
@@ -1631,7 +1636,7 @@
if (thissad < bestsad) {
this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
@@ -1652,10 +1657,10 @@
this_mv.as_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, center_mv, mvjcost, mvcost, x->errorperbit);
+ 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,
+ mvjcost, mvcost, x->errorperbit);
else
return INT_MAX;
}
@@ -1708,8 +1713,8 @@
// Baseline value at the centre
bestsad = fn_ptr->sdf(what, what_stride,
bestaddress, in_what_stride, 0x7fffffff)
- + mvsad_err_cost(best_mv, &fcenter_mv, mvjsadcost, mvsadcost,
- sad_per_bit);
+ + mvsad_err_cost(&best_mv->as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, sad_per_bit);
// Apply further limits to prevent us looking using vectors that stretch
// beyond the UMV border
@@ -1733,8 +1738,8 @@
if (thissad < bestsad) {
this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
@@ -1759,7 +1764,7 @@
if (thissad < bestsad) {
this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
@@ -1780,8 +1785,8 @@
if (thissad < bestsad) {
this_mv.as_mv.col = c;
- thissad += mvsad_err_cost(&this_mv, &fcenter_mv,
- mvjsadcost, mvsadcost, sad_per_bit);
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, sad_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
@@ -1800,10 +1805,10 @@
this_mv.as_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, center_mv, mvjcost, mvcost, x->errorperbit);
+ 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,
+ mvjcost, mvcost, x->errorperbit);
else
return INT_MAX;
}
@@ -1834,8 +1839,10 @@
fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
- bestsad = fn_ptr->sdf(what, what_stride, best_address, in_what_stride, 0x7fffffff) +
- mvsad_err_cost(ref_mv, &fcenter_mv, mvjsadcost, mvsadcost, error_per_bit);
+ bestsad = fn_ptr->sdf(what, what_stride, best_address,
+ in_what_stride, 0x7fffffff) +
+ mvsad_err_cost(&ref_mv->as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, error_per_bit);
for (i = 0; i < search_range; i++) {
int best_site = -1;
@@ -1852,8 +1859,8 @@
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, &fcenter_mv, mvjsadcost,
- mvsadcost, error_per_bit);
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, error_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
@@ -1876,10 +1883,10 @@
this_mv.as_mv.col = ref_mv->as_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, center_mv, mvjcost, mvcost, x->errorperbit);
+ 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,
+ mvjcost, mvcost, x->errorperbit);
else
return INT_MAX;
}
@@ -1911,8 +1918,10 @@
fcenter_mv.as_mv.row = center_mv->as_mv.row >> 3;
fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
- bestsad = fn_ptr->sdf(what, what_stride, best_address, in_what_stride, 0x7fffffff) +
- mvsad_err_cost(ref_mv, &fcenter_mv, mvjsadcost, mvsadcost, error_per_bit);
+ bestsad = fn_ptr->sdf(what, what_stride, best_address,
+ in_what_stride, 0x7fffffff) +
+ mvsad_err_cost(&ref_mv->as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, error_per_bit);
for (i = 0; i < search_range; i++) {
int best_site = -1;
@@ -1935,8 +1944,8 @@
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, &fcenter_mv, mvjsadcost,
- mvsadcost, error_per_bit);
+ sad_array[j] += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, error_per_bit);
if (sad_array[j] < bestsad) {
bestsad = sad_array[j];
@@ -1957,8 +1966,8 @@
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, &fcenter_mv, mvjsadcost,
- mvsadcost, error_per_bit);
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, error_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
@@ -1982,10 +1991,10 @@
this_mv.as_mv.col = ref_mv->as_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, center_mv, mvjcost, mvcost, x->errorperbit);
+ 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,
+ mvjcost, mvcost, x->errorperbit);
else
return INT_MAX;
}
@@ -2025,7 +2034,8 @@
/* 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, &fcenter_mv, mvjsadcost, mvsadcost, error_per_bit);
+ mvsad_err_cost(&ref_mv->as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, error_per_bit);
for (i = 0; i < search_range; i++) {
int best_site = -1;
@@ -2048,9 +2058,8 @@
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, &fcenter_mv, mvjsadcost,
- mvsadcost, error_per_bit);
-
+ thissad += mvsad_err_cost(&this_mv.as_mv, &fcenter_mv.as_mv,
+ mvjsadcost, mvsadcost, error_per_bit);
if (thissad < bestsad) {
bestsad = thissad;
best_site = j;
@@ -2075,10 +2084,10 @@
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, center_mv, mvjcost, mvcost, x->errorperbit);
+ 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,
+ mvjcost, mvcost, x->errorperbit);
} else {
return INT_MAX;
}
--- a/vp9/encoder/vp9_mcomp.h
+++ b/vp9/encoder/vp9_mcomp.h
@@ -24,8 +24,8 @@
#define MAX_FIRST_STEP (1 << (MAX_MVSEARCH_STEPS-1))
void vp9_clamp_mv_min_max(MACROBLOCK *x, MV *mv);
-int vp9_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvjcost,
- int *mvcost[2], int weight);
+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);
void vp9_init3smotion_compensation(MACROBLOCK *x, int stride);
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1477,11 +1477,12 @@
switch (m = this_mode) {
case NEWMV:
this_mv->as_int = seg_mvs[mbmi->ref_frame[0]].as_int;
- thismvcost = vp9_mv_bit_cost(this_mv, best_ref_mv, mvjcost, mvcost,
- 102);
+ thismvcost = vp9_mv_bit_cost(&this_mv->as_mv, &best_ref_mv->as_mv,
+ mvjcost, mvcost, 102);
if (has_second_rf) {
this_second_mv->as_int = seg_mvs[mbmi->ref_frame[1]].as_int;
- thismvcost += vp9_mv_bit_cost(this_second_mv, second_best_ref_mv,
+ thismvcost += vp9_mv_bit_cost(&this_second_mv->as_mv,
+ &second_best_ref_mv->as_mv,
mvjcost, mvcost, 102);
}
break;
@@ -2462,9 +2463,8 @@
x->nmvjointcost, x->mvcost,
&dis, &sse);
}
- *rate_mv = vp9_mv_bit_cost(tmp_mv, &ref_mv,
- x->nmvjointcost, x->mvcost,
- 96);
+ *rate_mv = vp9_mv_bit_cost(&tmp_mv->as_mv, &ref_mv.as_mv,
+ x->nmvjointcost, x->mvcost, 96);
if (cpi->sf.adaptive_motion_search && cpi->common.show_frame)
x->pred_mv[ref].as_int = tmp_mv->as_int;
@@ -2623,11 +2623,11 @@
for (i = 0; i < MAX_MB_PLANE; i++)
xd->plane[i].pre[1] = backup_second_yv12[i];
}
- *rate_mv = vp9_mv_bit_cost(&frame_mv[refs[0]],
- &mbmi->ref_mvs[refs[0]][0],
+ *rate_mv = vp9_mv_bit_cost(&frame_mv[refs[0]].as_mv,
+ &mbmi->ref_mvs[refs[0]][0].as_mv,
x->nmvjointcost, x->mvcost, 96);
- *rate_mv += vp9_mv_bit_cost(&frame_mv[refs[1]],
- &mbmi->ref_mvs[refs[1]][0],
+ *rate_mv += vp9_mv_bit_cost(&frame_mv[refs[1]].as_mv,
+ &mbmi->ref_mvs[refs[1]][0].as_mv,
x->nmvjointcost, x->mvcost, 96);
vpx_free(second_pred);
@@ -2679,11 +2679,11 @@
joint_motion_search(cpi, x, bsize, frame_mv,
mi_row, mi_col, single_newmv, &rate_mv);
} else {
- rate_mv = vp9_mv_bit_cost(&frame_mv[refs[0]],
- &mbmi->ref_mvs[refs[0]][0],
+ rate_mv = vp9_mv_bit_cost(&frame_mv[refs[0]].as_mv,
+ &mbmi->ref_mvs[refs[0]][0].as_mv,
x->nmvjointcost, x->mvcost, 96);
- rate_mv += vp9_mv_bit_cost(&frame_mv[refs[1]],
- &mbmi->ref_mvs[refs[1]][0],
+ rate_mv += vp9_mv_bit_cost(&frame_mv[refs[1]].as_mv,
+ &mbmi->ref_mvs[refs[1]][0].as_mv,
x->nmvjointcost, x->mvcost, 96);
}
if (frame_mv[refs[0]].as_int == INVALID_MV ||