Fixed Digital mode of AGC2 implementation finished.

This CL adds the GainCurveApplier (GCA). It owns a
FixedDigitalLevelEstimator (LE) and an InterpolatedGainCurve
(IGC). The GCA uses the LE to compute the input signal level, looks up
a gain from IGC and applies it on the signal.

The other IGC and LE submodules were added in previous CLs [1] and
[2].

This CL also turns on AGC2 in the APM fuzzer.

[1] https://webrtc-review.googlesource.com/c/src/+/51920
[2] https://webrtc-review.googlesource.com/c/src/+/52381

Bug: webrtc:7949
Change-Id: Idb10cc3ca9d6d2e4ac5824cc3391ed8aa680f6cd
Reviewed-on: https://webrtc-review.googlesource.com/54361
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22103}
This commit is contained in:
Alex Loiko
2018-02-20 15:58:36 +01:00
committed by Commit Bot
parent 1896cece01
commit a05ee82c4c
22 changed files with 1460 additions and 45 deletions

View File

@ -445,6 +445,7 @@ webrtc_fuzzer_test("audio_processing_fuzzer") {
":audio_processing_fuzzer_helper",
":fuzz_data_helper",
"../../modules/audio_processing",
"../../rtc_base:rtc_base_approved",
]
}

View File

@ -9,6 +9,7 @@
*/
#include "modules/audio_processing/include/audio_processing.h"
#include "rtc_base/numerics/safe_minmax.h"
#include "test/fuzzers/audio_processing_fuzzer_helper.h"
#include "test/fuzzers/fuzz_data_helper.h"
@ -36,6 +37,7 @@ std::unique_ptr<AudioProcessing> CreateApm(test::FuzzDataHelper* fuzz_data) {
bool use_le = fuzz_data->ReadOrDefaultValue(true);
bool use_vad = fuzz_data->ReadOrDefaultValue(true);
bool use_agc_limiter = fuzz_data->ReadOrDefaultValue(true);
bool use_agc2_limiter = fuzz_data->ReadOrDefaultValue(true);
// Filter out incompatible settings that lead to CHECK failures.
if (use_aecm && use_aec) {
@ -70,6 +72,12 @@ std::unique_ptr<AudioProcessing> CreateApm(test::FuzzDataHelper* fuzz_data) {
apm_config.residual_echo_detector.enabled = red;
apm_config.level_controller.enabled = lc;
apm_config.high_pass_filter.enabled = hpf;
apm_config.gain_controller2.enabled = use_agc2_limiter;
// Read an int8 value, but don't let it be too large or small.
const float gain_db =
rtc::SafeClamp<int>(fuzz_data->ReadOrDefaultValue<int8_t>(0), -50, 50);
apm_config.gain_controller2.fixed_gain_db = gain_db;
apm->ApplyConfig(apm_config);