Commit 5a978838 authored by Zoe Liu's avatar Zoe Liu

Add dependency of ext-comp-refs on one-sided-compound

When ext-comp-refs is enabled, one-sided-compound is enabled by default,
which ensures the use of ext-comp-refs is an extension of
one-sided-compound. Both coding tools allow the use of same-sided
reference frame pairs for compound prediction.

Also, remove the dependency of ext-comp-refs on var-refs, i.e. these two
coding tools can be independently enabled. They can still work together
if both are enabled simultaneously.

Change-Id: I3134e7e2956dc35d557fe814f5d801d473683650
parent 1cfe474b
......@@ -580,12 +580,12 @@ int av1_get_pred_context_comp_ref_p(const AV1_COMMON *cm,
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS // No change to bitstream
#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
// Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1
const int bwd_ref_sign_idx = 1;
#else
const int bwd_ref_sign_idx = cm->ref_frame_sign_bias[cm->comp_bwd_ref[0]];
#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS
#endif // CONFIG_ONE_SIDED_COMPOUND
const int fwd_ref_sign_idx = !bwd_ref_sign_idx;
(void)cm;
......@@ -690,12 +690,12 @@ int av1_get_pred_context_comp_ref_p1(const AV1_COMMON *cm,
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS // No change to bitstream
#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
// Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1
const int bwd_ref_sign_idx = 1;
#else
const int bwd_ref_sign_idx = cm->ref_frame_sign_bias[cm->comp_bwd_ref[0]];
#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS
#endif // CONFIG_ONE_SIDED_COMPOUND
const int fwd_ref_sign_idx = !bwd_ref_sign_idx;
(void)cm;
......@@ -798,12 +798,12 @@ int av1_get_pred_context_comp_ref_p2(const AV1_COMMON *cm,
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS // No change to bitstream
#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
// Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1
const int bwd_ref_sign_idx = 1;
#else
const int bwd_ref_sign_idx = cm->ref_frame_sign_bias[cm->comp_bwd_ref[0]];
#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS
#endif // CONFIG_ONE_SIDED_COMPOUND
const int fwd_ref_sign_idx = !bwd_ref_sign_idx;
(void)cm;
......@@ -989,7 +989,7 @@ int av1_get_pred_context_comp_bwdref_p1(const AV1_COMMON *cm,
return av1_get_pred_context_brf_or_arf2(xd);
}
#else // !CONFIG_ALTREF2
#else // !CONFIG_ALTREF2
// Returns a context number for the given MB prediction signal
int av1_get_pred_context_comp_bwdref_p(const AV1_COMMON *cm,
......@@ -1004,12 +1004,12 @@ int av1_get_pred_context_comp_bwdref_p(const AV1_COMMON *cm,
// The mode info data structure has a one element border above and to the
// left of the entries corresponding to real macroblocks.
// The prediction flags in these dummy entries are initialized to 0.
#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS // No change to bitstream
#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
// Code seems to assume that signbias of cm->comp_bwd_ref[0] is always 1
const int bwd_ref_sign_idx = 1;
#else
const int bwd_ref_sign_idx = cm->ref_frame_sign_bias[cm->comp_bwd_ref[0]];
#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS
#endif // CONFIG_ONE_SIDED_COMPOUND
const int fwd_ref_sign_idx = !bwd_ref_sign_idx;
(void)cm;
......
......@@ -94,7 +94,7 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
struct aom_read_bit_buffer *rb);
static int is_compound_reference_allowed(const AV1_COMMON *cm) {
#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS // Normative in decoder
#if CONFIG_ONE_SIDED_COMPOUND // Normative in decoder
return !frame_is_intra_only(cm);
#else
int i;
......@@ -103,7 +103,7 @@ static int is_compound_reference_allowed(const AV1_COMMON *cm) {
if (cm->ref_frame_sign_bias[i + 1] != cm->ref_frame_sign_bias[1]) return 1;
return 0;
#endif // CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS
#endif // CONFIG_ONE_SIDED_COMPOUND
}
static void setup_compound_reference_mode(AV1_COMMON *cm) {
......
......@@ -1459,15 +1459,15 @@ static void read_ref_frames(AV1_COMMON *const cm, MACROBLOCKD *const xd,
#endif // CONFIG_EXT_COMP_REFS
// Normative in decoder (for low delay)
#if CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS
#if CONFIG_ONE_SIDED_COMPOUND
const int idx = 1;
#else // !(CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS)
#else // !CONFIG_ONE_SIDED_COMPOUND
#if CONFIG_EXT_REFS
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_EXT_COMP_REFS
#endif // CONFIG_ONE_SIDED_COMPOUND
const int ctx = av1_get_pred_context_comp_ref_p(cm, xd);
#if CONFIG_VAR_REFS
......
......@@ -5347,14 +5347,14 @@ void av1_encode_frame(AV1_COMP *cpi) {
// side behavior is where the ALT ref buffer has opposite sign bias to
// the other two.
if (!frame_is_intra_only(cm)) {
#if !(CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS)
#if !CONFIG_ONE_SIDED_COMPOUND
if ((cm->ref_frame_sign_bias[ALTREF_FRAME] ==
cm->ref_frame_sign_bias[GOLDEN_FRAME]) ||
(cm->ref_frame_sign_bias[ALTREF_FRAME] ==
cm->ref_frame_sign_bias[LAST_FRAME])) {
cpi->allow_comp_inter_inter = 0;
} else {
#endif // !(CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS)
#endif // !CONFIG_ONE_SIDED_COMPOUND
cpi->allow_comp_inter_inter = 1;
#if CONFIG_EXT_REFS
cm->comp_fwd_ref[0] = LAST_FRAME;
......@@ -5373,10 +5373,9 @@ void av1_encode_frame(AV1_COMP *cpi) {
cm->comp_var_ref[0] = LAST_FRAME;
cm->comp_var_ref[1] = GOLDEN_FRAME;
#endif // CONFIG_EXT_REFS
#if !(CONFIG_ONE_SIDED_COMPOUND || \
CONFIG_EXT_COMP_REFS) // Normative in encoder
#if !CONFIG_ONE_SIDED_COMPOUND // Normative in encoder
}
#endif // !(CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS)
#endif // !CONFIG_ONE_SIDED_COMPOUND
} else {
cpi->allow_comp_inter_inter = 0;
}
......
......@@ -347,13 +347,14 @@ static void setup_frame(AV1_COMP *cpi) {
av1_zero(cpi->interp_filter_selected[0]);
}
#if CONFIG_EXT_REFS
#if CONFIG_ONE_SIDED_COMPOUND // No change to bitstream
#if CONFIG_ONE_SIDED_COMPOUND && \
!CONFIG_EXT_COMP_REFS // No change to bitstream
if (cpi->sf.recode_loop == DISALLOW_RECODE) {
cpi->refresh_bwd_ref_frame = cpi->refresh_last_frame;
cpi->rc.is_bipred_frame = 1;
}
#endif
#endif
#endif // CONFIG_ONE_SIDED_COMPOUND && !CONFIG_EXT_COMP_REFS
#endif // CONFIG_EXT_REFS
#if CONFIG_NO_FRAME_CONTEXT_SIGNALING
if (frame_is_intra_only(cm) || cm->error_resilient_mode ||
cm->frame_refs[0].idx < 0) {
......@@ -4540,13 +4541,13 @@ static int get_ref_frame_flags(const AV1_COMP *cpi) {
const int last3_is_last =
map[cpi->lst_fb_idxes[2]] == map[cpi->lst_fb_idxes[0]];
const int gld_is_last = map[cpi->gld_fb_idx] == map[cpi->lst_fb_idxes[0]];
#if CONFIG_ONE_SIDED_COMPOUND
#if CONFIG_ONE_SIDED_COMPOUND && !CONFIG_EXT_COMP_REFS
const int alt_is_last = map[cpi->alt_fb_idx] == map[cpi->lst_fb_idxes[0]];
const int last3_is_last2 =
map[cpi->lst_fb_idxes[2]] == map[cpi->lst_fb_idxes[1]];
const int gld_is_last2 = map[cpi->gld_fb_idx] == map[cpi->lst_fb_idxes[1]];
const int gld_is_last3 = map[cpi->gld_fb_idx] == map[cpi->lst_fb_idxes[2]];
#else // !CONFIG_ONE_SIDED_COMPOUND
#else // !CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS
const int bwd_is_last = map[cpi->bwd_fb_idx] == map[cpi->lst_fb_idxes[0]];
const int alt_is_last = map[cpi->alt_fb_idx] == map[cpi->lst_fb_idxes[0]];
......@@ -4559,7 +4560,7 @@ static int get_ref_frame_flags(const AV1_COMP *cpi) {
const int bwd_is_last3 = map[cpi->bwd_fb_idx] == map[cpi->lst_fb_idxes[2]];
const int bwd_is_gld = map[cpi->bwd_fb_idx] == map[cpi->gld_fb_idx];
#endif // CONFIG_ONE_SIDED_COMPOUND
#endif // CONFIG_ONE_SIDED_COMPOUND && !CONFIG_EXT_COMP_REFS
#if CONFIG_ALTREF2
const int alt2_is_last = map[cpi->alt2_fb_idx] == map[cpi->lst_fb_idxes[0]];
......@@ -4606,15 +4607,16 @@ static int get_ref_frame_flags(const AV1_COMP *cpi) {
if (gld_is_last2 || gld_is_last3) flags &= ~AOM_GOLD_FLAG;
#if CONFIG_ONE_SIDED_COMPOUND // Changes LL & HL bitstream
#if CONFIG_ONE_SIDED_COMPOUND && \
!CONFIG_EXT_COMP_REFS // Changes LL & HL bitstream
/* Allow biprediction between two identical frames (e.g. bwd_is_last = 1) */
if (bwd_is_alt && (flags & AOM_BWD_FLAG)) flags &= ~AOM_BWD_FLAG;
#else // !CONFIG_ONE_SIDED_COMPOUND
#else // !CONFIG_ONE_SIDED_COMPOUND || CONFIG_EXT_COMP_REFS
if ((bwd_is_last || bwd_is_last2 || bwd_is_last3 || bwd_is_gld ||
bwd_is_alt) &&
(flags & AOM_BWD_FLAG))
flags &= ~AOM_BWD_FLAG;
#endif // CONFIG_ONE_SIDED_COMPOUND
#endif // CONFIG_ONE_SIDED_COMPOUND && !CONFIG_EXT_COMP_REFS
#if CONFIG_ALTREF2
if ((alt2_is_last || alt2_is_last2 || alt2_is_last3 || alt2_is_gld ||
......
......@@ -10811,7 +10811,7 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
// This is only used in motion vector unit test.
if (cpi->oxcf.motion_vector_unit_test && ref_frame == INTRA_FRAME) continue;
#if CONFIG_ONE_SIDED_COMPOUND // Changes LL bitstream
#if CONFIG_ONE_SIDED_COMPOUND && !CONFIG_EXT_COMP_REFS // Changes LL bitstream
#if CONFIG_EXT_REFS
if (cpi->oxcf.pass == 0) {
// Complexity-compression trade-offs
......@@ -10820,8 +10820,8 @@ void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
if (second_ref_frame == ALTREF_FRAME) continue;
// if (second_ref_frame == BWDREF_FRAME) continue;
}
#endif
#endif
#endif // CONFIG_EXT_REFS
#endif // CONFIG_ONE_SIDED_COMPOUND && !CONFIG_EXT_COMP_REFS
comp_pred = second_ref_frame > INTRA_FRAME;
if (comp_pred) {
if (!cpi->allow_comp_inter_inter) continue;
......
......@@ -555,8 +555,7 @@ post_process_cmdline() {
enabled ncobmc_adapt_weight && enable_feature motion_var
enabled bgsprite && enable_feature global_motion
enabled ext_comp_refs && enable_feature ext_refs
enabled ext_comp_refs && enable_feature var_refs
enabled ext_comp_refs && disable_feature one_sided_compound
enabled ext_comp_refs && enable_feature one_sided_compound
enabled altref2 && enable_feature ext_refs
enabled altref2 && enable_feature flex_refs
enabled rect_tx_ext && enable_feature rect_tx
......
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