Using MV struct instead of int_mv union in encoder.
Change-Id: I8b81a3e4b4fa530a654c28d9c136afa0c1d379fd
This commit is contained in:
parent
ec79db6086
commit
25da21b14e
@ -15,7 +15,7 @@
|
||||
|
||||
#include "vp9/common/vp9_common.h"
|
||||
|
||||
typedef struct {
|
||||
typedef struct mv {
|
||||
int16_t row;
|
||||
int16_t col;
|
||||
} MV;
|
||||
@ -25,7 +25,7 @@ typedef union int_mv {
|
||||
MV as_mv;
|
||||
} int_mv; /* facilitates faster equality tests and copies */
|
||||
|
||||
typedef struct {
|
||||
typedef struct mv32 {
|
||||
int32_t row;
|
||||
int32_t col;
|
||||
} MV32;
|
||||
|
@ -14,6 +14,7 @@ struct macroblock;
|
||||
struct vp9_variance_vtable;
|
||||
|
||||
#define DEC_MVCOSTS int *mvjcost, int *mvcost[2]
|
||||
struct mv;
|
||||
union int_mv;
|
||||
struct yv12_buffer_config;
|
||||
EOF
|
||||
@ -736,20 +737,20 @@ specialize vp9_fdct32x32_rd sse2 avx2
|
||||
#
|
||||
# Motion search
|
||||
#
|
||||
prototype int vp9_full_search_sad "struct macroblock *x, union int_mv *ref_mv, int sad_per_bit, int distance, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, union int_mv *center_mv, int n"
|
||||
prototype int vp9_full_search_sad "struct macroblock *x, struct mv *ref_mv, int sad_per_bit, int distance, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, const struct mv *center_mv, int n"
|
||||
specialize vp9_full_search_sad sse3 sse4_1
|
||||
vp9_full_search_sad_sse3=vp9_full_search_sadx3
|
||||
vp9_full_search_sad_sse4_1=vp9_full_search_sadx8
|
||||
|
||||
prototype int vp9_refining_search_sad "struct macroblock *x, union int_mv *ref_mv, int sad_per_bit, int distance, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, union int_mv *center_mv"
|
||||
prototype int vp9_refining_search_sad "struct macroblock *x, struct mv *ref_mv, int sad_per_bit, int distance, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, const struct mv *center_mv"
|
||||
specialize vp9_refining_search_sad sse3
|
||||
vp9_refining_search_sad_sse3=vp9_refining_search_sadx4
|
||||
|
||||
prototype int vp9_diamond_search_sad "struct macroblock *x, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, union int_mv *center_mv"
|
||||
prototype int vp9_diamond_search_sad "struct macroblock *x, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, const struct mv *center_mv"
|
||||
specialize vp9_diamond_search_sad sse3
|
||||
vp9_diamond_search_sad_sse3=vp9_diamond_search_sadx4
|
||||
|
||||
prototype int vp9_full_range_search "struct macroblock *x, union int_mv *ref_mv, union int_mv *best_mv, int search_param, int sad_per_bit, int *num00, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, union int_mv *center_mv"
|
||||
prototype int vp9_full_range_search "struct macroblock *x, struct mv *ref_mv, struct mv *best_mv, int search_param, int sad_per_bit, int *num00, struct vp9_variance_vtable *fn_ptr, DEC_MVCOSTS, const struct mv *center_mv"
|
||||
specialize vp9_full_range_search
|
||||
|
||||
prototype void vp9_temporal_filter_apply "uint8_t *frame1, unsigned int stride, uint8_t *frame2, unsigned int block_size, int strength, int filter_weight, unsigned int *accumulator, uint16_t *count"
|
||||
|
@ -406,8 +406,7 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
int step_param = 3;
|
||||
int further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param;
|
||||
int n;
|
||||
vp9_variance_fn_ptr_t v_fn_ptr =
|
||||
cpi->fn_ptr[xd->mi_8x8[0]->mbmi.sb_type];
|
||||
vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[xd->mi_8x8[0]->mbmi.sb_type];
|
||||
int new_mv_mode_penalty = 256;
|
||||
|
||||
int sr = 0;
|
||||
@ -444,10 +443,11 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
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, &tmp_mv, step_param,
|
||||
tmp_err = cpi->diamond_search_sad(x, &ref_mv_full.as_mv, &tmp_mv.as_mv,
|
||||
step_param,
|
||||
x->sadperbit16, &num00, &v_fn_ptr,
|
||||
x->nmvjointcost,
|
||||
x->mvcost, ref_mv);
|
||||
x->mvcost, &ref_mv->as_mv);
|
||||
if (tmp_err < INT_MAX - new_mv_mode_penalty)
|
||||
tmp_err += new_mv_mode_penalty;
|
||||
|
||||
@ -467,11 +467,11 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
if (num00) {
|
||||
num00--;
|
||||
} else {
|
||||
tmp_err = cpi->diamond_search_sad(x, &ref_mv_full, &tmp_mv,
|
||||
tmp_err = cpi->diamond_search_sad(x, &ref_mv_full.as_mv, &tmp_mv.as_mv,
|
||||
step_param + n, x->sadperbit16,
|
||||
&num00, &v_fn_ptr,
|
||||
x->nmvjointcost,
|
||||
x->mvcost, ref_mv);
|
||||
x->mvcost, &ref_mv->as_mv);
|
||||
if (tmp_err < INT_MAX - new_mv_mode_penalty)
|
||||
tmp_err += new_mv_mode_penalty;
|
||||
|
||||
|
@ -1066,10 +1066,10 @@ int vp9_square_search(MACROBLOCK *x,
|
||||
#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;
|
||||
@ -1077,14 +1077,14 @@ int vp9_full_range_search_c(MACROBLOCK *x, int_mv *ref_mv, int_mv *best_mv,
|
||||
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]};
|
||||
@ -1098,16 +1098,15 @@ int vp9_full_range_search_c(MACROBLOCK *x, int_mv *ref_mv, int_mv *best_mv,
|
||||
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 +
|
||||
@ -1116,7 +1115,7 @@ int vp9_full_range_search_c(MACROBLOCK *x, int_mv *ref_mv, int_mv *best_mv,
|
||||
|
||||
// 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);
|
||||
@ -1136,10 +1135,10 @@ int vp9_full_range_search_c(MACROBLOCK *x, int_mv *ref_mv, int_mv *best_mv,
|
||||
|
||||
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;
|
||||
@ -1155,9 +1154,9 @@ int vp9_full_range_search_c(MACROBLOCK *x, int_mv *ref_mv, int_mv *best_mv,
|
||||
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) {
|
||||
@ -1171,26 +1170,26 @@ int vp9_full_range_search_c(MACROBLOCK *x, int_mv *ref_mv, int_mv *best_mv,
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1201,7 +1200,7 @@ int vp9_diamond_search_sad_c(MACROBLOCK *x,
|
||||
uint8_t *best_address;
|
||||
|
||||
int tot_steps;
|
||||
int_mv this_mv;
|
||||
MV this_mv;
|
||||
|
||||
int bestsad = INT_MAX;
|
||||
int best_site = 0;
|
||||
@ -1218,16 +1217,15 @@ int vp9_diamond_search_sad_c(MACROBLOCK *x,
|
||||
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 +
|
||||
@ -1236,7 +1234,7 @@ int vp9_diamond_search_sad_c(MACROBLOCK *x,
|
||||
|
||||
// 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
|
||||
@ -1251,8 +1249,8 @@ int vp9_diamond_search_sad_c(MACROBLOCK *x,
|
||||
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) &&
|
||||
@ -1263,9 +1261,9 @@ int vp9_diamond_search_sad_c(MACROBLOCK *x,
|
||||
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) {
|
||||
@ -1279,14 +1277,14 @@ int vp9_diamond_search_sad_c(MACROBLOCK *x,
|
||||
}
|
||||
|
||||
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) &&
|
||||
@ -1295,14 +1293,14 @@ int vp9_diamond_search_sad_c(MACROBLOCK *x,
|
||||
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;
|
||||
}
|
||||
@ -1316,23 +1314,24 @@ int vp9_diamond_search_sad_c(MACROBLOCK *x,
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1343,7 +1342,7 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
|
||||
uint8_t *best_address;
|
||||
|
||||
int tot_steps;
|
||||
int_mv this_mv;
|
||||
MV this_mv;
|
||||
|
||||
unsigned int bestsad = INT_MAX;
|
||||
int best_site = 0;
|
||||
@ -1362,16 +1361,15 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
|
||||
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 +
|
||||
@ -1380,7 +1378,7 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
|
||||
|
||||
// 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
|
||||
@ -1398,10 +1396,10 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
|
||||
|
||||
// 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
|
||||
@ -1420,9 +1418,9 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
|
||||
|
||||
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) {
|
||||
@ -1435,8 +1433,8 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
|
||||
} 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) &&
|
||||
@ -1447,9 +1445,9 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
|
||||
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) {
|
||||
@ -1462,14 +1460,14 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
|
||||
}
|
||||
}
|
||||
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) &&
|
||||
@ -1478,14 +1476,14 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
|
||||
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;
|
||||
}
|
||||
@ -1499,15 +1497,15 @@ int vp9_diamond_search_sadx4(MACROBLOCK *x,
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1522,10 +1520,10 @@ int vp9_full_pixel_diamond(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
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;
|
||||
@ -1542,10 +1540,10 @@ int vp9_full_pixel_diamond(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
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))
|
||||
@ -1563,9 +1561,9 @@ int vp9_full_pixel_diamond(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
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;
|
||||
@ -1575,11 +1573,11 @@ int vp9_full_pixel_diamond(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
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;
|
||||
@ -1588,27 +1586,27 @@ int vp9_full_search_sad_c(MACROBLOCK *x, int_mv *ref_mv,
|
||||
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;
|
||||
@ -1620,7 +1618,7 @@ int vp9_full_search_sad_c(MACROBLOCK *x, int_mv *ref_mv,
|
||||
// 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
|
||||
@ -1631,15 +1629,15 @@ int vp9_full_search_sad_c(MACROBLOCK *x, int_mv *ref_mv,
|
||||
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) {
|
||||
@ -1653,22 +1651,22 @@ int vp9_full_search_sad_c(MACROBLOCK *x, int_mv *ref_mv,
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1677,15 +1675,15 @@ int vp9_full_search_sadx3(MACROBLOCK *x, int_mv *ref_mv,
|
||||
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;
|
||||
@ -1693,13 +1691,13 @@ int vp9_full_search_sadx3(MACROBLOCK *x, int_mv *ref_mv,
|
||||
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;
|
||||
@ -1711,7 +1709,7 @@ int vp9_full_search_sadx3(MACROBLOCK *x, int_mv *ref_mv,
|
||||
// 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
|
||||
@ -1722,7 +1720,7 @@ int vp9_full_search_sadx3(MACROBLOCK *x, int_mv *ref_mv,
|
||||
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;
|
||||
|
||||
@ -1735,8 +1733,8 @@ int vp9_full_search_sadx3(MACROBLOCK *x, int_mv *ref_mv,
|
||||
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) {
|
||||
@ -1757,8 +1755,8 @@ int vp9_full_search_sadx3(MACROBLOCK *x, int_mv *ref_mv,
|
||||
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) {
|
||||
@ -1774,23 +1772,23 @@ int vp9_full_search_sadx3(MACROBLOCK *x, int_mv *ref_mv,
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1799,15 +1797,15 @@ int vp9_full_search_sadx8(MACROBLOCK *x, int_mv *ref_mv,
|
||||
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;
|
||||
@ -1816,13 +1814,13 @@ int vp9_full_search_sadx8(MACROBLOCK *x, int_mv *ref_mv,
|
||||
|
||||
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;
|
||||
@ -1834,7 +1832,7 @@ int vp9_full_search_sadx8(MACROBLOCK *x, int_mv *ref_mv,
|
||||
// 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
|
||||
@ -1845,7 +1843,7 @@ int vp9_full_search_sadx8(MACROBLOCK *x, int_mv *ref_mv,
|
||||
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;
|
||||
|
||||
@ -1858,8 +1856,8 @@ int vp9_full_search_sadx8(MACROBLOCK *x, int_mv *ref_mv,
|
||||
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) {
|
||||
@ -1884,8 +1882,8 @@ int vp9_full_search_sadx8(MACROBLOCK *x, int_mv *ref_mv,
|
||||
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) {
|
||||
@ -1906,8 +1904,8 @@ int vp9_full_search_sadx8(MACROBLOCK *x, int_mv *ref_mv,
|
||||
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) {
|
||||
@ -1923,21 +1921,22 @@ int vp9_full_search_sadx8(MACROBLOCK *x, int_mv *ref_mv,
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1947,31 +1946,31 @@ int vp9_refining_search_sad_c(MACROBLOCK *x,
|
||||
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) &&
|
||||
@ -1983,9 +1982,9 @@ int vp9_refining_search_sad_c(MACROBLOCK *x,
|
||||
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) {
|
||||
@ -1999,29 +1998,30 @@ int vp9_refining_search_sad_c(MACROBLOCK *x,
|
||||
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;
|
||||
@ -2031,31 +2031,31 @@ int vp9_refining_search_sadx4(MACROBLOCK *x,
|
||||
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];
|
||||
@ -2070,9 +2070,9 @@ int vp9_refining_search_sadx4(MACROBLOCK *x,
|
||||
|
||||
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) {
|
||||
@ -2083,8 +2083,8 @@ int vp9_refining_search_sadx4(MACROBLOCK *x,
|
||||
}
|
||||
} 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) &&
|
||||
@ -2096,9 +2096,9 @@ int vp9_refining_search_sadx4(MACROBLOCK *x,
|
||||
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) {
|
||||
@ -2113,20 +2113,20 @@ int vp9_refining_search_sadx4(MACROBLOCK *x,
|
||||
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;
|
||||
|
@ -103,25 +103,25 @@ extern fractional_mv_step_comp_fp vp9_find_best_sub_pixel_comp_iterative;
|
||||
extern fractional_mv_step_comp_fp vp9_find_best_sub_pixel_comp_tree;
|
||||
|
||||
typedef int (*vp9_full_search_fn_t)(MACROBLOCK *x,
|
||||
int_mv *ref_mv, int sad_per_bit,
|
||||
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);
|
||||
|
||||
typedef int (*vp9_refining_search_fn_t)(MACROBLOCK *x,
|
||||
int_mv *ref_mv, int sad_per_bit,
|
||||
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);
|
||||
const MV *center_mv);
|
||||
|
||||
typedef int (*vp9_diamond_search_fn_t)(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);
|
||||
const MV *center_mv);
|
||||
|
||||
int vp9_refining_search_8p_c(MACROBLOCK *x,
|
||||
int_mv *ref_mv, int error_per_bit,
|
||||
|
@ -1813,10 +1813,10 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
clamp_mv(&mvp_full.as_mv, x->mv_col_min, x->mv_col_max,
|
||||
x->mv_row_min, x->mv_row_max);
|
||||
|
||||
thissme = cpi->full_search_sad(x, &mvp_full,
|
||||
thissme = cpi->full_search_sad(x, &mvp_full.as_mv,
|
||||
sadpb, 16, v_fn_ptr,
|
||||
x->nmvjointcost, x->mvcost,
|
||||
bsi->ref_mv, i);
|
||||
&bsi->ref_mv->as_mv, i);
|
||||
|
||||
if (thissme < bestsme) {
|
||||
bestsme = thissme;
|
||||
|
Loading…
x
Reference in New Issue
Block a user