Commit cb60b185 authored by Yue Chen's avatar Yue Chen

Renamings for OBMC experiment

To get ready for pulling AV1 to nextgenv2
Replace the experimental flag by MOTION_VAR. Rename major variables.

Change-Id: If6cf4f37b9319c46d8f90df551cc7295d66ca205
parent 732c1885
......@@ -314,10 +314,10 @@ ifeq ($(CONFIG_EXT_INTER),yes)
DSP_SRCS-$(HAVE_SSSE3) += x86/masked_sad_intrin_ssse3.c
DSP_SRCS-$(HAVE_SSSE3) += x86/masked_variance_intrin_ssse3.c
endif #CONFIG_EXT_INTER
ifeq ($(CONFIG_OBMC),yes)
ifeq ($(CONFIG_MOTION_VAR),yes)
DSP_SRCS-$(HAVE_SSE4_1) += x86/obmc_sad_sse4.c
DSP_SRCS-$(HAVE_SSE4_1) += x86/obmc_variance_sse4.c
endif #CONFIG_OBMC
endif #CONFIG_MOTION_VAR
endif #CONFIG_AV1_ENCODER
DSP_SRCS-$(HAVE_SSE) += x86/sad4d_sse2.asm
......
......@@ -1208,7 +1208,7 @@ if (aom_config("CONFIG_EXT_INTER") eq "yes") {
#
# OBMC SAD
#
if (aom_config("CONFIG_OBMC") eq "yes") {
if (aom_config("CONFIG_MOTION_VAR") eq "yes") {
foreach (@block_sizes) {
($w, $h) = @$_;
add_proto qw/unsigned int/, "aom_obmc_sad${w}x${h}", "const uint8_t *pre, int pre_stride, const int32_t *wsrc, const int32_t *mask";
......@@ -1540,7 +1540,7 @@ if (aom_config("CONFIG_EXT_INTER") eq "yes") {
#
# OBMC Variance / OBMC Subpixel Variance
#
if (aom_config("CONFIG_OBMC") eq "yes") {
if (aom_config("CONFIG_MOTION_VAR") eq "yes") {
foreach (@block_sizes) {
($w, $h) = @$_;
add_proto qw/unsigned int/, "aom_obmc_variance${w}x${h}", "const uint8_t *pre, int pre_stride, const int32_t *wsrc, const int32_t *mask, unsigned int *sse";
......
......@@ -410,7 +410,7 @@ HIGHBD_MASKSADMXN(4, 4)
#endif // CONFIG_AOM_HIGHBITDEPTH
#endif // CONFIG_AV1 && CONFIG_EXT_INTER
#if CONFIG_AV1 && CONFIG_OBMC
#if CONFIG_AV1 && CONFIG_MOTION_VAR
// pre: predictor being evaluated
// wsrc: target weighted prediction (has been *4096 to keep precision)
// mask: 2d weights (scaled by 4096)
......@@ -509,4 +509,4 @@ HIGHBD_OBMCSADMXN(4, 8)
HIGHBD_OBMCSADMXN(4, 4)
/* clang-format on */
#endif // CONFIG_AOM_HIGHBITDEPTH
#endif // CONFIG_AV1 && CONFIG_OBMC
#endif // CONFIG_AV1 && CONFIG_MOTION_VAR
......@@ -942,7 +942,7 @@ HIGHBD_MASK_SUBPIX_VAR(128, 128)
#endif // CONFIG_AOM_HIGHBITDEPTH
#endif // CONFIG_AV1 && CONFIG_EXT_INTER
#if CONFIG_AV1 && CONFIG_OBMC
#if CONFIG_AV1 && CONFIG_MOTION_VAR
static INLINE void obmc_variance(const uint8_t *pre, int pre_stride,
const int32_t *wsrc, const int32_t *mask,
int w, int h, unsigned int *sse, int *sum) {
......@@ -1216,4 +1216,4 @@ HIGHBD_OBMC_VAR(128, 128)
HIGHBD_OBMC_SUBPIX_VAR(128, 128)
#endif // CONFIG_EXT_PARTITION
#endif // CONFIG_AOM_HIGHBITDEPTH
#endif // CONFIG_AV1 && CONFIG_OBMC
#endif // CONFIG_AV1 && CONFIG_MOTION_VAR
......@@ -68,7 +68,7 @@ typedef unsigned int (*aom_masked_subpixvariance_fn_t)(
unsigned int *sse);
#endif // CONFIG_AV1 && CONFIG_EXT_INTER
#if CONFIG_AV1 && CONFIG_OBMC
#if CONFIG_AV1 && CONFIG_MOTION_VAR
typedef unsigned int (*aom_obmc_sad_fn_t)(const uint8_t *pred, int pred_stride,
const int32_t *wsrc,
const int32_t *msk);
......@@ -80,7 +80,7 @@ typedef unsigned int (*aom_obmc_variance_fn_t)(const uint8_t *pred,
typedef unsigned int (*aom_obmc_subpixvariance_fn_t)(
const uint8_t *pred, int pred_stride, int xoffset, int yoffset,
const int32_t *wsrc, const int32_t *msk, unsigned int *sse);
#endif // CONFIG_AV1 && CONFIG_OBMC
#endif // CONFIG_AV1 && CONFIG_MOTION_VAR
#if CONFIG_AV1
typedef struct aom_variance_vtable {
......@@ -97,11 +97,11 @@ typedef struct aom_variance_vtable {
aom_masked_variance_fn_t mvf;
aom_masked_subpixvariance_fn_t msvf;
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
aom_obmc_sad_fn_t osdf;
aom_obmc_variance_fn_t ovf;
aom_obmc_subpixvariance_fn_t osvf;
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
} aom_variance_fn_ptr_t;
#endif // CONFIG_AV1
......
......@@ -227,7 +227,7 @@ typedef struct {
int interinter_wedge_index;
int interinter_wedge_sign;
#endif // CONFIG_EXT_INTER
MOTION_VARIATION motion_variation;
MOTION_MODE motion_mode;
int_mv mv[2];
int_mv pred_mv[2];
#if CONFIG_REF_MV
......@@ -772,21 +772,26 @@ static INLINE int is_interintra_pred(const MB_MODE_INFO *mbmi) {
}
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
static INLINE int is_motvar_allowed(const MB_MODE_INFO *mbmi) {
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
static INLINE int is_motion_variation_allowed_bsize(BLOCK_SIZE bsize) {
return (bsize >= BLOCK_8X8);
}
static INLINE int is_motion_variation_allowed(const MB_MODE_INFO *mbmi) {
#if CONFIG_EXT_INTER
return (mbmi->sb_type >= BLOCK_8X8 && mbmi->ref_frame[1] != INTRA_FRAME);
return is_motion_variation_allowed_bsize(mbmi->sb_type) &&
mbmi->ref_frame[1] != INTRA_FRAME;
#else
return (mbmi->sb_type >= BLOCK_8X8);
return is_motion_variation_allowed_bsize(mbmi->sb_type);
#endif // CONFIG_EXT_INTER
}
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
static INLINE int is_neighbor_overlappable(const MB_MODE_INFO *mbmi) {
return (is_inter_block(mbmi));
}
#endif // CONFIG_OBMC
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#endif // CONFIG_MOTION_VAR
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#ifdef __cplusplus
} // extern "C"
......
......@@ -315,43 +315,45 @@ static const aom_prob default_wedge_interinter_prob[BLOCK_SIZES] = {
#endif // CONFIG_EXT_INTER
// Change this section appropriately once warped motion is supported
#if CONFIG_OBMC && !CONFIG_WARPED_MOTION
const aom_tree_index av1_motvar_tree[TREE_SIZE(MOTION_VARIATIONS)] = {
#if CONFIG_MOTION_VAR && !CONFIG_WARPED_MOTION
const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = {
-SIMPLE_TRANSLATION, -OBMC_CAUSAL
};
static const aom_prob default_motvar_prob[BLOCK_SIZES]
[MOTION_VARIATIONS - 1] = {
{ 255 }, { 255 }, { 255 }, { 151 },
{ 153 }, { 144 }, { 178 }, { 165 },
{ 160 }, { 207 }, { 195 }, { 168 },
{ 244 },
static const aom_prob default_motion_mode_prob[BLOCK_SIZES]
[MOTION_MODES - 1] = {
{ 255 }, { 255 }, { 255 },
{ 151 }, { 153 }, { 144 },
{ 178 }, { 165 }, { 160 },
{ 207 }, { 195 }, { 168 },
{ 244 },
#if CONFIG_EXT_PARTITION
{ 252 }, { 252 }, { 252 },
{ 252 }, { 252 }, { 252 },
#endif // CONFIG_EXT_PARTITION
};
};
#elif !CONFIG_OBMC && CONFIG_WARPED_MOTION
#elif !CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
const aom_tree_index av1_motvar_tree[TREE_SIZE(MOTION_VARIATIONS)] = {
const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = {
-SIMPLE_TRANSLATION, -WARPED_CAUSAL
};
static const aom_prob default_motvar_prob[BLOCK_SIZES]
[MOTION_VARIATIONS - 1] = {
{ 255 }, { 255 }, { 255 }, { 151 },
{ 153 }, { 144 }, { 178 }, { 165 },
{ 160 }, { 207 }, { 195 }, { 168 },
{ 244 },
static const aom_prob default_motion_mode_prob[BLOCK_SIZES]
[MOTION_MODES - 1] = {
{ 255 }, { 255 }, { 255 },
{ 151 }, { 153 }, { 144 },
{ 178 }, { 165 }, { 160 },
{ 207 }, { 195 }, { 168 },
{ 244 },
#if CONFIG_EXT_PARTITION
{ 252 }, { 252 }, { 252 },
{ 252 }, { 252 }, { 252 },
#endif // CONFIG_EXT_PARTITION
};
};
#elif CONFIG_OBMC && CONFIG_WARPED_MOTION
#elif CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
const aom_tree_index av1_motvar_tree[TREE_SIZE(MOTION_VARIATIONS)] = {
const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)] = {
-SIMPLE_TRANSLATION, 2, -OBMC_CAUSAL, -WARPED_CAUSAL,
};
static const aom_prob default_motvar_prob[BLOCK_SIZES][MOTION_VARIATIONS - 1] =
static const aom_prob default_motion_mode_prob[BLOCK_SIZES][MOTION_MODES - 1] =
{
{ 255, 200 }, { 255, 200 }, { 255, 200 }, { 151, 200 }, { 153, 200 },
{ 144, 200 }, { 178, 200 }, { 165, 200 }, { 160, 200 }, { 207, 200 },
......@@ -360,7 +362,7 @@ static const aom_prob default_motvar_prob[BLOCK_SIZES][MOTION_VARIATIONS - 1] =
{ 252, 200 }, { 252, 200 }, { 252, 200 },
#endif // CONFIG_EXT_PARTITION
};
#endif // CONFIG_OBMC || !CONFIG_WARPED_MOTION
#endif // CONFIG_MOTION_VAR || !CONFIG_WARPED_MOTION
/* Array indices are identical to previously-existing INTRAMODECONTEXTNODES. */
const aom_tree_index av1_intra_mode_tree[TREE_SIZE(INTRA_MODES)] = {
......@@ -1350,9 +1352,9 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#endif // CONFIG_EXT_INTER
#endif // CONFIG_REF_MV
av1_copy(fc->inter_mode_probs, default_inter_mode_probs);
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
av1_copy(fc->motvar_prob, default_motvar_prob);
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
av1_copy(fc->motion_mode_prob, default_motion_mode_prob);
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if CONFIG_EXT_INTER
av1_copy(fc->inter_compound_mode_probs, default_inter_compound_mode_probs);
av1_copy(fc->interintra_prob, default_interintra_prob);
......@@ -1451,11 +1453,11 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
counts->inter_mode[i], fc->inter_mode_probs[i]);
#endif
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
for (i = BLOCK_8X8; i < BLOCK_SIZES; ++i)
aom_tree_merge_probs(av1_motvar_tree, pre_fc->motvar_prob[i],
counts->motvar[i], fc->motvar_prob[i]);
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
aom_tree_merge_probs(av1_motion_mode_tree, pre_fc->motion_mode_prob[i],
counts->motion_mode[i], fc->motion_mode_prob[i]);
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if CONFIG_SUPERTX
for (i = 0; i < PARTITION_SUPERTX_CONTEXTS; ++i) {
......
......@@ -80,9 +80,9 @@ typedef struct frame_contexts {
aom_prob wedge_interintra_prob[BLOCK_SIZES];
aom_prob wedge_interinter_prob[BLOCK_SIZES];
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
aom_prob motvar_prob[BLOCK_SIZES][MOTION_VARIATIONS - 1];
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
aom_prob motion_mode_prob[BLOCK_SIZES][MOTION_MODES - 1];
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
aom_prob intra_inter_prob[INTRA_INTER_CONTEXTS];
aom_prob comp_inter_prob[COMP_INTER_CONTEXTS];
aom_prob single_ref_prob[REF_CONTEXTS][SINGLE_REFS - 1];
......@@ -165,9 +165,9 @@ typedef struct FRAME_COUNTS {
unsigned int wedge_interintra[BLOCK_SIZES][2];
unsigned int wedge_interinter[BLOCK_SIZES][2];
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
unsigned int motvar[BLOCK_SIZES][MOTION_VARIATIONS];
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
unsigned int motion_mode[BLOCK_SIZES][MOTION_MODES];
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
unsigned int intra_inter[INTRA_INTER_CONTEXTS][2];
unsigned int comp_inter[COMP_INTER_CONTEXTS][2];
unsigned int single_ref[REF_CONTEXTS][SINGLE_REFS - 1][2];
......@@ -262,9 +262,9 @@ extern const aom_tree_index av1_ext_tx_intra_tree[EXT_TX_SETS_INTRA]
#else
extern const aom_tree_index av1_ext_tx_tree[TREE_SIZE(TX_TYPES)];
#endif // CONFIG_EXT_TX
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
extern const aom_tree_index av1_motvar_tree[TREE_SIZE(MOTION_VARIATIONS)];
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
extern const aom_tree_index av1_motion_mode_tree[TREE_SIZE(MOTION_MODES)];
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if CONFIG_LOOP_RESTORATION
#define RESTORE_NONE_BILATERAL_PROB 16
......
......@@ -280,14 +280,14 @@ typedef enum ATTRIBUTE_PACKED {
typedef enum {
SIMPLE_TRANSLATION = 0,
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
OBMC_CAUSAL, // 2-sided OBMC
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
#if CONFIG_WARPED_MOTION
WARPED_CAUSAL, // 2-sided WARPED
#endif // CONFIG_WARPED_MOTION
MOTION_VARIATIONS
} MOTION_VARIATION;
MOTION_MODES
} MOTION_MODE;
#if CONFIG_EXT_INTER
typedef enum {
......
......@@ -21,9 +21,9 @@
#include "av1/common/blockd.h"
#include "av1/common/reconinter.h"
#include "av1/common/reconintra.h"
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
#include "av1/common/onyxc_int.h"
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
#if CONFIG_GLOBAL_MOTION
#include "av1/common/warped_motion.h"
#endif // CONFIG_GLOBAL_MOTION
......@@ -534,9 +534,9 @@ void av1_build_inter_predictor(const uint8_t *src, int src_stride, uint8_t *dst,
}
void build_inter_predictors(MACROBLOCKD *xd, int plane,
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
int mi_col_offset, int mi_row_offset,
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
int block, int bw, int bh, int x, int y, int w,
int h,
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
......@@ -544,11 +544,11 @@ void build_inter_predictors(MACROBLOCKD *xd, int plane,
#endif // CONFIG_SUPERTX && CONFIG_EXT_INTER
int mi_x, int mi_y) {
struct macroblockd_plane *const pd = &xd->plane[plane];
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
const MODE_INFO *mi = xd->mi[mi_col_offset + xd->mi_stride * mi_row_offset];
#else
const MODE_INFO *mi = xd->mi[0];
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
const int is_compound = has_second_ref(&mi->mbmi);
int ref;
#if CONFIG_GLOBAL_MOTION
......@@ -782,9 +782,9 @@ static void build_inter_predictors_for_planes(MACROBLOCKD *xd, BLOCK_SIZE bsize,
for (y = 0; y < num_4x4_h; ++y)
for (x = 0; x < num_4x4_w; ++x)
build_inter_predictors(xd, plane,
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
0, 0,
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
y * 2 + x, bw, bh, 4 * x, 4 * y, pw, ph,
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
0, 0,
......@@ -792,9 +792,9 @@ static void build_inter_predictors_for_planes(MACROBLOCKD *xd, BLOCK_SIZE bsize,
mi_x, mi_y);
} else {
build_inter_predictors(xd, plane,
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
0, 0,
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
0, bw, bh, 0, 0, bw, bh,
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
0, 0,
......@@ -1056,9 +1056,9 @@ void av1_build_inter_predictors_sb_sub8x8_extend(MACROBLOCKD *xd,
const int bh = 4 * num_4x4_h;
build_inter_predictors(xd, plane,
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
0, 0,
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
block, bw, bh, 0, 0, bw, bh,
#if CONFIG_EXT_INTER
wedge_offset_x, wedge_offset_y,
......@@ -1101,9 +1101,9 @@ void av1_build_inter_predictors_sb_extend(MACROBLOCKD *xd,
for (y = 0; y < num_4x4_h; ++y)
for (x = 0; x < num_4x4_w; ++x)
build_inter_predictors(xd, plane,
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
0, 0,
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
y * 2 + x, bw, bh, 4 * x, 4 * y, 4, 4,
#if CONFIG_EXT_INTER
wedge_offset_x, wedge_offset_y,
......@@ -1111,9 +1111,9 @@ void av1_build_inter_predictors_sb_extend(MACROBLOCKD *xd,
mi_x, mi_y);
} else {
build_inter_predictors(xd, plane,
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
0, 0,
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
0, bw, bh, 0, 0, bw, bh,
#if CONFIG_EXT_INTER
wedge_offset_x, wedge_offset_y,
......@@ -1124,7 +1124,7 @@ void av1_build_inter_predictors_sb_extend(MACROBLOCKD *xd,
}
#endif // CONFIG_SUPERTX
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
// obmc_mask_N[overlap_position]
static const uint8_t obmc_mask_1[1] = { 55 };
......@@ -1474,7 +1474,7 @@ void av1_build_prediction_by_left_preds(AV1_COMMON *cm, MACROBLOCKD *xd,
}
xd->mb_to_top_edge = -((mi_row * MI_SIZE) * 8);
}
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
#if CONFIG_EXT_INTER
#if CONFIG_EXT_PARTITION
......
......@@ -214,9 +214,9 @@ static INLINE int get_interintra_wedge_bits(BLOCK_SIZE sb_type) {
#endif // CONFIG_EXT_INTER
void build_inter_predictors(MACROBLOCKD *xd, int plane,
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
int mi_col_offset, int mi_row_offset,
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
int block, int bw, int bh, int x, int y, int w,
int h,
#if CONFIG_SUPERTX && CONFIG_EXT_INTER
......@@ -515,7 +515,7 @@ static INLINE int av1_is_interp_needed(const MACROBLOCKD *const xd) {
}
#endif // CONFIG_EXT_INTERP
#if CONFIG_OBMC
#if CONFIG_MOTION_VAR
const uint8_t *av1_get_obmc_mask(int length);
void av1_build_obmc_inter_prediction(AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_row, int mi_col,
......@@ -535,7 +535,7 @@ void av1_build_prediction_by_left_preds(AV1_COMMON *cm, MACROBLOCKD *xd,
int tmp_width[MAX_MB_PLANE],
int tmp_height[MAX_MB_PLANE],
int tmp_stride[MAX_MB_PLANE]);
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
#if CONFIG_EXT_INTER
#define MASK_MASTER_SIZE (2 * MAX_SB_SIZE)
......
......@@ -1238,8 +1238,8 @@ static void decode_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
} else {
// Prediction
av1_build_inter_predictors_sb(xd, mi_row, mi_col, AOMMAX(bsize, BLOCK_8X8));
#if CONFIG_OBMC
if (mbmi->motion_variation == OBMC_CAUSAL) {
#if CONFIG_MOTION_VAR
if (mbmi->motion_mode == OBMC_CAUSAL) {
#if CONFIG_AOM_HIGHBITDEPTH
DECLARE_ALIGNED(16, uint8_t, tmp_buf1[2 * MAX_MB_PLANE * MAX_SB_SQUARE]);
DECLARE_ALIGNED(16, uint8_t, tmp_buf2[2 * MAX_MB_PLANE * MAX_SB_SQUARE]);
......@@ -1284,7 +1284,7 @@ static void decode_block(AV1Decoder *const pbi, MACROBLOCKD *const xd,
av1_build_obmc_inter_prediction(cm, xd, mi_row, mi_col, dst_buf1,
dst_stride1, dst_buf2, dst_stride2);
}
#endif // CONFIG_OBMC
#endif // CONFIG_MOTION_VAR
// Reconstruction
if (!mbmi->skip) {
......@@ -3649,12 +3649,12 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
}
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
for (i = BLOCK_8X8; i < BLOCK_SIZES; ++i) {
for (j = 0; j < MOTION_VARIATIONS - 1; ++j)
av1_diff_update_prob(&r, &fc->motvar_prob[i][j]);
for (j = 0; j < MOTION_MODES - 1; ++j)
av1_diff_update_prob(&r, &fc->motion_mode_prob[i][j]);
}
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
if (cm->interp_filter == SWITCHABLE) read_switchable_interp_probs(fc, &r);
......@@ -3722,10 +3722,10 @@ static void debug_check_frame_counts(const AV1_COMMON *const cm) {
assert(!memcmp(cm->counts.wedge_interinter, zero_counts.wedge_interinter,
sizeof(cm->counts.wedge_interinter)));
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
assert(!memcmp(cm->counts.motvar, zero_counts.motvar,
sizeof(cm->counts.motvar)));
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
assert(!memcmp(cm->counts.motion_mode, zero_counts.motion_mode,
sizeof(cm->counts.motion_mode)));
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
assert(!memcmp(cm->counts.intra_inter, zero_counts.intra_inter,
sizeof(cm->counts.intra_inter)));
assert(!memcmp(cm->counts.comp_inter, zero_counts.comp_inter,
......
......@@ -819,24 +819,22 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
}
}
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
static MOTION_VARIATION read_motvar_block(AV1_COMMON *const cm,
MACROBLOCKD *const xd,
aom_reader *r) {
BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
FRAME_COUNTS *counts = xd->counts;
MOTION_VARIATION motvar;
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
static MOTION_MODE read_motion_mode(AV1_COMMON *cm, MACROBLOCKD *xd,
MB_MODE_INFO *mbmi, aom_reader *r) {
if (is_motion_variation_allowed(mbmi)) {
int motion_mode;
FRAME_COUNTS *counts = xd->counts;
if (is_motvar_allowed(&xd->mi[0]->mbmi)) {
motvar = (MOTION_VARIATION)aom_read_tree(r, av1_motvar_tree,
cm->fc->motvar_prob[bsize]);
if (counts) ++counts->motvar[bsize][motvar];
return motvar;
motion_mode = aom_read_tree(r, av1_motion_mode_tree,
cm->fc->motion_mode_prob[mbmi->sb_type]);
if (counts) ++counts->motion_mode[mbmi->sb_type][motion_mode];
return (MOTION_MODE)(SIMPLE_TRANSLATION + motion_mode);
} else {
return SIMPLE_TRANSLATION;
}
}
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
static INLINE InterpFilter read_interp_filter(AV1_COMMON *const cm,
MACROBLOCKD *const xd,
......@@ -1166,12 +1164,12 @@ static void fpm_sync(void *const data, int mi_row) {
static void read_inter_block_mode_info(AV1Decoder *const pbi,
MACROBLOCKD *const xd,
MODE_INFO *const mi,
#if (CONFIG_OBMC || CONFIG_EXT_INTER) && CONFIG_SUPERTX
#if (CONFIG_MOTION_VAR || CONFIG_EXT_INTER) && CONFIG_SUPERTX
int mi_row, int mi_col, aom_reader *r,
int supertx_enabled) {
#else
int mi_row, int mi_col, aom_reader *r) {
#endif // CONFIG_OBMC && CONFIG_SUPERTX
#endif // CONFIG_MOTION_VAR && CONFIG_SUPERTX
AV1_COMMON *const cm = &pbi->common;
MB_MODE_INFO *const mbmi = &mi->mbmi;
const BLOCK_SIZE bsize = mbmi->sb_type;
......@@ -1538,25 +1536,25 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
}
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
mbmi->motion_variation = SIMPLE_TRANSLATION;
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
mbmi->motion_mode = SIMPLE_TRANSLATION;
#if CONFIG_SUPERTX
if (!supertx_enabled)
#endif // CONFIG_SUPERTX
#if CONFIG_EXT_INTER
if (mbmi->ref_frame[1] != INTRA_FRAME)
#endif // CONFIG_EXT_INTER
mbmi->motion_variation = read_motvar_block(cm, xd, r);
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
mbmi->motion_mode = read_motion_mode(cm, xd, mbmi, r);
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if CONFIG_EXT_INTER
mbmi->use_wedge_interinter = 0;
if (cm->reference_mode != SINGLE_REFERENCE &&
is_inter_compound_mode(mbmi->mode) &&
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
!(is_motvar_allowed(mbmi) &&
mbmi->motion_variation != SIMPLE_TRANSLATION) &&
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
!(is_motion_variation_allowed(mbmi) &&
mbmi->motion_mode != SIMPLE_TRANSLATION) &&
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
is_interinter_wedge_used(bsize)) {
mbmi->use_wedge_interinter =
aom_read(r, cm->fc->wedge_interinter_prob[bsize]);
......@@ -1698,12 +1696,12 @@ static void read_inter_frame_mode_info(AV1Decoder *const pbi,
if (inter_block)
read_inter_block_mode_info(pbi, xd,
#if (CONFIG_OBMC || CONFIG_EXT_INTER) && CONFIG_SUPERTX
#if (CONFIG_MOTION_VAR || CONFIG_EXT_INTER) && CONFIG_SUPERTX
mi, mi_row, mi_col, r, supertx_enabled);
#else
mi, mi_row, mi_col, r);
#endif // CONFIG_OBMC && CONFIG_SUPERTX
#endif // CONFIG_MOTION_VAR && CONFIG_SUPERTX
else
read_intra_block_mode_info(cm, xd, mi, r);
......
......@@ -149,9 +149,9 @@ static struct av1_token intra_filter_encodings[INTRA_FILTERS];
#if CONFIG_EXT_INTER
static struct av1_token interintra_mode_encodings[INTERINTRA_MODES];
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
static struct av1_token motvar_encodings[MOTION_VARIATIONS];
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
static struct av1_token motion_mode_encodings[MOTION_MODES];
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if CONFIG_LOOP_RESTORATION
static struct av1_token switchable_restore_encodings[RESTORE_SWITCHABLE_TYPES];
#endif // CONFIG_LOOP_RESTORATION
......@@ -174,9 +174,9 @@ void av1_encode_token_init(void) {
#if CONFIG_EXT_INTER
av1_tokens_from_tree(interintra_mode_encodings, av1_interintra_mode_tree);
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
av1_tokens_from_tree(motvar_encodings, av1_motvar_tree);
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
av1_tokens_from_tree(motion_mode_encodings, av1_motion_mode_tree);
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if CONFIG_GLOBAL_MOTION
av1_tokens_from_tree(global_motion_types_encodings,
av1_global_motion_types_tree);
......@@ -1401,30 +1401,31 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
}
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if CONFIG_SUPERTX
if (!supertx_enabled)
#endif // CONFIG_SUPERTX
#if CONFIG_EXT_INTER
if (mbmi->ref_frame[1] != INTRA_FRAME)
#endif // CONFIG_EXT_INTER
if (is_motvar_allowed(mbmi)) {
if (is_motion_variation_allowed(mbmi)) {
// TODO(debargha): Might want to only emit this if SEG_LVL_SKIP
// is not active, and assume SIMPLE_TRANSLATION in the decoder if
// it is active.
assert(mbmi->motion_variation < MOTION_VARIATIONS);
av1_write_token(w, av1_motvar_tree, cm->fc->motvar_prob[bsize],
&motvar_encodings[mbmi->motion_variation]);
assert(mbmi->motion_mode < MOTION_MODES);
av1_write_token(w, av1_motion_mode_tree,
cm->fc->motion_mode_prob[bsize],
&motion_mode_encodings[mbmi->motion_mode]);
}
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if CONFIG_EXT_INTER
if (cpi->common.reference_mode != SINGLE_REFERENCE &&
is_inter_compound_mode(mbmi->mode) &&
#if CONFIG_OBMC
!(is_motvar_allowed(mbmi) &&
mbmi->motion_variation != SIMPLE_TRANSLATION) &&
#endif // CONFIG_OBMC
#if CONFIG_MOTION_VAR
!(is_motion_variation_allowed(mbmi) &&
mbmi->motion_mode != SIMPLE_TRANSLATION) &&
#endif // CONFIG_MOTION_VAR
is_interinter_wedge_used(bsize)) {
aom_write(w, mbmi->use_wedge_interinter,
cm->fc->wedge_interinter_prob[bsize]);
......@@ -3474,11 +3475,11 @@ static uint32_t write_compressed_header(AV1_COMP *cpi, uint8_t *data) {
}
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
for (i = BLOCK_8X8; i < BLOCK_SIZES; ++i)
prob_diff_update(av1_motvar_tree, fc->motvar_prob[i], counts->motvar[i],
MOTION_VARIATIONS, header_bc);
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
prob_diff_update(av1_motion_mode_tree, fc->motion_mode_prob[i],
counts->motion_mode[i], MOTION_MODES, header_bc);
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
if (cm->interp_filter == SWITCHABLE)
update_switchable_interp_probs(cm, header_bc, counts);
......
......@@ -1301,7 +1301,7 @@ static void update_state_supertx(AV1_COMP *cpi, ThreadData *td,
}
#endif // CONFIG_VAR_TX
// Turn motion variation off for supertx
mbmi->motion_variation = SIMPLE_TRANSLATION;
mbmi->motion_mode = SIMPLE_TRANSLATION;
if (!output_enabled) return;
......@@ -1886,24 +1886,24 @@ static void update_stats(AV1_COMMON *cm, ThreadData *td
}
#endif // CONFIG_EXT_INTER
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if CONFIG_SUPERTX
if (!supertx_enabled)
#endif // CONFIG_SUPERTX
#if CONFIG_EXT_INTER
if (mbmi->ref_frame[1] != INTRA_FRAME)
#endif // CONFIG_EXT_INTER
if (is_motvar_allowed(mbmi))
counts->motvar[mbmi->sb_type][mbmi->motion_variation]++;
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
if (is_motion_variation_allowed(mbmi))
counts->motion_mode[mbmi->sb_type][mbmi->motion_mode]++;
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
#if CONFIG_EXT_INTER
if (cm->reference_mode != SINGLE_REFERENCE &&
is_inter_compound_mode(mbmi->mode) &&
#if CONFIG_OBMC || CONFIG_WARPED_MOTION
!(is_motvar_allowed(mbmi) &&
mbmi->motion_variation != SIMPLE_TRANSLATION) &&
#endif // CONFIG_OBMC || CONFIG_WARPED_MOTION
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
!(is_motion_variation_allowed(mbmi) &&
mbmi->motion_mode != SIMPLE_TRANSLATION) &&
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
is_interinter_wedge_used(bsize)) {
counts->wedge_interinter[bsize][mbmi->use_wedge_interinter]++;
}
......@@ -5063,8 +5063,8 @@ static void encode_superblock(AV1_COMP *cpi, ThreadData *td, TOKENEXTRA **t,
av1_build_inter_predictors_sbuv(xd, mi_row, mi_col,
AOMMAX(bsize, BLOCK_8X8));