Merge "Bug when last group before forced key frame is short."
This commit is contained in:
@@ -1843,6 +1843,9 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
||||
|
||||
twopass->gf_zeromotion_pct = (int)(zero_motion_accumulator * 1000.0);
|
||||
|
||||
// Was the group length constrained by the requirement for a new KF?
|
||||
rc->constrained_gf_group = (i >= rc->frames_to_key) ? 1 : 0;
|
||||
|
||||
// Set the interval until the next gf.
|
||||
if (cpi->common.frame_type == KEY_FRAME || rc->source_alt_ref_active)
|
||||
rc->baseline_gf_interval = i - 1;
|
||||
|
||||
@@ -1254,7 +1254,9 @@ void vp9_rc_postencode_update(VP9_COMP *cpi, uint64_t bytes_used) {
|
||||
// better than that already stored.
|
||||
// This is used to help set quality in forced key frames to reduce popping
|
||||
if ((qindex < rc->last_boosted_qindex) ||
|
||||
(((cm->frame_type == KEY_FRAME) || cpi->refresh_alt_ref_frame ||
|
||||
(cm->frame_type == KEY_FRAME) ||
|
||||
(!rc->constrained_gf_group &&
|
||||
(cpi->refresh_alt_ref_frame ||
|
||||
(cpi->refresh_golden_frame && !rc->is_src_frame_alt_ref)))) {
|
||||
rc->last_boosted_qindex = qindex;
|
||||
}
|
||||
@@ -1358,8 +1360,12 @@ void vp9_rc_get_one_pass_vbr_params(VP9_COMP *cpi) {
|
||||
rc->baseline_gf_interval = DEFAULT_GF_INTERVAL;
|
||||
rc->frames_till_gf_update_due = rc->baseline_gf_interval;
|
||||
// NOTE: frames_till_gf_update_due must be <= frames_to_key.
|
||||
if (rc->frames_till_gf_update_due > rc->frames_to_key)
|
||||
if (rc->frames_till_gf_update_due > rc->frames_to_key) {
|
||||
rc->frames_till_gf_update_due = rc->frames_to_key;
|
||||
rc->constrained_gf_group = 1;
|
||||
} else {
|
||||
rc->constrained_gf_group = 0;
|
||||
}
|
||||
cpi->refresh_golden_frame = 1;
|
||||
rc->source_alt_ref_pending = USE_ALTREF_FOR_ONE_PASS;
|
||||
rc->gfu_boost = DEFAULT_GF_BOOST;
|
||||
|
||||
@@ -55,6 +55,7 @@ typedef struct {
|
||||
int max_gf_interval;
|
||||
int static_scene_max_gf_interval;
|
||||
int baseline_gf_interval;
|
||||
int constrained_gf_group;
|
||||
int frames_to_key;
|
||||
int frames_since_key;
|
||||
int this_key_frame_forced;
|
||||
|
||||
Reference in New Issue
Block a user