Commit 19234cc2 authored by Sarah Parker's avatar Sarah Parker

Macro to disable warped/obmc_causal with global motion

Enabling SEPARATE_GLOBAL_MOTION will remove the ability for
a block that uses zeromv with global motion to pick warped_causal
or obmc_causal as the motion mode. When this is enabled there is:

0.05% drop on lowres for global + warped enabled
0.15% drop on midres for global + warped enabled

0.12% drop on lowres with global + motion var enabled
0.07% drop on midres with global + motion var enabled
No performance change for global, warped, or motion var individually.

Change-Id: Idbfb8dd7a93da14902438504b06a08e5212e48cb
parent 428bbb2b
...@@ -415,6 +415,25 @@ PREDICTION_MODE av1_left_block_mode(const MODE_INFO *cur_mi, ...@@ -415,6 +415,25 @@ PREDICTION_MODE av1_left_block_mode(const MODE_INFO *cur_mi,
PREDICTION_MODE av1_above_block_mode(const MODE_INFO *cur_mi, PREDICTION_MODE av1_above_block_mode(const MODE_INFO *cur_mi,
const MODE_INFO *above_mi, int b); const MODE_INFO *above_mi, int b);
#if CONFIG_GLOBAL_MOTION
static INLINE int is_global_mv_block(const MODE_INFO *mi, int block,
TransformationType type) {
PREDICTION_MODE mode = get_y_mode(mi, block);
#if GLOBAL_SUB8X8_USED
const int block_size_allowed = 1;
#else
const BLOCK_SIZE bsize = mi->mbmi.sb_type;
const int block_size_allowed = (bsize >= BLOCK_8X8);
#endif // GLOBAL_SUB8X8_USED
#if CONFIG_EXT_INTER
return (mode == ZEROMV || mode == ZERO_ZEROMV) && type > TRANSLATION &&
block_size_allowed;
#else
return mode == ZEROMV && type > TRANSLATION && block_size_allowed;
#endif // CONFIG_EXT_INTER
}
#endif // CONFIG_GLOBAL_MOTION
enum mv_precision { MV_PRECISION_Q3, MV_PRECISION_Q4 }; enum mv_precision { MV_PRECISION_Q3, MV_PRECISION_Q4 };
struct buf_2d { struct buf_2d {
...@@ -1061,7 +1080,16 @@ static INLINE int check_num_overlappable_neighbors(const MB_MODE_INFO *mbmi) { ...@@ -1061,7 +1080,16 @@ static INLINE int check_num_overlappable_neighbors(const MB_MODE_INFO *mbmi) {
} }
#endif #endif
static INLINE MOTION_MODE motion_mode_allowed(const MB_MODE_INFO *mbmi) { static INLINE MOTION_MODE motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
int block, const WarpedMotionParams *gm_params,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
const MODE_INFO *mi) {
const MB_MODE_INFO *mbmi = &mi->mbmi;
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
const TransformationType gm_type = gm_params[mbmi->ref_frame[0]].wmtype;
if (is_global_mv_block(mi, block, gm_type)) return SIMPLE_TRANSLATION;
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
if (is_motion_variation_allowed_bsize(mbmi->sb_type) && if (is_motion_variation_allowed_bsize(mbmi->sb_type) &&
is_inter_mode(mbmi->mode) && mbmi->ref_frame[1] != INTRA_FRAME) { is_inter_mode(mbmi->mode) && mbmi->ref_frame[1] != INTRA_FRAME) {
...@@ -1087,6 +1115,22 @@ static INLINE MOTION_MODE motion_mode_allowed(const MB_MODE_INFO *mbmi) { ...@@ -1087,6 +1115,22 @@ static INLINE MOTION_MODE motion_mode_allowed(const MB_MODE_INFO *mbmi) {
} }
} }
static INLINE void assert_motion_mode_valid(MOTION_MODE mode,
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
int block,
const WarpedMotionParams *gm_params,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
const MODE_INFO *mi) {
const MOTION_MODE last_motion_mode_allowed = motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
block, gm_params,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
mi);
// Check that the input mode is not illegal
if (last_motion_mode_allowed < mode)
assert(0 && "Illegal motion mode selected");
}
#if CONFIG_MOTION_VAR #if CONFIG_MOTION_VAR
static INLINE int is_neighbor_overlappable(const MB_MODE_INFO *mbmi) { static INLINE int is_neighbor_overlappable(const MB_MODE_INFO *mbmi) {
return (is_inter_block(mbmi)); return (is_inter_block(mbmi));
......
...@@ -35,6 +35,9 @@ typedef struct mv32 { ...@@ -35,6 +35,9 @@ typedef struct mv32 {
int32_t col; int32_t col;
} MV32; } MV32;
#if (CONFIG_WARPED_MOTION || CONFIG_MOTION_VAR) && CONFIG_GLOBAL_MOTION
#define SEPARATE_GLOBAL_MOTION 0
#endif // (CONFIG_WARPED_MOTION || CONFIG_MOTION_VAR) && CONFIG_GLOBAL_MOTION
#if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION #if CONFIG_GLOBAL_MOTION || CONFIG_WARPED_MOTION
// Bits of precision used for the model // Bits of precision used for the model
#define WARPEDMODEL_PREC_BITS 16 #define WARPEDMODEL_PREC_BITS 16
......
...@@ -1839,6 +1839,12 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -1839,6 +1839,12 @@ void av1_build_prediction_by_above_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
} else { } else {
#if CONFIG_WARPED_MOTION #if CONFIG_WARPED_MOTION
if (above_mbmi->motion_mode == WARPED_CAUSAL) { if (above_mbmi->motion_mode == WARPED_CAUSAL) {
assert_motion_mode_valid(WARPED_CAUSAL,
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, cm->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
above_mi);
av1_warp_plane(&above_mbmi->wm_params[0], av1_warp_plane(&above_mbmi->wm_params[0],
#if CONFIG_AOM_HIGHBITDEPTH #if CONFIG_AOM_HIGHBITDEPTH
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd, xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
...@@ -1961,6 +1967,12 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -1961,6 +1967,12 @@ void av1_build_prediction_by_left_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
} else { } else {
#if CONFIG_WARPED_MOTION #if CONFIG_WARPED_MOTION
if (left_mbmi->motion_mode == WARPED_CAUSAL) { if (left_mbmi->motion_mode == WARPED_CAUSAL) {
assert_motion_mode_valid(WARPED_CAUSAL,
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, cm->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
left_mi);
av1_warp_plane(&left_mbmi->wm_params[0], av1_warp_plane(&left_mbmi->wm_params[0],
#if CONFIG_AOM_HIGHBITDEPTH #if CONFIG_AOM_HIGHBITDEPTH
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd, xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
...@@ -2133,6 +2145,12 @@ void av1_build_prediction_by_bottom_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -2133,6 +2145,12 @@ void av1_build_prediction_by_bottom_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
} else { } else {
#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, cm->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
mi);
av1_warp_plane(&mbmi->wm_params[0], av1_warp_plane(&mbmi->wm_params[0],
#if CONFIG_AOM_HIGHBITDEPTH #if CONFIG_AOM_HIGHBITDEPTH
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd, xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
...@@ -2258,6 +2276,12 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -2258,6 +2276,12 @@ void av1_build_prediction_by_right_preds(const AV1_COMMON *cm, MACROBLOCKD *xd,
} else { } else {
#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, cm->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
mi);
av1_warp_plane(&mbmi->wm_params[0], av1_warp_plane(&mbmi->wm_params[0],
#if CONFIG_AOM_HIGHBITDEPTH #if CONFIG_AOM_HIGHBITDEPTH
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd, xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
......
...@@ -24,20 +24,6 @@ ...@@ -24,20 +24,6 @@
extern "C" { extern "C" {
#endif #endif
#if CONFIG_GLOBAL_MOTION
static INLINE int is_global_mv_block(const MODE_INFO *mi, int block,
TransformationType type) {
PREDICTION_MODE mode = get_y_mode(mi, block);
#if GLOBAL_SUB8X8_USED
const int block_size_allowed = 1;
#else
const BLOCK_SIZE bsize = mi->mbmi.sb_type;
const int block_size_allowed = (bsize >= BLOCK_8X8);
#endif // GLOBAL_SUB8X8_USED
return mode == ZEROMV && type > TRANSLATION && block_size_allowed;
}
#endif // CONFIG_GLOBAL_MOTION
static INLINE void inter_predictor(const uint8_t *src, int src_stride, static INLINE void inter_predictor(const uint8_t *src, int src_stride,
uint8_t *dst, int dst_stride, uint8_t *dst, int dst_stride,
const int subpel_x, const int subpel_y, const int subpel_x, const int subpel_y,
......
...@@ -1701,6 +1701,11 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi, ...@@ -1701,6 +1701,11 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
#if CONFIG_WARPED_MOTION #if CONFIG_WARPED_MOTION
if (mbmi->motion_mode == WARPED_CAUSAL) { if (mbmi->motion_mode == WARPED_CAUSAL) {
int i; 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) { for (i = 0; i < 3; ++i) {
const struct macroblockd_plane *pd = &xd->plane[i]; const struct macroblockd_plane *pd = &xd->plane[i];
...@@ -1730,6 +1735,11 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi, ...@@ -1730,6 +1735,11 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
#endif // 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
......
...@@ -293,8 +293,13 @@ static void read_drl_idx(const AV1_COMMON *cm, MACROBLOCKD *xd, ...@@ -293,8 +293,13 @@ static void read_drl_idx(const AV1_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
static MOTION_MODE read_motion_mode(AV1_COMMON *cm, MACROBLOCKD *xd, static MOTION_MODE read_motion_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
MB_MODE_INFO *mbmi, aom_reader *r) { MODE_INFO *mi, aom_reader *r) {
MOTION_MODE last_motion_mode_allowed = motion_mode_allowed(mbmi); MB_MODE_INFO *mbmi = &mi->mbmi;
const MOTION_MODE last_motion_mode_allowed = motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, xd->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
mi);
int motion_mode; int motion_mode;
FRAME_COUNTS *counts = xd->counts; FRAME_COUNTS *counts = xd->counts;
...@@ -1991,7 +1996,13 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi, ...@@ -1991,7 +1996,13 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
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, mbmi, 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;
......
...@@ -550,9 +550,14 @@ static int write_skip(const AV1_COMMON *cm, const MACROBLOCKD *xd, ...@@ -550,9 +550,14 @@ static int write_skip(const AV1_COMMON *cm, const MACROBLOCKD *xd,
} }
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
static void write_motion_mode(const AV1_COMMON *cm, const MB_MODE_INFO *mbmi, static void write_motion_mode(const AV1_COMMON *cm, const MODE_INFO *mi,
aom_writer *w) { aom_writer *w) {
MOTION_MODE last_motion_mode_allowed = motion_mode_allowed(mbmi); const MB_MODE_INFO *mbmi = &mi->mbmi;
MOTION_MODE last_motion_mode_allowed = motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, cm->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
mi);
if (last_motion_mode_allowed == SIMPLE_TRANSLATION) return; if (last_motion_mode_allowed == SIMPLE_TRANSLATION) return;
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
...@@ -1862,7 +1867,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi, ...@@ -1862,7 +1867,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
if (mbmi->ref_frame[1] != INTRA_FRAME) if (mbmi->ref_frame[1] != INTRA_FRAME)
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
write_motion_mode(cm, mbmi, w); write_motion_mode(cm, mi, w);
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION #endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if CONFIG_EXT_INTER #if CONFIG_EXT_INTER
......
...@@ -2143,6 +2143,11 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row, ...@@ -2143,6 +2143,11 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
const MOTION_MODE motion_allowed = motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, xd->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
mi);
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
if (!supertx_enabled) if (!supertx_enabled)
#endif // CONFIG_SUPERTX #endif // CONFIG_SUPERTX
...@@ -2151,13 +2156,13 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row, ...@@ -2151,13 +2156,13 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
{ {
if (motion_mode_allowed(mbmi) == WARPED_CAUSAL) if (motion_allowed == WARPED_CAUSAL)
counts->motion_mode[mbmi->sb_type][mbmi->motion_mode]++; counts->motion_mode[mbmi->sb_type][mbmi->motion_mode]++;
else if (motion_mode_allowed(mbmi) == OBMC_CAUSAL) else if (motion_allowed == OBMC_CAUSAL)
counts->obmc[mbmi->sb_type][mbmi->motion_mode == OBMC_CAUSAL]++; counts->obmc[mbmi->sb_type][mbmi->motion_mode == OBMC_CAUSAL]++;
} }
#else #else
if (motion_mode_allowed(mbmi) > SIMPLE_TRANSLATION) if (motion_allowed > SIMPLE_TRANSLATION)
counts->motion_mode[mbmi->sb_type][mbmi->motion_mode]++; counts->motion_mode[mbmi->sb_type][mbmi->motion_mode]++;
#endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION #endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION #endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
...@@ -2402,8 +2407,12 @@ static void encode_b(const AV1_COMP *const cpi, const TileInfo *const tile, ...@@ -2402,8 +2407,12 @@ static void encode_b(const AV1_COMP *const cpi, const TileInfo *const tile,
update_state(cpi, td, ctx, mi_row, mi_col, bsize, dry_run); update_state(cpi, td, ctx, mi_row, mi_col, bsize, dry_run);
#if CONFIG_MOTION_VAR && CONFIG_NCOBMC #if CONFIG_MOTION_VAR && CONFIG_NCOBMC
mbmi = &xd->mi[0]->mbmi; mbmi = &xd->mi[0]->mbmi;
check_ncobmc = const MOTION_MODE motion_allowed = motion_mode_allowed(
is_inter_block(mbmi) && motion_mode_allowed(mbmi) >= OBMC_CAUSAL; #if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, xd->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
mi);
check_ncobmc = is_inter_block(mbmi) && motion_allowed >= OBMC_CAUSAL;
if (!dry_run && check_ncobmc) { if (!dry_run && check_ncobmc) {
av1_check_ncobmc_rd(cpi, x, mi_row, mi_col); av1_check_ncobmc_rd(cpi, x, mi_row, mi_col);
av1_setup_dst_planes(x->e_mbd.plane, get_frame_new_buffer(&cpi->common), av1_setup_dst_planes(x->e_mbd.plane, get_frame_new_buffer(&cpi->common),
...@@ -5712,9 +5721,13 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, ...@@ -5712,9 +5721,13 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
#if CONFIG_WARPED_MOTION #if CONFIG_WARPED_MOTION
if (mbmi->motion_mode == WARPED_CAUSAL) { if (mbmi->motion_mode == WARPED_CAUSAL) {
int i; 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) { for (i = 0; i < 3; ++i) {
const struct macroblockd_plane *pd = &xd->plane[i]; const struct macroblockd_plane *pd = &xd->plane[i];
av1_warp_plane(&mbmi->wm_params[0], av1_warp_plane(&mbmi->wm_params[0],
#if CONFIG_AOM_HIGHBITDEPTH #if CONFIG_AOM_HIGHBITDEPTH
xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd, xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
...@@ -5740,6 +5753,11 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td, ...@@ -5740,6 +5753,11 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
#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);
......
...@@ -8189,7 +8189,8 @@ static int64_t handle_inter_mode( ...@@ -8189,7 +8189,8 @@ static int64_t handle_inter_mode(
int mi_col, HandleInterModeArgs *args, const int64_t ref_best_rd) { int mi_col, HandleInterModeArgs *args, const int64_t ref_best_rd) {
const AV1_COMMON *cm = &cpi->common; const AV1_COMMON *cm = &cpi->common;
MACROBLOCKD *xd = &x->e_mbd; MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; MODE_INFO *mi = xd->mi[0];
MB_MODE_INFO *mbmi = &mi->mbmi;
MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext; MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext;
const int is_comp_pred = has_second_ref(mbmi); const int is_comp_pred = has_second_ref(mbmi);
const int this_mode = mbmi->mode; const int this_mode = mbmi->mode;
...@@ -8789,7 +8790,11 @@ static int64_t handle_inter_mode( ...@@ -8789,7 +8790,11 @@ static int64_t handle_inter_mode(
#endif // CONFIG_WARPED_MOTION #endif // CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
rate2_nocoeff = rd_stats->rate; rate2_nocoeff = rd_stats->rate;
last_motion_mode_allowed = motion_mode_allowed(mbmi); last_motion_mode_allowed = motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, xd->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
mi);
base_mbmi = *mbmi; base_mbmi = *mbmi;
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION #endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
...@@ -8811,6 +8816,11 @@ static int64_t handle_inter_mode( ...@@ -8811,6 +8816,11 @@ static int64_t handle_inter_mode(
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;
...@@ -8855,6 +8865,11 @@ static int64_t handle_inter_mode( ...@@ -8855,6 +8865,11 @@ static int64_t handle_inter_mode(
#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;
...@@ -10661,12 +10676,17 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data, ...@@ -10661,12 +10676,17 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
*returnrate_nocoef -= av1_cost_bit(av1_get_intra_inter_prob(cm, xd), *returnrate_nocoef -= av1_cost_bit(av1_get_intra_inter_prob(cm, xd),
mbmi->ref_frame[0] != INTRA_FRAME); mbmi->ref_frame[0] != INTRA_FRAME);
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
const MOTION_MODE motion_allowed = motion_mode_allowed(
#if CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
0, xd->global_motion,
#endif // CONFIG_GLOBAL_MOTION && SEPARATE_GLOBAL_MOTION
mi);
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
if (motion_mode_allowed(mbmi) == WARPED_CAUSAL) if (motion_allowed == WARPED_CAUSAL)
#endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION #endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
*returnrate_nocoef -= cpi->motion_mode_cost[bsize][mbmi->motion_mode]; *returnrate_nocoef -= cpi->motion_mode_cost[bsize][mbmi->motion_mode];
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION #if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
else if (motion_mode_allowed(mbmi) == OBMC_CAUSAL) else if (motion_allowed == OBMC_CAUSAL)
*returnrate_nocoef -= *returnrate_nocoef -=
cpi->motion_mode_cost1[bsize][mbmi->motion_mode]; cpi->motion_mode_cost1[bsize][mbmi->motion_mode];
#endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION #endif // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
...@@ -10744,6 +10764,11 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data, ...@@ -10744,6 +10764,11 @@ 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 #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
xd->mi[0]);
assert(!has_second_ref(mbmi)); assert(!has_second_ref(mbmi));
int plane; int plane;
...@@ -10770,10 +10795,16 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data, ...@@ -10770,10 +10795,16 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
} }
#endif // 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);
}
#endif // CONFIG_MOTION_VAR #endif // CONFIG_MOTION_VAR
av1_subtract_plane(x, bsize, 0); av1_subtract_plane(x, bsize, 0);
#if CONFIG_VAR_TX #if CONFIG_VAR_TX
...@@ -11221,6 +11252,18 @@ PALETTE_EXIT: ...@@ -11221,6 +11252,18 @@ PALETTE_EXIT:
|| mbmi->mode == ZERO_ZEROMV || mbmi->mode == ZERO_ZEROMV
#endif // CONFIG_EXT_INTER #endif // CONFIG_EXT_INTER
) { ) {
#if CONFIG_WARPED_MOTION || CONFIG_MOTION_VAR
// Correct the motion mode for ZEROMV
const MOTION_MODE last_motion_mode_allowed = motion_mode_allowed(
#if SEPARATE_GLOBAL_MOTION
0, xd->global_motion,
#endif // SEPARATE_GLOBAL_MOTION
xd->mi[0]);
if (mbmi->motion_mode > last_motion_mode_allowed)
mbmi->motion_mode = last_motion_mode_allowed;
#endif // CONFIG_WARPED_MOTION || CONFIG_MOTION_VAR
// Correct the interpolation filter for ZEROMV
if (is_nontrans_global_motion(xd)) { if (is_nontrans_global_motion(xd)) {
#if CONFIG_DUAL_FILTER #if CONFIG_DUAL_FILTER
mbmi->interp_filter[0] = cm->interp_filter == SWITCHABLE mbmi->interp_filter[0] = cm->interp_filter == SWITCHABLE
...@@ -12472,6 +12515,11 @@ void av1_check_ncobmc_rd(const struct AV1_COMP *cpi, struct macroblock *x, ...@@ -12472,6 +12515,11 @@ 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
mi);
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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment