Merge "Re-factor some duplicate code."
This commit is contained in:
commit
d009c2360e
@ -1576,7 +1576,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
|
||||
|
||||
// Break out conditions.
|
||||
if (
|
||||
// Break at cpi->max_gf_interval unless almost totally static.
|
||||
// Break at active_max_gf_interval unless almost totally static.
|
||||
(i >= active_max_gf_interval && (zero_motion_accumulator < 0.995)) ||
|
||||
(
|
||||
// Don't break out with a very short interval.
|
||||
|
@ -1388,6 +1388,24 @@ int vp9_compute_qdelta_by_rate(const RATE_CONTROL *rc, FRAME_TYPE frame_type,
|
||||
return target_index - qindex;
|
||||
}
|
||||
|
||||
void vp9_rc_set_gf_max_interval(const VP9EncoderConfig *const oxcf,
|
||||
RATE_CONTROL *const rc) {
|
||||
// Set Maximum gf/arf interval
|
||||
rc->max_gf_interval = 16;
|
||||
|
||||
// Extended interval for genuinely static scenes
|
||||
rc->static_scene_max_gf_interval = oxcf->key_freq >> 1;
|
||||
|
||||
// Special conditions when alt ref frame enabled
|
||||
if (oxcf->play_alternate && oxcf->lag_in_frames) {
|
||||
if (rc->static_scene_max_gf_interval > oxcf->lag_in_frames - 1)
|
||||
rc->static_scene_max_gf_interval = oxcf->lag_in_frames - 1;
|
||||
}
|
||||
|
||||
if (rc->max_gf_interval > rc->static_scene_max_gf_interval)
|
||||
rc->max_gf_interval = rc->static_scene_max_gf_interval;
|
||||
}
|
||||
|
||||
void vp9_rc_update_framerate(VP9_COMP *cpi) {
|
||||
const VP9_COMMON *const cm = &cpi->common;
|
||||
const VP9EncoderConfig *const oxcf = &cpi->oxcf;
|
||||
@ -1412,21 +1430,5 @@ void vp9_rc_update_framerate(VP9_COMP *cpi) {
|
||||
rc->max_frame_bandwidth = MAX(MAX((cm->MBs * MAX_MB_RATE), MAXRATE_1080P),
|
||||
vbr_max_bits);
|
||||
|
||||
// Set Maximum gf/arf interval
|
||||
rc->max_gf_interval = 16;
|
||||
|
||||
// Extended interval for genuinely static scenes
|
||||
rc->static_scene_max_gf_interval = cpi->oxcf.key_freq >> 1;
|
||||
|
||||
// Special conditions when alt ref frame enabled in lagged compress mode
|
||||
if (oxcf->play_alternate && oxcf->lag_in_frames) {
|
||||
if (rc->max_gf_interval > oxcf->lag_in_frames - 1)
|
||||
rc->max_gf_interval = oxcf->lag_in_frames - 1;
|
||||
|
||||
if (rc->static_scene_max_gf_interval > oxcf->lag_in_frames - 1)
|
||||
rc->static_scene_max_gf_interval = oxcf->lag_in_frames - 1;
|
||||
}
|
||||
|
||||
if (rc->max_gf_interval > rc->static_scene_max_gf_interval)
|
||||
rc->max_gf_interval = rc->static_scene_max_gf_interval;
|
||||
vp9_rc_set_gf_max_interval(oxcf, rc);
|
||||
}
|
||||
|
@ -178,6 +178,9 @@ int vp9_compute_qdelta_by_rate(const RATE_CONTROL *rc, FRAME_TYPE frame_type,
|
||||
|
||||
void vp9_rc_update_framerate(struct VP9_COMP *cpi);
|
||||
|
||||
void vp9_rc_set_gf_max_interval(const struct VP9EncoderConfig *const oxcf,
|
||||
RATE_CONTROL *const rc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
@ -149,20 +149,7 @@ void vp9_update_spatial_layer_framerate(VP9_COMP *const cpi, double framerate) {
|
||||
oxcf->two_pass_vbrmin_section / 100);
|
||||
lrc->max_frame_bandwidth = (int)(((int64_t)lrc->avg_frame_bandwidth *
|
||||
oxcf->two_pass_vbrmax_section) / 100);
|
||||
lrc->max_gf_interval = 16;
|
||||
|
||||
lrc->static_scene_max_gf_interval = cpi->oxcf.key_freq >> 1;
|
||||
|
||||
if (oxcf->play_alternate && oxcf->lag_in_frames) {
|
||||
if (lrc->max_gf_interval > oxcf->lag_in_frames - 1)
|
||||
lrc->max_gf_interval = oxcf->lag_in_frames - 1;
|
||||
|
||||
if (lrc->static_scene_max_gf_interval > oxcf->lag_in_frames - 1)
|
||||
lrc->static_scene_max_gf_interval = oxcf->lag_in_frames - 1;
|
||||
}
|
||||
|
||||
if (lrc->max_gf_interval > lrc->static_scene_max_gf_interval)
|
||||
lrc->max_gf_interval = lrc->static_scene_max_gf_interval;
|
||||
vp9_rc_set_gf_max_interval(oxcf, lrc);
|
||||
}
|
||||
|
||||
void vp9_restore_layer_context(VP9_COMP *const cpi) {
|
||||
|
Loading…
Reference in New Issue
Block a user