aom: update libaom to 0ec86ac7ae1e32a7e70410fa4972a655ec3670a4

This commit is contained in:
Roy Tam 2019-02-22 21:52:01 +08:00
commit eb361970c5
438 changed files with 52661 additions and 21905 deletions

View file

@ -112,7 +112,7 @@ static int mvsad_err_cost(const MACROBLOCK *x, const MV *mv, const MV *ref,
int sad_per_bit) {
const MV diff = { (mv->row - ref->row) * 8, (mv->col - ref->col) * 8 };
return ROUND_POWER_OF_TWO(
(unsigned)mv_cost(&diff, x->nmvjointcost, x->mvcost) * sad_per_bit,
(unsigned)mv_cost(&diff, x->nmv_vec_cost, x->mv_cost_stack) * sad_per_bit,
AV1_PROB_COST_SHIFT);
}
@ -179,36 +179,31 @@ static INLINE const uint8_t *pre(const uint8_t *buf, int stride, int r, int c) {
}
/* checks if (r, c) has better score than previous best */
#define CHECK_BETTER(v, r, c) \
if (c >= minc && c <= maxc && r >= minr && r <= maxr) { \
MV this_mv = { r, c }; \
v = mv_err_cost(&this_mv, ref_mv, mvjcost, mvcost, error_per_bit); \
if (second_pred == NULL) { \
thismse = vfp->svf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), \
src_address, src_stride, &sse); \
} else if (mask) { \
thismse = vfp->msvf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), \
src_address, src_stride, second_pred, mask, \
mask_stride, invert_mask, &sse); \
} else { \
if (xd->jcp_param.use_jnt_comp_avg) \
thismse = vfp->jsvaf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), \
src_address, src_stride, &sse, second_pred, \
&xd->jcp_param); \
else \
thismse = vfp->svaf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), \
src_address, src_stride, &sse, second_pred); \
} \
v += thismse; \
if (v < besterr) { \
besterr = v; \
br = r; \
bc = c; \
*distortion = thismse; \
*sse1 = sse; \
} \
} else { \
v = INT_MAX; \
#define CHECK_BETTER(v, r, c) \
if (c >= minc && c <= maxc && r >= minr && r <= maxr) { \
MV this_mv = { r, c }; \
v = mv_err_cost(&this_mv, ref_mv, mvjcost, mvcost, error_per_bit); \
if (second_pred == NULL) { \
thismse = vfp->svf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), \
src_address, src_stride, &sse); \
} else if (mask) { \
thismse = vfp->msvf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), \
src_address, src_stride, second_pred, mask, \
mask_stride, invert_mask, &sse); \
} else { \
thismse = vfp->svaf(pre(y, y_stride, r, c), y_stride, sp(c), sp(r), \
src_address, src_stride, &sse, second_pred); \
} \
v += thismse; \
if (v < besterr) { \
besterr = v; \
br = r; \
bc = c; \
*distortion = thismse; \
*sse1 = sse; \
} \
} else { \
v = INT_MAX; \
}
#define CHECK_BETTER0(v, r, c) CHECK_BETTER(v, r, c)
@ -341,19 +336,15 @@ static unsigned int setup_center_error(
int *mvcost[2], unsigned int *sse1, int *distortion) {
unsigned int besterr;
if (second_pred != NULL) {
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
if (is_cur_buf_hbd(xd)) {
DECLARE_ALIGNED(16, uint16_t, comp_pred16[MAX_SB_SQUARE]);
uint8_t *comp_pred = CONVERT_TO_BYTEPTR(comp_pred16);
if (mask) {
aom_highbd_comp_mask_pred(comp_pred, second_pred, w, h, y + offset,
y_stride, mask, mask_stride, invert_mask);
} else {
if (xd->jcp_param.use_jnt_comp_avg)
aom_highbd_jnt_comp_avg_pred(comp_pred, second_pred, w, h, y + offset,
y_stride, &xd->jcp_param);
else
aom_highbd_comp_avg_pred(comp_pred, second_pred, w, h, y + offset,
y_stride);
aom_highbd_comp_avg_pred(comp_pred, second_pred, w, h, y + offset,
y_stride);
}
besterr = vfp->vf(comp_pred, w, src, src_stride, sse1);
} else {
@ -362,11 +353,7 @@ static unsigned int setup_center_error(
aom_comp_mask_pred(comp_pred, second_pred, w, h, y + offset, y_stride,
mask, mask_stride, invert_mask);
} else {
if (xd->jcp_param.use_jnt_comp_avg)
aom_jnt_comp_avg_pred(comp_pred, second_pred, w, h, y + offset,
y_stride, &xd->jcp_param);
else
aom_comp_avg_pred(comp_pred, second_pred, w, h, y + offset, y_stride);
aom_comp_avg_pred(comp_pred, second_pred, w, h, y + offset, y_stride);
}
besterr = vfp->vf(comp_pred, w, src, src_stride, sse1);
}
@ -409,7 +396,7 @@ int av1_find_best_sub_pixel_tree_pruned_evenmore(
int *cost_list, int *mvjcost, int *mvcost[2], int *distortion,
unsigned int *sse1, const uint8_t *second_pred, const uint8_t *mask,
int mask_stride, int invert_mask, int w, int h,
int use_accurate_subpel_search) {
int use_accurate_subpel_search, const int do_reset_fractional_mv) {
SETUP_SUBPEL_SEARCH;
besterr = setup_center_error(xd, bestmv, ref_mv, error_per_bit, vfp,
src_address, src_stride, y, y_stride,
@ -426,6 +413,7 @@ int av1_find_best_sub_pixel_tree_pruned_evenmore(
(void)cm;
(void)mi_row;
(void)mi_col;
(void)do_reset_fractional_mv;
if (cost_list && cost_list[0] != INT_MAX && cost_list[1] != INT_MAX &&
cost_list[2] != INT_MAX && cost_list[3] != INT_MAX &&
@ -481,12 +469,13 @@ int av1_find_best_sub_pixel_tree_pruned_more(
int *cost_list, int *mvjcost, int *mvcost[2], int *distortion,
unsigned int *sse1, const uint8_t *second_pred, const uint8_t *mask,
int mask_stride, int invert_mask, int w, int h,
int use_accurate_subpel_search) {
int use_accurate_subpel_search, const int do_reset_fractional_mv) {
SETUP_SUBPEL_SEARCH;
(void)use_accurate_subpel_search;
(void)cm;
(void)mi_row;
(void)mi_col;
(void)do_reset_fractional_mv;
besterr = setup_center_error(xd, bestmv, ref_mv, error_per_bit, vfp,
src_address, src_stride, y, y_stride,
@ -549,12 +538,13 @@ int av1_find_best_sub_pixel_tree_pruned(
int *cost_list, int *mvjcost, int *mvcost[2], int *distortion,
unsigned int *sse1, const uint8_t *second_pred, const uint8_t *mask,
int mask_stride, int invert_mask, int w, int h,
int use_accurate_subpel_search) {
int use_accurate_subpel_search, const int do_reset_fractional_mv) {
SETUP_SUBPEL_SEARCH;
(void)use_accurate_subpel_search;
(void)cm;
(void)mi_row;
(void)mi_col;
(void)do_reset_fractional_mv;
besterr = setup_center_error(xd, bestmv, ref_mv, error_per_bit, vfp,
src_address, src_stride, y, y_stride,
@ -651,7 +641,7 @@ static int upsampled_pref_error(MACROBLOCKD *xd, const AV1_COMMON *const cm,
int mask_stride, int invert_mask, int w, int h,
unsigned int *sse, int subpel_search) {
unsigned int besterr;
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
if (is_cur_buf_hbd(xd)) {
DECLARE_ALIGNED(16, uint16_t, pred16[MAX_SB_SQUARE]);
uint8_t *pred8 = CONVERT_TO_BYTEPTR(pred16);
if (second_pred != NULL) {
@ -661,14 +651,9 @@ static int upsampled_pref_error(MACROBLOCKD *xd, const AV1_COMMON *const cm,
subpel_y_q3, y, y_stride, mask, mask_stride, invert_mask, xd->bd,
subpel_search);
} else {
if (xd->jcp_param.use_jnt_comp_avg)
aom_highbd_jnt_comp_avg_upsampled_pred(
xd, cm, mi_row, mi_col, mv, pred8, second_pred, w, h, subpel_x_q3,
subpel_y_q3, y, y_stride, xd->bd, &xd->jcp_param, subpel_search);
else
aom_highbd_comp_avg_upsampled_pred(
xd, cm, mi_row, mi_col, mv, pred8, second_pred, w, h, subpel_x_q3,
subpel_y_q3, y, y_stride, xd->bd, subpel_search);
aom_highbd_comp_avg_upsampled_pred(
xd, cm, mi_row, mi_col, mv, pred8, second_pred, w, h, subpel_x_q3,
subpel_y_q3, y, y_stride, xd->bd, subpel_search);
}
} else {
aom_highbd_upsampled_pred(xd, cm, mi_row, mi_col, mv, pred8, w, h,
@ -685,14 +670,9 @@ static int upsampled_pref_error(MACROBLOCKD *xd, const AV1_COMMON *const cm,
subpel_y_q3, y, y_stride, mask,
mask_stride, invert_mask, subpel_search);
} else {
if (xd->jcp_param.use_jnt_comp_avg)
aom_jnt_comp_avg_upsampled_pred(
xd, cm, mi_row, mi_col, mv, pred, second_pred, w, h, subpel_x_q3,
subpel_y_q3, y, y_stride, &xd->jcp_param, subpel_search);
else
aom_comp_avg_upsampled_pred(xd, cm, mi_row, mi_col, mv, pred,
second_pred, w, h, subpel_x_q3,
subpel_y_q3, y, y_stride, subpel_search);
aom_comp_avg_upsampled_pred(xd, cm, mi_row, mi_col, mv, pred,
second_pred, w, h, subpel_x_q3, subpel_y_q3,
y, y_stride, subpel_search);
}
} else {
aom_upsampled_pred(xd, cm, mi_row, mi_col, mv, pred, w, h, subpel_x_q3,
@ -723,7 +703,7 @@ static unsigned int upsampled_setup_center_error(
// when use_accurate_subpel_search == 0
static INLINE unsigned int estimate_upsampled_pref_error(
MACROBLOCKD *xd, const aom_variance_fn_ptr_t *vfp, const uint8_t *const src,
const aom_variance_fn_ptr_t *vfp, const uint8_t *const src,
const int src_stride, const uint8_t *const pre, int y_stride,
int subpel_x_q3, int subpel_y_q3, const uint8_t *second_pred,
const uint8_t *mask, int mask_stride, int invert_mask, unsigned int *sse) {
@ -734,12 +714,8 @@ static INLINE unsigned int estimate_upsampled_pref_error(
return vfp->msvf(pre, y_stride, subpel_x_q3, subpel_y_q3, src, src_stride,
second_pred, mask, mask_stride, invert_mask, sse);
} else {
if (xd->jcp_param.use_jnt_comp_avg)
return vfp->jsvaf(pre, y_stride, subpel_x_q3, subpel_y_q3, src,
src_stride, sse, second_pred, &xd->jcp_param);
else
return vfp->svaf(pre, y_stride, subpel_x_q3, subpel_y_q3, src, src_stride,
sse, second_pred);
return vfp->svaf(pre, y_stride, subpel_x_q3, subpel_y_q3, src, src_stride,
sse, second_pred);
}
}
@ -750,7 +726,7 @@ int av1_find_best_sub_pixel_tree(
int *cost_list, int *mvjcost, int *mvcost[2], int *distortion,
unsigned int *sse1, const uint8_t *second_pred, const uint8_t *mask,
int mask_stride, int invert_mask, int w, int h,
int use_accurate_subpel_search) {
int use_accurate_subpel_search, const int do_reset_fractional_mv) {
const uint8_t *const src_address = x->plane[0].src.buf;
const int src_stride = x->plane[0].src.stride;
MACROBLOCKD *xd = &x->e_mbd;
@ -796,7 +772,16 @@ int av1_find_best_sub_pixel_tree(
(void)cost_list; // to silence compiler warning
if (do_reset_fractional_mv) {
av1_set_fractional_mv(x->fractional_best_mv);
}
for (iter = 0; iter < round; ++iter) {
if ((x->fractional_best_mv[iter].as_mv.row == br) &&
(x->fractional_best_mv[iter].as_mv.col == bc))
return INT_MAX;
x->fractional_best_mv[iter].as_mv.row = br;
x->fractional_best_mv[iter].as_mv.col = bc;
// Check vertical and horizontal sub-pixel positions.
for (idx = 0; idx < 4; ++idx) {
tr = br + search_step[idx].row;
@ -812,9 +797,9 @@ int av1_find_best_sub_pixel_tree(
use_accurate_subpel_search);
} else {
thismse = estimate_upsampled_pref_error(
xd, vfp, src_address, src_stride, pre(y, y_stride, tr, tc),
y_stride, sp(tc), sp(tr), second_pred, mask, mask_stride,
invert_mask, &sse);
vfp, src_address, src_stride, pre(y, y_stride, tr, tc), y_stride,
sp(tc), sp(tr), second_pred, mask, mask_stride, invert_mask,
&sse);
}
cost_array[idx] = thismse + mv_err_cost(&this_mv, ref_mv, mvjcost,
@ -848,9 +833,8 @@ int av1_find_best_sub_pixel_tree(
use_accurate_subpel_search);
} else {
thismse = estimate_upsampled_pref_error(
xd, vfp, src_address, src_stride, pre(y, y_stride, tr, tc),
y_stride, sp(tc), sp(tr), second_pred, mask, mask_stride,
invert_mask, &sse);
vfp, src_address, src_stride, pre(y, y_stride, tr, tc), y_stride,
sp(tc), sp(tr), second_pred, mask, mask_stride, invert_mask, &sse);
}
cost_array[4] = thismse + mv_err_cost(&this_mv, ref_mv, mvjcost, mvcost,
@ -915,9 +899,10 @@ unsigned int av1_compute_motion_cost(const AV1_COMP *cpi, MACROBLOCK *const x,
unsigned int mse;
unsigned int sse;
av1_build_inter_predictors_sby(cm, xd, mi_row, mi_col, NULL, bsize);
av1_enc_build_inter_predictor(cm, xd, mi_row, mi_col, NULL, bsize,
AOM_PLANE_Y, AOM_PLANE_Y);
mse = vfp->vf(dst, dst_stride, src, src_stride, &sse);
mse += mv_err_cost(this_mv, &ref_mv.as_mv, x->nmvjointcost, x->mvcost,
mse += mv_err_cost(this_mv, &ref_mv.as_mv, x->nmv_vec_cost, x->mv_cost_stack,
x->errorperbit);
return mse;
}
@ -1057,8 +1042,8 @@ static INLINE void calc_int_cost_list(const MACROBLOCK *x,
cost_list[i + 1] = fn_ptr->vf(what->buf, what->stride,
get_buf_from_mv(in_what, &neighbor_mv),
in_what->stride, &sse) +
mv_err_cost(&neighbor_mv, &fcenter_mv, x->nmvjointcost,
x->mvcost, x->errorperbit);
mv_err_cost(&neighbor_mv, &fcenter_mv, x->nmv_vec_cost,
x->mv_cost_stack, x->errorperbit);
}
} else {
for (i = 0; i < 4; i++) {
@ -1070,8 +1055,8 @@ static INLINE void calc_int_cost_list(const MACROBLOCK *x,
fn_ptr->vf(what->buf, what->stride,
get_buf_from_mv(in_what, &neighbor_mv), in_what->stride,
&sse) +
mv_err_cost(&neighbor_mv, &fcenter_mv, x->nmvjointcost, x->mvcost,
x->errorperbit);
mv_err_cost(&neighbor_mv, &fcenter_mv, x->nmv_vec_cost,
x->mv_cost_stack, x->errorperbit);
}
}
}
@ -1393,8 +1378,8 @@ int av1_get_mvpred_var(const MACROBLOCK *x, const MV *best_mv,
return vfp->vf(what->buf, what->stride, get_buf_from_mv(in_what, best_mv),
in_what->stride, &unused) +
(use_mvcost ? mv_err_cost(&mv, center_mv, x->nmvjointcost, x->mvcost,
x->errorperbit)
(use_mvcost ? mv_err_cost(&mv, center_mv, x->nmv_vec_cost,
x->mv_cost_stack, x->errorperbit)
: 0);
}
@ -1407,19 +1392,11 @@ int av1_get_mvpred_av_var(const MACROBLOCK *x, const MV *best_mv,
const MV mv = { best_mv->row * 8, best_mv->col * 8 };
unsigned int unused;
if (xd->jcp_param.use_jnt_comp_avg)
return vfp->jsvaf(get_buf_from_mv(in_what, best_mv), in_what->stride, 0, 0,
what->buf, what->stride, &unused, second_pred,
&xd->jcp_param) +
(use_mvcost ? mv_err_cost(&mv, center_mv, x->nmvjointcost, x->mvcost,
x->errorperbit)
: 0);
else
return vfp->svaf(get_buf_from_mv(in_what, best_mv), in_what->stride, 0, 0,
what->buf, what->stride, &unused, second_pred) +
(use_mvcost ? mv_err_cost(&mv, center_mv, x->nmvjointcost, x->mvcost,
x->errorperbit)
: 0);
return vfp->svaf(get_buf_from_mv(in_what, best_mv), in_what->stride, 0, 0,
what->buf, what->stride, &unused, second_pred) +
(use_mvcost ? mv_err_cost(&mv, center_mv, x->nmv_vec_cost,
x->mv_cost_stack, x->errorperbit)
: 0);
}
int av1_get_mvpred_mask_var(const MACROBLOCK *x, const MV *best_mv,
@ -1436,8 +1413,8 @@ int av1_get_mvpred_mask_var(const MACROBLOCK *x, const MV *best_mv,
return vfp->msvf(what->buf, what->stride, 0, 0,
get_buf_from_mv(in_what, best_mv), in_what->stride,
second_pred, mask, mask_stride, invert_mask, &unused) +
(use_mvcost ? mv_err_cost(&mv, center_mv, x->nmvjointcost, x->mvcost,
x->errorperbit)
(use_mvcost ? mv_err_cost(&mv, center_mv, x->nmv_vec_cost,
x->mv_cost_stack, x->errorperbit)
: 0);
}
@ -1897,7 +1874,7 @@ static int full_pixel_exhaustive(const AV1_COMP *const cpi, MACROBLOCK *x,
int baseline_interval_divisor;
// Keep track of number of exhaustive calls (this frame in this thread).
++(*x->ex_search_count_ptr);
if (x->ex_search_count_ptr != NULL) ++(*x->ex_search_count_ptr);
// Trap illegal values for interval and range for this function.
if ((range < MIN_RANGE) || (range > MAX_RANGE) || (interval < MIN_INTERVAL) ||
@ -2051,16 +2028,10 @@ int av1_refining_search_8p_c(MACROBLOCK *x, int error_per_bit, int search_range,
second_pred, mask, mask_stride, invert_mask) +
mvsad_err_cost(x, best_mv, &fcenter_mv, error_per_bit);
} else {
if (xd->jcp_param.use_jnt_comp_avg)
best_sad = fn_ptr->jsdaf(what->buf, what->stride,
get_buf_from_mv(in_what, best_mv),
in_what->stride, second_pred, &xd->jcp_param) +
mvsad_err_cost(x, best_mv, &fcenter_mv, error_per_bit);
else
best_sad = fn_ptr->sdaf(what->buf, what->stride,
get_buf_from_mv(in_what, best_mv),
in_what->stride, second_pred) +
mvsad_err_cost(x, best_mv, &fcenter_mv, error_per_bit);
best_sad =
fn_ptr->sdaf(what->buf, what->stride, get_buf_from_mv(in_what, best_mv),
in_what->stride, second_pred) +
mvsad_err_cost(x, best_mv, &fcenter_mv, error_per_bit);
}
do_refine_search_grid[grid_coord] = 1;
@ -2084,14 +2055,9 @@ int av1_refining_search_8p_c(MACROBLOCK *x, int error_per_bit, int search_range,
get_buf_from_mv(in_what, &mv), in_what->stride,
second_pred, mask, mask_stride, invert_mask);
} else {
if (xd->jcp_param.use_jnt_comp_avg)
sad = fn_ptr->jsdaf(what->buf, what->stride,
get_buf_from_mv(in_what, &mv), in_what->stride,
second_pred, &xd->jcp_param);
else
sad = fn_ptr->sdaf(what->buf, what->stride,
get_buf_from_mv(in_what, &mv), in_what->stride,
second_pred);
sad = fn_ptr->sdaf(what->buf, what->stride,
get_buf_from_mv(in_what, &mv), in_what->stride,
second_pred);
}
if (sad < best_sad) {
sad += mvsad_err_cost(x, &mv, &fcenter_mv, error_per_bit);
@ -2117,13 +2083,16 @@ int av1_refining_search_8p_c(MACROBLOCK *x, int error_per_bit, int search_range,
#define MIN_EX_SEARCH_LIMIT 128
static int is_exhaustive_allowed(const AV1_COMP *const cpi, MACROBLOCK *x) {
const SPEED_FEATURES *const sf = &cpi->sf;
const int max_ex =
AOMMAX(MIN_EX_SEARCH_LIMIT,
(*x->m_search_count_ptr * sf->max_exaustive_pct) / 100);
return sf->allow_exhaustive_searches &&
(sf->exhaustive_searches_thresh < INT_MAX) &&
(*x->ex_search_count_ptr <= max_ex) && !cpi->rc.is_src_frame_alt_ref;
int is_allowed = sf->allow_exhaustive_searches &&
(sf->exhaustive_searches_thresh < INT_MAX) &&
!cpi->rc.is_src_frame_alt_ref;
if (x->m_search_count_ptr != NULL && x->ex_search_count_ptr != NULL) {
const int max_ex =
AOMMAX(MIN_EX_SEARCH_LIMIT,
(*x->m_search_count_ptr * sf->max_exaustive_pct) / 100);
is_allowed = *x->ex_search_count_ptr <= max_ex && is_allowed;
}
return is_allowed;
}
int av1_full_pixel_search(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
@ -2144,7 +2113,7 @@ int av1_full_pixel_search(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
}
// Keep track of number of searches (this frame in this thread).
++(*x->m_search_count_ptr);
if (x->m_search_count_ptr != NULL) ++(*x->m_search_count_ptr);
switch (method) {
case FAST_DIAMOND:
@ -2241,13 +2210,12 @@ int av1_full_pixel_search(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
// for the hashMap
hash_table *ref_frame_hash =
intra
? &cpi->common.cur_frame->hash_table
: av1_get_ref_frame_hash_map(cpi, x->e_mbd.mi[0]->ref_frame[0]);
intra ? &cpi->common.cur_frame->hash_table
: av1_get_ref_frame_hash_map(&cpi->common,
x->e_mbd.mi[0]->ref_frame[0]);
av1_get_block_hash_value(
what, what_stride, block_width, &hash_value1, &hash_value2,
x->e_mbd.cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, x);
av1_get_block_hash_value(what, what_stride, block_width, &hash_value1,
&hash_value2, is_cur_buf_hbd(&x->e_mbd), x);
const int count = av1_hash_table_count(ref_frame_hash, hash_value1);
// for intra, at lest one matching can be found, itself.
@ -2333,8 +2301,9 @@ int av1_full_pixel_search(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
mask, vfp, z, pre(y, y_stride, r, c), \
y_stride, sp(c), sp(r), w, h, &sse, \
use_accurate_subpel_search); \
if ((v = MVC(r, c) + thismse) < besterr) { \
besterr = v; \
v = mv_err_cost(&this_mv, ref_mv, mvjcost, mvcost, error_per_bit); \
if ((v + thismse) < besterr) { \
besterr = v + thismse; \
br = r; \
bc = c; \
*distortion = thismse; \
@ -2365,7 +2334,7 @@ static int upsampled_obmc_pref_error(
unsigned int besterr;
DECLARE_ALIGNED(16, uint8_t, pred[2 * MAX_SB_SQUARE]);
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
if (is_cur_buf_hbd(xd)) {
uint8_t *pred8 = CONVERT_TO_BYTEPTR(pred);
aom_highbd_upsampled_pred(xd, cm, mi_row, mi_col, mv, pred8, w, h,
subpel_x_q3, subpel_y_q3, y, y_stride, xd->bd,
@ -2568,16 +2537,16 @@ static int get_obmc_mvpred_var(const MACROBLOCK *x, const int32_t *wsrc,
return vfp->ovf(get_buf_from_mv(in_what, best_mv), in_what->stride, wsrc,
mask, &unused) +
(use_mvcost ? mv_err_cost(&mv, center_mv, x->nmvjointcost, x->mvcost,
x->errorperbit)
(use_mvcost ? mv_err_cost(&mv, center_mv, x->nmv_vec_cost,
x->mv_cost_stack, x->errorperbit)
: 0);
}
int obmc_refining_search_sad(const MACROBLOCK *x, const int32_t *wsrc,
const int32_t *mask, MV *ref_mv, int error_per_bit,
int search_range,
const aom_variance_fn_ptr_t *fn_ptr,
const MV *center_mv, int is_second) {
static int obmc_refining_search_sad(const MACROBLOCK *x, const int32_t *wsrc,
const int32_t *mask, MV *ref_mv,
int error_per_bit, int search_range,
const aom_variance_fn_ptr_t *fn_ptr,
const MV *center_mv, int is_second) {
const MV neighbors[4] = { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };
const MACROBLOCKD *const xd = &x->e_mbd;
const struct buf_2d *const in_what = &xd->plane[0].pre[is_second];
@ -2616,12 +2585,13 @@ int obmc_refining_search_sad(const MACROBLOCK *x, const int32_t *wsrc,
return best_sad;
}
int obmc_diamond_search_sad(const MACROBLOCK *x, const search_site_config *cfg,
const int32_t *wsrc, const int32_t *mask,
MV *ref_mv, MV *best_mv, int search_param,
int sad_per_bit, int *num00,
const aom_variance_fn_ptr_t *fn_ptr,
const MV *center_mv, int is_second) {
static int obmc_diamond_search_sad(const MACROBLOCK *x,
const search_site_config *cfg,
const int32_t *wsrc, const int32_t *mask,
MV *ref_mv, MV *best_mv, int search_param,
int sad_per_bit, int *num00,
const aom_variance_fn_ptr_t *fn_ptr,
const MV *center_mv, int is_second) {
const MACROBLOCKD *const xd = &x->e_mbd;
const struct buf_2d *const in_what = &xd->plane[0].pre[is_second];
// search_param determines the length of the initial step and hence the number
@ -2824,16 +2794,14 @@ int av1_obmc_full_pixel_search(const AV1_COMP *cpi, MACROBLOCK *x, MV *mvp_full,
(void)thismse; \
(void)cost_list;
// Return the maximum MV.
int av1_return_max_sub_pixel_mv(MACROBLOCK *x, const AV1_COMMON *const cm,
int mi_row, int mi_col, const MV *ref_mv,
int allow_hp, int error_per_bit,
const aom_variance_fn_ptr_t *vfp,
int forced_stop, int iters_per_step,
int *cost_list, int *mvjcost, int *mvcost[2],
int *distortion, unsigned int *sse1,
const uint8_t *second_pred, const uint8_t *mask,
int mask_stride, int invert_mask, int w, int h,
int use_accurate_subpel_search) {
int av1_return_max_sub_pixel_mv(
MACROBLOCK *x, const AV1_COMMON *const cm, int mi_row, int mi_col,
const MV *ref_mv, int allow_hp, int error_per_bit,
const aom_variance_fn_ptr_t *vfp, int forced_stop, int iters_per_step,
int *cost_list, int *mvjcost, int *mvcost[2], int *distortion,
unsigned int *sse1, const uint8_t *second_pred, const uint8_t *mask,
int mask_stride, int invert_mask, int w, int h,
int use_accurate_subpel_search, const int do_reset_fractional_mv) {
COMMON_MV_TEST;
(void)mask;
(void)mask_stride;
@ -2844,6 +2812,7 @@ int av1_return_max_sub_pixel_mv(MACROBLOCK *x, const AV1_COMMON *const cm,
(void)cm;
(void)mi_row;
(void)mi_col;
(void)do_reset_fractional_mv;
bestmv->row = maxr;
bestmv->col = maxc;
@ -2854,16 +2823,14 @@ int av1_return_max_sub_pixel_mv(MACROBLOCK *x, const AV1_COMMON *const cm,
return besterr;
}
// Return the minimum MV.
int av1_return_min_sub_pixel_mv(MACROBLOCK *x, const AV1_COMMON *const cm,
int mi_row, int mi_col, const MV *ref_mv,
int allow_hp, int error_per_bit,
const aom_variance_fn_ptr_t *vfp,
int forced_stop, int iters_per_step,
int *cost_list, int *mvjcost, int *mvcost[2],
int *distortion, unsigned int *sse1,
const uint8_t *second_pred, const uint8_t *mask,
int mask_stride, int invert_mask, int w, int h,
int use_accurate_subpel_search) {
int av1_return_min_sub_pixel_mv(
MACROBLOCK *x, const AV1_COMMON *const cm, int mi_row, int mi_col,
const MV *ref_mv, int allow_hp, int error_per_bit,
const aom_variance_fn_ptr_t *vfp, int forced_stop, int iters_per_step,
int *cost_list, int *mvjcost, int *mvcost[2], int *distortion,
unsigned int *sse1, const uint8_t *second_pred, const uint8_t *mask,
int mask_stride, int invert_mask, int w, int h,
int use_accurate_subpel_search, const int do_reset_fractional_mv) {
COMMON_MV_TEST;
(void)maxr;
(void)maxc;
@ -2874,6 +2841,7 @@ int av1_return_min_sub_pixel_mv(MACROBLOCK *x, const AV1_COMMON *const cm,
(void)cm;
(void)mi_row;
(void)mi_col;
(void)do_reset_fractional_mv;
bestmv->row = minr;
bestmv->col = minc;