ref: c68e75b940fcf96e892c60c17af0e1f24bb315e9
parent: ce023d5413a933eb2244d037f11d608ceac8cd91
author: angiebird <angiebird@google.com>
date: Mon Oct 21 14:32:57 EDT 2019
Remove input_stats when decide frames_to_key Also remove the corresponding reset_fpf_position Change-Id: I6ebb023a38627785ff19e161bfe7bbef797fc710
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -3104,14 +3104,13 @@
rc->frames_to_key = VPXMIN(oxcf->key_freq, rc->frames_to_key);
} else {
int i = 0;
- while (twopass->stats_in < twopass->stats_in_end &&
+ while (kf_show_idx + i + 1 < first_pass_info->num_frames &&
rc->frames_to_key < cpi->oxcf.key_freq) {
- FIRSTPASS_STATS this_frame;
- input_stats(twopass, &this_frame);
-
// Provided that we are not at the end of the file...
- if (twopass->stats_in < twopass->stats_in_end) {
+ if (kf_show_idx + i + 2 < first_pass_info->num_frames) {
double loop_decay_rate;
+ const FIRSTPASS_STATS *next_frame =
+ fps_get_frame_stats(first_pass_info, kf_show_idx + i + 2);
// Check for a scene cut.
if (test_candidate_kf(first_pass_info, kf_show_idx + i + 1)) break;
@@ -3118,7 +3117,7 @@
// How fast is the prediction quality decaying?
loop_decay_rate =
- get_prediction_decay_rate(&cpi->frame_info, twopass->stats_in);
+ get_prediction_decay_rate(&cpi->frame_info, next_frame);
// We want to know something about the recent past... rather than
// as used elsewhere where we are concerned with decay in prediction
@@ -3150,8 +3149,7 @@
// We already breakout of the loop above at 2x max.
// This code centers the extra kf if the actual natural interval
// is between 1x and 2x.
- if (twopass->stats_in == twopass->stats_in_end ||
- rc->frames_to_key >= cpi->oxcf.key_freq) {
+ if (rc->frames_to_key >= cpi->oxcf.key_freq) {
rc->next_key_frame_forced = 1;
} else {
rc->next_key_frame_forced = 0;
@@ -3186,9 +3184,6 @@
twopass->kf_group_bits = 0;
}
twopass->kf_group_bits = VPXMAX(0, twopass->kf_group_bits);
-
- // Reset the first pass file position.
- reset_fpf_position(twopass, start_position);
// Scan through the kf group collating various stats used to determine
// how many bits to spend on it.