Remove flag USE_SYMM_MULTI_LAYER
BUG=aomedia:2306
Change-Id: Id37c3d4dd0871e0f7addd66c540cb799e77e4396
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c
index 3680a9a..3e02884 100644
--- a/av1/encoder/encode_strategy.c
+++ b/av1/encoder/encode_strategy.c
@@ -86,41 +86,29 @@
AV1_COMMON *const cm = &cpi->common;
const FRAME_UPDATE_TYPE next_frame_update_type =
gf_group->update_type[gf_group->index];
-#if USE_SYMM_MULTI_LAYER
const int which_arf = (cpi->new_bwdref_update_rule == 1)
? gf_group->arf_update_idx[gf_group->index] > 0
: gf_group->arf_update_idx[gf_group->index];
-#else
- const int which_arf = gf_group->arf_update_idx[gf_group->index];
-#endif
if (cm->show_existing_frame == 1) {
cm->show_existing_frame = 0;
} else if (cpi->rc.is_last_bipred_frame) {
-#if USE_SYMM_MULTI_LAYER
// NOTE: When new structure is used, every bwdref will have one overlay
// frame. Therefore, there is no need to find out which frame to
// show in advance.
if (cpi->new_bwdref_update_rule == 0) {
-#endif
// NOTE: If the current frame is a last bi-predictive frame, it is
// needed next to show the BWDREF_FRAME, which is pointed by
// the last_fb_idxes[0] after reference frame buffer update
cpi->rc.is_last_bipred_frame = 0;
cm->show_existing_frame = 1;
cpi->existing_fb_idx_to_show = cm->remapped_ref_idx[0];
-#if USE_SYMM_MULTI_LAYER
}
-#endif
} else if (cpi->is_arf_filter_off[which_arf] &&
(next_frame_update_type == OVERLAY_UPDATE ||
next_frame_update_type == INTNL_OVERLAY_UPDATE)) {
-#if USE_SYMM_MULTI_LAYER
const int bwdref_to_show =
(cpi->new_bwdref_update_rule == 1) ? BWDREF_FRAME : ALTREF2_FRAME;
-#else
- const int bwdref_to_show = ALTREF2_FRAME;
-#endif
// Other parameters related to OVERLAY_UPDATE will be taken care of
// in av1_rc_get_second_pass_params(cpi)
cm->show_existing_frame = 1;
@@ -129,10 +117,9 @@
(next_frame_update_type == OVERLAY_UPDATE)
? get_ref_frame_map_idx(cm, ALTREF_FRAME)
: get_ref_frame_map_idx(cm, bwdref_to_show);
-#if USE_SYMM_MULTI_LAYER
- if (cpi->new_bwdref_update_rule == 0)
-#endif
+ if (cpi->new_bwdref_update_rule == 0) {
cpi->is_arf_filter_off[which_arf] = 0;
+ }
}
cpi->rc.is_src_frame_ext_arf = 0;
}
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 82fec7a..f6d612e 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -3509,7 +3509,6 @@
}
}
-#if USE_SYMM_MULTI_LAYER
// This function is used to shift the virtual indices of bwd reference
// frames as follows:
// BWD_REF -> ALT2_REF -> EXT_REF
@@ -3549,7 +3548,6 @@
cpi->common.remapped_ref_idx[ordered_bwd[i + 1] - LAST_FRAME];
}
}
-#endif // USE_SYMM_MULTI_LAYER
static void update_reference_frames(AV1_COMP *cpi) {
AV1_COMMON *const cm = &cpi->common;
@@ -3623,13 +3621,9 @@
#if CONFIG_DEBUG
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
assert(gf_group->update_type[gf_group->index] == INTNL_OVERLAY_UPDATE);
-#endif
-#if USE_SYMM_MULTI_LAYER
+#endif // CONFIG_DEBUG
const int bwdref_to_show =
(cpi->new_bwdref_update_rule == 1) ? BWDREF_FRAME : ALTREF2_FRAME;
-#else
- const int bwdref_to_show = ALTREF2_FRAME;
-#endif
// Deal with the special case for showing existing internal ALTREF_FRAME
// Refresh the LAST_FRAME with the ALTREF_FRAME and retire the LAST3_FRAME
// by updating the virtual indices.
@@ -3642,18 +3636,14 @@
memcpy(cpi->interp_filter_selected[LAST_FRAME],
cpi->interp_filter_selected[bwdref_to_show],
sizeof(cpi->interp_filter_selected[bwdref_to_show]));
-#if USE_SYMM_MULTI_LAYER
if (cpi->new_bwdref_update_rule == 1) {
lshift_bwd_ref_frames(cpi);
// pass outdated forward reference frame (previous LAST3) to the
// spared space
cm->remapped_ref_idx[EXTREF_FRAME - LAST_FRAME] = last3_remapped_idx;
} else {
-#endif
cm->remapped_ref_idx[bwdref_to_show - LAST_FRAME] = last3_remapped_idx;
-#if USE_SYMM_MULTI_LAYER
}
-#endif
} else { /* For non key/golden frames */
// === ALTREF_FRAME ===
if (cpi->refresh_alt_ref_frame) {
@@ -3678,7 +3668,6 @@
// === BWDREF_FRAME ===
if (cpi->refresh_bwd_ref_frame) {
-#if USE_SYMM_MULTI_LAYER
if (cpi->new_bwdref_update_rule) {
// We shift the backward reference frame as follows:
// BWDREF -> ALTREF2 -> EXTREF
@@ -3690,13 +3679,10 @@
rshift_bwd_ref_frames(cpi);
cm->remapped_ref_idx[BWDREF_FRAME - LAST_FRAME] = tmp;
} else {
-#endif // USE_SYMM_MULTI_LAYER
assign_frame_buffer_p(
&cm->ref_frame_map[get_ref_frame_map_idx(cm, BWDREF_FRAME)],
cm->cur_frame);
-#if USE_SYMM_MULTI_LAYER
}
-#endif
memcpy(cpi->interp_filter_selected[BWDREF_FRAME],
cpi->interp_filter_selected[0],
sizeof(cpi->interp_filter_selected[0]));
@@ -3762,11 +3748,7 @@
// If the new structure is used, we will always have overlay frames coupled
// with bwdref frames. Therefore, we won't have to perform this update
// in advance (we do this update when the overlay frame shows up).
-#if USE_SYMM_MULTI_LAYER
if (cpi->new_bwdref_update_rule == 0 && cpi->rc.is_last_bipred_frame) {
-#else
- if (cpi->rc.is_last_bipred_frame) {
-#endif
// Refresh the LAST_FRAME with the BWDREF_FRAME and retire the
// LAST3_FRAME by updating the virtual indices.
//
@@ -4480,12 +4462,8 @@
refresh_mask |=
(cpi->refresh_last_frame << get_ref_frame_map_idx(cm, LAST3_FRAME));
-#if USE_SYMM_MULTI_LAYER
const int bwd_ref_frame =
(cpi->new_bwdref_update_rule == 1) ? EXTREF_FRAME : BWDREF_FRAME;
-#else
- const int bwd_ref_frame = BWDREF_FRAME;
-#endif
refresh_mask |=
(cpi->refresh_bwd_ref_frame << get_ref_frame_map_idx(cm, bwd_ref_frame));
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 7292525..1b4d7cd 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -659,14 +659,12 @@
// frame of the same type as the current frame).
int fb_of_context_type[REF_FRAMES];
-#if USE_SYMM_MULTI_LAYER
// When true, a new rule for backward (future) reference frames is in effect:
// - BWDREF_FRAME is always the closest future frame available
// - ALTREF2_FRAME is always the 2nd closest future frame available
// - 'refresh_bwd_ref_frame' flag is used for updating both the BWDREF_FRAME
// and ALTREF2_FRAME. ('refresh_alt2_ref_frame' flag is irrelevant).
int new_bwdref_update_rule;
-#endif
int ext_refresh_frame_flags_pending;
int ext_refresh_last_frame;
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index 383644b..55c0055 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -1567,7 +1567,6 @@
0);
}
-#if USE_SYMM_MULTI_LAYER
// #define CHCEK_GF_PARAMETER
#ifdef CHCEK_GF_PARAMETER
void check_frame_params(GF_GROUP *const gf_group, int gf_interval,
@@ -1923,12 +1922,10 @@
return gf_update_frames;
}
#endif // USE_MANUAL_GF4_STRUCT
-#endif // USE_SYMM_MULTI_LAYER
static void define_gf_group_structure(AV1_COMP *cpi) {
RATE_CONTROL *const rc = &cpi->rc;
-#if USE_SYMM_MULTI_LAYER
const int max_pyr_height = cpi->oxcf.gf_max_pyr_height;
const int valid_customized_gf_length =
max_pyr_height >= MIN_PYRAMID_LVL && max_pyr_height <= MAX_PYRAMID_LVL &&
@@ -1948,7 +1945,6 @@
} else {
cpi->new_bwdref_update_rule = 0;
}
-#endif
TWO_PASS *const twopass = &cpi->twopass;
GF_GROUP *const gf_group = &twopass->gf_group;
@@ -2165,7 +2161,6 @@
gf_group->brf_src_offset[frame_index] = 0;
}
-#if USE_SYMM_MULTI_LAYER
#define NEW_MULTI_LVL_BOOST_VBR_ALLOC 1
#if NEW_MULTI_LVL_BOOST_VBR_ALLOC
@@ -2174,7 +2169,6 @@
{ 1.0, 0.0, 0.0 }, { 0.6, 0.4, 0 }, { 0.45, 0.35, 0.20 }
};
#endif // NEW_MULTI_LVL_BOOST_VBR_ALLOC
-#endif // USE_SYMM_MULTI_LAYER
static void allocate_gf_group_bits(AV1_COMP *cpi, int64_t gf_group_bits,
double group_error, int gf_arf_bits) {
RATE_CONTROL *const rc = &cpi->rc;
@@ -2229,13 +2223,11 @@
}
}
-#if USE_SYMM_MULTI_LAYER
#if NEW_MULTI_LVL_BOOST_VBR_ALLOC
// Save.
const int tmp_frame_index = frame_index;
int budget_reduced_from_leaf_level = 0;
#endif // NEW_MULTI_LVL_BOOST_VBR_ALLOC
-#endif // USE_SYMM_MULTI_LAYER
// Allocate bits to the other frames in the group.
const int normal_frames =
@@ -2266,7 +2258,6 @@
// TODO(zoeliu): To investigate whether the allocated bits on
// BIPRED_UPDATE frames need to be further adjusted.
gf_group->bit_allocation[frame_index] = target_frame_size;
-#if USE_SYMM_MULTI_LAYER
} else if (cpi->new_bwdref_update_rule &&
gf_group->update_type[frame_index] == INTNL_OVERLAY_UPDATE) {
assert(gf_group->pyramid_height <= MAX_PYRAMID_LVL &&
@@ -2277,7 +2268,6 @@
gf_group->bit_allocation[arf_pos] = target_frame_size;
// Note: Boost, if needed, is added in the next loop.
-#endif // USE_SYMM_MULTI_LAYER
} else {
assert(gf_group->update_type[frame_index] == LF_UPDATE ||
gf_group->update_type[frame_index] == INTNL_OVERLAY_UPDATE);
@@ -2305,7 +2295,6 @@
}
}
-#if USE_SYMM_MULTI_LAYER
#if MULTI_LVL_BOOST_VBR_CQ
if (budget_reduced_from_leaf_level > 0) {
// Restore.
@@ -2342,13 +2331,8 @@
}
}
#endif // MULTI_LVL_BOOST_VBR_CQ
-#endif // USE_SYMM_MULTI_LAYER
-#if USE_SYMM_MULTI_LAYER
if (cpi->new_bwdref_update_rule == 0 && rc->source_alt_ref_pending) {
-#else
- if (rc->source_alt_ref_pending) {
-#endif
if (cpi->num_extra_arfs) {
// NOTE: For bit allocation, move the allocated bits associated with
// INTNL_OVERLAY_UPDATE to the corresponding INTNL_ARF_UPDATE.
@@ -2662,7 +2646,6 @@
// Note: When new pyramid structure is used through
// 'define_customized_gf_group_structure()' function, this value is
// overridden.
-#if USE_SYMM_MULTI_LAYER
if (rc->baseline_gf_interval == MIN_GF_INTERVAL &&
rc->source_alt_ref_pending) {
cpi->num_extra_arfs = 1;
@@ -2671,18 +2654,8 @@
rc->source_alt_ref_pending,
oxcf->gf_max_pyr_height);
}
-#else
- cpi->num_extra_arfs = get_number_of_extra_arfs(rc->baseline_gf_interval,
- rc->source_alt_ref_pending,
- oxcf->gf_max_pyr_height);
-#endif // USE_SYMM_MULTI_LAYER
}
-#if !USE_SYMM_MULTI_LAYER
- // Currently at maximum two extra ARFs' are allowed
- assert(cpi->num_extra_arfs <= MAX_EXT_ARFS);
-#endif
-
rc->frames_till_gf_update_due = rc->baseline_gf_interval;
rc->bipred_group_interval = BFG_INTERVAL;
diff --git a/av1/encoder/firstpass.h b/av1/encoder/firstpass.h
index c7e7e70..35af2d1 100644
--- a/av1/encoder/firstpass.h
+++ b/av1/encoder/firstpass.h
@@ -114,12 +114,10 @@
unsigned char arf_src_offset[MAX_STATIC_GF_GROUP_LENGTH + 1];
unsigned char arf_update_idx[MAX_STATIC_GF_GROUP_LENGTH + 1];
unsigned char arf_ref_idx[MAX_STATIC_GF_GROUP_LENGTH + 1];
-#if USE_SYMM_MULTI_LAYER
unsigned char arf_pos_in_gf[MAX_STATIC_GF_GROUP_LENGTH + 1];
unsigned char pyramid_level[MAX_STATIC_GF_GROUP_LENGTH + 1];
unsigned char pyramid_height;
unsigned char pyramid_lvl_nodes[MAX_PYRAMID_LVL];
-#endif // USE_SYMM_MULTI_LAYER
unsigned char brf_src_offset[MAX_STATIC_GF_GROUP_LENGTH + 1];
unsigned char bidir_pred_enabled[MAX_STATIC_GF_GROUP_LENGTH + 1];
int bit_allocation[MAX_STATIC_GF_GROUP_LENGTH + 1];
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index 6635304..20d6aab 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -1053,7 +1053,7 @@
// Constrained quality use slightly lower active best.
active_best_quality = active_best_quality * 15 / 16;
-#if USE_SYMM_MULTI_LAYER && MULTI_LVL_BOOST_VBR_CQ
+#if MULTI_LVL_BOOST_VBR_CQ
if (gf_group->update_type[gf_group->index] == ARF_UPDATE ||
(is_intrl_arf_boost && !cpi->new_bwdref_update_rule)) {
#if REDUCE_LAST_ALT_BOOST
@@ -1074,7 +1074,7 @@
++this_height;
}
}
-#endif // USE_SYMM_MULTI_LAYER && MULTI_LVL_BOOST_VBR_CQ
+#endif // MULTI_LVL_BOOST_VBR_CQ
} else if (oxcf->rc_mode == AOM_Q) {
if (!cpi->refresh_alt_ref_frame && !is_intrl_arf_boost) {
active_best_quality = cq_level;
@@ -1092,7 +1092,6 @@
assert(rc->arf_q >= 0); // Ensure it is set to a valid value.
active_best_quality = rc->arf_q;
}
-#if USE_SYMM_MULTI_LAYER
if (cpi->new_bwdref_update_rule && is_intrl_arf_boost) {
int this_height = gf_group_pyramid_level(cpi);
while (this_height < gf_group->pyramid_height) {
@@ -1100,14 +1099,11 @@
++this_height;
}
} else {
-#endif
// Modify best quality for second level arfs. For mode AOM_Q this
// becomes the baseline frame q.
if (gf_group->rf_level[gf_group->index] == GF_ARF_LOW)
active_best_quality = (active_best_quality + cq_level + 1) / 2;
-#if USE_SYMM_MULTI_LAYER
}
-#endif
}
} else {
active_best_quality = get_gf_active_quality(rc, q, bit_depth);
@@ -1117,7 +1113,6 @@
active_best_quality = min_boost - (int)(boost * rc->arf_boost_factor);
#endif
-#if USE_SYMM_MULTI_LAYER
if (cpi->new_bwdref_update_rule && is_intrl_arf_boost) {
int this_height = gf_group_pyramid_level(cpi);
while (this_height < gf_group->pyramid_height) {
@@ -1126,7 +1121,6 @@
++this_height;
}
}
-#endif
}
} else {
if (oxcf->rc_mode == AOM_Q) {
@@ -1431,17 +1425,13 @@
case INTNL_ARF_UPDATE:
cpi->refresh_last_frame = 0;
cpi->refresh_golden_frame = 0;
-#if USE_SYMM_MULTI_LAYER
if (cpi->new_bwdref_update_rule == 1) {
cpi->refresh_bwd_ref_frame = 1;
cpi->refresh_alt2_ref_frame = 0;
} else {
-#endif
cpi->refresh_bwd_ref_frame = 0;
cpi->refresh_alt2_ref_frame = 1;
-#if USE_SYMM_MULTI_LAYER
}
-#endif
cpi->refresh_alt_ref_frame = 0;
break;
diff --git a/av1/encoder/ratectrl.h b/av1/encoder/ratectrl.h
index 5297aa1..2bad55e 100644
--- a/av1/encoder/ratectrl.h
+++ b/av1/encoder/ratectrl.h
@@ -40,14 +40,11 @@
// (Old structure supports height = 1, but does NOT support height = 4).
#define MIN_PYRAMID_LVL 2
#define MAX_PYRAMID_LVL 4
-#define USE_SYMM_MULTI_LAYER 1
#define REDUCE_LAST_ALT_BOOST 1
#define REDUCE_LAST_GF_LENGTH 1
#define MULTI_LVL_BOOST_VBR_CQ 1
-#if USE_SYMM_MULTI_LAYER
#define USE_MANUAL_GF4_STRUCT 0
-#endif
#define MIN_GF_INTERVAL 4
#define MAX_GF_INTERVAL 16