Fix incorrect libvpx vp9 dynamic rate control settings

Bug: webrtc:10155, b:133399415
Change-Id: I69430dce41cde8bc1f8716b8508d4be8d9645d6d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138076
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28037}
This commit is contained in:
Erik Språng 2019-05-23 13:55:24 +02:00 committed by Commit Bot
parent fe68daab97
commit eb180f8f77

View file

@ -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<uint32_t>(((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;