ref: 8069f310767e1a9a3de77f25ef0db09cbafbf0cd
parent: 29938b3a5acb18000d2db55f617ae38310e24973
author: hui su <[email protected]>
date: Thu Apr 20 11:49:52 EDT 2017
Adjust alt-ref selection in define_gf_group() 107de19698 changes the encoder alt-ref selection behavior. Assuming min_gf_interval = max_gf_interval = 4, the frame order would be frm_1 arf_1 frm_2 frm_3 frm_4 frm_5 arf_2 before 107de19698; frm_1 arf_1 frm_2 frm_3 frm_4 arf_2 frm_5 after 107de19698. This patch reverts such alt-ref placement change. Change-Id: I93a4a65036575151286f004d455d4fcea88a1550
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2370,8 +2370,8 @@
cpi->common.bit_depth));
active_min_gf_interval =
rc->min_gf_interval + arf_active_or_kf + VPXMIN(2, int_max_q / 200);
- if (active_min_gf_interval > rc->max_gf_interval)
- active_min_gf_interval = rc->max_gf_interval;
+ active_min_gf_interval =
+ VPXMIN(active_min_gf_interval, rc->max_gf_interval + arf_active_or_kf);
if (cpi->multi_arf_allowed) {
active_max_gf_interval = rc->max_gf_interval;
@@ -2382,11 +2382,14 @@
// interval to spread the cost of the GF.
active_max_gf_interval = 12 + arf_active_or_kf + VPXMIN(4, (int_lbq / 6));
- // We have: active_min_gf_interval <= rc->max_gf_interval
- if (active_max_gf_interval < active_min_gf_interval)
+ // We have: active_min_gf_interval <=
+ // rc->max_gf_interval + arf_active_or_kf.
+ if (active_max_gf_interval < active_min_gf_interval) {
active_max_gf_interval = active_min_gf_interval;
- else if (active_max_gf_interval > rc->max_gf_interval)
- active_max_gf_interval = rc->max_gf_interval;
+ } else {
+ active_max_gf_interval = VPXMIN(active_max_gf_interval,
+ rc->max_gf_interval + arf_active_or_kf);
+ }
// Would the active max drop us out just before the near the next kf?
if ((active_max_gf_interval <= rc->frames_to_key) &&