summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_ratectrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/encoder/vp9_ratectrl.c')
-rw-r--r--vp9/encoder/vp9_ratectrl.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index b4e883fb5..6a9ffd25d 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -1258,17 +1258,25 @@ static int calc_pframe_target_size_one_pass_cbr(const VP9_COMP *cpi) {
static int calc_iframe_target_size_one_pass_cbr(const VP9_COMP *cpi) {
const RATE_CONTROL *rc = &cpi->rc;
+ const VP9_CONFIG *oxcf = &cpi->oxcf;
+ const SVC *const svc = &cpi->svc;
int target;
-
if (cpi->common.current_video_frame == 0) {
target = ((cpi->oxcf.starting_buffer_level / 2) > INT_MAX)
? INT_MAX : (int)(cpi->oxcf.starting_buffer_level / 2);
} else {
- const int initial_boost = 32;
- int kf_boost = MAX(initial_boost, (int)(2 * cpi->output_framerate - 16));
- if (rc->frames_since_key < cpi->output_framerate / 2) {
+ int kf_boost = 32;
+ double framerate = oxcf->framerate;
+ if (svc->number_temporal_layers > 1 &&
+ oxcf->end_usage == USAGE_STREAM_FROM_SERVER) {
+ // Use the layer framerate for temporal layers CBR mode.
+ const LAYER_CONTEXT *lc = &svc->layer_context[svc->temporal_layer_id];
+ framerate = lc->framerate;
+ }
+ kf_boost = MAX(kf_boost, (int)(2 * framerate - 16));
+ if (rc->frames_since_key < framerate / 2) {
kf_boost = (int)(kf_boost * rc->frames_since_key /
- (cpi->output_framerate / 2));
+ (framerate / 2));
}
target = ((16 + kf_boost) * rc->av_per_frame_bandwidth) >> 4;
}