vp9: Reset buffer level on large bitrate changes.
For a large change in the target avg_frame_bandwidth, via the update in change_config()), reset the buffer_level to optimal_level. This fix prevents possible frame drops, where for example, encoder suddenly goes from lower to higher bitrate. Change-Id: I2f844c41d04c01240e85f574e59d2b9075c7eb6d
This commit is contained in:
@@ -1868,6 +1868,7 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
|||||||
// Check for resetting the rc flags (rc_1_frame, rc_2_frame) if the
|
// Check for resetting the rc flags (rc_1_frame, rc_2_frame) if the
|
||||||
// configuration change has a large change in avg_frame_bandwidth.
|
// configuration change has a large change in avg_frame_bandwidth.
|
||||||
// For SVC check for resetting based on spatial layer average bandwidth.
|
// For SVC check for resetting based on spatial layer average bandwidth.
|
||||||
|
// Also reset buffer level to optimal level.
|
||||||
if (cm->current_video_frame > 0) {
|
if (cm->current_video_frame > 0) {
|
||||||
if (cpi->use_svc) {
|
if (cpi->use_svc) {
|
||||||
vp9_svc_check_reset_layer_rc_flag(cpi);
|
vp9_svc_check_reset_layer_rc_flag(cpi);
|
||||||
@@ -1876,6 +1877,8 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
|||||||
rc->avg_frame_bandwidth < (rc->last_avg_frame_bandwidth >> 1)) {
|
rc->avg_frame_bandwidth < (rc->last_avg_frame_bandwidth >> 1)) {
|
||||||
rc->rc_1_frame = 0;
|
rc->rc_1_frame = 0;
|
||||||
rc->rc_2_frame = 0;
|
rc->rc_2_frame = 0;
|
||||||
|
rc->bits_off_target = rc->optimal_buffer_level;
|
||||||
|
rc->buffer_level = rc->optimal_buffer_level;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -881,6 +881,8 @@ void vp9_svc_check_reset_layer_rc_flag(VP9_COMP *const cpi) {
|
|||||||
RATE_CONTROL *lrc = &lc->rc;
|
RATE_CONTROL *lrc = &lc->rc;
|
||||||
lrc->rc_1_frame = 0;
|
lrc->rc_1_frame = 0;
|
||||||
lrc->rc_2_frame = 0;
|
lrc->rc_2_frame = 0;
|
||||||
|
lrc->bits_off_target = lrc->optimal_buffer_level;
|
||||||
|
lrc->buffer_level = lrc->optimal_buffer_level;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user