Remove experimental flags for symmetric GF struct
Following flags are removed here:
- MULTI_LVL_BOOST_VBR_CQ
- NEW_MULTI_LVL_BOOST_VBR_ALLOC
- REDUCE_LAST_GF_LENGTH
- REDUCE_LAST_ALT_BOOST
These were on by default already, and multiple experiments have shown
that they provide gains.
So, no need for a knob to turn them off.
BUG=aomedia:2306
Change-Id: I458d2508009ca60cd05c45ef7319c74e8c5510da
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index d2ff61f..0279a78 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -2026,14 +2026,10 @@
gf_group->brf_src_offset[frame_index] = 0;
}
-#define NEW_MULTI_LVL_BOOST_VBR_ALLOC 1
-
-#if NEW_MULTI_LVL_BOOST_VBR_ALLOC
#define LEAF_REDUCTION_FACTOR 0.75
static double lvl_budget_factor[MAX_PYRAMID_LVL - 1][MAX_PYRAMID_LVL - 1] = {
{ 1.0, 0.0, 0.0 }, { 0.6, 0.4, 0 }, { 0.45, 0.35, 0.20 }
};
-#endif // NEW_MULTI_LVL_BOOST_VBR_ALLOC
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;
@@ -2088,11 +2084,9 @@
}
}
-#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
// Allocate bits to the other frames in the group.
const int normal_frames =
@@ -2137,18 +2131,12 @@
assert(gf_group->update_type[frame_index] == LF_UPDATE ||
gf_group->update_type[frame_index] == INTNL_OVERLAY_UPDATE);
gf_group->bit_allocation[frame_index] = target_frame_size;
-#if MULTI_LVL_BOOST_VBR_CQ
if (cpi->new_bwdref_update_rule) {
-#if NEW_MULTI_LVL_BOOST_VBR_ALLOC
const int this_budget_reduction =
(int)(target_frame_size * LEAF_REDUCTION_FACTOR);
gf_group->bit_allocation[frame_index] -= this_budget_reduction;
budget_reduced_from_leaf_level += this_budget_reduction;
-#else
- gf_group->bit_allocation[frame_index] -= (target_frame_size >> 1);
-#endif // NEW_MULTI_LVL_BOOST_VBR_ALLOC
}
-#endif // MULTI_LVL_BOOST_VBR_CQ
}
++frame_index;
@@ -2160,7 +2148,6 @@
}
}
-#if MULTI_LVL_BOOST_VBR_CQ
if (budget_reduced_from_leaf_level > 0) {
// Restore.
frame_index = tmp_frame_index;
@@ -2174,16 +2161,11 @@
const int arf_pos = gf_group->arf_pos_in_gf[frame_index];
const int this_lvl = gf_group->pyramid_level[arf_pos];
const int dist2top = gf_group->pyramid_height - 1 - this_lvl;
-#if NEW_MULTI_LVL_BOOST_VBR_ALLOC
const double lvl_boost_factor =
lvl_budget_factor[gf_group->pyramid_height - 2][dist2top];
const int extra_size =
(int)(budget_reduced_from_leaf_level * lvl_boost_factor /
gf_group->pyramid_lvl_nodes[this_lvl]);
-#else
- const int target_frame_size = gf_group->bit_allocation[arf_pos];
- const int extra_size = target_frame_size >> dist2top;
-#endif // NEW_MULTI_LVL_BOOST_VBR_ALLOC
gf_group->bit_allocation[arf_pos] += extra_size;
}
++frame_index;
@@ -2195,7 +2177,6 @@
}
}
}
-#endif // MULTI_LVL_BOOST_VBR_CQ
if (cpi->new_bwdref_update_rule == 0 && rc->source_alt_ref_pending) {
if (cpi->num_extra_arfs) {
@@ -2417,7 +2398,6 @@
#define REDUCE_GF_LENGTH_TO_KEY_THRESH 9
#define REDUCE_GF_LENGTH_BY 1
int alt_offset = 0;
-#if REDUCE_LAST_GF_LENGTH
// The length reduction strategy is tweaked using AOM_Q mode, and doesn't work
// for VBR mode.
// Also, we don't have do adjustment for lossless mode.
@@ -2449,7 +2429,6 @@
i -= roll_back;
}
}
-#endif // REDUCE_LAST_GF_LENGTH
// Should we use the alternate reference frame.
if (use_alt_ref) {
@@ -2492,7 +2471,6 @@
rc->baseline_gf_interval = i - rc->source_alt_ref_pending;
}
-#if REDUCE_LAST_ALT_BOOST
#define LAST_ALR_BOOST_FACTOR 0.2f
rc->arf_boost_factor = 1.0;
if (rc->source_alt_ref_pending && !is_lossless_requested(&cpi->oxcf)) {
@@ -2502,7 +2480,6 @@
rc->arf_boost_factor = LAST_ALR_BOOST_FACTOR;
}
}
-#endif
if (!cpi->extra_arf_allowed) {
cpi->num_extra_arfs = 0;
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index 20d6aab..1a9f0be 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -558,13 +558,11 @@
arfgf_low_motion_minq, arfgf_high_motion_minq);
}
-#if REDUCE_LAST_ALT_BOOST
static int get_gf_high_motion_quality(int q, aom_bit_depth_t bit_depth) {
int *arfgf_high_motion_minq;
ASSIGN_MINQ_TABLE(bit_depth, arfgf_high_motion_minq);
return arfgf_high_motion_minq[q];
}
-#endif
static int calc_active_worst_quality_one_pass_vbr(const AV1_COMP *cpi) {
const RATE_CONTROL *const rc = &cpi->rc;
@@ -1053,17 +1051,14 @@
// Constrained quality use slightly lower active best.
active_best_quality = active_best_quality * 15 / 16;
-#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
if (gf_group->update_type[gf_group->index] == ARF_UPDATE) {
const int min_boost = get_gf_high_motion_quality(q, bit_depth);
const int boost = min_boost - active_best_quality;
active_best_quality = min_boost - (int)(boost * rc->arf_boost_factor);
}
-#endif // REDUCE_LAST_ALT_BOOST
*arf_q = active_best_quality;
} else if (cpi->new_bwdref_update_rule && is_intrl_arf_boost) {
assert(rc->arf_q >= 0); // Ensure it is set to a valid value.
@@ -1074,7 +1069,6 @@
++this_height;
}
}
-#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;
@@ -1082,12 +1076,10 @@
if (gf_group->update_type[gf_group->index] == ARF_UPDATE) {
active_best_quality = get_gf_active_quality(rc, q, bit_depth);
*arf_q = active_best_quality;
-#if REDUCE_LAST_ALT_BOOST
const int min_boost = get_gf_high_motion_quality(q, bit_depth);
const int boost = min_boost - active_best_quality;
active_best_quality = min_boost - (int)(boost * rc->arf_boost_factor);
-#endif
} else {
assert(rc->arf_q >= 0); // Ensure it is set to a valid value.
active_best_quality = rc->arf_q;
@@ -1107,12 +1099,10 @@
}
} else {
active_best_quality = get_gf_active_quality(rc, q, bit_depth);
-#if REDUCE_LAST_ALT_BOOST
const int min_boost = get_gf_high_motion_quality(q, bit_depth);
const int boost = min_boost - active_best_quality;
active_best_quality = min_boost - (int)(boost * rc->arf_boost_factor);
-#endif
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) {
diff --git a/av1/encoder/ratectrl.h b/av1/encoder/ratectrl.h
index c8bcaae..8faf662 100644
--- a/av1/encoder/ratectrl.h
+++ b/av1/encoder/ratectrl.h
@@ -40,9 +40,6 @@
// (Old structure supports height = 1, but does NOT support height = 4).
#define MIN_PYRAMID_LVL 2
#define MAX_PYRAMID_LVL 4
-#define REDUCE_LAST_ALT_BOOST 1
-#define REDUCE_LAST_GF_LENGTH 1
-#define MULTI_LVL_BOOST_VBR_CQ 1
#define MIN_GF_INTERVAL 4
#define MAX_GF_INTERVAL 16