Respect max_gf_interval in case of fwd key-frame.
Change-Id: I188234f9bf20b4ee2a0983c90200d31c2abe6481
diff --git a/av1/encoder/pass2_strategy.c b/av1/encoder/pass2_strategy.c
index b6e14ec..4cd6062 100644
--- a/av1/encoder/pass2_strategy.c
+++ b/av1/encoder/pass2_strategy.c
@@ -1008,7 +1008,7 @@
AOMMAX(MIN_FWD_KF_INTERVAL, rc->min_gf_interval)) &&
(rc->frames_to_key != i)) {
// if possible, merge the last two gf groups
- if (rc->frames_to_key <= get_max_gf_length(oxcf->gf_max_pyr_height)) {
+ if (rc->frames_to_key <= active_max_gf_interval) {
rc->baseline_gf_interval = rc->frames_to_key;
// if merging the last two gf groups creates a group that is too long,
// split them and force the last gf group to be the MIN_FWD_KF_INTERVAL
diff --git a/test/fwd_kf_test.cc b/test/fwd_kf_test.cc
index ac9ccb6..6c428d9 100644
--- a/test/fwd_kf_test.cc
+++ b/test/fwd_kf_test.cc
@@ -24,7 +24,7 @@
const FwdKfTestParam kTestParams[] = {
{ 4, 37.3 }, { 6, 36.5 }, { 8, 35.8 },
- { 12, 34.3 }, { 16, 34.3 }, { 18, 34.4 }
+ { 12, 34.3 }, { 16, 34.3 }, { 18, 33.7 }
};
// Params: encoding mode and index into the kMaxKfDists array to control