From e590e087d5ba59131c2004690f8df11ee68a46b6 Mon Sep 17 00:00:00 2001 From: Marco Paniconi <marpan@google.com> Date: Thu, 13 Feb 2014 14:02:15 -0800 Subject: [PATCH] Fix target frame size setting, for 1pass cbr. Only use layered average size if number_temporal_layers > 1. Also removed unneeded commented-out line, and change some parameter setting in vpx_temporal_scalable_patterns.c Change-Id: Ic86e43e7daf0313e8c5a4aba1497299158111955 --- examples/vpx_temporal_scalable_patterns.c | 4 ++-- vp9/encoder/vp9_ratectrl.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/vpx_temporal_scalable_patterns.c b/examples/vpx_temporal_scalable_patterns.c index 464273cea3..28bb7ff4df 100644 --- a/examples/vpx_temporal_scalable_patterns.c +++ b/examples/vpx_temporal_scalable_patterns.c @@ -502,8 +502,8 @@ int main(int argc, char **argv) { cfg.rc_resize_allowed = 0; cfg.rc_min_quantizer = 2; cfg.rc_max_quantizer = 56; - cfg.rc_undershoot_pct = 100; - cfg.rc_overshoot_pct = 15; + cfg.rc_undershoot_pct = 50; + cfg.rc_overshoot_pct = 50; cfg.rc_buf_initial_sz = 500; cfg.rc_buf_optimal_sz = 600; cfg.rc_buf_sz = 1000; diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 2427dbe744..bc2c3a69a5 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -499,8 +499,6 @@ static int calc_active_worst_quality_one_pass_cbr(const VP9_COMP *cpi) { // (at buffer = critical level). const VP9_CONFIG *oxcf = &cpi->oxcf; const RATE_CONTROL *rc = &cpi->rc; - // int active_worst_quality = rc->active_worst_quality; - // Maximum limit for down adjustment, ~20%. // Buffer level below which we push active_worst to worst_quality. int critical_level = oxcf->optimal_buffer_level >> 2; int adjustment = 0; @@ -516,6 +514,7 @@ static int calc_active_worst_quality_one_pass_cbr(const VP9_COMP *cpi) { rc->avg_frame_qindex[KEY_FRAME] * 3 / 2); if (rc->buffer_level > oxcf->optimal_buffer_level) { // Adjust down. + // Maximum limit for down adjustment, ~30%. int max_adjustment_down = active_worst_quality / 3; if (max_adjustment_down) { buff_lvl_step = (int)((oxcf->maximum_buffer_size - @@ -1314,7 +1313,8 @@ static int calc_pframe_target_size_one_pass_cbr(const VP9_COMP *cpi) { int min_frame_target = MAX(rc->av_per_frame_bandwidth >> 4, FRAME_OVERHEAD_BITS); int target = rc->av_per_frame_bandwidth; - if (cpi->use_svc && cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) { + if (cpi->svc.number_temporal_layers > 1 && + cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) { // Note that for layers, av_per_frame_bandwidth is the cumulative // per-frame-bandwidth. For the target size of this frame, use the // layer average frame size (i.e., non-cumulative per-frame-bw). -- GitLab