Remove compile guards for CONFIG_EXT_REFS
This experiment has been adopted, we can simplify the code
by dropping the associated preprocessor conditionals.
Change-Id: I4705652ac8231ee25f960e8096dc97c2aeed1d20
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 002f4ef..f3a5126 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -120,7 +120,6 @@
}
static void setup_compound_reference_mode(AV1_COMMON *cm) {
-#if CONFIG_EXT_REFS
cm->comp_fwd_ref[0] = LAST_FRAME;
cm->comp_fwd_ref[1] = LAST2_FRAME;
cm->comp_fwd_ref[2] = LAST3_FRAME;
@@ -129,23 +128,6 @@
cm->comp_bwd_ref[0] = BWDREF_FRAME;
cm->comp_bwd_ref[1] = ALTREF2_FRAME;
cm->comp_bwd_ref[2] = ALTREF_FRAME;
-#else // !CONFIG_EXT_REFS
- if (cm->ref_frame_sign_bias[LAST_FRAME] ==
- cm->ref_frame_sign_bias[GOLDEN_FRAME]) {
- cm->comp_fixed_ref = ALTREF_FRAME;
- cm->comp_var_ref[0] = LAST_FRAME;
- cm->comp_var_ref[1] = GOLDEN_FRAME;
- } else if (cm->ref_frame_sign_bias[LAST_FRAME] ==
- cm->ref_frame_sign_bias[ALTREF_FRAME]) {
- cm->comp_fixed_ref = GOLDEN_FRAME;
- cm->comp_var_ref[0] = LAST_FRAME;
- cm->comp_var_ref[1] = ALTREF_FRAME;
- } else {
- cm->comp_fixed_ref = LAST_FRAME;
- cm->comp_var_ref[0] = GOLDEN_FRAME;
- cm->comp_var_ref[1] = ALTREF_FRAME;
- }
-#endif // CONFIG_EXT_REFS
}
static int read_is_valid(const uint8_t *start, size_t len, const uint8_t *end) {
@@ -237,15 +219,10 @@
for (i = 0; i < REF_CONTEXTS; ++i) {
int j;
-#if CONFIG_EXT_REFS
for (j = 0; j < (FWD_REFS - 1); ++j)
av1_diff_update_prob(r, &fc->comp_ref_prob[i][j], ACCT_STR);
for (j = 0; j < (BWD_REFS - 1); ++j)
av1_diff_update_prob(r, &fc->comp_bwdref_prob[i][j], ACCT_STR);
-#else
- for (j = 0; j < (COMP_REFS - 1); ++j)
- av1_diff_update_prob(r, &fc->comp_ref_prob[i][j], ACCT_STR);
-#endif // CONFIG_EXT_REFS
}
}
}
@@ -4678,10 +4655,8 @@
cm->last_frame_type = cm->frame_type;
cm->last_intra_only = cm->intra_only;
-#if CONFIG_EXT_REFS
// NOTE: By default all coded frames to be used as a reference
cm->is_reference_frame = 1;
-#endif // CONFIG_EXT_REFS
#if !CONFIG_OBU
if (aom_rb_read_literal(rb, 2) != AOM_FRAME_MARKER)
@@ -4897,13 +4872,11 @@
pbi->refresh_frame_flags = aom_rb_read_literal(rb, REF_FRAMES);
#endif
-#if CONFIG_EXT_REFS
if (!pbi->refresh_frame_flags) {
// NOTE: "pbi->refresh_frame_flags == 0" indicates that the coded frame
// will not be used as a reference
cm->is_reference_frame = 0;
}
-#endif // CONFIG_EXT_REFS
for (i = 0; i < INTER_REFS_PER_FRAME; ++i) {
const int ref = aom_rb_read_literal(rb, REF_FRAMES_LOG2);
@@ -5192,7 +5165,6 @@
if (cm->use_adapt_scan == 0) av1_init_scan_order(cm);
#endif // CONFIG_ADAPT_SCAN
-#if CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
// NOTE(zoeliu): As cm->prev_frame can take neither a frame of
// show_exisiting_frame=1, nor can it take a frame not used as
// a reference, it is probable that by the time it is being
@@ -5211,7 +5183,6 @@
->frame_bufs[cm->frame_refs[LAST_FRAME - LAST_FRAME].idx]
: NULL;
}
-#endif // CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
#if CONFIG_TEMPMV_SIGNALING
if (cm->use_prev_frame_mvs && !frame_can_use_prev_frame_mvs(cm)) {
@@ -5424,10 +5395,8 @@
sizeof(cm->counts.single_ref)));
assert(!memcmp(cm->counts.comp_ref, zero_counts.comp_ref,
sizeof(cm->counts.comp_ref)));
-#if CONFIG_EXT_REFS
assert(!memcmp(cm->counts.comp_bwdref, zero_counts.comp_bwdref,
sizeof(cm->counts.comp_bwdref)));
-#endif // CONFIG_EXT_REFS
assert(!memcmp(&cm->counts.tx_size, &zero_counts.tx_size,
sizeof(cm->counts.tx_size)));
assert(!memcmp(cm->counts.skip, zero_counts.skip, sizeof(cm->counts.skip)));
@@ -5522,9 +5491,7 @@
uint8_t clear_data[MAX_AV1_HEADER_SIZE];
size_t first_partition_size;
YV12_BUFFER_CONFIG *new_fb;
-#if CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
RefBuffer *last_fb_ref_buf = &cm->frame_refs[LAST_FRAME - LAST_FRAME];
-#endif // CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
#if CONFIG_ADAPT_SCAN
av1_deliver_eob_threshold(cm, xd);
@@ -5586,7 +5553,6 @@
cm->setup_mi(cm);
-#if CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
// NOTE(zoeliu): As cm->prev_frame can take neither a frame of
// show_exisiting_frame=1, nor can it take a frame not used as
// a reference, it is probable that by the time it is being
@@ -5603,7 +5569,6 @@
? &cm->buffer_pool->frame_bufs[last_fb_ref_buf->idx]
: NULL;
}
-#endif // CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
#if CONFIG_TEMPMV_SIGNALING
if (cm->use_prev_frame_mvs && !frame_can_use_prev_frame_mvs(cm)) {
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index 0a754fd..a5f59c9 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -1595,12 +1595,8 @@
// Normative in decoder (for low delay)
#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_FRAME_SIGN_BIAS
const int idx = 1;
-#else // !(CONFIG_ONE_SIDED_COMPOUND || CONFIG_FRAME_SIGN_BIAS)
-#if CONFIG_EXT_REFS
+#else // !(CONFIG_ONE_SIDED_COMPOUND || CONFIG_FRAME_SIGN_BIAS)
const int idx = cm->ref_frame_sign_bias[cm->comp_bwd_ref[0]];
-#else // !CONFIG_EXT_REFS
- const int idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref];
-#endif // CONFIG_EXT_REFS
#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_FRAME_SIGN_BIAS)
const int ctx = av1_get_pred_context_comp_ref_p(cm, xd);
@@ -1616,7 +1612,6 @@
#endif // CONFIG_VAR_REFS
if (counts) ++counts->comp_ref[ctx][0][bit];
-#if CONFIG_EXT_REFS
// Decode forward references.
if (!bit) {
const int ctx1 = av1_get_pred_context_comp_ref_p1(cm, xd);
@@ -1678,12 +1673,7 @@
} else {
ref_frame[idx] = cm->comp_bwd_ref[2];
}
-#else // !CONFIG_EXT_REFS
- ref_frame[!idx] = cm->comp_var_ref[bit];
- ref_frame[idx] = cm->comp_fixed_ref;
-#endif // CONFIG_EXT_REFS
} else if (mode == SINGLE_REFERENCE) {
-#if CONFIG_EXT_REFS
const int ctx0 = av1_get_pred_context_single_ref_p1(xd);
#if CONFIG_VAR_REFS
int bit0;
@@ -1772,20 +1762,6 @@
ref_frame[0] = bit3 ? LAST2_FRAME : LAST_FRAME;
}
}
-#else // !CONFIG_EXT_REFS
- const int ctx0 = av1_get_pred_context_single_ref_p1(xd);
- const int bit0 = READ_REF_BIT(single_ref_p1);
- if (counts) ++counts->single_ref[ctx0][0][bit0];
-
- if (bit0) {
- const int ctx1 = av1_get_pred_context_single_ref_p2(xd);
- const int bit1 = READ_REF_BIT(single_ref_p2);
- if (counts) ++counts->single_ref[ctx1][1][bit1];
- ref_frame[0] = bit1 ? ALTREF_FRAME : GOLDEN_FRAME;
- } else {
- ref_frame[0] = LAST_FRAME;
- }
-#endif // CONFIG_EXT_REFS
ref_frame[1] = NONE_FRAME;
} else {
diff --git a/av1/decoder/decoder.c b/av1/decoder/decoder.c
index cd82d5b..c9bc612 100644
--- a/av1/decoder/decoder.c
+++ b/av1/decoder/decoder.c
@@ -393,11 +393,8 @@
if (!cm->show_existing_frame) {
cm->last_show_frame = cm->show_frame;
-#if CONFIG_EXT_REFS
// NOTE: It is not supposed to ref to any frame not used as reference
- if (cm->is_reference_frame)
-#endif // CONFIG_EXT_REFS
- cm->prev_frame = cm->cur_frame;
+ if (cm->is_reference_frame) cm->prev_frame = cm->cur_frame;
if (cm->seg.enabled && !cm->frame_parallel_decode)
av1_swap_current_and_last_seg_map(cm);
diff --git a/av1/decoder/decoder.h b/av1/decoder/decoder.h
index 20129b6..0871995 100644
--- a/av1/decoder/decoder.h
+++ b/av1/decoder/decoder.h
@@ -196,7 +196,6 @@
}
}
-#if CONFIG_EXT_REFS || CONFIG_TEMPMV_SIGNALING
static INLINE int dec_is_ref_frame_buf(AV1Decoder *const pbi,
RefCntBuffer *frame_buf) {
AV1_COMMON *const cm = &pbi->common;
@@ -208,7 +207,6 @@
}
return (i < INTER_REFS_PER_FRAME);
}
-#endif // CONFIG_EXT_REFS
#define ACCT_STR __func__
static INLINE int av1_read_uniform(aom_reader *r, int n) {
diff --git a/av1/decoder/dthread.c b/av1/decoder/dthread.c
index 7f16b23..531ea25 100644
--- a/av1/decoder/dthread.c
+++ b/av1/decoder/dthread.c
@@ -160,9 +160,7 @@
#if CONFIG_HIGHBITDEPTH
dst_cm->use_highbitdepth = src_cm->use_highbitdepth;
#endif
-#if CONFIG_EXT_REFS
-// TODO(zoeliu): To handle parallel decoding
-#endif // CONFIG_EXT_REFS
+ // TODO(zoeliu): To handle parallel decoding
dst_cm->prev_frame =
src_cm->show_existing_frame ? src_cm->prev_frame : src_cm->cur_frame;
dst_cm->last_width =