Commit 4c10a3c2 authored by Sarah Parker's avatar Sarah Parker

Refactor gm/wm/obmc for cleaner warping interactions

This creates a central function which defines when a
block should be warped. It also refactors the
WARPED_MOTION code so that all calls to av1_warp_plane
happen in the same location.

No change in performance.

Change-Id: Icaf9ec7700d34523809258594bb9843bb2975f46
parent 97f56645
...@@ -86,6 +86,15 @@ typedef enum { ...@@ -86,6 +86,15 @@ typedef enum {
// GLOBAL_TRANS_TYPES 7 - up to full homography // GLOBAL_TRANS_TYPES 7 - up to full homography
#define GLOBAL_TRANS_TYPES 3 #define GLOBAL_TRANS_TYPES 3
typedef struct {
#if CONFIG_GLOBAL_MOTION
int global_warp_allowed;
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_WARPED_MOTION
int local_warp_allowed;
#endif // CONFIG_WARPED_MOTION
} WarpTypesAllowed;
// number of parameters used by each transformation in TransformationTypes // number of parameters used by each transformation in TransformationTypes
static const int trans_model_params[TRANS_TYPES] = { 0, 2, 4, 6, 6, 6, 8 }; static const int trans_model_params[TRANS_TYPES] = { 0, 2, 4, 6, 6, 6, 8 };
...@@ -99,6 +108,15 @@ typedef struct { ...@@ -99,6 +108,15 @@ typedef struct {
int32_t wmmat[8]; int32_t wmmat[8];
int16_t alpha, beta, gamma, delta; int16_t alpha, beta, gamma, delta;
} WarpedMotionParams; } WarpedMotionParams;
static INLINE void set_default_warp_params(WarpedMotionParams *wm) {
static const int32_t default_wm_mat[8] = {
0, 0, (1 << WARPEDMODEL_PREC_BITS), 0, 0, (1 << WARPEDMODEL_PREC_BITS), 0, 0
};
memset(wm, 0, sizeof(*wm));
memcpy(wm->wmmat, default_wm_mat, sizeof(wm->wmmat));
wm->wmtype = IDENTITY;
}
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION
...@@ -240,15 +258,6 @@ static INLINE TransformationType get_gmtype(const WarpedMotionParams *gm) { ...@@ -240,15 +258,6 @@ static INLINE TransformationType get_gmtype(const WarpedMotionParams *gm) {
else else
return AFFINE; return AFFINE;
} }
static INLINE void set_default_gmparams(WarpedMotionParams *wm) {
static const int32_t default_wm_mat[8] = {
0, 0, (1 << WARPEDMODEL_PREC_BITS), 0, 0, (1 << WARPEDMODEL_PREC_BITS), 0, 0
};
memcpy(wm->wmmat, default_wm_mat, sizeof(wm->wmmat));
wm->alpha = wm->beta = wm->gamma = wm->delta = 0;
wm->wmtype = IDENTITY;
}
#endif // CONFIG_GLOBAL_MOTION #endif // CONFIG_GLOBAL_MOTION
#if CONFIG_REF_MV #if CONFIG_REF_MV
......
This diff is collapsed.
This diff is collapsed.
...@@ -1724,48 +1724,16 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi, ...@@ -1724,48 +1724,16 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
"Reference frame has invalid dimensions"); "Reference frame has invalid dimensions");
av1_setup_pre_planes(xd, ref, ref_buf->buf, mi_row, mi_col, &ref_buf->sf); av1_setup_pre_planes(xd, ref, ref_buf->buf, mi_row, mi_col, &ref_buf->sf);
} }
#if CONFIG_WARPED_MOTION
if (mbmi->motion_mode == WARPED_CAUSAL) {
int i;
assert_motion_mode_valid(WARPED_CAUSAL,
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, cm->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
xd->mi[0]);
for (i = 0; i < 3; ++i) {
const struct macroblockd_plane *pd = &xd->plane[i];
av1_warp_plane(&mbmi->wm_params[0],
#if CONFIG_HIGHBITDEPTH
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
#endif // CONFIG_HIGHBITDEPTH
pd->pre[0].buf0, pd->pre[0].width, pd->pre[0].height,
pd->pre[0].stride, pd->dst.buf,
((mi_col * MI_SIZE) >> pd->subsampling_x),
((mi_row * MI_SIZE) >> pd->subsampling_y),
xd->n8_w * (MI_SIZE >> pd->subsampling_x),
xd->n8_h * (MI_SIZE >> pd->subsampling_y),
pd->dst.stride, pd->subsampling_x, pd->subsampling_y, 16,
16, 0);
}
} else {
#endif // CONFIG_WARPED_MOTION
#if CONFIG_CB4X4 #if CONFIG_CB4X4
av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize); av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
#else #else
av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL,
AOMMAX(bsize, BLOCK_8X8)); AOMMAX(bsize, BLOCK_8X8));
#endif #endif
#if CONFIG_WARPED_MOTION
}
#endif // CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR #if CONFIG_MOTION_VAR
if (mbmi->motion_mode == OBMC_CAUSAL) { if (mbmi->motion_mode == OBMC_CAUSAL) {
assert_motion_mode_valid(OBMC_CAUSAL,
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, cm->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
xd->mi[0]);
#if CONFIG_NCOBMC #if CONFIG_NCOBMC
av1_build_ncobmc_inter_predictors_sb(cm, xd, mi_row, mi_col); av1_build_ncobmc_inter_predictors_sb(cm, xd, mi_row, mi_col);
#else #else
...@@ -4426,7 +4394,7 @@ static void read_global_motion_params(WarpedMotionParams *params, ...@@ -4426,7 +4394,7 @@ static void read_global_motion_params(WarpedMotionParams *params,
int trans_bits; int trans_bits;
int trans_dec_factor; int trans_dec_factor;
int trans_prec_diff; int trans_prec_diff;
set_default_gmparams(params); set_default_warp_params(params);
params->wmtype = type; params->wmtype = type;
switch (type) { switch (type) {
case HOMOGRAPHY: case HOMOGRAPHY:
...@@ -4866,8 +4834,8 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data, ...@@ -4866,8 +4834,8 @@ void av1_decode_frame(AV1Decoder *pbi, const uint8_t *data,
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION
int i; int i;
for (i = LAST_FRAME; i <= ALTREF_FRAME; ++i) { for (i = LAST_FRAME; i <= ALTREF_FRAME; ++i) {
set_default_gmparams(&cm->global_motion[i]); set_default_warp_params(&cm->global_motion[i]);
set_default_gmparams(&cm->cur_frame->global_motion[i]); set_default_warp_params(&cm->cur_frame->global_motion[i]);
} }
xd->global_motion = cm->global_motion; xd->global_motion = cm->global_motion;
#endif // CONFIG_GLOBAL_MOTION #endif // CONFIG_GLOBAL_MOTION
......
...@@ -2009,12 +2009,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi, ...@@ -2009,12 +2009,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
if (mbmi->ref_frame[1] != INTRA_FRAME) if (mbmi->ref_frame[1] != INTRA_FRAME)
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
mbmi->motion_mode = read_motion_mode(cm, xd, mi, r); mbmi->motion_mode = read_motion_mode(cm, xd, mi, r);
assert_motion_mode_valid(mbmi->motion_mode,
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, xd->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
xd->mi[0]);
#if CONFIG_WARPED_MOTION #if CONFIG_WARPED_MOTION
if (mbmi->motion_mode == WARPED_CAUSAL) { if (mbmi->motion_mode == WARPED_CAUSAL) {
mbmi->wm_params[0].wmtype = DEFAULT_WMTYPE; mbmi->wm_params[0].wmtype = DEFAULT_WMTYPE;
......
...@@ -3701,9 +3701,9 @@ static void fix_interp_filter(AV1_COMMON *cm, FRAME_COUNTS *counts) { ...@@ -3701,9 +3701,9 @@ static void fix_interp_filter(AV1_COMMON *cm, FRAME_COUNTS *counts) {
if (count[i]) { if (count[i]) {
#if CONFIG_MOTION_VAR && (CONFIG_WARPED_MOTION || CONFIG_GLOBAL_MOTION) #if CONFIG_MOTION_VAR && (CONFIG_WARPED_MOTION || CONFIG_GLOBAL_MOTION)
#if CONFIG_WARPED_MOTION #if CONFIG_WARPED_MOTION
if (i == EIGHTTAP_REGULAR || WARP_NEIGHBORS_WITH_OBMC) if (i == EIGHTTAP_REGULAR || WARP_WM_NEIGHBORS_WITH_OBMC)
#else #else
if (i == EIGHTTAP_REGULAR || WARP_NEIGHBORS_WITH_GM) if (i == EIGHTTAP_REGULAR || WARP_GM_NEIGHBORS_WITH_OBMC)
#endif // CONFIG_WARPED_MOTION #endif // CONFIG_WARPED_MOTION
#endif // CONFIG_MOTION_VAR && (CONFIG_WARPED_MOTION || CONFIG_GLOBAL_MOTION) #endif // CONFIG_MOTION_VAR && (CONFIG_WARPED_MOTION || CONFIG_GLOBAL_MOTION)
cm->interp_filter = i; cm->interp_filter = i;
...@@ -4662,7 +4662,7 @@ static void write_global_motion(AV1_COMP *cpi, aom_writer *w) { ...@@ -4662,7 +4662,7 @@ static void write_global_motion(AV1_COMP *cpi, aom_writer *w) {
// unsafe, and we need to rely on the recode loop to do it // unsafe, and we need to rely on the recode loop to do it
// instead. See av1_find_mv_refs for details. // instead. See av1_find_mv_refs for details.
if (!cpi->global_motion_used[frame]) { if (!cpi->global_motion_used[frame]) {
set_default_gmparams(&cm->global_motion[frame]); set_default_warp_params(&cm->global_motion[frame]);
} }
#endif #endif
write_global_motion_params( write_global_motion_params(
......
...@@ -5169,7 +5169,7 @@ static void encode_frame_internal(AV1_COMP *cpi) { ...@@ -5169,7 +5169,7 @@ static void encode_frame_internal(AV1_COMP *cpi) {
} }
if (cm->global_motion[frame].wmtype <= AFFINE) if (cm->global_motion[frame].wmtype <= AFFINE)
if (!get_shear_params(&cm->global_motion[frame])) if (!get_shear_params(&cm->global_motion[frame]))
set_default_gmparams(&cm->global_motion[frame]); set_default_warp_params(&cm->global_motion[frame]);
if (cm->global_motion[frame].wmtype == TRANSLATION) { if (cm->global_motion[frame].wmtype == TRANSLATION) {
cm->global_motion[frame].wmmat[0] = cm->global_motion[frame].wmmat[0] =
...@@ -5189,7 +5189,7 @@ static void encode_frame_internal(AV1_COMP *cpi) { ...@@ -5189,7 +5189,7 @@ static void encode_frame_internal(AV1_COMP *cpi) {
gm_get_params_cost(&cm->global_motion[frame], gm_get_params_cost(&cm->global_motion[frame],
&cm->prev_frame->global_motion[frame], &cm->prev_frame->global_motion[frame],
cm->allow_high_precision_mv))) { cm->allow_high_precision_mv))) {
set_default_gmparams(&cm->global_motion[frame]); set_default_warp_params(&cm->global_motion[frame]);
} }
if (cm->global_motion[frame].wmtype != IDENTITY) break; if (cm->global_motion[frame].wmtype != IDENTITY) break;
...@@ -5908,46 +5908,12 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, ...@@ -5908,46 +5908,12 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
av1_setup_pre_planes(xd, ref, cfg, mi_row, mi_col, av1_setup_pre_planes(xd, ref, cfg, mi_row, mi_col,
&xd->block_refs[ref]->sf); &xd->block_refs[ref]->sf);
} }
#if CONFIG_WARPED_MOTION if (!(cpi->sf.reuse_inter_pred_sby && ctx->pred_pixel_ready) || seg_skip)
if (mbmi->motion_mode == WARPED_CAUSAL) { av1_build_inter_predictors_sby(xd, mi_row, mi_col, NULL, block_size);
int i;
assert_motion_mode_valid(WARPED_CAUSAL,
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, cm->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
mi);
for (i = 0; i < 3; ++i) {
const struct macroblockd_plane *pd = &xd->plane[i];
av1_warp_plane(&mbmi->wm_params[0],
#if CONFIG_HIGHBITDEPTH
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
#endif // CONFIG_HIGHBITDEPTH
pd->pre[0].buf0, pd->pre[0].width, pd->pre[0].height,
pd->pre[0].stride, pd->dst.buf,
((mi_col * MI_SIZE) >> pd->subsampling_x),
((mi_row * MI_SIZE) >> pd->subsampling_y),
xd->n8_w * (MI_SIZE >> pd->subsampling_x),
xd->n8_h * (MI_SIZE >> pd->subsampling_y),
pd->dst.stride, pd->subsampling_x, pd->subsampling_y, 16,
16, 0);
}
} else {
#endif // CONFIG_WARPED_MOTION
if (!(cpi->sf.reuse_inter_pred_sby && ctx->pred_pixel_ready) || seg_skip)
av1_build_inter_predictors_sby(xd, mi_row, mi_col, NULL, block_size);
av1_build_inter_predictors_sbuv(xd, mi_row, mi_col, NULL, block_size);
#if CONFIG_WARPED_MOTION
}
#endif // CONFIG_WARPED_MOTION
av1_build_inter_predictors_sbuv(xd, mi_row, mi_col, NULL, block_size);
#if CONFIG_MOTION_VAR #if CONFIG_MOTION_VAR
if (mbmi->motion_mode == OBMC_CAUSAL) { if (mbmi->motion_mode == OBMC_CAUSAL) {
assert_motion_mode_valid(OBMC_CAUSAL,
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, cm->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
mi);
#if CONFIG_NCOBMC #if CONFIG_NCOBMC
if (dry_run == OUTPUT_ENABLED) if (dry_run == OUTPUT_ENABLED)
av1_build_ncobmc_inter_predictors_sb(cm, xd, mi_row, mi_col); av1_build_ncobmc_inter_predictors_sb(cm, xd, mi_row, mi_col);
......
...@@ -3052,7 +3052,7 @@ static int recode_loop_test_global_motion(AV1_COMP *cpi) { ...@@ -3052,7 +3052,7 @@ static int recode_loop_test_global_motion(AV1_COMP *cpi) {
if (cm->global_motion[i].wmtype != IDENTITY && if (cm->global_motion[i].wmtype != IDENTITY &&
cpi->global_motion_used[i] * GM_RECODE_LOOP_NUM4X4_FACTOR < cpi->global_motion_used[i] * GM_RECODE_LOOP_NUM4X4_FACTOR <
cpi->gmparams_cost[i]) { cpi->gmparams_cost[i]) {
set_default_gmparams(&cm->global_motion[i]); set_default_warp_params(&cm->global_motion[i]);
cpi->gmparams_cost[i] = 0; cpi->gmparams_cost[i] = 0;
#if CONFIG_REF_MV #if CONFIG_REF_MV
recode = 1; recode = 1;
...@@ -3839,7 +3839,7 @@ static void set_size_independent_vars(AV1_COMP *cpi) { ...@@ -3839,7 +3839,7 @@ static void set_size_independent_vars(AV1_COMP *cpi) {
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION
int i; int i;
for (i = LAST_FRAME; i <= ALTREF_FRAME; ++i) { for (i = LAST_FRAME; i <= ALTREF_FRAME; ++i) {
set_default_gmparams(&cpi->common.global_motion[i]); set_default_warp_params(&cpi->common.global_motion[i]);
} }
cpi->global_motion_search_done = 0; cpi->global_motion_search_done = 0;
#endif // CONFIG_GLOBAL_MOTION #endif // CONFIG_GLOBAL_MOTION
......
...@@ -5524,12 +5524,13 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x, ...@@ -5524,12 +5524,13 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
#endif // CONFIG_DUAL_FILTER #endif // CONFIG_DUAL_FILTER
struct scale_factors sf; struct scale_factors sf;
struct macroblockd_plane *const pd = &xd->plane[0]; struct macroblockd_plane *const pd = &xd->plane[0];
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
// ic and ir are the 4x4 coordiantes of the sub8x8 at index "block" // ic and ir are the 4x4 coordiantes of the sub8x8 at index "block"
const int ic = block & 1; const int ic = block & 1;
const int ir = (block - ic) >> 1; const int ir = (block - ic) >> 1;
const int p_col = ((mi_col * MI_SIZE) >> pd->subsampling_x) + 4 * ic; const int p_col = ((mi_col * MI_SIZE) >> pd->subsampling_x) + 4 * ic;
const int p_row = ((mi_row * MI_SIZE) >> pd->subsampling_y) + 4 * ir; const int p_row = ((mi_row * MI_SIZE) >> pd->subsampling_y) + 4 * ir;
#if CONFIG_GLOBAL_MOTION
int is_global[2]; int is_global[2];
for (ref = 0; ref < 2; ++ref) { for (ref = 0; ref < 2; ++ref) {
WarpedMotionParams *const wm = WarpedMotionParams *const wm =
...@@ -5537,6 +5538,7 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x, ...@@ -5537,6 +5538,7 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
is_global[ref] = is_global_mv_block(xd->mi[0], block, wm->wmtype); is_global[ref] = is_global_mv_block(xd->mi[0], block, wm->wmtype);
} }
#endif // CONFIG_GLOBAL_MOTION #endif // CONFIG_GLOBAL_MOTION
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
// Do joint motion search in compound mode to get more accurate mv. // Do joint motion search in compound mode to get more accurate mv.
struct buf_2d backup_yv12[2][MAX_MB_PLANE]; struct buf_2d backup_yv12[2][MAX_MB_PLANE];
...@@ -5608,6 +5610,15 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x, ...@@ -5608,6 +5610,15 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
// found for the 'other' reference frame is factored in. // found for the 'other' reference frame is factored in.
const int plane = 0; const int plane = 0;
ConvolveParams conv_params = get_conv_params(0, plane); ConvolveParams conv_params = get_conv_params(0, plane);
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
WarpTypesAllowed warp_types;
#if CONFIG_GLOBAL_MOTION
warp_types.global_warp_allowed = is_global[!id];
#endif // CONFIG_GLOBAL_MOTION
#if CONFIG_WARPED_MOTION
warp_types.local_warp_allowed = mbmi->motion_mode == WARPED_CAUSAL;
#endif // CONFIG_WARPED_MOTION
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
// Initialized here because of compiler problem in Visual Studio. // Initialized here because of compiler problem in Visual Studio.
ref_yv12[0] = xd->plane[plane].pre[0]; ref_yv12[0] = xd->plane[plane].pre[0];
...@@ -5628,27 +5639,27 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x, ...@@ -5628,27 +5639,27 @@ static void joint_motion_search(const AV1_COMP *cpi, MACROBLOCK *x,
av1_highbd_build_inter_predictor( av1_highbd_build_inter_predictor(
ref_yv12[!id].buf, ref_yv12[!id].stride, second_pred, pw, ref_yv12[!id].buf, ref_yv12[!id].stride, second_pred, pw,
&frame_mv[refs[!id]].as_mv, &sf, pw, ph, 0, interp_filter, &frame_mv[refs[!id]].as_mv, &sf, pw, ph, 0, interp_filter,
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
is_global[!id], p_col, p_row, &warp_types, p_col, p_row,
#endif // CONFIG_GLOBAL_MOTION #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
plane, MV_PRECISION_Q3, mi_col * MI_SIZE, mi_row * MI_SIZE, xd); plane, MV_PRECISION_Q3, mi_col * MI_SIZE, mi_row * MI_SIZE, xd);
} else { } else {
second_pred = (uint8_t *)second_pred_alloc_16; second_pred = (uint8_t *)second_pred_alloc_16;
av1_build_inter_predictor( av1_build_inter_predictor(
ref_yv12[!id].buf, ref_yv12[!id].stride, second_pred, pw, ref_yv12[!id].buf, ref_yv12[!id].stride, second_pred, pw,
&frame_mv[refs[!id]].as_mv, &sf, pw, ph, &conv_params, interp_filter, &frame_mv[refs[!id]].as_mv, &sf, pw, ph, &conv_params, interp_filter,
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
is_global[!id], p_col, p_row, plane, !id, &warp_types, p_col, p_row, plane, !id,
#endif // CONFIG_GLOBAL_MOTION #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
MV_PRECISION_Q3, mi_col * MI_SIZE, mi_row * MI_SIZE, xd); MV_PRECISION_Q3, mi_col * MI_SIZE, mi_row * MI_SIZE, xd);
} }
#else #else
av1_build_inter_predictor( av1_build_inter_predictor(
ref_yv12[!id].buf, ref_yv12[!id].stride, second_pred, pw, ref_yv12[!id].buf, ref_yv12[!id].stride, second_pred, pw,
&frame_mv[refs[!id]].as_mv, &sf, pw, ph, &conv_params, interp_filter, &frame_mv[refs[!id]].as_mv, &sf, pw, ph, &conv_params, interp_filter,
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
is_global[!id], p_col, p_row, plane, !id, &warp_types, p_col, p_row, plane, !id,
#endif // CONFIG_GLOBAL_MOTION #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
MV_PRECISION_Q3, mi_col * MI_SIZE, mi_row * MI_SIZE, xd); MV_PRECISION_Q3, mi_col * MI_SIZE, mi_row * MI_SIZE, xd);
#endif // CONFIG_HIGHBITDEPTH #endif // CONFIG_HIGHBITDEPTH
...@@ -8233,11 +8244,6 @@ static int64_t motion_mode_rd( ...@@ -8233,11 +8244,6 @@ static int64_t motion_mode_rd(
mbmi->motion_mode = motion_mode; mbmi->motion_mode = motion_mode;
#if CONFIG_MOTION_VAR #if CONFIG_MOTION_VAR
if (mbmi->motion_mode == OBMC_CAUSAL) { if (mbmi->motion_mode == OBMC_CAUSAL) {
assert_motion_mode_valid(OBMC_CAUSAL,
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, cm->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
mi);
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
*mbmi = *best_bmc_mbmi; *mbmi = *best_bmc_mbmi;
mbmi->motion_mode = OBMC_CAUSAL; mbmi->motion_mode = OBMC_CAUSAL;
...@@ -8282,11 +8288,6 @@ static int64_t motion_mode_rd( ...@@ -8282,11 +8288,6 @@ static int64_t motion_mode_rd(
#if CONFIG_WARPED_MOTION #if CONFIG_WARPED_MOTION
if (mbmi->motion_mode == WARPED_CAUSAL) { if (mbmi->motion_mode == WARPED_CAUSAL) {
assert_motion_mode_valid(WARPED_CAUSAL,
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, xd->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
mi);
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
*mbmi = *best_bmc_mbmi; *mbmi = *best_bmc_mbmi;
mbmi->motion_mode = WARPED_CAUSAL; mbmi->motion_mode = WARPED_CAUSAL;
...@@ -8307,24 +8308,7 @@ static int64_t motion_mode_rd( ...@@ -8307,24 +8308,7 @@ static int64_t motion_mode_rd(
if (find_projection(mbmi->num_proj_ref[0], pts, pts_inref, bsize, if (find_projection(mbmi->num_proj_ref[0], pts, pts_inref, bsize,
mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col, mbmi->mv[0].as_mv.row, mbmi->mv[0].as_mv.col,
&mbmi->wm_params[0], mi_row, mi_col) == 0) { &mbmi->wm_params[0], mi_row, mi_col) == 0) {
int plane; av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
for (plane = 0; plane < 3; ++plane) {
const struct macroblockd_plane *pd = &xd->plane[plane];
av1_warp_plane(&mbmi->wm_params[0],
#if CONFIG_HIGHBITDEPTH
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
#endif // CONFIG_HIGHBITDEPTH
pd->pre[0].buf0, pd->pre[0].width, pd->pre[0].height,
pd->pre[0].stride, pd->dst.buf,
(mi_col * MI_SIZE) >> pd->subsampling_x,
(mi_row * MI_SIZE) >> pd->subsampling_y,
(xd->n8_w * MI_SIZE) >> pd->subsampling_x,
(xd->n8_h * MI_SIZE) >> pd->subsampling_y,
pd->dst.stride, pd->subsampling_x, pd->subsampling_y,
16, 16, 0);
}
model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate, model_rd_for_sb(cpi, bsize, x, xd, 0, MAX_MB_PLANE - 1, &tmp_rate,
&tmp_dist, skip_txfm_sb, skip_sse_sb); &tmp_dist, skip_txfm_sb, skip_sse_sb);
} else { } else {
...@@ -10785,45 +10769,9 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data, ...@@ -10785,45 +10769,9 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
} }
if (is_inter_mode(mbmi->mode)) { if (is_inter_mode(mbmi->mode)) {
#if CONFIG_WARPED_MOTION av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
if (mbmi->motion_mode == WARPED_CAUSAL) {
assert_motion_mode_valid(WARPED_CAUSAL,
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, xd->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
xd->mi[0]);
assert(!has_second_ref(mbmi));
int plane;
for (plane = 0; plane < 3; ++plane) {
const struct macroblockd_plane *pd = &xd->plane[plane];
av1_warp_plane(&mbmi->wm_params[0],
#if CONFIG_HIGHBITDEPTH
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
#endif // CONFIG_HIGHBITDEPTH
pd->pre[0].buf0, pd->pre[0].width, pd->pre[0].height,
pd->pre[0].stride, pd->dst.buf,
((mi_col * MI_SIZE) >> pd->subsampling_x),
((mi_row * MI_SIZE) >> pd->subsampling_y),
xd->n8_w * (MI_SIZE >> pd->subsampling_x),
xd->n8_h * (MI_SIZE >> pd->subsampling_y),
pd->dst.stride, pd->subsampling_x, pd->subsampling_y,
16, 16, 0);
}
} else {
#endif // CONFIG_WARPED_MOTION
av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);
#if CONFIG_WARPED_MOTION
}
#endif // CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR #if CONFIG_MOTION_VAR
if (mbmi->motion_mode == OBMC_CAUSAL) { if (mbmi->motion_mode == OBMC_CAUSAL) {
assert_motion_mode_valid(OBMC_CAUSAL,
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, cm->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
xd->mi[0]);
av1_build_obmc_inter_prediction( av1_build_obmc_inter_prediction(
cm, xd, mi_row, mi_col, args.above_pred_buf, args.above_pred_stride, cm, xd, mi_row, mi_col, args.above_pred_buf, args.above_pred_stride,
args.left_pred_buf, args.left_pred_stride); args.left_pred_buf, args.left_pred_stride);
...@@ -12569,11 +12517,6 @@ void av1_check_ncobmc_rd(const struct AV1_COMP *cpi, struct macroblock *x, ...@@ -12569,11 +12517,6 @@ void av1_check_ncobmc_rd(const struct AV1_COMP *cpi, struct macroblock *x,
// Check non-causal mode // Check non-causal mode
mbmi->motion_mode = OBMC_CAUSAL; mbmi->motion_mode = OBMC_CAUSAL;
assert_motion_mode_valid(OBMC_CAUSAL,
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, cm->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
xd->mi[0]);
av1_build_ncobmc_inter_predictors_sb(cm, xd, mi_row, mi_col); av1_build_ncobmc_inter_predictors_sb(cm, xd, mi_row, mi_col);
av1_subtract_plane(x, bsize, 0); av1_subtract_plane(x, bsize, 0);
......
...@@ -56,6 +56,10 @@ static void temporal_filter_predictors_mb_c( ...@@ -56,6 +56,10 @@ static void temporal_filter_predictors_mb_c(
#else #else
const InterpFilter interp_filter = xd->mi[0]->mbmi.interp_filter; const InterpFilter interp_filter = xd->mi[0]->mbmi.interp_filter;
#endif // USE_TEMPORALFILTER_12TAP #endif // USE_TEMPORALFILTER_12TAP
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
WarpTypesAllowed warp_types;
memset(&warp_types, 0, sizeof(WarpTypesAllowed));
#endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
if (uv_block_width == 8) { if (uv_block_width == 8) {
uv_stride = (stride + 1) >> 1; uv_stride = (stride + 1) >> 1;
...@@ -69,50 +73,50 @@ static void temporal_filter_predictors_mb_c( ...@@ -69,50 +73,50 @@ static void temporal_filter_predictors_mb_c(
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
av1_highbd_build_inter_predictor(y_mb_ptr, stride, &pred[0], 16, &mv, scale, av1_highbd_build_inter_predictor(y_mb_ptr, stride, &pred[0], 16, &mv, scale,
16, 16, which_mv, interp_filter, 16, 16, which_mv, interp_filter,
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
0, x, y, &warp_types, x, y,
#endif // CONFIG_GLOBAL_MOTION #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
0, MV_PRECISION_Q3, x, y, xd); 0, MV_PRECISION_Q3, x, y, xd);
av1_highbd_build_inter_predictor(u_mb_ptr, uv_stride, &pred[256], av1_highbd_build_inter_predictor(u_mb_ptr, uv_stride, &pred[256],
uv_block_width, &mv, scale, uv_block_width, uv_block_width, &mv, scale, uv_block_width,
uv_block_height, which_mv, interp_filter, uv_block_height, which_mv, interp_filter,
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
0, x, y, &warp_types, x, y,
#endif // CONFIG_GLOBAL_MOTION #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
1, mv_precision_uv, x, y, xd); 1, mv_precision_uv, x, y, xd);
av1_highbd_build_inter_predictor(v_mb_ptr, uv_stride, &pred[512], av1_highbd_build_inter_predictor(v_mb_ptr, uv_stride, &pred[512],
uv_block_width, &mv, scale, uv_block_width, uv_block_width, &mv, scale, uv_block_width,
uv_block_height, which_mv, interp_filter, uv_block_height, which_mv, interp_filter,
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
0, x, y, &warp_types, x, y,
#endif // CONFIG_GLOBAL_MOTION #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
2, mv_precision_uv, x, y, xd); 2, mv_precision_uv, x, y, xd);
return; return;
} }
#endif // CONFIG_HIGHBITDEPTH #endif // CONFIG_HIGHBITDEPTH
av1_build_inter_predictor(y_mb_ptr, stride, &pred[0], 16, &mv, scale, 16, 16, av1_build_inter_predictor(y_mb_ptr, stride, &pred[0], 16, &mv, scale, 16, 16,
&conv_params, interp_filter, &conv_params, interp_filter,
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
0, x, y, 0, 0, &warp_types, x, y, 0, 0,
#endif // CONFIG_GLOBAL_MOTION #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
MV_PRECISION_Q3, x, y, xd); MV_PRECISION_Q3, x, y, xd);
av1_build_inter_predictor(u_mb_ptr, uv_stride, &pred[256], uv_block_width, av1_build_inter_predictor(u_mb_ptr, uv_stride, &pred[256], uv_block_width,
&mv, scale, uv_block_width, uv_block_height, &mv, scale, uv_block_width, uv_block_height,
&conv_params, interp_filter, &conv_params, interp_filter,
#if CONFIG_GLOBAL_MOTION #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
0, x, y, 1, 0, &warp_types, x, y, 1, 0,
#endif // CONFIG_GLOBAL_MOTION #endif // CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION