AGC2: retuning and large refactoring

- Bug fix: the desired initial gain quickly dropped to 0 dB hence
  starting a call with a too low level
- New tuning to make AGC2 more robust to VAD mistakes
- Smarter max gain increase speed: to deal with an increased threshold
  of adjacent speech frames, the gain applier temporarily allows a
  faster gain increase to deal with a longer time spent waiting for
  enough speech frames in a row to be observed
- Saturation protector isolated from `AdaptiveModeLevelEstimator` to
  simplify the unit tests for the latter (non bit-exact change)
- AGC2 adaptive digital config: unnecessary params deprecated
- Code readability improvements
- Data dumps clean-up and better naming

Bug: webrtc:7494
Change-Id: I4e36059bdf2566cc2a7e1a7e95b7430ba9ae9844
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215140
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33736}
This commit is contained in:
Alessio Bazzica
2021-04-14 19:09:17 +02:00
committed by Commit Bot
parent d28434bd3f
commit 980c4601e1
29 changed files with 990 additions and 941 deletions

View File

@ -46,17 +46,6 @@ std::string GainController1ModeToString(const Agc1Config::Mode& mode) {
RTC_CHECK_NOTREACHED();
}
std::string GainController2LevelEstimatorToString(
const Agc2Config::LevelEstimator& level) {
switch (level) {
case Agc2Config::LevelEstimator::kRms:
return "Rms";
case Agc2Config::LevelEstimator::kPeak:
return "Peak";
}
RTC_CHECK_NOTREACHED();
}
std::string GainController2NoiseEstimatorToString(
const Agc2Config::NoiseEstimator& type) {
switch (type) {
@ -174,20 +163,10 @@ std::string AudioProcessing::Config::ToString() const {
<< gain_controller2.adaptive_digital.enabled << ", noise_estimator: "
<< GainController2NoiseEstimatorToString(
gain_controller2.adaptive_digital.noise_estimator)
<< ", level_estimator: { vad_probability_attack: "
<< gain_controller2.adaptive_digital.vad_probability_attack << ", type: "
<< GainController2LevelEstimatorToString(
gain_controller2.adaptive_digital.level_estimator)
<< ", vad_reset_period_ms: "
<< gain_controller2.adaptive_digital.vad_reset_period_ms
<< ", adjacent_speech_frames_threshold: "
<< gain_controller2.adaptive_digital
.level_estimator_adjacent_speech_frames_threshold
<< ", initial_saturation_margin_db: "
<< gain_controller2.adaptive_digital.initial_saturation_margin_db
<< ", extra_saturation_margin_db: "
<< gain_controller2.adaptive_digital.extra_saturation_margin_db
<< " }, gain_applier: { adjacent_speech_frames_threshold: "
<< gain_controller2.adaptive_digital
.gain_applier_adjacent_speech_frames_threshold
<< gain_controller2.adaptive_digital.adjacent_speech_frames_threshold
<< ", max_gain_change_db_per_second: "
<< gain_controller2.adaptive_digital.max_gain_change_db_per_second
<< ", max_output_noise_level_dbfs: "
@ -195,7 +174,7 @@ std::string AudioProcessing::Config::ToString() const {
<< ", sse2_allowed: " << gain_controller2.adaptive_digital.sse2_allowed
<< ", avx2_allowed: " << gain_controller2.adaptive_digital.avx2_allowed
<< ", neon_allowed: " << gain_controller2.adaptive_digital.neon_allowed
<< " }}}, residual_echo_detector: { enabled: "
<< "}}, residual_echo_detector: { enabled: "
<< residual_echo_detector.enabled
<< " }, level_estimation: { enabled: " << level_estimation.enabled
<< " }}";