Commit 4be6cb32 authored by Sebastien Alaiwan's avatar Sebastien Alaiwan

Remove VAR_REFS experiment

This experiment has been abandonned.

Change-Id: Ieabc6f365651e2d116a4505a3cc202add94d1386
parent ebdbcb4c
......@@ -558,9 +558,6 @@ typedef struct RefBuffer {
int idx;
YV12_BUFFER_CONFIG *buf;
struct scale_factors sf;
#if CONFIG_VAR_REFS
int is_valid;
#endif // CONFIG_VAR_REFS
} RefBuffer;
#if CONFIG_ADAPT_SCAN
......
......@@ -646,29 +646,6 @@ static INLINE void ensure_mv_buffer(RefCntBuffer *buf, AV1_COMMON *cm) {
#endif
}
#if CONFIG_VAR_REFS
#define LAST_IS_VALID(cm) ((cm)->frame_refs[LAST_FRAME - 1].is_valid)
#define LAST2_IS_VALID(cm) ((cm)->frame_refs[LAST2_FRAME - 1].is_valid)
#define LAST3_IS_VALID(cm) ((cm)->frame_refs[LAST3_FRAME - 1].is_valid)
#define GOLDEN_IS_VALID(cm) ((cm)->frame_refs[GOLDEN_FRAME - 1].is_valid)
#define BWDREF_IS_VALID(cm) ((cm)->frame_refs[BWDREF_FRAME - 1].is_valid)
#define ALTREF2_IS_VALID(cm) ((cm)->frame_refs[ALTREF2_FRAME - 1].is_valid)
#define ALTREF_IS_VALID(cm) ((cm)->frame_refs[ALTREF_FRAME - 1].is_valid)
#define L_OR_L2(cm) (LAST_IS_VALID(cm) || LAST2_IS_VALID(cm))
#define L_AND_L2(cm) (LAST_IS_VALID(cm) && LAST2_IS_VALID(cm))
#define L_AND_L3(cm) (LAST_IS_VALID(cm) && LAST3_IS_VALID(cm))
#define L_AND_G(cm) (LAST_IS_VALID(cm) && GOLDEN_IS_VALID(cm))
#define L3_OR_G(cm) (LAST3_IS_VALID(cm) || GOLDEN_IS_VALID(cm))
#define L3_AND_G(cm) (LAST3_IS_VALID(cm) && GOLDEN_IS_VALID(cm))
#define BWD_OR_ALT2(cm) (BWDREF_IS_VALID(cm) || ALTREF2_IS_VALID(cm))
#define BWD_AND_ALT2(cm) (BWDREF_IS_VALID(cm) && ALTREF2_IS_VALID(cm))
#define BWD_OR_ALT(cm) (BWDREF_IS_VALID(cm) || ALTREF_IS_VALID(cm))
#define BWD_AND_ALT(cm) (BWDREF_IS_VALID(cm) && ALTREF_IS_VALID(cm))
#endif // CONFIG_VAR_REFS
static INLINE int mi_cols_aligned_to_sb(const AV1_COMMON *cm) {
return ALIGN_POWER_OF_TWO(cm->mi_cols, cm->mib_size_log2);
}
......
......@@ -2630,38 +2630,6 @@ static void read_compound_tools(AV1_COMMON *cm,
}
}
#if CONFIG_VAR_REFS
static void check_valid_ref_frames(AV1_COMMON *cm) {
MV_REFERENCE_FRAME ref_frame;
// TODO(zoeliu): To handle ALTREF_FRAME the same way as do with other
// reference frames: Current encoder invalid ALTREF when ALTREF
// is the same as LAST, but invalid all the other references
// when they are the same as ALTREF.
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
RefBuffer *const ref_buf = &cm->frame_refs[ref_frame - LAST_FRAME];
if (ref_buf->idx != INVALID_IDX) {
ref_buf->is_valid = 1;
MV_REFERENCE_FRAME ref;
for (ref = LAST_FRAME; ref < ref_frame; ++ref) {
RefBuffer *const buf = &cm->frame_refs[ref - LAST_FRAME];
if (buf->is_valid && buf->idx == ref_buf->idx) {
if (ref_frame != ALTREF_FRAME || ref == LAST_FRAME) {
ref_buf->is_valid = 0;
break;
} else {
buf->is_valid = 0;
}
}
}
} else {
ref_buf->is_valid = 0;
}
}
}
#endif // CONFIG_VAR_REFS
static int read_global_motion_params(WarpedMotionParams *params,
const WarpedMotionParams *ref_params,
struct aom_read_bit_buffer *rb,
......@@ -2930,9 +2898,6 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
for (i = 0; i < INTER_REFS_PER_FRAME; ++i) {
cm->frame_refs[i].idx = INVALID_IDX;
cm->frame_refs[i].buf = NULL;
#if CONFIG_VAR_REFS
cm->frame_refs[i].is_valid = 0;
#endif // CONFIG_VAR_REFS
}
#if CONFIG_FRAME_SIZE
......@@ -3076,10 +3041,6 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
#endif // CONFIG_REFERENCE_BUFFER
}
#if CONFIG_VAR_REFS
check_valid_ref_frames(cm);
#endif // CONFIG_VAR_REFS
#if CONFIG_FRAME_SIZE
if (cm->error_resilient_mode == 0 && frame_size_override_flag) {
setup_frame_size_with_refs(cm, rb);
......
......@@ -1437,26 +1437,14 @@ static COMP_REFERENCE_TYPE read_comp_reference_type(AV1_COMMON *cm,
aom_reader *r) {
const int ctx = av1_get_comp_reference_type_context(xd);
COMP_REFERENCE_TYPE comp_ref_type;
#if CONFIG_VAR_REFS
if ((L_OR_L2(cm) || L3_OR_G(cm)) && BWD_OR_ALT(cm)) {
if (L_AND_L2(cm) || L_AND_L3(cm) || L_AND_G(cm) || BWD_AND_ALT(cm)) {
#endif // CONFIG_VAR_REFS
#if CONFIG_NEW_MULTISYMBOL
(void)cm;
comp_ref_type = (COMP_REFERENCE_TYPE)aom_read_symbol(
r, xd->tile_ctx->comp_ref_type_cdf[ctx], 2, ACCT_STR);
(void)cm;
comp_ref_type = (COMP_REFERENCE_TYPE)aom_read_symbol(
r, xd->tile_ctx->comp_ref_type_cdf[ctx], 2, ACCT_STR);
#else
comp_ref_type = (COMP_REFERENCE_TYPE)aom_read(
r, cm->fc->comp_ref_type_prob[ctx], ACCT_STR);
#endif
#if CONFIG_VAR_REFS
} else {
comp_ref_type = BIDIR_COMP_REFERENCE;
}
} else {
comp_ref_type = UNIDIR_COMP_REFERENCE;
}
#endif // CONFIG_VAR_REFS
FRAME_COUNTS *counts = xd->counts;
if (counts) ++counts->comp_ref_type[ctx][comp_ref_type];
return comp_ref_type; // UNIDIR_COMP_REFERENCE or BIDIR_COMP_REFERENCE
......@@ -1564,14 +1552,7 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
if (comp_ref_type == UNIDIR_COMP_REFERENCE) {
const int ctx = av1_get_pred_context_uni_comp_ref_p(xd);
int bit;
#if CONFIG_VAR_REFS
if ((L_AND_L2(cm) || L_AND_L3(cm) || L_AND_G(cm)) && BWD_AND_ALT(cm))
#endif // CONFIG_VAR_REFS
bit = READ_REF_BIT2(uni_comp_ref_p);
#if CONFIG_VAR_REFS
else
bit = BWD_AND_ALT(cm);
#endif // CONFIG_VAR_REFS
bit = READ_REF_BIT2(uni_comp_ref_p);
if (counts) ++counts->uni_comp_ref[ctx][0][bit];
if (bit) {
......@@ -1580,27 +1561,13 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
} else {
const int ctx1 = av1_get_pred_context_uni_comp_ref_p1(xd);
int bit1;
#if CONFIG_VAR_REFS
if (L_AND_L2(cm) && (L_AND_L3(cm) || L_AND_G(cm)))
#endif // CONFIG_VAR_REFS
bit1 = READ_REF_BIT2(uni_comp_ref_p1);
#if CONFIG_VAR_REFS
else
bit1 = L_AND_L3(cm) || L_AND_G(cm);
#endif // CONFIG_VAR_REFS
bit1 = READ_REF_BIT2(uni_comp_ref_p1);
if (counts) ++counts->uni_comp_ref[ctx1][1][bit1];
if (bit1) {
const int ctx2 = av1_get_pred_context_uni_comp_ref_p2(xd);
int bit2;
#if CONFIG_VAR_REFS
if (L_AND_L3(cm) && L_AND_G(cm))
#endif // CONFIG_VAR_REFS
bit2 = READ_REF_BIT2(uni_comp_ref_p2);
#if CONFIG_VAR_REFS
else
bit2 = L_AND_G(cm);
#endif // CONFIG_VAR_REFS
bit2 = READ_REF_BIT2(uni_comp_ref_p2);
if (counts) ++counts->uni_comp_ref[ctx2][2][bit2];
if (bit2) {
......@@ -1630,74 +1597,29 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_FRAME_SIGN_BIAS)
const int ctx = av1_get_pred_context_comp_ref_p(cm, xd);
#if CONFIG_VAR_REFS
int bit;
// Test need to explicitly code (L,L2) vs (L3,G) branch node in tree
if (L_OR_L2(cm) && L3_OR_G(cm))
bit = READ_REF_BIT(comp_ref_p);
else
bit = L3_OR_G(cm);
#else // !CONFIG_VAR_REFS
const int bit = READ_REF_BIT(comp_ref_p);
#endif // CONFIG_VAR_REFS
if (counts) ++counts->comp_ref[ctx][0][bit];
// Decode forward references.
if (!bit) {
const int ctx1 = av1_get_pred_context_comp_ref_p1(cm, xd);
#if CONFIG_VAR_REFS
int bit1;
// Test need to explicitly code (L) vs (L2) branch node in tree
if (L_AND_L2(cm))
bit1 = READ_REF_BIT(comp_ref_p1);
else
bit1 = LAST_IS_VALID(cm);
#else // !CONFIG_VAR_REFS
const int bit1 = READ_REF_BIT(comp_ref_p1);
#endif // CONFIG_VAR_REFS
if (counts) ++counts->comp_ref[ctx1][1][bit1];
ref_frame[!idx] = cm->comp_fwd_ref[bit1 ? 0 : 1];
} else {
const int ctx2 = av1_get_pred_context_comp_ref_p2(cm, xd);
#if CONFIG_VAR_REFS
int bit2;
// Test need to explicitly code (L3) vs (G) branch node in tree
if (L3_AND_G(cm))
bit2 = READ_REF_BIT(comp_ref_p2);
else
bit2 = GOLDEN_IS_VALID(cm);
#else // !CONFIG_VAR_REFS
const int bit2 = READ_REF_BIT(comp_ref_p2);
#endif // CONFIG_VAR_REFS
if (counts) ++counts->comp_ref[ctx2][2][bit2];
ref_frame[!idx] = cm->comp_fwd_ref[bit2 ? 3 : 2];
}
// Decode backward references.
const int ctx_bwd = av1_get_pred_context_comp_bwdref_p(cm, xd);
#if CONFIG_VAR_REFS
int bit_bwd;
// Test need to explicitly code (BWD/ALT2) vs (ALT) branch node in tree
const int bit_bwd_uncertain = BWD_OR_ALT2(cm) && ALTREF_IS_VALID(cm);
if (bit_bwd_uncertain)
bit_bwd = READ_REF_BIT(comp_bwdref_p);
else
bit_bwd = ALTREF_IS_VALID(cm);
#else // !CONFIG_VAR_REFS
const int bit_bwd = READ_REF_BIT(comp_bwdref_p);
#endif // CONFIG_VAR_REFS
if (counts) ++counts->comp_bwdref[ctx_bwd][0][bit_bwd];
if (!bit_bwd) {
const int ctx1_bwd = av1_get_pred_context_comp_bwdref_p1(cm, xd);
#if CONFIG_VAR_REFS
int bit1_bwd;
if (BWD_AND_ALT2(cm))
bit1_bwd = READ_REF_BIT(comp_bwdref_p1);
else
bit1_bwd = ALTREF2_IS_VALID(cm);
#else // !CONFIG_VAR_REFS
const int bit1_bwd = READ_REF_BIT(comp_bwdref_p1);
#endif // CONFIG_VAR_REFS
if (counts) ++counts->comp_bwdref[ctx1_bwd][1][bit1_bwd];
ref_frame[idx] = cm->comp_bwd_ref[bit1_bwd];
} else {
......@@ -1705,45 +1627,16 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
}
} else if (mode == SINGLE_REFERENCE) {
const int ctx0 = av1_get_pred_context_single_ref_p1(xd);
#if CONFIG_VAR_REFS
int bit0;
// Test need to explicitly code (L,L2,L3,G) vs (BWD,ALT2,ALT) branch node
// in tree
if ((L_OR_L2(cm) || L3_OR_G(cm)) &&
(BWD_OR_ALT2(cm) || ALTREF_IS_VALID(cm)))
bit0 = READ_REF_BIT(single_ref_p1);
else
bit0 = (BWD_OR_ALT2(cm) || ALTREF_IS_VALID(cm));
#else // !CONFIG_VAR_REFS
const int bit0 = READ_REF_BIT(single_ref_p1);
#endif // CONFIG_VAR_REFS
if (counts) ++counts->single_ref[ctx0][0][bit0];
if (bit0) {
const int ctx1 = av1_get_pred_context_single_ref_p2(xd);
#if CONFIG_VAR_REFS
int bit1;
// Test need to explicitly code (BWD/ALT2) vs (ALT) branch node in tree
const int bit1_uncertain = BWD_OR_ALT2(cm) && ALTREF_IS_VALID(cm);
if (bit1_uncertain)
bit1 = READ_REF_BIT(single_ref_p2);
else
bit1 = ALTREF_IS_VALID(cm);
#else // !CONFIG_VAR_REFS
const int bit1 = READ_REF_BIT(single_ref_p2);
#endif // CONFIG_VAR_REFS
if (counts) ++counts->single_ref[ctx1][1][bit1];
if (!bit1) {
const int ctx5 = av1_get_pred_context_single_ref_p6(xd);
#if CONFIG_VAR_REFS
int bit5;
if (BWD_AND_ALT2(cm))
bit5 = READ_REF_BIT(single_ref_p6);
else
bit5 = ALTREF2_IS_VALID(cm);
#else // !CONFIG_VAR_REFS
const int bit5 = READ_REF_BIT(single_ref_p6);
#endif // CONFIG_VAR_REFS
if (counts) ++counts->single_ref[ctx5][5][bit5];
ref_frame[0] = bit5 ? ALTREF2_FRAME : BWDREF_FRAME;
} else {
......@@ -1751,43 +1644,16 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
}
} else {
const int ctx2 = av1_get_pred_context_single_ref_p3(xd);
#if CONFIG_VAR_REFS
int bit2;
// Test need to explicitly code (L,L2) vs (L3,G) branch node in tree
if (L_OR_L2(cm) && L3_OR_G(cm))
bit2 = READ_REF_BIT(single_ref_p3);
else
bit2 = L3_OR_G(cm);
#else // !CONFIG_VAR_REFS
const int bit2 = READ_REF_BIT(single_ref_p3);
#endif // CONFIG_VAR_REFS
if (counts) ++counts->single_ref[ctx2][2][bit2];
if (bit2) {
const int ctx4 = av1_get_pred_context_single_ref_p5(xd);
#if CONFIG_VAR_REFS
int bit4;
// Test need to explicitly code (L3) vs (G) branch node in tree
if (L3_AND_G(cm))
bit4 = READ_REF_BIT(single_ref_p5);
else
bit4 = GOLDEN_IS_VALID(cm);
#else // !CONFIG_VAR_REFS
const int bit4 = READ_REF_BIT(single_ref_p5);
#endif // CONFIG_VAR_REFS
if (counts) ++counts->single_ref[ctx4][4][bit4];
ref_frame[0] = bit4 ? GOLDEN_FRAME : LAST3_FRAME;
} else {
const int ctx3 = av1_get_pred_context_single_ref_p4(xd);
#if CONFIG_VAR_REFS
int bit3;
// Test need to explicitly code (L) vs (L2) branch node in tree
if (L_AND_L2(cm))
bit3 = READ_REF_BIT(single_ref_p4);
else
bit3 = LAST2_IS_VALID(cm);
#else // !CONFIG_VAR_REFS
const int bit3 = READ_REF_BIT(single_ref_p4);
#endif // CONFIG_VAR_REFS
if (counts) ++counts->single_ref[ctx3][3][bit3];
ref_frame[0] = bit3 ? LAST2_FRAME : LAST_FRAME;
}
......
......@@ -828,51 +828,26 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
const COMP_REFERENCE_TYPE comp_ref_type = has_uni_comp_refs(mbmi)
? UNIDIR_COMP_REFERENCE
: BIDIR_COMP_REFERENCE;
#if CONFIG_VAR_REFS
if ((L_OR_L2(cm) || L3_OR_G(cm)) && BWD_OR_ALT(cm))
if (L_AND_L2(cm) || L_AND_L3(cm) || L_AND_G(cm) || BWD_AND_ALT(cm))
#endif // CONFIG_VAR_REFS
#if CONFIG_NEW_MULTISYMBOL
aom_write_symbol(w, comp_ref_type,
av1_get_comp_reference_type_cdf(xd), 2);
aom_write_symbol(w, comp_ref_type, av1_get_comp_reference_type_cdf(xd),
2);
#else
aom_write(w, comp_ref_type, av1_get_comp_reference_type_prob(cm, xd));
#endif
#if CONFIG_VAR_REFS
else
assert(comp_ref_type == BIDIR_COMP_REFERENCE);
else
assert(comp_ref_type == UNIDIR_COMP_REFERENCE);
#endif // CONFIG_VAR_REFS
if (comp_ref_type == UNIDIR_COMP_REFERENCE) {
const int bit = mbmi->ref_frame[0] == BWDREF_FRAME;
#if CONFIG_VAR_REFS
if ((L_AND_L2(cm) || L_AND_L3(cm) || L_AND_G(cm)) && BWD_AND_ALT(cm))
#endif // CONFIG_VAR_REFS
WRITE_REF_BIT2(bit, uni_comp_ref_p);
WRITE_REF_BIT2(bit, uni_comp_ref_p);
if (!bit) {
assert(mbmi->ref_frame[0] == LAST_FRAME);
#if CONFIG_VAR_REFS
if (L_AND_L2(cm) && (L_AND_L3(cm) || L_AND_G(cm))) {
#endif // CONFIG_VAR_REFS
const int bit1 = mbmi->ref_frame[1] == LAST3_FRAME ||
mbmi->ref_frame[1] == GOLDEN_FRAME;
WRITE_REF_BIT2(bit1, uni_comp_ref_p1);
if (bit1) {
#if CONFIG_VAR_REFS
if (L_AND_L3(cm) && L_AND_G(cm)) {
#endif // CONFIG_VAR_REFS
const int bit2 = mbmi->ref_frame[1] == GOLDEN_FRAME;
WRITE_REF_BIT2(bit2, uni_comp_ref_p2);
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_REFS
}
#if CONFIG_VAR_REFS
const int bit1 = mbmi->ref_frame[1] == LAST3_FRAME ||
mbmi->ref_frame[1] == GOLDEN_FRAME;
WRITE_REF_BIT2(bit1, uni_comp_ref_p1);
if (bit1) {
const int bit2 = mbmi->ref_frame[1] == GOLDEN_FRAME;
WRITE_REF_BIT2(bit2, uni_comp_ref_p2);
}
#endif // CONFIG_VAR_REFS
} else {
assert(mbmi->ref_frame[1] == ALTREF_FRAME);
}
......@@ -885,111 +860,46 @@ static void write_ref_frames(const AV1_COMMON *cm, const MACROBLOCKD *xd,
const int bit = (mbmi->ref_frame[0] == GOLDEN_FRAME ||
mbmi->ref_frame[0] == LAST3_FRAME);
#if CONFIG_VAR_REFS
// Test need to explicitly code (L,L2) vs (L3,G) branch node in tree
if (L_OR_L2(cm) && L3_OR_G(cm))
#endif // CONFIG_VAR_REFS
WRITE_REF_BIT(bit, comp_ref_p);
WRITE_REF_BIT(bit, comp_ref_p);
if (!bit) {
#if CONFIG_VAR_REFS
// Test need to explicitly code (L) vs (L2) branch node in tree
if (L_AND_L2(cm)) {
#endif // CONFIG_VAR_REFS
const int bit1 = mbmi->ref_frame[0] == LAST_FRAME;
WRITE_REF_BIT(bit1, comp_ref_p1);
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_REFS
const int bit1 = mbmi->ref_frame[0] == LAST_FRAME;
WRITE_REF_BIT(bit1, comp_ref_p1);
} else {
#if CONFIG_VAR_REFS
// Test need to explicitly code (L3) vs (G) branch node in tree
if (L3_AND_G(cm)) {
#endif // CONFIG_VAR_REFS
const int bit2 = mbmi->ref_frame[0] == GOLDEN_FRAME;
WRITE_REF_BIT(bit2, comp_ref_p2);
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_REFS
const int bit2 = mbmi->ref_frame[0] == GOLDEN_FRAME;
WRITE_REF_BIT(bit2, comp_ref_p2);
}
#if CONFIG_VAR_REFS
// Test need to explicitly code (BWD,ALT2) vs (ALT) branch node in tree
if (BWD_OR_ALT2(cm) && ALTREF_IS_VALID(cm)) {
#endif // CONFIG_VAR_REFS
const int bit_bwd = mbmi->ref_frame[1] == ALTREF_FRAME;
WRITE_REF_BIT(bit_bwd, comp_bwdref_p);
if (!bit_bwd) {
#if CONFIG_VAR_REFS
// Test need to explicitly code (BWD,ALT2) vs (ALT) branch node in
// tree
if (BWD_AND_ALT2(cm))
#endif // CONFIG_VAR_REFS
WRITE_REF_BIT(mbmi->ref_frame[1] == ALTREF2_FRAME, comp_bwdref_p1);
}
#if CONFIG_VAR_REFS
const int bit_bwd = mbmi->ref_frame[1] == ALTREF_FRAME;
WRITE_REF_BIT(bit_bwd, comp_bwdref_p);
if (!bit_bwd) {
WRITE_REF_BIT(mbmi->ref_frame[1] == ALTREF2_FRAME, comp_bwdref_p1);
}
#endif // CONFIG_VAR_REFS
} else {
const int bit0 = (mbmi->ref_frame[0] <= ALTREF_FRAME &&
mbmi->ref_frame[0] >= BWDREF_FRAME);
#if CONFIG_VAR_REFS
// Test need to explicitly code (L,L2,L3,G) vs (BWD,ALT2,ALT) branch node
// in tree
if ((L_OR_L2(cm) || L3_OR_G(cm)) &&
(BWD_OR_ALT2(cm) || ALTREF_IS_VALID(cm)))
#endif // CONFIG_VAR_REFS
WRITE_REF_BIT(bit0, single_ref_p1);
WRITE_REF_BIT(bit0, single_ref_p1);
if (bit0) {
#if CONFIG_VAR_REFS
// Test need to explicitly code (BWD,ALT2) vs (ALT) branch node in tree
if (BWD_OR_ALT2(cm) && ALTREF_IS_VALID(cm)) {
#endif // CONFIG_VAR_REFS
const int bit1 = mbmi->ref_frame[0] == ALTREF_FRAME;
WRITE_REF_BIT(bit1, single_ref_p2);
if (!bit1) {
#if CONFIG_VAR_REFS
// Test need to explicitly code (BWD) vs (ALT2) branch node in tree
if (BWD_AND_ALT2(cm))
#endif // CONFIG_VAR_REFS
WRITE_REF_BIT(mbmi->ref_frame[0] == ALTREF2_FRAME, single_ref_p6);
}
#if CONFIG_VAR_REFS
const int bit1 = mbmi->ref_frame[0] == ALTREF_FRAME;
WRITE_REF_BIT(bit1, single_ref_p2);
if (!bit1) {
WRITE_REF_BIT(mbmi->ref_frame[0] == ALTREF2_FRAME, single_ref_p6);
}
#endif // CONFIG_VAR_REFS
} else {
const int bit2 = (mbmi->ref_frame[0] == LAST3_FRAME ||
mbmi->ref_frame[0] == GOLDEN_FRAME);
#if CONFIG_VAR_REFS
// Test need to explicitly code (L,L2) vs (L3,G) branch node in tree
if (L_OR_L2(cm) && L3_OR_G(cm))
#endif // CONFIG_VAR_REFS
WRITE_REF_BIT(bit2, single_ref_p3);
WRITE_REF_BIT(bit2, single_ref_p3);
if (!bit2) {
#if CONFIG_VAR_REFS
// Test need to explicitly code (L) vs (L2) branch node in tree
if (L_AND_L2(cm)) {
#endif // CONFIG_VAR_REFS
const int bit3 = mbmi->ref_frame[0] != LAST_FRAME;
WRITE_REF_BIT(bit3, single_ref_p4);
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_REFS
const int bit3 = mbmi->ref_frame[0] != LAST_FRAME;
WRITE_REF_BIT(bit3, single_ref_p4);
} else {
#if CONFIG_VAR_REFS
// Test need to explicitly code (L3) vs (G) branch node in tree
if (L3_AND_G(cm)) {
#endif // CONFIG_VAR_REFS
const int bit4 = mbmi->ref_frame[0] != LAST3_FRAME;
WRITE_REF_BIT(bit4, single_ref_p5);
#if CONFIG_VAR_REFS
}
#endif // CONFIG_VAR_REFS
const int bit4 = mbmi->ref_frame[0] != LAST3_FRAME;
WRITE_REF_BIT(bit4, single_ref_p5);
}
}
}
......
......@@ -3592,42 +3592,6 @@ static INLINE void shift_last_ref_frames(AV1_COMP *cpi) {
}
}
#if CONFIG_VAR_REFS
static void enc_check_valid_ref_frames(AV1_COMP *const cpi) {
AV1_COMMON *const cm = &cpi->common;
MV_REFERENCE_FRAME ref_frame;
// TODO(zoeliu): To handle ALTREF_FRAME the same way as do with other
// reference frames. Current encoder invalid ALTREF when ALTREF
// is the same as LAST, but invalid all the other references
// when they are the same as ALTREF.
for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
int ref_buf_idx = get_ref_frame_buf_idx(cpi, ref_frame);
RefBuffer *const ref_buf = &cm->frame_refs[ref_frame - LAST_FRAME];
if (ref_buf_idx != INVALID_IDX) {
ref_buf->is_valid = 1;
MV_REFERENCE_FRAME ref;
for (ref = LAST_FRAME; ref < ref_frame; ++ref) {
int buf_idx = get_ref_frame_buf_idx(cpi, ref);
RefBuffer *const buf = &cm->frame_refs[ref - LAST_FRAME];
if (buf->is_valid && buf_idx == ref_buf_idx) {
if (ref_frame != ALTREF_FRAME || ref == LAST_FRAME) {
ref_buf->is_valid = 0;
break;
} else {
buf->is_valid = 0;
}
}
}
} else {
ref_buf->is_valid = 0;
}
}
}
#endif // CONFIG_VAR_REFS
#if USE_GF16_MULTI_LAYER
static void update_reference_frames_gf16(AV1_COMP *cpi) {
AV1_COMMON *const cm = &cpi->common;
......@@ -4320,11 +4284,6 @@ static void set_frame_size(AV1_COMP *cpi, int width, int height) {
}
}
#if CONFIG_VAR_REFS
// Check duplicate reference frames
enc_check_valid_ref_frames(cpi);
#endif // CONFIG_VAR_REFS
#if CONFIG_INTRABC
#if CONFIG_HIGHBITDEPTH
av1_setup_scale_factors_for_frame(&xd->sf_identity, cm->width, cm->height,
......
......@@ -198,6 +198,5 @@ set(CONFIG_TX64X64 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_TXK_SEL 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_TXMG 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_UNPOISON_PARTITION_CTX 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_VAR_REFS 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_VAR_TX_NO_TX_MODE 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_XIPHRC 0 CACHE NUMBER "AV1 experiment flag.")
......@@ -312,7 +312,6 @@ EXPERIMENT_LIST="
one_sided_compound
ext_comp_refs
smooth_hv
var_refs
lgt
lgt_from_pred
ncobmc_adapt_weight
......
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