Commit 34d5566a authored by Sebastien Alaiwan's avatar Sebastien Alaiwan

Remove COMPOUND_SINGLEREF experiment

This experiment has been abandonned for AV1.

Change-Id: I3501181d096873dec35ea58e4b55530fa76e683f
parent 35a4db38
......@@ -316,11 +316,6 @@ static const uint16_t above_border_uv = 0x000f;
static const int mode_lf_lut[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // INTRA_MODES
1, 1, 0, 1, // INTER_MODES (GLOBALMV == 0)
#if CONFIG_COMPOUND_SINGLEREF
// 1, 1, 1, 1, 1, // INTER_SINGLEREF_COMP_MODES
// NOTE(zoeliu): Remove SR_NEAREST_NEWMV
1, 1, 1, 1, // INTER_SINGLEREF_COMP_MODES
#endif // CONFIG_COMPOUND_SINGLEREF
1, 1, 1, 1, 1, 1, 0, 1 // INTER_COMPOUND_MODES (GLOBAL_GLOBALMV == 0)
};
......
......@@ -81,14 +81,6 @@ static INLINE int is_inter_singleref_mode(PREDICTION_MODE mode) {
static INLINE int is_inter_compound_mode(PREDICTION_MODE mode) {
return mode >= NEAREST_NEARESTMV && mode <= NEW_NEWMV;
}
#if CONFIG_COMPOUND_SINGLEREF
static INLINE int is_inter_singleref_comp_mode(PREDICTION_MODE mode) {
return mode >= SR_NEAREST_NEARMV && mode <= SR_NEW_NEWMV;
}
static INLINE int is_inter_anyref_comp_mode(PREDICTION_MODE mode) {
return is_inter_compound_mode(mode) || is_inter_singleref_comp_mode(mode);
}
#endif // CONFIG_COMPOUND_SINGLEREF
static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
static PREDICTION_MODE lut[] = {
......@@ -109,28 +101,17 @@ static INLINE PREDICTION_MODE compound_ref0_mode(PREDICTION_MODE mode) {
MB_MODE_COUNT, // NEARMV
MB_MODE_COUNT, // GLOBALMV
MB_MODE_COUNT, // NEWMV
#if CONFIG_COMPOUND_SINGLEREF
NEARESTMV, // SR_NEAREST_NEARMV
// NEARESTMV, // SR_NEAREST_NEWMV
NEARMV, // SR_NEAR_NEWMV
GLOBALMV, // SR_ZERO_NEWMV
NEWMV, // SR_NEW_NEWMV
#endif // CONFIG_COMPOUND_SINGLEREF
NEARESTMV, // NEAREST_NEARESTMV
NEARMV, // NEAR_NEARMV
NEARESTMV, // NEAREST_NEWMV
NEWMV, // NEW_NEARESTMV
NEARMV, // NEAR_NEWMV
NEWMV, // NEW_NEARMV
GLOBALMV, // GLOBAL_GLOBALMV
NEWMV, // NEW_NEWMV
NEARESTMV, // NEAREST_NEARESTMV
NEARMV, // NEAR_NEARMV
NEARESTMV, // NEAREST_NEWMV
NEWMV, // NEW_NEARESTMV
NEARMV, // NEAR_NEWMV
NEWMV, // NEW_NEARMV
GLOBALMV, // GLOBAL_GLOBALMV
NEWMV, // NEW_NEWMV
};
assert(NELEMENTS(lut) == MB_MODE_COUNT);
#if CONFIG_COMPOUND_SINGLEREF
assert(is_inter_anyref_comp_mode(mode));
#else // !CONFIG_COMPOUND_SINGLEREF
assert(is_inter_compound_mode(mode));
#endif // CONFIG_COMPOUND_SINGLEREF
return lut[mode];
}
......@@ -153,45 +134,27 @@ static INLINE PREDICTION_MODE compound_ref1_mode(PREDICTION_MODE mode) {
MB_MODE_COUNT, // NEARMV
MB_MODE_COUNT, // GLOBALMV
MB_MODE_COUNT, // NEWMV
#if CONFIG_COMPOUND_SINGLEREF
NEARMV, // SR_NEAREST_NEARMV
// NEWMV, // SR_NEAREST_NEWMV
NEWMV, // SR_NEAR_NEWMV
NEWMV, // SR_ZERO_NEWMV
NEWMV, // SR_NEW_NEWMV
#endif // CONFIG_COMPOUND_SINGLEREF
NEARESTMV, // NEAREST_NEARESTMV
NEARMV, // NEAR_NEARMV
NEWMV, // NEAREST_NEWMV
NEARESTMV, // NEW_NEARESTMV
NEWMV, // NEAR_NEWMV
NEARMV, // NEW_NEARMV
GLOBALMV, // GLOBAL_GLOBALMV
NEWMV, // NEW_NEWMV
NEARESTMV, // NEAREST_NEARESTMV
NEARMV, // NEAR_NEARMV
NEWMV, // NEAREST_NEWMV
NEARESTMV, // NEW_NEARESTMV
NEWMV, // NEAR_NEWMV
NEARMV, // NEW_NEARMV
GLOBALMV, // GLOBAL_GLOBALMV
NEWMV, // NEW_NEWMV
};
assert(NELEMENTS(lut) == MB_MODE_COUNT);
#if CONFIG_COMPOUND_SINGLEREF
assert(is_inter_anyref_comp_mode(mode));
#else // !CONFIG_COMPOUND_SINGLEREF
assert(is_inter_compound_mode(mode));
#endif // CONFIG_COMPOUND_SINGLEREF
return lut[mode];
}
static INLINE int have_nearmv_in_inter_mode(PREDICTION_MODE mode) {
return (mode == NEARMV || mode == NEAR_NEARMV || mode == NEAR_NEWMV ||
#if CONFIG_COMPOUND_SINGLEREF
mode == SR_NEAREST_NEARMV || mode == SR_NEAR_NEWMV ||
#endif // CONFIG_COMPOUND_SINGLEREF
mode == NEW_NEARMV);
}
static INLINE int have_newmv_in_inter_mode(PREDICTION_MODE mode) {
return (mode == NEWMV || mode == NEW_NEWMV || mode == NEAREST_NEWMV ||
#if CONFIG_COMPOUND_SINGLEREF
/* mode == SR_NEAREST_NEWMV || */ mode == SR_NEAR_NEWMV ||
mode == SR_ZERO_NEWMV || mode == SR_NEW_NEWMV ||
#endif // CONFIG_COMPOUND_SINGLEREF
mode == NEW_NEARESTMV || mode == NEAR_NEWMV || mode == NEW_NEARMV);
}
......@@ -1277,11 +1240,7 @@ static INLINE int is_motion_variation_allowed_bsize(BLOCK_SIZE bsize) {
static INLINE int is_motion_variation_allowed_compound(
const MB_MODE_INFO *mbmi) {
#if CONFIG_COMPOUND_SINGLEREF
if (!has_second_ref(mbmi) && !is_inter_singleref_comp_mode(mbmi->mode))
#else
if (!has_second_ref(mbmi))
#endif // CONFIG_COMPOUND_SINGLEREF
return 1;
else
return 0;
......
......@@ -1795,9 +1795,6 @@ void av1_average_tile_inter_cdfs(AV1_COMMON *cm, FRAME_CONTEXT *fc,
AVERAGE_TILE_CDFS(inter_compound_mode_cdf)
AVERAGE_TILE_CDFS(compound_type_cdf)
#if CONFIG_COMPOUND_SINGLEREF
AVERAGE_TILE_CDFS(inter_singleref_comp_mode_cdf)
#endif
#if CONFIG_NEW_MULTISYMBOL
AVERAGE_TILE_CDFS(interintra_cdf)
......
......@@ -814,41 +814,6 @@ static const aom_cdf_prob
{ AOM_CDF8(3456, 9067, 14069, 16907, 18817, 21214, 23139) }
};
#if CONFIG_COMPOUND_SINGLEREF
// TODO(zoeliu): Default values to be further adjusted based on the collected
// stats.
/*
static const aom_prob default_inter_singleref_comp_mode_probs
[INTER_MODE_CONTEXTS][INTER_SINGLEREF_COMP_MODES - 1] = {
{ 2, 173, 68, 180 }, // 0 = both zero mv
{ 7, 145, 160, 180 }, // 1 = 1 zero + 1 predicted
{ 7, 166, 126, 180 }, // 2 = two predicted mvs
{ 7, 94, 132, 180 }, // 3 = 1 pred/zero, 1 new
{ 8, 64, 64, 180 }, // 4 = two new mvs
{ 17, 81, 52, 180 }, // 5 = one intra neighbour
{ 25, 29, 50, 180 }, // 6 = two intra neighbours
};*/
static const aom_prob default_inter_singleref_comp_mode_probs
[INTER_MODE_CONTEXTS][INTER_SINGLEREF_COMP_MODES - 1] = {
{ 2, 173, 68 }, // 0 = both zero mv
{ 7, 145, 160 }, // 1 = 1 zero + 1 predicted
{ 7, 166, 126 }, // 2 = two predicted mvs
{ 7, 94, 132 }, // 3 = 1 pred/zero, 1 new
{ 8, 64, 64 }, // 4 = two new mvs
{ 17, 81, 52 }, // 5 = one intra neighbour
{ 25, 29, 50 }, // 6 = two intra neighbours
};
static const aom_cdf_prob
default_inter_singleref_comp_mode_cdf[INTER_MODE_CONTEXTS][CDF_SIZE(
INTER_SINGLEREF_COMP_MODES)] = {
{ AOM_CDF4(21971, 24771, 25027) }, { AOM_CDF4(18053, 26690, 27586) },
{ AOM_CDF4(20667, 26182, 27078) }, { AOM_CDF4(11703, 22103, 22999) },
{ AOM_CDF4(7936, 13888, 14912) }, { AOM_CDF4(9679, 13927, 16103) },
{ AOM_CDF4(3349, 8470, 11670) }
};
#endif // CONFIG_COMPOUND_SINGLEREF
static const aom_prob
default_compound_type_probs[BLOCK_SIZES_ALL][COMPOUND_TYPES - 1] = {
{ 128, 128 }, { 128, 128 }, { 128, 128 }, { 128, 128 },
......@@ -1058,26 +1023,6 @@ const aom_tree_index av1_inter_compound_mode_tree
-INTER_COMPOUND_OFFSET(NEAR_NEWMV), -INTER_COMPOUND_OFFSET(NEW_NEARMV)
};
#if CONFIG_COMPOUND_SINGLEREF
// TODO(zoeliu): To redesign the tree structure once the number of mode changes.
/*
const aom_tree_index av1_inter_singleref_comp_mode_tree
[TREE_SIZE(INTER_SINGLEREF_COMP_MODES)] = {
-INTER_SINGLEREF_COMP_OFFSET(SR_ZERO_NEWMV), 2,
-INTER_SINGLEREF_COMP_OFFSET(SR_NEAREST_NEARMV), 4,
6, -INTER_SINGLEREF_COMP_OFFSET(SR_NEW_NEWMV),
-INTER_SINGLEREF_COMP_OFFSET(SR_NEAREST_NEWMV),
-INTER_SINGLEREF_COMP_OFFSET(SR_NEAR_NEWMV)
};*/
const aom_tree_index av1_inter_singleref_comp_mode_tree
[TREE_SIZE(INTER_SINGLEREF_COMP_MODES)] = {
-INTER_SINGLEREF_COMP_OFFSET(SR_ZERO_NEWMV), 2,
-INTER_SINGLEREF_COMP_OFFSET(SR_NEAREST_NEARMV), 4,
-INTER_SINGLEREF_COMP_OFFSET(SR_NEAR_NEWMV),
-INTER_SINGLEREF_COMP_OFFSET(SR_NEW_NEWMV)
};
#endif // CONFIG_COMPOUND_SINGLEREF
const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)] = {
-COMPOUND_AVERAGE, 2, -COMPOUND_WEDGE, -COMPOUND_SEG
......@@ -1241,14 +1186,6 @@ static const aom_cdf_prob default_single_ref_cdf[REF_CONTEXTS][SINGLE_REFS - 1]
};
#endif // CONFIG_NEW_MULTISYMBOL
#if CONFIG_COMPOUND_SINGLEREF
// TODO(zoeliu): Default values to be further adjusted based on the collected
// stats.
static const aom_prob default_comp_inter_mode_p[COMP_INTER_MODE_CONTEXTS] = {
40, 110, 160, 220
};
#endif // CONFIG_COMPOUND_SINGLEREF
// TODO(huisu): tune these cdfs
const aom_cdf_prob
default_palette_y_size_cdf[PALETTE_BLOCK_SIZES][CDF_SIZE(PALETTE_SIZES)] = {
......@@ -3243,9 +3180,6 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#if CONFIG_NEW_MULTISYMBOL
av1_copy(fc->single_ref_cdf, default_single_ref_cdf);
#endif
#if CONFIG_COMPOUND_SINGLEREF
av1_copy(fc->comp_inter_mode_prob, default_comp_inter_mode_p);
#endif // CONFIG_COMPOUND_SINGLEREF
av1_copy(fc->txfm_partition_prob, default_txfm_partition_probs);
#if CONFIG_NEW_MULTISYMBOL
av1_copy(fc->txfm_partition_cdf, default_txfm_partition_cdf);
......@@ -3274,12 +3208,6 @@ static void init_mode_probs(FRAME_CONTEXT *fc) {
#endif
av1_copy(fc->inter_compound_mode_probs, default_inter_compound_mode_probs);
av1_copy(fc->inter_compound_mode_cdf, default_inter_compound_mode_cdf);
#if CONFIG_COMPOUND_SINGLEREF
av1_copy(fc->inter_singleref_comp_mode_probs,
default_inter_singleref_comp_mode_probs);
av1_copy(fc->inter_singleref_comp_mode_cdf,
default_inter_singleref_comp_mode_cdf);
#endif // CONFIG_COMPOUND_SINGLEREF
av1_copy(fc->compound_type_prob, default_compound_type_probs);
av1_copy(fc->compound_type_cdf, default_compound_type_cdf);
av1_copy(fc->interintra_prob, default_interintra_prob);
......@@ -3393,13 +3321,6 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
fc->single_ref_prob[i][j] = av1_mode_mv_merge_probs(
pre_fc->single_ref_prob[i][j], counts->single_ref[i][j]);
#if CONFIG_COMPOUND_SINGLEREF
for (i = 0; i < COMP_INTER_MODE_CONTEXTS; i++)
fc->comp_inter_mode_prob[i] = av1_mode_mv_merge_probs(
pre_fc->comp_inter_mode_prob[i], counts->comp_inter_mode[i]);
#endif // CONFIG_COMPOUND_SINGLEREF
for (i = 0; i < NEWMV_MODE_CONTEXTS; ++i)
fc->newmv_prob[i] =
av1_mode_mv_merge_probs(pre_fc->newmv_prob[i], counts->newmv_mode[i]);
......@@ -3425,13 +3346,6 @@ void av1_adapt_inter_frame_probs(AV1_COMMON *cm) {
aom_tree_merge_probs(
av1_inter_compound_mode_tree, pre_fc->inter_compound_mode_probs[i],
counts->inter_compound_mode[i], fc->inter_compound_mode_probs[i]);
#if CONFIG_COMPOUND_SINGLEREF
for (i = 0; i < INTER_MODE_CONTEXTS; i++)
aom_tree_merge_probs(av1_inter_singleref_comp_mode_tree,
pre_fc->inter_singleref_comp_mode_probs[i],
counts->inter_singleref_comp_mode[i],
fc->inter_singleref_comp_mode_probs[i]);
#endif // CONFIG_COMPOUND_SINGLEREF
if (cm->allow_interintra_compound) {
for (i = 0; i < BLOCK_SIZE_GROUPS; ++i) {
if (is_interintra_allowed_bsize_group(i))
......
......@@ -27,9 +27,6 @@ extern "C" {
#define TX_SIZE_CONTEXTS 2
#define INTER_OFFSET(mode) ((mode)-NEARESTMV)
#if CONFIG_COMPOUND_SINGLEREF
#define INTER_SINGLEREF_COMP_OFFSET(mode) ((mode)-SR_NEAREST_NEARMV)
#endif // CONFIG_COMPOUND_SINGLEREF
#define INTER_COMPOUND_OFFSET(mode) ((mode)-NEAREST_NEARESTMV)
// Number of possible contexts for a color index.
......@@ -200,12 +197,6 @@ typedef struct frame_contexts {
[INTER_COMPOUND_MODES - 1];
aom_cdf_prob inter_compound_mode_cdf[INTER_MODE_CONTEXTS]
[CDF_SIZE(INTER_COMPOUND_MODES)];
#if CONFIG_COMPOUND_SINGLEREF
aom_prob inter_singleref_comp_mode_probs[INTER_MODE_CONTEXTS]
[INTER_SINGLEREF_COMP_MODES - 1];
aom_cdf_prob inter_singleref_comp_mode_cdf[INTER_MODE_CONTEXTS][CDF_SIZE(
INTER_SINGLEREF_COMP_MODES)];
#endif // CONFIG_COMPOUND_SINGLEREF
aom_prob compound_type_prob[BLOCK_SIZES_ALL][COMPOUND_TYPES - 1];
aom_cdf_prob compound_type_cdf[BLOCK_SIZES_ALL][CDF_SIZE(COMPOUND_TYPES)];
aom_prob interintra_prob[BLOCK_SIZE_GROUPS];
......@@ -263,9 +254,6 @@ typedef struct frame_contexts {
aom_cdf_prob comp_ref_cdf[REF_CONTEXTS][FWD_REFS - 1][CDF_SIZE(2)];
aom_cdf_prob comp_bwdref_cdf[REF_CONTEXTS][BWD_REFS - 1][CDF_SIZE(2)];
#endif
#if CONFIG_COMPOUND_SINGLEREF
aom_prob comp_inter_mode_prob[COMP_INTER_MODE_CONTEXTS];
#endif // CONFIG_COMPOUND_SINGLEREF
aom_prob txfm_partition_prob[TXFM_PARTITION_CONTEXTS];
#if CONFIG_NEW_MULTISYMBOL
aom_cdf_prob txfm_partition_cdf[TXFM_PARTITION_CONTEXTS][CDF_SIZE(2)];
......@@ -431,10 +419,6 @@ typedef struct FRAME_COUNTS {
unsigned int drl_mode[DRL_MODE_CONTEXTS][2];
unsigned int inter_compound_mode[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES];
#if CONFIG_COMPOUND_SINGLEREF
unsigned int inter_singleref_comp_mode[INTER_MODE_CONTEXTS]
[INTER_SINGLEREF_COMP_MODES];
#endif // CONFIG_COMPOUND_SINGLEREF
unsigned int interintra[BLOCK_SIZE_GROUPS][2];
unsigned int interintra_mode[BLOCK_SIZE_GROUPS][INTERINTRA_MODES];
unsigned int wedge_interintra[BLOCK_SIZES_ALL][2];
......@@ -450,9 +434,6 @@ typedef struct FRAME_COUNTS {
unsigned int single_ref[REF_CONTEXTS][SINGLE_REFS - 1][2];
unsigned int comp_ref[REF_CONTEXTS][FWD_REFS - 1][2];
unsigned int comp_bwdref[REF_CONTEXTS][BWD_REFS - 1][2];
#if CONFIG_COMPOUND_SINGLEREF
unsigned int comp_inter_mode[COMP_INTER_MODE_CONTEXTS][2];
#endif // CONFIG_COMPOUND_SINGLEREF
unsigned int txfm_partition[TXFM_PARTITION_CONTEXTS][2];
#if CONFIG_EXT_SKIP
unsigned int skip_mode[SKIP_MODE_CONTEXTS][2];
......@@ -566,10 +547,6 @@ extern const aom_tree_index
av1_interintra_mode_tree[TREE_SIZE(INTERINTRA_MODES)];
extern const aom_tree_index
av1_inter_compound_mode_tree[TREE_SIZE(INTER_COMPOUND_MODES)];
#if CONFIG_COMPOUND_SINGLEREF
extern const aom_tree_index
av1_inter_singleref_comp_mode_tree[TREE_SIZE(INTER_SINGLEREF_COMP_MODES)];
#endif // CONFIG_COMPOUND_SINGLEREF
extern const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)];
extern const aom_tree_index av1_partition_tree[TREE_SIZE(PARTITION_TYPES)];
#if CONFIG_EXT_PARTITION_TYPES
......
......@@ -494,14 +494,6 @@ typedef enum ATTRIBUTE_PACKED {
NEARMV,
GLOBALMV,
NEWMV,
#if CONFIG_COMPOUND_SINGLEREF
// Single ref compound modes
SR_NEAREST_NEARMV,
// SR_NEAREST_NEWMV,
SR_NEAR_NEWMV,
SR_ZERO_NEWMV,
SR_NEW_NEWMV,
#endif // CONFIG_COMPOUND_SINGLEREF
// Compound ref compound modes
NEAREST_NEARESTMV,
NEAR_NEARMV,
......@@ -590,10 +582,6 @@ typedef enum ATTRIBUTE_PACKED {
#define INTER_MODES (1 + NEWMV - NEARESTMV)
#if CONFIG_COMPOUND_SINGLEREF
#define INTER_SINGLEREF_COMP_MODES (1 + SR_NEW_NEWMV - SR_NEAREST_NEARMV)
#endif // CONFIG_COMPOUND_SINGLEREF
#define INTER_COMPOUND_MODES (1 + NEW_NEWMV - NEAREST_NEARESTMV)
#define SKIP_CONTEXTS 3
......@@ -653,10 +641,6 @@ typedef enum ATTRIBUTE_PACKED {
#define UNI_COMP_REF_CONTEXTS 3
#endif // CONFIG_EXT_COMP_REFS
#if CONFIG_COMPOUND_SINGLEREF
#define COMP_INTER_MODE_CONTEXTS 4
#endif // CONFIG_COMPOUND_SINGLEREF
#define TXFM_PARTITION_CONTEXTS ((TX_SIZES - TX_8X8) * 6 - 2)
typedef uint8_t TXFM_CONTEXT;
......
......@@ -61,21 +61,14 @@ static const int mode_2_counter[] = {
0, // NEARMV
3, // GLOBALMV
1, // NEWMV
#if CONFIG_COMPOUND_SINGLEREF
0, // SR_NEAREST_NEARMV
// 1, // SR_NEAREST_NEWMV
1, // SR_NEAR_NEWMV
3, // SR_ZERO_NEWMV
1, // SR_NEW_NEWMV
#endif // CONFIG_COMPOUND_SINGLEREF
0, // NEAREST_NEARESTMV
0, // NEAR_NEARMV
1, // NEAREST_NEWMV
1, // NEW_NEARESTMV
1, // NEAR_NEWMV
1, // NEW_NEARMV
3, // GLOBAL_GLOBALMV
1, // NEW_NEWMV
0, // NEAREST_NEARESTMV
0, // NEAR_NEARMV
1, // NEAREST_NEWMV
1, // NEW_NEARESTMV
1, // NEAR_NEWMV
1, // NEW_NEARMV
3, // GLOBAL_GLOBALMV
1, // NEW_NEWMV
};
// There are 3^3 different combinations of 3 counts that can be either 0,1 or
......
......@@ -172,42 +172,6 @@ int av1_get_intra_inter_context(const MACROBLOCKD *xd) {
}
}
#if CONFIG_COMPOUND_SINGLEREF
// The compound/single mode info data structure has one element border above and
// to the left of the entries corresponding to real macroblocks.
// The prediction flags in these dummy entries are initialized to 0.
int av1_get_inter_mode_context(const MACROBLOCKD *xd) {
const MB_MODE_INFO *const above_mbmi = xd->above_mbmi;
const MB_MODE_INFO *const left_mbmi = xd->left_mbmi;
const int has_above = xd->up_available;
const int has_left = xd->left_available;
if (has_above && has_left) { // both edges available
const int above_inter_comp_mode =
is_inter_anyref_comp_mode(above_mbmi->mode);
const int left_inter_comp_mode = is_inter_anyref_comp_mode(left_mbmi->mode);
if (above_inter_comp_mode && left_inter_comp_mode)
return 0;
else if (above_inter_comp_mode || left_inter_comp_mode)
return 1;
else if (!is_inter_block(above_mbmi) && !is_inter_block(left_mbmi))
return 2;
else
return 3;
} else if (has_above || has_left) { // one edge available
const MB_MODE_INFO *const edge_mbmi = has_above ? above_mbmi : left_mbmi;
if (is_inter_anyref_comp_mode(edge_mbmi->mode))
return 1;
else if (!is_inter_block(edge_mbmi))
return 2;
else
return 3;
} else { // no edge available
return 2;
}
}
#endif // CONFIG_COMPOUND_SINGLEREF
#define CHECK_BACKWARD_REFS(ref_frame) \
(((ref_frame) >= BWDREF_FRAME) && ((ref_frame) <= ALTREF_FRAME))
#define IS_BACKWARD_REF_FRAME(ref_frame) CHECK_BACKWARD_REFS(ref_frame)
......
......@@ -409,15 +409,6 @@ static INLINE aom_cdf_prob *av1_get_pred_cdf_single_ref_p6(
}
#endif // CONFIG_NEW_MULTISYMBOL
#if CONFIG_COMPOUND_SINGLEREF
int av1_get_inter_mode_context(const MACROBLOCKD *xd);
static INLINE aom_prob av1_get_inter_mode_prob(const AV1_COMMON *cm,
const MACROBLOCKD *xd) {
return cm->fc->comp_inter_mode_prob[av1_get_inter_mode_context(xd)];
}
#endif // CONFIG_COMPOUND_SINGLEREF
// Returns a context number for the given MB prediction signal
// The mode info data structure has a one element border above and to the
// left of the entries corresponding to real blocks.
......
......@@ -78,17 +78,7 @@ static INLINE void av1_make_inter_predictor(
WarpedMotionParams final_warp_params;
const int do_warp =
(w >= 8 && h >= 8 &&
allow_warp(mi, warp_types,
#if CONFIG_COMPOUND_SINGLEREF
// TODO(zoeliu): To further check the single
// ref comp mode to work together with
// global motion.
has_second_ref(&mi->mbmi)
? &xd->global_motion[mi->mbmi.ref_frame[ref]]
: &xd->global_motion[mi->mbmi.ref_frame[0]],
#else // !(CONFIG_COMPOUND_SINGLEREF)
&xd->global_motion[mi->mbmi.ref_frame[ref]],
#endif // CONFIG_COMPOUND_SINGLEREF
allow_warp(mi, warp_types, &xd->global_motion[mi->mbmi.ref_frame[ref]],
build_for_obmc, xs, ys, &final_warp_params));
if (do_warp
#if CONFIG_AMVR
......@@ -997,10 +987,6 @@ static INLINE void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
int mi_x, int mi_y) {
struct macroblockd_plane *const pd = &xd->plane[plane];
int is_compound = has_second_ref(&mi->mbmi);
#if CONFIG_COMPOUND_SINGLEREF
int is_comp_mode_pred =
is_compound || is_inter_singleref_comp_mode(mi->mbmi.mode);
#endif // CONFIG_COMPOUND_SINGLEREF
int ref;
#if CONFIG_INTRABC
const int is_intrabc = is_intrabc_block(&mi->mbmi);
......@@ -1011,9 +997,6 @@ static INLINE void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
WarpedMotionParams *const wm = &xd->global_motion[mi->mbmi.ref_frame[ref]];
is_global[ref] = is_global_mv_block(mi, block, wm->wmtype);
}
#if CONFIG_COMPOUND_SINGLEREF
if (!is_compound && is_comp_mode_pred) is_global[1] = is_global[0];
#endif // CONFIG_COMPOUND_SINGLEREF
(void)block;
(void)cm;
......@@ -1194,17 +1177,10 @@ static INLINE void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
xd->bd);
else
#endif // CONFIG_HIGHBITDEPTH
#if CONFIG_COMPOUND_SINGLEREF
av1_convolve_rounding(
tmp_dst, tmp_dst_stride, dst, dst_buf->stride, b4_w, b4_h,
FILTER_BITS * 2 + is_comp_mode_pred - conv_params.round_0 -
FILTER_BITS * 2 + is_compound - conv_params.round_0 -
conv_params.round_1);
#else // !(CONFIG_COMPOUND_SINGLEREF)
av1_convolve_rounding(tmp_dst, tmp_dst_stride, dst, dst_buf->stride,
b4_w, b4_h,
FILTER_BITS * 2 + is_compound -
conv_params.round_0 - conv_params.round_1);
#endif // CONFIG_COMPOUND_SINGLEREF
}
#endif // CONFIG_CONVOLVE_ROUND
++col;
......@@ -1225,12 +1201,7 @@ static INLINE void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
DECLARE_ALIGNED(16, int32_t, tmp_dst[MAX_SB_SIZE * MAX_SB_SIZE]);
#endif // CONFIG_CONVOLVE_ROUND
#if CONFIG_COMPOUND_SINGLEREF
for (ref = 0; ref < 1 + is_comp_mode_pred; ++ref)
#else
for (ref = 0; ref < 1 + is_compound; ++ref)
#endif // CONFIG_COMPOUND_SINGLEREF
{
for (ref = 0; ref < 1 + is_compound; ++ref) {
#if CONFIG_INTRABC
const struct scale_factors *const sf =
is_intrabc ? &xd->sf_identity : &xd->block_refs[ref]->sf;
......@@ -1305,12 +1276,7 @@ static INLINE void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
ConvolveParams conv_params = get_conv_params(ref, ref, plane);
#endif // CONFIG_CONVOLVE_ROUND
#if CONFIG_COMPOUND_SINGLEREF
for (ref = 0; ref < 1 + is_comp_mode_pred; ++ref)
#else
for (ref = 0; ref < 1 + is_compound; ++ref)
#endif // CONFIG_COMPOUND_SINGLEREF
{
for (ref = 0; ref < 1 + is_compound; ++ref) {
#if CONFIG_INTRABC
const struct scale_factors *const sf =
is_intrabc ? &xd->sf_identity : &xd->block_refs[ref]->sf;
......@@ -1359,15 +1325,9 @@ static INLINE void build_inter_predictors(const AV1_COMMON *cm, MACROBLOCKD *xd,
xd->bd);
else
#endif // CONFIG_HIGHBITDEPTH
#if CONFIG_COMPOUND_SINGLEREF
av1_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, w, h,
FILTER_BITS * 2 + is_comp_mode_pred -
FILTER_BITS * 2 + is_compound -
conv_params.round_0 - conv_params.round_1);
#else // !(CONFIG_COMPOUND_SINGLEREF)
av1_convolve_rounding(tmp_dst, MAX_SB_SIZE, dst, dst_buf->stride, w, h,
FILTER_BITS * 2 + is_compound -
conv_params.round_0 - conv_params.round_1);
#endif // CONFIG_COMPOUND_SINGLEREF
}
#endif // CONFIG_CONVOLVE_ROUND
}
......@@ -1722,14 +1682,6 @@ void modify_neighbor_predictor_for_obmc(MB_MODE_INFO *mbmi) {
is_masked_compound_type(mbmi->interinter_compound_type)) {
mbmi->interinter_compound_type = COMPOUND_AVERAGE;
mbmi->ref_frame[1] = NONE_FRAME;
#if CONFIG_COMPOUND_SINGLEREF
} else if (!has_second_ref(mbmi) &&
is_inter_singleref_comp_mode(mbmi->mode)) {
// mbmi->mode = compound_ref0_mode(mbmi->mode);
mbmi->mode = compound_ref1_mode(mbmi->mode);
assert(is_inter_singleref_mode(mbmi->mode));
mbmi->mv[0].as_int = mbmi->mv[1].as_int;
#endif // CONFIG_COMPOUND_SINGLEREF
}
if (has_second_ref(mbmi)) mbmi->ref_frame[1] = NONE_FRAME;
return;
......@@ -1766,20 +1718,10 @@ static INLINE void build_prediction_by_above_pred(MACROBLOCKD *xd,
NULL, pd->subsampling_x, pd->subsampling_y);
}
#if CONFIG_COMPOUND_SINGLEREF
const int num_refs = 1 + is_inter_anyref_comp_mode(above_mbmi->mode);
#else
const int num_refs = 1 + has_second_ref(above_mbmi);
#endif
for (int ref = 0; ref < num_refs; ++ref) {
#if CONFIG_COMPOUND_SINGLEREF
const MV_REFERENCE_FRAME frame = has_second_ref(above_mbmi)
? above_mbmi->ref_frame[ref]
: above_mbmi->ref_frame[0];
#else
const MV_REFERENCE_FRAME frame = above_mbmi->ref_frame[ref];
#endif // CONFIG_COMPOUND_SINGLEREF
const RefBuffer *const ref_buf = &ctxt->cm->frame_refs[frame - LAST_FRAME];
......@@ -1862,20 +1804,10 @@ static INLINE void build_prediction_by_left_pred(MACROBLOCKD *xd,
NULL, pd->subsampling_x, pd->subsampling_y);
}
#if CONFIG_COMPOUND_SINGLEREF
const int num_refs = 1 + is_inter_anyref_comp_mode(left_mbmi->mode);
#else
const int num_refs = 1 + has_second_ref(left_mbmi);
#endif
for (int ref = 0; ref < num_refs; ++ref) {
#if CONFIG_COMPOUND_SINGLEREF
const MV_REFERENCE_FRAME frame = has_second_ref(left_mbmi)
? left_mbmi->ref_frame[ref]
: left_mbmi->ref_frame[0];
#else
const MV_REFERENCE_FRAME frame = left_mbmi->ref_frame[ref];
#endif // CONFIG_COMPOUND_SINGLEREF
const RefBuffer *const ref_buf = &ctxt->cm->frame_refs[frame - LAST_FRAME];
......@@ -2288,7 +2220,6 @@ void av1_build_ncobmc_inter_predictors_sb(const AV1_COMMON *cm, MACROBLOCKD *xd,
#endif // CONFIG_HIGHBITDEPTH
const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type;
// TODO(zoeliu): COMPOUND_SINGLEREF has not worked with NCOBMC yet.
av1_build_prediction_by_bottom_preds(cm, xd, mi_row, mi_col, dst_buf1,
dst_width1, dst_height1, dst_stride1);
av1_build_prediction_by_right_preds(cm, xd, mi_row, mi_col, dst_buf2,
......@@ -2615,13 +2546,7 @@ static void build_inter_predictors_single_buf(MACROBLOCKD *xd, int plane,
const int is_scaled = av1_is_scaled(sf);
ConvolveParams conv_params = get_conv_params(ref, 0, plane);
WarpTypesAllowed warp_types;
#if CONFIG_COMPOUND_SINGLEREF
WarpedMotionParams *const wm =
mi->mbmi.ref_frame[ref] > 0 ? &xd->global_motion[mi->mbmi.ref_frame[ref]]
: &xd->global_motion[mi->mbmi.ref_frame[0]];
#else // !(CONFIG_COMPOUND_SINGLEREF)
WarpedMotionParams *const wm = &xd->global_motion[mi->mbmi.ref_frame[ref]];
#endif // CONFIG_COMPOUND_SINGLEREF
warp_types.global_warp_allowed = is_global_mv_block(mi, block, wm->wmtype);
warp_types.local_warp_allowed = mi->mbmi.motion_mode == WARPED_CAUSAL;
......@@ -2698,13 +2623,7 @@ static void build_wedge_inter_predictor_from_buf(
mbmi->mask_type, xd->seg_mask,
mbmi->interinter_compound_type };
#if CONFIG_COMPOUND_SINGLEREF
if ((is_compound || is_inter_singleref_comp_mode(mbmi->mode)) &&
is_masked_compound_type(mbmi->interinter_compound_type))
#else // !CONFIG_COMPOUND_SINGLEREF
if (is_compound && is_masked_compound_type(mbmi->interinter_compound_type))
#endif // CONFIG_COMPOUND_SINGLEREF
{
if (is_compound && is_masked_compound_type(mbmi->interinter_compound_type)) {
if (!plane && comp_data.interinter_compound_type == COMPOUND_SEG) {
#if CONFIG_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
......
......@@ -541,18 +541,8 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
} else {
int ref;
#if CONFIG_COMPOUND_SINGLEREF
for (ref = 0; ref < 1 + is_inter_anyref_comp_mode(mbmi->mode); ++ref)
#else
for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref)
#endif // CONFIG_COMPOUND_SINGLEREF
{
const MV_REFERENCE_FRAME frame =
#if CONFIG_COMPOUND_SINGLEREF
has_second_ref(mbmi) ? mbmi->ref_frame[ref] : mbmi->ref_frame[0];
#else
mbmi->ref_frame[ref];
#endif // CONFIG_COMPOUND_SINGLEREF
for (ref = 0; ref < 1 + has_second_ref(mbmi); ++ref) {
const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref];
if (frame < LAST_FRAME) {
#if CONFIG_INTRABC
assert(is_intrabc_block(mbmi));
......@@ -2572,11 +2562,7 @@ static void read_compound_tools(AV1_COMMON *cm,
} else {
cm->allow_interintra_compound = 0;
}
#if CONFIG_COMPOUND_SINGLEREF
if (!frame_is_intra_only(cm)) {
#else // !CONFIG_COMPOUND_SINGLEREF
if (!frame_is_intra_only(cm) && cm->reference_mode != SINGLE_REFERENCE) {
#endif // CONFIG_COMPOUND_SINGLEREF
cm->allow_masked_compound = aom_rb_read_bit(rb);
} else {
cm->allow_masked_compound = 0;
......@@ -3403,11 +3389,6 @@ static int read_compressed_header(AV1Decoder *pbi, const uint8_t *data,
read_frame_reference_mode_probs(cm, &r);
#if CONFIG_COMPOUND_SINGLEREF
for (int i = 0; i < COMP_INTER_MODE_CONTEXTS; i++)
av1_diff_update_prob(&r, &fc->comp_inter_mode_prob[i], ACCT_STR);
#endif // CONFIG_COMPOUND_SINGLEREF
#if CONFIG_AMVR
if (cm->cur_frame_force_integer_mv == 0) {
#endif
......@@ -3450,10 +3431,6 @@ static void debug_check_frame_counts(const AV1_COMMON *const cm) {
sizeof(cm->counts.motion_mode)));
assert(!memcmp(cm->counts.intra_inter, zero_counts.intra_inter,
sizeof(cm->counts.intra_inter)));
#if CONFIG_COMPOUND_SINGLEREF
assert(!memcmp(cm->counts.comp_inter_mode, zero_counts.comp_inter_mode,
sizeof(cm->counts.comp_inter_mode)));
#endif // CONFIG_COMPOUND_SINGLEREF
assert(!memcmp(cm->counts.comp_inter, zero_counts.comp_inter,
sizeof(cm->counts.comp_inter)));
#if CONFIG_EXT_COMP_REFS
......
This diff is collapsed.
......@@ -54,11 +54,6 @@
#define ENC_MISMATCH_DEBUG 0
#if CONFIG_COMPOUND_SINGLEREF
static struct av1_token
inter_singleref_comp_mode_encodings[INTER_SINGLEREF_COMP_MODES];
#endif // CONFIG_COMPOUND_SINGLEREF
static INLINE void write_uniform(aom_writer *w, int n, int v) {
const int l = get_unsigned_bits(n);
const int m = (1 << l) - n;
......@@ -98,10 +93,6 @@ static int remux_tiles(const AV1_COMMON *const cm, uint8_t *dst,