History

Change the interface of find_next_key_frame

angiebird committed 7 years ago

Commit 1bd337b1 parent b2e49801 file · +12 −13Browse files

Unified · Split

vp9/encoder/vp9_firstpass.c+12−13
@@ -3055,8 +3055,7 @@ static int test_candidate_kf(TWO_PASS *twopass, · 3054 unmodified lines
3055#define MAX_KF_TOT_BOOST 54003055#define MAX_KF_TOT_BOOST 5400
3056#endif3056#endif
3057 3057
3058static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame,3058static void find_next_key_frame(VP9_COMP *cpi, int kf_show_idx) {
3059 int kf_show_idx) {
3060 int i, j;3059 int i, j;
3061 RATE_CONTROL *const rc = &cpi->rc;3060 RATE_CONTROL *const rc = &cpi->rc;
3062 TWO_PASS *const twopass = &cpi->twopass;3061 TWO_PASS *const twopass = &cpi->twopass;
@@ -3065,8 +3064,9 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame, · 2 unmodified lines
3065 const FIRST_PASS_INFO *first_pass_info = &twopass->first_pass_info;3064 const FIRST_PASS_INFO *first_pass_info = &twopass->first_pass_info;
3066 const FRAME_INFO *frame_info = &cpi->frame_info;3065 const FRAME_INFO *frame_info = &cpi->frame_info;
3067 const FIRSTPASS_STATS *const start_position = twopass->stats_in;3066 const FIRSTPASS_STATS *const start_position = twopass->stats_in;
3067 const FIRSTPASS_STATS *keyframe_stats =
3068 fps_get_frame_stats(first_pass_info, kf_show_idx);
3068 FIRSTPASS_STATS next_frame;3069 FIRSTPASS_STATS next_frame;
3069 FIRSTPASS_STATS last_frame;
3070 int kf_bits = 0;3070 int kf_bits = 0;
3071 int64_t max_kf_bits;3071 int64_t max_kf_bits;
3072 double decay_accumulator = 1.0;3072 double decay_accumulator = 1.0;
@@ -3109,9 +3109,9 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame, · 36 unmodified lines
3109 twopass->kf_group_bits = 0; // Total bits available to kf group3109 twopass->kf_group_bits = 0; // Total bits available to kf group
3110 twopass->kf_group_error_left = 0.0; // Group modified error score.3110 twopass->kf_group_error_left = 0.0; // Group modified error score.
3111 3111
3112 kf_raw_err = this_frame->intra_error;3112 kf_raw_err = keyframe_stats->intra_error;
3113 kf_mod_err =3113 kf_mod_err = calc_norm_frame_score(oxcf, frame_info, keyframe_stats,
3114 calculate_norm_frame_score(cpi, twopass, oxcf, this_frame, av_err);3114 mean_mod_score, av_err);
3115 3115
3116 // Initialize the decay rates for the recent frames to check3116 // Initialize the decay rates for the recent frames to check
3117 for (j = 0; j < FRAMES_TO_CHECK_DECAY; ++j) recent_loop_decay[j] = 1.0;3117 for (j = 0; j < FRAMES_TO_CHECK_DECAY; ++j) recent_loop_decay[j] = 1.0;
@@ -3121,15 +3121,17 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame, · 3 unmodified lines
3121 while (twopass->stats_in < twopass->stats_in_end &&3121 while (twopass->stats_in < twopass->stats_in_end &&
3122 rc->frames_to_key < cpi->oxcf.key_freq) {3122 rc->frames_to_key < cpi->oxcf.key_freq) {
3123 // Load the next frame's stats.3123 // Load the next frame's stats.
3124 last_frame = *this_frame;3124 const FIRSTPASS_STATS *last_frame =
3125 input_stats(twopass, this_frame);3125 fps_get_frame_stats(first_pass_info, kf_show_idx + i);
3126 FIRSTPASS_STATS this_frame;
3127 input_stats(twopass, &this_frame);
3126 3128
3127 // Provided that we are not at the end of the file...3129 // Provided that we are not at the end of the file...
3128 if (cpi->oxcf.auto_key && twopass->stats_in < twopass->stats_in_end) {3130 if (cpi->oxcf.auto_key && twopass->stats_in < twopass->stats_in_end) {
3129 double loop_decay_rate;3131 double loop_decay_rate;
3130 3132
3131 // Check for a scene cut.3133 // Check for a scene cut.
3132 if (test_candidate_kf(twopass, &last_frame, this_frame,3134 if (test_candidate_kf(twopass, last_frame, &this_frame,
3133 twopass->stats_in))3135 twopass->stats_in))
3134 break;3136 break;
3135 3137
@@ -3434,11 +3436,8 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) { · 298 unmodified lines
3434 3436
3435 // Keyframe and section processing.3437 // Keyframe and section processing.
3436 if (rc->frames_to_key == 0 || (cpi->frame_flags & FRAMEFLAGS_KEY)) {3438 if (rc->frames_to_key == 0 || (cpi->frame_flags & FRAMEFLAGS_KEY)) {
3437 FIRSTPASS_STATS this_frame_copy;
3438 this_frame_copy = this_frame;
3439 // Define next KF group and assign bits to it.3439 // Define next KF group and assign bits to it.
3440 find_next_key_frame(cpi, &this_frame, show_idx);3440 find_next_key_frame(cpi, show_idx);
3441 this_frame = this_frame_copy;
3442 } else {3441 } else {
3443 cm->frame_type = INTER_FRAME;3442 cm->frame_type = INTER_FRAME;
3444 }3443 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t