Commit 3558a8c0 authored by Sebastien Alaiwan's avatar Sebastien Alaiwan

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
parent 2d4322ba
......@@ -120,13 +120,7 @@ static TX_MODE read_tx_mode(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
static REFERENCE_MODE read_frame_reference_mode(
const AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
if (av1_is_compound_reference_allowed(cm)) {
#if CONFIG_REF_ADAPT
return aom_rb_read_bit(rb) ? REFERENCE_MODE_SELECT : SINGLE_REFERENCE;
#else
return aom_rb_read_bit(rb)
? REFERENCE_MODE_SELECT
: (aom_rb_read_bit(rb) ? COMPOUND_REFERENCE : SINGLE_REFERENCE);
#endif // CONFIG_REF_ADAPT
} else {
return SINGLE_REFERENCE;
}
......@@ -2282,16 +2276,8 @@ void read_sequence_header(SequenceHeader *seq_params,
static void read_compound_tools(AV1_COMMON *cm,
struct aom_read_bit_buffer *rb) {
#if CONFIG_REF_ADAPT
cm->allow_interintra_compound =
!frame_is_intra_only(cm) ? aom_rb_read_bit(rb) : 0;
#else
if (!frame_is_intra_only(cm) && cm->reference_mode != COMPOUND_REFERENCE) {
cm->allow_interintra_compound = aom_rb_read_bit(rb);
} else {
cm->allow_interintra_compound = 0;
}
#endif // CONFIG_REF_ADAPT
if (!frame_is_intra_only(cm) && cm->reference_mode != SINGLE_REFERENCE) {
cm->allow_masked_compound = aom_rb_read_bit(rb);
......
......@@ -1275,9 +1275,7 @@ static REFERENCE_MODE read_block_reference_mode(AV1_COMMON *cm,
r, xd->tile_ctx->comp_inter_cdf[ctx], 2, ACCT_STR);
return mode; // SINGLE_REFERENCE or COMPOUND_REFERENCE
} else {
#if CONFIG_REF_ADAPT
assert(cm->reference_mode == SINGLE_REFERENCE);
#endif // CONFIG_REF_ADAPT
return cm->reference_mode;
}
}
......@@ -2024,9 +2022,6 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
mbmi->use_wedge_interintra = 0;
if (cm->allow_interintra_compound &&
#if !CONFIG_REF_ADAPT
cm->reference_mode != COMPOUND_REFERENCE &&
#endif // !CONFIG_REF_ADAPT
#if CONFIG_EXT_SKIP
!mbmi->skip_mode &&
#endif // CONFIG_EXT_SKIP
......
......@@ -3835,14 +3835,8 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi,
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 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
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
......
......@@ -1036,11 +1036,6 @@ static void update_stats(const AV1_COMMON *const cm, TileDataEnc *tile_data,
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 @@ static void update_stats(const AV1_COMMON *const cm, TileDataEnc *tile_data,
}
}
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 encode_frame_internal(AV1_COMP *cpi) {
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 @@ void av1_encode_frame(AV1_COMP *cpi) {
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 @@ void av1_encode_frame(AV1_COMP *cpi) {
#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);
......
......@@ -331,9 +331,6 @@ typedef struct RD_COUNTS {
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;
......
......@@ -24,9 +24,6 @@ static void accumulate_rd_opt(ThreadData *td, ThreadData *td_t) {
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
......
......@@ -5788,56 +5788,42 @@ static void estimate_ref_frame_costs(
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] += 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[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[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[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_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[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[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 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
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) {
......
......@@ -172,7 +172,6 @@ set(CONFIG_RD_DEBUG 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_RECT_TX_EXT 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_RECT_TX_EXT_INTRA 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_REFERENCE_BUFFER 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_REF_ADAPT 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_SEGMENT_GLOBALMV 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_SEGMENT_PRED_LAST 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_SHORT_FILTER 1 CACHE NUMBER "AV1 experiment flag.")
......
......@@ -289,7 +289,6 @@ EXPERIMENT_LIST="
dependent_horztilegroups
dist_8x8
palette_throughput
ref_adapt
lv_map
txk_sel
mv_compress
......@@ -517,7 +516,6 @@ post_process_cmdline() {
soft_enable filter_intra
soft_enable ext_skip
soft_enable frame_sign_bias
soft_enable ref_adapt
soft_enable ext_warped_motion
soft_enable horzonly_frame_superres
......
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