Enable flex-refs by default when altref2 is on
Compared against baseline with default enabled tools (except for
ext-tx and global-motion for speed concern):
altref2 -> altref2 + flex-refs
lowres: avg_psnr -0.395% -> -0.460%
midres: avg_psnr -0.418% -> -0.478%
In particular, flex-refs improves the coding performance for the
following 3 clips while no impact on all other clips:
bowing_cif.y4m: avg_psnr 0.023% -> -1.022%
pamphlet_cif.y4m: avg_psnr 0.454% -> -1.111%
snow_mnt_480p.y4m: avg_psnr -0.162% -> -1.948%
Change-Id: I612c1ae5feb1f07d8bd5aaf67e21a076445e10b9
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index a1f53b7..6e4be09 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -580,9 +580,9 @@
curr_frame == 0 ? rc->worst_quality : rc->last_q[KEY_FRAME] * 2;
} else {
if (!rc->is_src_frame_alt_ref && (cpi->refresh_golden_frame ||
-#if CONFIG_EXT_REFS && CONFIG_ALTREF2
+#if CONFIG_ALTREF2
cpi->refresh_alt2_ref_frame ||
-#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
+#endif // CONFIG_ALTREF2
cpi->refresh_alt_ref_frame)) {
active_worst_quality = curr_frame == 1 ? rc->last_q[KEY_FRAME] * 5 / 4
: rc->last_q[INTER_FRAME];
@@ -1009,9 +1009,9 @@
av1_compute_qdelta(rc, q_val, q_val * q_adj_factor, cm->bit_depth);
}
} else if (!rc->is_src_frame_alt_ref && (cpi->refresh_golden_frame ||
-#if CONFIG_EXT_REFS && CONFIG_ALTREF2
+#if CONFIG_ALTREF2
cpi->refresh_alt2_ref_frame ||
-#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
+#endif // CONFIG_ALTREF2
cpi->refresh_alt_ref_frame)) {
// Use the lower of active_worst_quality and recent
// average Q as basis for GF/ARF best Q limit unless last frame was
@@ -1032,11 +1032,11 @@
active_best_quality = active_best_quality * 15 / 16;
} else if (oxcf->rc_mode == AOM_Q) {
-#if CONFIG_EXT_REFS && CONFIG_ALTREF2
+#if CONFIG_ALTREF2
if (!cpi->refresh_alt_ref_frame && !cpi->refresh_alt2_ref_frame) {
#else
if (!cpi->refresh_alt_ref_frame) {
-#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
+#endif // CONFIG_ALTREF2
active_best_quality = cq_level;
} else {
active_best_quality = get_gf_active_quality(rc, q, cm->bit_depth);
@@ -1069,9 +1069,9 @@
(cpi->twopass.gf_zeromotion_pct < VLOW_MOTION_THRESHOLD)) {
if (frame_is_intra_only(cm) ||
(!rc->is_src_frame_alt_ref && (cpi->refresh_golden_frame ||
-#if CONFIG_EXT_REFS && CONFIG_ALTREF2
+#if CONFIG_ALTREF2
cpi->refresh_alt2_ref_frame ||
-#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
+#endif // CONFIG_ALTREF2
cpi->refresh_alt_ref_frame))) {
active_best_quality -=
(cpi->twopass.extend_minq + cpi->twopass.extend_minq_fast);
@@ -1232,11 +1232,11 @@
// Decrement count down till next gf
if (rc->frames_till_gf_update_due > 0) rc->frames_till_gf_update_due--;
-#if CONFIG_EXT_REFS && CONFIG_ALTREF2
+#if CONFIG_ALTREF2
} else if (!cpi->refresh_alt_ref_frame && !cpi->refresh_alt2_ref_frame) {
#else
} else if (!cpi->refresh_alt_ref_frame) {
-#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
+#endif // CONFIG_ALTREF2
// Decrement count down till next gf
if (rc->frames_till_gf_update_due > 0) rc->frames_till_gf_update_due--;
@@ -1267,9 +1267,9 @@
} else {
if (!rc->is_src_frame_alt_ref &&
!(cpi->refresh_golden_frame ||
-#if CONFIG_EXT_REFS && CONFIG_ALTREF2
+#if CONFIG_ALTREF2
cpi->refresh_alt2_ref_frame ||
-#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
+#endif // CONFIG_ALTREF2
cpi->refresh_alt_ref_frame)) {
rc->last_q[INTER_FRAME] = qindex;
rc->avg_frame_qindex[INTER_FRAME] =
@@ -1292,9 +1292,9 @@
if ((qindex < rc->last_boosted_qindex) || (cm->frame_type == KEY_FRAME) ||
(!rc->constrained_gf_group &&
(cpi->refresh_alt_ref_frame ||
-#if CONFIG_EXT_REFS && CONFIG_ALTREF2
+#if CONFIG_ALTREF2
cpi->refresh_alt2_ref_frame ||
-#endif // CONFIG_EXT_REFS && CONFIG_ALTREF2
+#endif // CONFIG_ALTREF2
(cpi->refresh_golden_frame && !rc->is_src_frame_alt_ref)))) {
rc->last_boosted_qindex = qindex;
}