AGC2: adding level estimation option (RMS or peak-based).

This CL makes possible to choose the level estimation for the adaptive
digital GC of AGC2. The options are RMS (default and currently used
estimator) and peak-based (already computed, but not used).

Besides adding the new AGC2 config param for the level estimator, this CL
also refactors the config class by making it more structured.

Bug: webrtc:7494
Change-Id: I20eb558ca50f13536aa7bdea08d21de3b630f8bc
Reviewed-on: https://webrtc-review.googlesource.com/c/110144
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25620}
This commit is contained in:
Alessio Bazzica
2018-11-13 14:44:15 +01:00
committed by Commit Bot
parent 44ca9a392a
commit 1e2542f593
12 changed files with 169 additions and 44 deletions

View File

@ -270,10 +270,23 @@ class AudioProcessing : public rtc::RefCountInterface {
// first applies a fixed gain. The adaptive digital AGC can be turned off by
// setting |adaptive_digital_mode=false|.
struct GainController2 {
enum LevelEstimator { kRms, kPeak };
bool enabled = false;
bool adaptive_digital_mode = true;
float extra_saturation_margin_db = 2.f;
struct {
float gain_db = 0.f;
} fixed_digital;
struct {
bool enabled = true;
LevelEstimator level_estimator = kRms;
bool use_saturation_protector = true;
float extra_saturation_margin_db = 2.f;
} adaptive_digital;
// Deprecated.
// TODO(webrtc:7494): Switch to fixed_digital.gain_db and remove.
float fixed_gain_db = 0.f;
// Deprecated.
// TODO(webrtc:7494): Switch to adaptive_digital.enabled and remove.
bool adaptive_digital_mode = false;
} gain_controller2;
// Explicit copy assignment implementation to avoid issues with memory