first pass: Respect the rc->max_gf_interval. max_gf_interval may be provided by the user, or we may have set it to a default value in av1_rc_init(). So, we should respect that value in the breakout condition, instead of recalculating it based on pyramid levels. No change in stats if there was no user provided value for max_gf_interval. Change-Id: Ie462ba8b53229dd96d8b7c10a867caf01476f653
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c index 62d21d5..eefce39 100644 --- a/av1/encoder/firstpass.c +++ b/av1/encoder/firstpass.c
@@ -2216,6 +2216,7 @@ double boost_score = 0.0; int active_min_gf_interval; + int active_max_gf_interval; double gf_group_err = 0.0; #if GROUP_ADAPTIVE_MAXQ double gf_group_raw_error = 0.0; @@ -2282,6 +2283,7 @@ // TODO(urvang): Try logic to vary min and max interval based on q. active_min_gf_interval = rc->min_gf_interval; + active_max_gf_interval = rc->max_gf_interval; double avg_sr_coded_error = 0; double avg_raw_err_stdev = 0; @@ -2343,9 +2345,9 @@ boost_score += decay_accumulator * calc_frame_boost(cpi, &next_frame, this_frame_mv_in_out, GF_MAX_BOOST); - // If almost totally static, we will not use the the fixed GF length later, + // If almost totally static, we will not use the the max GF length later, // so we can continue for more frames. - if (i >= (av1_rc_get_fixed_gf_length(oxcf->gf_max_pyr_height) + 1) && + if ((i >= active_max_gf_interval + 1) && !is_almost_static(zero_motion_accumulator, twopass->kf_zeromotion_pct)) { break;