Fix separation between ext-inter group of expts.
Change-Id: I359d100548ed337d643a421591243565b08945ed
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index a2bcf8b..c135a10 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -203,15 +203,24 @@
}
static INLINE int use_masked_motion_search(COMPOUND_TYPE type) {
+#if CONFIG_WEDGE
return (type == COMPOUND_WEDGE);
+#else
+ (void)type;
+ return 0;
+#endif
}
static INLINE int is_masked_compound_type(COMPOUND_TYPE type) {
-#if CONFIG_COMPOUND_SEGMENT
+#if CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
return (type == COMPOUND_WEDGE || type == COMPOUND_SEG);
-#else
+#elif !CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
return (type == COMPOUND_WEDGE);
+#elif CONFIG_COMPOUND_SEGMENT && !CONFIG_WEDGE
+ return (type == COMPOUND_SEG);
#endif // CONFIG_COMPOUND_SEGMENT
+ (void)type;
+ return 0;
}
#else
diff --git a/av1/common/entropymode.c b/av1/common/entropymode.c
index 5aa99ce..f95ad84 100644
--- a/av1/common/entropymode.c
+++ b/av1/common/entropymode.c
@@ -772,7 +772,7 @@
{ 25, 29, 50, 192, 64, 192, 128, 180, 180 }, // 6 = two intra neighbours
};
-#if CONFIG_COMPOUND_SEGMENT
+#if CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
static const aom_prob
default_compound_type_probs[BLOCK_SIZES][COMPOUND_TYPES - 1] = {
#if CONFIG_CB4X4
@@ -785,7 +785,7 @@
{ 255, 200 }, { 255, 200 }, { 255, 200 },
#endif // CONFIG_EXT_PARTITION
};
-#else // !CONFIG_COMPOUND_SEGMENT
+#elif !CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
static const aom_prob
default_compound_type_probs[BLOCK_SIZES][COMPOUND_TYPES - 1] = {
#if CONFIG_CB4X4
@@ -797,7 +797,22 @@
{ 255 }, { 255 }, { 255 },
#endif // CONFIG_EXT_PARTITION
};
-#endif // CONFIG_COMPOUND_SEGMENT
+#elif CONFIG_COMPOUND_SEGMENT && !CONFIG_WEDGE
+static const aom_prob
+ default_compound_type_probs[BLOCK_SIZES][COMPOUND_TYPES - 1] = {
+#if CONFIG_CB4X4
+ { 208 }, { 208 }, { 208 },
+#endif
+ { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 208 }, { 216 },
+ { 216 }, { 216 }, { 224 }, { 224 }, { 240 }, { 240 },
+#if CONFIG_EXT_PARTITION
+ { 255 }, { 255 }, { 255 },
+#endif // CONFIG_EXT_PARTITION
+ };
+#else
+static const aom_prob default_compound_type_probs[BLOCK_SIZES]
+ [COMPOUND_TYPES - 1];
+#endif // CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
static const aom_prob default_interintra_prob[BLOCK_SIZE_GROUPS] = {
208, 208, 208, 208,
@@ -968,15 +983,21 @@
-INTER_COMPOUND_OFFSET(NEAR_NEWMV), -INTER_COMPOUND_OFFSET(NEW_NEARMV)
};
-#if CONFIG_COMPOUND_SEGMENT
+#if CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)] = {
-COMPOUND_AVERAGE, 2, -COMPOUND_WEDGE, -COMPOUND_SEG
};
-#else // !CONFIG_COMPOUND_SEGMENT
+#elif !CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)] = {
-COMPOUND_AVERAGE, -COMPOUND_WEDGE
};
-#endif // CONFIG_COMPOUND_SEGMENT
+#elif CONFIG_COMPOUND_SEGMENT && !CONFIG_WEDGE
+const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)] = {
+ -COMPOUND_AVERAGE, -COMPOUND_SEG
+};
+#else
+const aom_tree_index av1_compound_type_tree[TREE_SIZE(COMPOUND_TYPES)] = {};
+#endif // CONFIG_COMPOUND_SEGMENT && CONFIG_WEDGE
/* clang-format on */
#endif // CONFIG_EXT_INTER
@@ -3470,11 +3491,13 @@
pre_fc->wedge_interintra_prob[i], counts->wedge_interintra[i]);
}
+#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
for (i = 0; i < BLOCK_SIZES; ++i) {
aom_tree_merge_probs(av1_compound_type_tree, pre_fc->compound_type_prob[i],
counts->compound_interinter[i],
fc->compound_type_prob[i]);
}
+#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
#endif // CONFIG_EXT_INTER
for (i = 0; i < BLOCK_SIZE_GROUPS; i++)
diff --git a/av1/common/enums.h b/av1/common/enums.h
index acfcafd..96df0ed 100644
--- a/av1/common/enums.h
+++ b/av1/common/enums.h
@@ -362,7 +362,9 @@
typedef enum {
COMPOUND_AVERAGE = 0,
+#if CONFIG_WEDGE
COMPOUND_WEDGE,
+#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
COMPOUND_SEG,
#endif // CONFIG_COMPOUND_SEGMENT
diff --git a/av1/common/reconinter.c b/av1/common/reconinter.c
index af6cb1c..c20bd9b 100644
--- a/av1/common/reconinter.c
+++ b/av1/common/reconinter.c
@@ -355,10 +355,13 @@
#endif
BLOCK_SIZE sb_type) {
assert(is_masked_compound_type(comp_data->type));
+ (void)sb_type;
switch (comp_data->type) {
+#if CONFIG_WEDGE
case COMPOUND_WEDGE:
return av1_get_contiguous_soft_mask(comp_data->wedge_index,
!comp_data->wedge_sign, sb_type);
+#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
case COMPOUND_SEG:
return invert_mask(mask_buffer, comp_data->seg_mask, h, w, stride);
@@ -370,10 +373,13 @@
const uint8_t *av1_get_compound_type_mask(
const INTERINTER_COMPOUND_DATA *const comp_data, BLOCK_SIZE sb_type) {
assert(is_masked_compound_type(comp_data->type));
+ (void)sb_type;
switch (comp_data->type) {
+#if CONFIG_WEDGE
case COMPOUND_WEDGE:
return av1_get_contiguous_soft_mask(comp_data->wedge_index,
comp_data->wedge_sign, sb_type);
+#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
case COMPOUND_SEG: return comp_data->seg_mask;
#endif // CONFIG_COMPOUND_SEGMENT
diff --git a/av1/common/reconinter.h b/av1/common/reconinter.h
index 15f5ffa..156ab66 100644
--- a/av1/common/reconinter.h
+++ b/av1/common/reconinter.h
@@ -205,9 +205,12 @@
static INLINE int is_interinter_compound_used(COMPOUND_TYPE type,
BLOCK_SIZE sb_type) {
+ (void)sb_type;
switch (type) {
- case COMPOUND_AVERAGE: (void)sb_type; return 1;
+ case COMPOUND_AVERAGE: return 1;
+#if CONFIG_WEDGE
case COMPOUND_WEDGE: return wedge_params_lookup[sb_type].bits > 0;
+#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
case COMPOUND_SEG: return sb_type >= BLOCK_8X8;
#endif // CONFIG_COMPOUND_SEGMENT
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 0ca4c9c..95fc308 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -4655,6 +4655,7 @@
}
}
}
+#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
if (cm->reference_mode != SINGLE_REFERENCE) {
for (i = 0; i < BLOCK_SIZES; i++) {
for (j = 0; j < COMPOUND_TYPES - 1; j++) {
@@ -4662,6 +4663,7 @@
}
}
}
+#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index 24e7cee..69325fa 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -2154,16 +2154,20 @@
#endif // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
) {
if (is_any_masked_compound_used(bsize)) {
+#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
mbmi->interinter_compound_data.type =
aom_read_tree(r, av1_compound_type_tree,
cm->fc->compound_type_prob[bsize], ACCT_STR);
+#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
+#if CONFIG_WEDGE
if (mbmi->interinter_compound_data.type == COMPOUND_WEDGE) {
mbmi->interinter_compound_data.wedge_index =
aom_read_literal(r, get_wedge_bits_lookup(bsize), ACCT_STR);
mbmi->interinter_compound_data.wedge_sign = aom_read_bit(r, ACCT_STR);
}
+#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
- else if (mbmi->interinter_compound_data.type == COMPOUND_SEG) {
+ if (mbmi->interinter_compound_data.type == COMPOUND_SEG) {
mbmi->interinter_compound_data.mask_type =
aom_read_literal(r, MAX_SEG_MASK_BITS, ACCT_STR);
}
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 36a9f8a..76701ee 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2001,16 +2001,20 @@
&& mbmi->motion_mode == SIMPLE_TRANSLATION
#endif // CONFIG_MOTION_VAR
&& is_any_masked_compound_used(bsize)) {
+#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
av1_write_token(
w, av1_compound_type_tree, cm->fc->compound_type_prob[bsize],
&compound_type_encodings[mbmi->interinter_compound_data.type]);
+#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
+#if CONFIG_WEDGE
if (mbmi->interinter_compound_data.type == COMPOUND_WEDGE) {
aom_write_literal(w, mbmi->interinter_compound_data.wedge_index,
get_wedge_bits_lookup(bsize));
aom_write_bit(w, mbmi->interinter_compound_data.wedge_sign);
}
+#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
- else if (mbmi->interinter_compound_data.type == COMPOUND_SEG) {
+ if (mbmi->interinter_compound_data.type == COMPOUND_SEG) {
aom_write_literal(w, mbmi->interinter_compound_data.mask_type,
MAX_SEG_MASK_BITS);
}
@@ -4936,12 +4940,14 @@
cm->counts.wedge_interintra[i], probwt);
}
}
+#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
if (cm->reference_mode != SINGLE_REFERENCE) {
for (i = 0; i < BLOCK_SIZES; i++)
prob_diff_update(av1_compound_type_tree, fc->compound_type_prob[i],
cm->counts.compound_interinter[i], COMPOUND_TYPES,
probwt, header_bc);
}
+#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 444961f..35aacb9 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -4976,9 +4976,12 @@
#if CONFIG_EXT_INTER
static int get_interinter_compound_type_bits(BLOCK_SIZE bsize,
COMPOUND_TYPE comp_type) {
+ (void)bsize;
switch (comp_type) {
case COMPOUND_AVERAGE: return 0;
+#if CONFIG_WEDGE
case COMPOUND_WEDGE: return get_interinter_wedge_bits(bsize);
+#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
case COMPOUND_SEG: return 1;
#endif // CONFIG_COMPOUND_SEGMENT
@@ -7133,6 +7136,7 @@
}
#if CONFIG_EXT_INTER
+#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
static void do_masked_motion_search(const AV1_COMP *const cpi, MACROBLOCK *x,
const uint8_t *mask, int mask_stride,
BLOCK_SIZE bsize, int mi_row, int mi_col,
@@ -7286,6 +7290,7 @@
&tmp_mv[1], &rate_mv[1], 1);
}
}
+#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
#endif // CONFIG_EXT_INTER
// In some situations we want to discount tha pparent cost of a new motion
@@ -7319,6 +7324,7 @@
}
#if CONFIG_EXT_INTER
+#if CONFIG_WEDGE
static int estimate_wedge_sign(const AV1_COMP *cpi, const MACROBLOCK *x,
const BLOCK_SIZE bsize, const uint8_t *pred0,
int stride0, const uint8_t *pred1, int stride1) {
@@ -7362,6 +7368,7 @@
(int64_t)(esq[0][3] + esq[0][1] + esq[0][2]);
return (tl + br > 0);
}
+#endif // CONFIG_WEDGE
#endif // CONFIG_EXT_INTER
#if !CONFIG_DUAL_FILTER
@@ -7467,6 +7474,7 @@
#if CONFIG_EXT_INTER
// Choose the best wedge index and sign
+#if CONFIG_WEDGE
static int64_t pick_wedge(const AV1_COMP *const cpi, const MACROBLOCK *const x,
const BLOCK_SIZE bsize, const uint8_t *const p0,
const uint8_t *const p1, int *const best_wedge_sign,
@@ -7638,6 +7646,7 @@
mbmi->interinter_compound_data.wedge_index = wedge_index;
return rd;
}
+#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
static int64_t pick_interinter_seg_mask(const AV1_COMP *const cpi,
@@ -7727,6 +7736,7 @@
}
#endif // CONFIG_COMPOUND_SEGMENT
+#if CONFIG_WEDGE && CONFIG_INTERINTRA
static int64_t pick_interintra_wedge(const AV1_COMP *const cpi,
const MACROBLOCK *const x,
const BLOCK_SIZE bsize,
@@ -7746,7 +7756,9 @@
mbmi->interintra_wedge_index = wedge_index;
return rd;
}
+#endif // CONFIG_WEDGE && CONFIG_INTERINTRA
+#if CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
static int interinter_compound_motion_search(const AV1_COMP *const cpi,
MACROBLOCK *x,
const BLOCK_SIZE bsize,
@@ -7775,6 +7787,7 @@
}
return tmp_rate_mv;
}
+#endif // CONFIG_COMPOUND_SEGMENT || CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
// TODO(sarahparker) this and build_and_cost_compound_wedge can probably
@@ -7841,6 +7854,7 @@
}
#endif // CONFIG_COMPOUND_SEGMENT
+#if CONFIG_WEDGE
static int64_t build_and_cost_compound_wedge(
const AV1_COMP *const cpi, MACROBLOCK *x, const int_mv *const cur_mv,
const BLOCK_SIZE bsize, const int this_mode, int rs2, int rate_mv,
@@ -7899,6 +7913,7 @@
}
return best_rd_cur;
}
+#endif // CONFIG_WEDGE
#endif // CONFIG_EXT_INTER
typedef struct {
@@ -8544,8 +8559,10 @@
int pred_exists = 1;
const int bw = block_size_wide[bsize];
int_mv single_newmv[TOTAL_REFS_PER_FRAME];
+#if CONFIG_INTERINTRA
const unsigned int *const interintra_mode_cost =
cpi->interintra_mode_cost[size_group_lookup[bsize]];
+#endif // CONFIG_INTERINTRA
const int is_comp_interintra_pred = (mbmi->ref_frame[1] == INTRA_FRAME);
#if CONFIG_REF_MV
uint8_t ref_frame_type = av1_ref_frame_type(mbmi->ref_frame);
@@ -8838,6 +8855,7 @@
RDCOST(x->rdmult, x->rddiv, rs2 + rate_mv + rate_sum, dist_sum);
best_rd_compound = best_rd_cur;
break;
+#if CONFIG_WEDGE
case COMPOUND_WEDGE:
if (x->source_variance > cpi->sf.disable_wedge_search_var_thresh &&
best_rd_compound / 3 < ref_best_rd) {
@@ -8846,6 +8864,7 @@
&tmp_rate_mv, preds0, preds1, strides, mi_row, mi_col);
}
break;
+#endif // CONFIG_WEDGE
#if CONFIG_COMPOUND_SEGMENT
case COMPOUND_SEG:
if (x->source_variance > cpi->sf.disable_wedge_search_var_thresh &&
@@ -8906,16 +8925,13 @@
: 0);
}
+#if CONFIG_INTERINTRA
if (is_comp_interintra_pred) {
INTERINTRA_MODE best_interintra_mode = II_DC_PRED;
int64_t best_interintra_rd = INT64_MAX;
int rmode, rate_sum;
int64_t dist_sum;
int j;
- int64_t best_interintra_rd_nowedge = INT64_MAX;
- int64_t best_interintra_rd_wedge = INT64_MAX;
- int rwedge;
- int_mv tmp_mv;
int tmp_rate_mv = 0;
int tmp_skip_txfm_sb;
int64_t tmp_skip_sse_sb;
@@ -8969,8 +8985,12 @@
// Don't need to call restore_dst_buf here
return INT64_MAX;
}
+#if CONFIG_WEDGE
if (is_interintra_wedge_used(bsize)) {
- rwedge = av1_cost_bit(cm->fc->wedge_interintra_prob[bsize], 0);
+ int64_t best_interintra_rd_nowedge = INT64_MAX;
+ int64_t best_interintra_rd_wedge = INT64_MAX;
+ int_mv tmp_mv;
+ int rwedge = av1_cost_bit(cm->fc->wedge_interintra_prob[bsize], 0);
if (rd != INT64_MAX)
rd = RDCOST(x->rdmult, x->rddiv, rmode + rate_mv + rwedge + rate_sum,
dist_sum);
@@ -9037,6 +9057,7 @@
best_interintra_rd = best_interintra_rd_nowedge;
}
}
+#endif // CONFIG_WEDGE
pred_exists = 0;
*args->compmode_interintra_cost =
@@ -9055,6 +9076,7 @@
*args->compmode_interintra_cost =
av1_cost_bit(cm->fc->interintra_prob[size_group_lookup[bsize]], 0);
}
+#endif // CONFIG_INTERINTRA
if (pred_exists == 0) {
int tmp_rate;