From eb180f8f77239d65cdcedfe30b5b663277bb04ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Spr=C3=A5ng?= Date: Thu, 23 May 2019 13:55:24 +0200 Subject: [PATCH] Fix incorrect libvpx vp9 dynamic rate control settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:10155, b:133399415 Change-Id: I69430dce41cde8bc1f8716b8508d4be8d9645d6d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138076 Reviewed-by: Ilya Nikolaevskiy Commit-Queue: Erik Språng Cr-Commit-Position: refs/heads/master@{#28037} --- modules/video_coding/codecs/vp9/vp9_impl.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/video_coding/codecs/vp9/vp9_impl.cc b/modules/video_coding/codecs/vp9/vp9_impl.cc index 18e146b037..f974932289 100644 --- a/modules/video_coding/codecs/vp9/vp9_impl.cc +++ b/modules/video_coding/codecs/vp9/vp9_impl.cc @@ -54,7 +54,7 @@ constexpr double kLowRateFactor = 1.0; constexpr double kHighRateFactor = 2.0; // These settings correspond to the settings in vpx_codec_enc_cfg. -struct Vp8RateSettings { +struct Vp9RateSettings { uint32_t rc_undershoot_pct; uint32_t rc_overshoot_pct; uint32_t rc_buf_sz; @@ -161,9 +161,9 @@ uint32_t Interpolate(uint32_t low, return static_cast(((1.0 - factor) * low) + (factor * high) + 0.5); } -Vp8RateSettings GetRateSettings(double bandwidth_headroom_factor) { - static const Vp8RateSettings low_settings{1000u, 0u, 100u, 30u, 40u}; - static const Vp8RateSettings high_settings{100u, 15u, 1000u, 600u, 5u}; +Vp9RateSettings GetRateSettings(double bandwidth_headroom_factor) { + static const Vp9RateSettings low_settings{100u, 0u, 100u, 33u, 40u}; + static const Vp9RateSettings high_settings{50u, 50u, 1000u, 700u, 5u}; if (bandwidth_headroom_factor <= kLowRateFactor) { return low_settings; @@ -171,7 +171,7 @@ Vp8RateSettings GetRateSettings(double bandwidth_headroom_factor) { return high_settings; } - Vp8RateSettings settings; + Vp9RateSettings settings; settings.rc_undershoot_pct = Interpolate(low_settings.rc_undershoot_pct, high_settings.rc_undershoot_pct, bandwidth_headroom_factor); @@ -191,7 +191,7 @@ Vp8RateSettings GetRateSettings(double bandwidth_headroom_factor) { } void UpdateRateSettings(vpx_codec_enc_cfg_t* config, - const Vp8RateSettings& new_settings) { + const Vp9RateSettings& new_settings) { config->rc_undershoot_pct = new_settings.rc_undershoot_pct; config->rc_overshoot_pct = new_settings.rc_overshoot_pct; config->rc_buf_sz = new_settings.rc_buf_sz;