Remove experimental flag of REF_ADAPT
This experiment has been adopted, we can simplify the code
by dropping the associated preprocessor conditionals.
Change-Id: Ia2100f102de6d9d5a67ba7178a20a50202839636
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index a318f4b..7ae9e8f 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -3835,14 +3835,8 @@
if (cpi->allow_comp_inter_inter) {
const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;
-#if !CONFIG_REF_ADAPT
- const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
-#endif // !CONFIG_REF_ADAPT
aom_wb_write_bit(wb, use_hybrid_pred);
-#if !CONFIG_REF_ADAPT
- if (!use_hybrid_pred) aom_wb_write_bit(wb, use_compound_pred);
-#endif // !CONFIG_REF_ADAPT
}
#if CONFIG_EXT_SKIP
@@ -4217,14 +4211,8 @@
if (cpi->allow_comp_inter_inter) {
const int use_hybrid_pred = cm->reference_mode == REFERENCE_MODE_SELECT;
-#if !CONFIG_REF_ADAPT
- const int use_compound_pred = cm->reference_mode != SINGLE_REFERENCE;
-#endif // !CONFIG_REF_ADAPT
aom_wb_write_bit(wb, use_hybrid_pred);
-#if !CONFIG_REF_ADAPT
- if (!use_hybrid_pred) aom_wb_write_bit(wb, use_compound_pred);
-#endif // !CONFIG_REF_ADAPT
}
#if CONFIG_EXT_SKIP
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 3550a96..ad9ad94 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -1036,11 +1036,6 @@
if (has_second_ref(mbmi))
// This flag is also updated for 4x4 blocks
rdc->compound_ref_used_flag = 1;
-#if !CONFIG_REF_ADAPT
- else
- // This flag is also updated for 4x4 blocks
- rdc->single_ref_used_flag = 1;
-#endif // !CONFIG_REF_ADAPT
if (is_comp_ref_allowed(bsize)) {
#if CONFIG_ENTROPY_STATS
counts->comp_inter[av1_get_reference_mode_context(cm, xd)]
@@ -1198,11 +1193,7 @@
}
}
- if (cm->allow_interintra_compound &&
-#if !CONFIG_REF_ADAPT
- cm->reference_mode != COMPOUND_REFERENCE &&
-#endif // !CONFIG_REF_ADAPT
- is_interintra_allowed(mbmi)) {
+ if (cm->allow_interintra_compound && is_interintra_allowed(mbmi)) {
const int bsize_group = size_group_lookup[bsize];
if (mbmi->ref_frame[1] == INTRA_FRAME) {
counts->interintra[bsize_group][1]++;
@@ -4084,12 +4075,7 @@
static void make_consistent_compound_tools(AV1_COMMON *cm) {
(void)cm;
-#if CONFIG_REF_ADAPT
- if (frame_is_intra_only(cm))
-#else
- if (frame_is_intra_only(cm) || cm->reference_mode == COMPOUND_REFERENCE)
-#endif // CONFIG_REF_ADAPT
- cm->allow_interintra_compound = 0;
+ if (frame_is_intra_only(cm)) cm->allow_interintra_compound = 0;
if (frame_is_intra_only(cm) || cm->reference_mode == SINGLE_REFERENCE)
cm->allow_masked_compound = 0;
}
@@ -4172,9 +4158,6 @@
make_consistent_compound_tools(cm);
-#if !CONFIG_REF_ADAPT
- rdc->single_ref_used_flag = 0;
-#endif // !CONFIG_REF_ADAPT
rdc->compound_ref_used_flag = 0;
#if CONFIG_EXT_SKIP
rdc->skip_mode_used_flag = 0;
@@ -4192,14 +4175,6 @@
#if CONFIG_ENTROPY_STATS
av1_zero(cpi->td.counts->comp_inter);
#endif // CONFIG_ENTROPY_STATS
-#if !CONFIG_REF_ADAPT
- // Use a flag that includes 4x4 blocks
- } else if (rdc->single_ref_used_flag == 0) {
- cm->reference_mode = COMPOUND_REFERENCE;
-#if CONFIG_ENTROPY_STATS
- av1_zero(cpi->td.counts->comp_inter);
-#endif // CONFIG_ENTROPY_STATS
-#endif // !CONFIG_REF_ADAPT
}
}
make_consistent_compound_tools(cm);
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 0728f0d..fe0509d 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -331,9 +331,6 @@
int64_t comp_pred_diff[REFERENCE_MODES];
// Stores number of 4x4 blocks using global motion per reference frame.
int global_motion_used[TOTAL_REFS_PER_FRAME];
-#if !CONFIG_REF_ADAPT
- int single_ref_used_flag;
-#endif // !CONFIG_REF_ADAPT
int compound_ref_used_flag;
#if CONFIG_EXT_SKIP
int skip_mode_used_flag;
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index 1f2a4b0..7f6c641 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -24,9 +24,6 @@
td->rd_counts.compound_ref_used_flag |=
td_t->rd_counts.compound_ref_used_flag;
-#if !CONFIG_REF_ADAPT
- td->rd_counts.single_ref_used_flag |= td_t->rd_counts.single_ref_used_flag;
-#endif // !CONFIG_REF_ADAPT
#if CONFIG_EXT_SKIP
td->rd_counts.skip_mode_used_flag |= td_t->rd_counts.skip_mode_used_flag;
#endif // CONFIG_EXT_SKIP
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 9662820..d14000d 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -5788,56 +5788,42 @@
ref_costs_single[INTRA_FRAME] = x->intra_inter_cost[intra_inter_ctx][0];
unsigned int base_cost = x->intra_inter_cost[intra_inter_ctx][1];
-#if !CONFIG_REF_ADAPT
- if (cm->reference_mode != COMPOUND_REFERENCE) {
-#endif // !CONFIG_REF_ADAPT
- ref_costs_single[LAST_FRAME] = ref_costs_single[LAST2_FRAME] =
- ref_costs_single[LAST3_FRAME] = ref_costs_single[BWDREF_FRAME] =
- ref_costs_single[ALTREF2_FRAME] = ref_costs_single[GOLDEN_FRAME] =
- ref_costs_single[ALTREF_FRAME] = base_cost;
- const int ctx_p1 = av1_get_pred_context_single_ref_p1(xd);
- const int ctx_p2 = av1_get_pred_context_single_ref_p2(xd);
- const int ctx_p3 = av1_get_pred_context_single_ref_p3(xd);
- const int ctx_p4 = av1_get_pred_context_single_ref_p4(xd);
- const int ctx_p5 = av1_get_pred_context_single_ref_p5(xd);
- const int ctx_p6 = av1_get_pred_context_single_ref_p6(xd);
+ ref_costs_single[LAST_FRAME] = ref_costs_single[LAST2_FRAME] =
+ ref_costs_single[LAST3_FRAME] = ref_costs_single[BWDREF_FRAME] =
+ ref_costs_single[ALTREF2_FRAME] = ref_costs_single[GOLDEN_FRAME] =
+ ref_costs_single[ALTREF_FRAME] = base_cost;
+ const int ctx_p1 = av1_get_pred_context_single_ref_p1(xd);
+ const int ctx_p2 = av1_get_pred_context_single_ref_p2(xd);
+ const int ctx_p3 = av1_get_pred_context_single_ref_p3(xd);
+ const int ctx_p4 = av1_get_pred_context_single_ref_p4(xd);
+ const int ctx_p5 = av1_get_pred_context_single_ref_p5(xd);
+ const int ctx_p6 = av1_get_pred_context_single_ref_p6(xd);
- ref_costs_single[LAST_FRAME] += x->single_ref_cost[ctx_p1][0][0];
- ref_costs_single[LAST2_FRAME] += x->single_ref_cost[ctx_p1][0][0];
- ref_costs_single[LAST3_FRAME] += x->single_ref_cost[ctx_p1][0][0];
- ref_costs_single[GOLDEN_FRAME] += x->single_ref_cost[ctx_p1][0][0];
- ref_costs_single[BWDREF_FRAME] += x->single_ref_cost[ctx_p1][0][1];
- ref_costs_single[ALTREF2_FRAME] += x->single_ref_cost[ctx_p1][0][1];
- ref_costs_single[ALTREF_FRAME] += x->single_ref_cost[ctx_p1][0][1];
+ ref_costs_single[LAST_FRAME] += x->single_ref_cost[ctx_p1][0][0];
+ ref_costs_single[LAST2_FRAME] += x->single_ref_cost[ctx_p1][0][0];
+ ref_costs_single[LAST3_FRAME] += x->single_ref_cost[ctx_p1][0][0];
+ ref_costs_single[GOLDEN_FRAME] += x->single_ref_cost[ctx_p1][0][0];
+ ref_costs_single[BWDREF_FRAME] += x->single_ref_cost[ctx_p1][0][1];
+ ref_costs_single[ALTREF2_FRAME] += x->single_ref_cost[ctx_p1][0][1];
+ ref_costs_single[ALTREF_FRAME] += x->single_ref_cost[ctx_p1][0][1];
- ref_costs_single[LAST_FRAME] += x->single_ref_cost[ctx_p3][2][0];
- ref_costs_single[LAST2_FRAME] += x->single_ref_cost[ctx_p3][2][0];
- ref_costs_single[LAST3_FRAME] += x->single_ref_cost[ctx_p3][2][1];
- ref_costs_single[GOLDEN_FRAME] += x->single_ref_cost[ctx_p3][2][1];
+ ref_costs_single[LAST_FRAME] += x->single_ref_cost[ctx_p3][2][0];
+ ref_costs_single[LAST2_FRAME] += x->single_ref_cost[ctx_p3][2][0];
+ ref_costs_single[LAST3_FRAME] += x->single_ref_cost[ctx_p3][2][1];
+ ref_costs_single[GOLDEN_FRAME] += x->single_ref_cost[ctx_p3][2][1];
- ref_costs_single[BWDREF_FRAME] += x->single_ref_cost[ctx_p2][1][0];
- ref_costs_single[ALTREF2_FRAME] += x->single_ref_cost[ctx_p2][1][0];
- ref_costs_single[ALTREF_FRAME] += x->single_ref_cost[ctx_p2][1][1];
+ ref_costs_single[BWDREF_FRAME] += x->single_ref_cost[ctx_p2][1][0];
+ ref_costs_single[ALTREF2_FRAME] += x->single_ref_cost[ctx_p2][1][0];
+ ref_costs_single[ALTREF_FRAME] += x->single_ref_cost[ctx_p2][1][1];
- ref_costs_single[LAST_FRAME] += x->single_ref_cost[ctx_p4][3][0];
- ref_costs_single[LAST2_FRAME] += x->single_ref_cost[ctx_p4][3][1];
+ ref_costs_single[LAST_FRAME] += x->single_ref_cost[ctx_p4][3][0];
+ ref_costs_single[LAST2_FRAME] += x->single_ref_cost[ctx_p4][3][1];
- ref_costs_single[LAST3_FRAME] += x->single_ref_cost[ctx_p5][4][0];
- ref_costs_single[GOLDEN_FRAME] += x->single_ref_cost[ctx_p5][4][1];
+ ref_costs_single[LAST3_FRAME] += x->single_ref_cost[ctx_p5][4][0];
+ ref_costs_single[GOLDEN_FRAME] += x->single_ref_cost[ctx_p5][4][1];
- ref_costs_single[BWDREF_FRAME] += x->single_ref_cost[ctx_p6][5][0];
- ref_costs_single[ALTREF2_FRAME] += x->single_ref_cost[ctx_p6][5][1];
-#if !CONFIG_REF_ADAPT
- } else {
- ref_costs_single[LAST_FRAME] = 512;
- ref_costs_single[LAST2_FRAME] = 512;
- ref_costs_single[LAST3_FRAME] = 512;
- ref_costs_single[BWDREF_FRAME] = 512;
- ref_costs_single[ALTREF2_FRAME] = 512;
- ref_costs_single[GOLDEN_FRAME] = 512;
- ref_costs_single[ALTREF_FRAME] = 512;
- }
-#endif // !CONFIG_REF_ADAPT
+ ref_costs_single[BWDREF_FRAME] += x->single_ref_cost[ctx_p6][5][0];
+ ref_costs_single[ALTREF2_FRAME] += x->single_ref_cost[ctx_p6][5][1];
if (cm->reference_mode != SINGLE_REFERENCE) {
const int bwdref_comp_ctx_p = av1_get_pred_context_comp_bwdref_p(cm, xd);
@@ -9439,12 +9425,7 @@
mode_excluded = cm->reference_mode == SINGLE_REFERENCE;
} else {
-#if CONFIG_REF_ADAPT
if (ref_frame != INTRA_FRAME) mode_excluded = 0;
-#else
- if (ref_frame != INTRA_FRAME)
- mode_excluded = cm->reference_mode == COMPOUND_REFERENCE;
-#endif // CONFIG_REF_ADAPT
}
if (ref_frame == INTRA_FRAME) {