cleanup / reduce memory in AV1Common
comp_fwd_ref and comp_bwd_ref never have their values change and are used in only decodemv. Remove the indirection and express the values directly.
Change-Id: Idbc3a724daab34db2166e6fe9e56e5c90b9e3ab6
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index cf70459..e0e41497 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -492,10 +492,6 @@
int reduced_tx_set_used;
- // Context probabilities for reference frame prediction
- MV_REFERENCE_FRAME comp_fwd_ref[FWD_REFS];
- MV_REFERENCE_FRAME comp_bwd_ref[BWD_REFS];
-
FRAME_CONTEXT *fc; /* this frame entropy */
FRAME_CONTEXT *default_frame_context;
int primary_ref_frame;
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index c4bad1b..456be60 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -121,17 +121,6 @@
const AV1_COMMON *const cm, MACROBLOCKD *xd, aom_reader *const r, int plane,
int runit_idx);
-static AOM_INLINE void setup_compound_reference_mode(AV1_COMMON *cm) {
- cm->comp_fwd_ref[0] = LAST_FRAME;
- cm->comp_fwd_ref[1] = LAST2_FRAME;
- cm->comp_fwd_ref[2] = LAST3_FRAME;
- cm->comp_fwd_ref[3] = GOLDEN_FRAME;
-
- cm->comp_bwd_ref[0] = BWDREF_FRAME;
- cm->comp_bwd_ref[1] = ALTREF2_FRAME;
- cm->comp_bwd_ref[2] = ALTREF_FRAME;
-}
-
static int read_is_valid(const uint8_t *start, size_t len, const uint8_t *end) {
return len != 0 && len <= (size_t)(end - start);
}
@@ -5228,8 +5217,6 @@
cm->tx_mode = read_tx_mode(cm, rb);
current_frame->reference_mode = read_frame_reference_mode(cm, rb);
- if (current_frame->reference_mode != SINGLE_REFERENCE)
- setup_compound_reference_mode(cm);
av1_setup_skip_mode_allowed(cm);
current_frame->skip_mode_info.skip_mode_flag =
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index d2502f7..c194d47 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -960,19 +960,19 @@
// Decode forward references.
if (!bit) {
const int bit1 = READ_REF_BIT(comp_ref_p1);
- ref_frame[!idx] = cm->comp_fwd_ref[bit1 ? 1 : 0];
+ ref_frame[!idx] = bit1 ? LAST2_FRAME : LAST_FRAME;
} else {
const int bit2 = READ_REF_BIT(comp_ref_p2);
- ref_frame[!idx] = cm->comp_fwd_ref[bit2 ? 3 : 2];
+ ref_frame[!idx] = bit2 ? GOLDEN_FRAME : LAST3_FRAME;
}
// Decode backward references.
const int bit_bwd = READ_REF_BIT(comp_bwdref_p);
if (!bit_bwd) {
const int bit1_bwd = READ_REF_BIT(comp_bwdref_p1);
- ref_frame[idx] = cm->comp_bwd_ref[bit1_bwd];
+ ref_frame[idx] = bit1_bwd ? ALTREF2_FRAME : BWDREF_FRAME;
} else {
- ref_frame[idx] = cm->comp_bwd_ref[2];
+ ref_frame[idx] = ALTREF_FRAME;
}
} else if (mode == SINGLE_REFERENCE) {
const int bit0 = READ_REF_BIT(single_ref_p1);