Add debug data dumping to the AEC3 suppressor

Bug: webrtc:8671
Change-Id: Ia4f96fc247335bdf19620446559c21f16abd6682
Reviewed-on: https://webrtc-review.googlesource.com/72700
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23051}
This commit is contained in:
Gustaf Ullberg 2018-04-26 12:39:11 +02:00 committed by Commit Bot
parent 5ebb82ba9c
commit 216af841ad
2 changed files with 16 additions and 3 deletions

View File

@ -21,6 +21,8 @@
#include <numeric>
#include "modules/audio_processing/aec3/vector_math.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
#include "rtc_base/atomicops.h"
#include "rtc_base/checks.h"
namespace webrtc {
@ -253,6 +255,8 @@ void AdjustNonConvergedFrequencies(
} // namespace
int SuppressionGain::instance_count_ = 0;
// TODO(peah): Add further optimizations, in particular for the divisions.
void SuppressionGain::LowerBandGain(
bool low_noise_render,
@ -298,8 +302,8 @@ void SuppressionGain::LowerBandGain(
// Iteratively compute the gain required to attenuate the echo to a non
// noticeable level.
gain->fill(0.f);
std::array<float, kFftLengthBy2Plus1> masker;
for (int k = 0; k < 2; ++k) {
std::array<float, kFftLengthBy2Plus1> masker;
MaskingPower(config_, nearend, comfort_noise, last_masker_, *gain, &masker);
GainToNoAudibleEcho(config_, low_noise_render, saturated_echo,
linear_echo_estimate, nearend, weighted_echo, masker,
@ -320,12 +324,20 @@ void SuppressionGain::LowerBandGain(
MaskingPower(config_, nearend, comfort_noise, last_masker_, *gain,
&last_masker_);
aec3::VectorMath(optimization_).Sqrt(*gain);
// Debug outputs for the purpose of development and analysis.
data_dumper_->DumpRaw("aec3_suppressor_min_gain", min_gain);
data_dumper_->DumpRaw("aec3_suppressor_max_gain", max_gain);
data_dumper_->DumpRaw("aec3_suppressor_masker", masker);
data_dumper_->DumpRaw("aec3_suppressor_last_masker", last_masker_);
}
SuppressionGain::SuppressionGain(const EchoCanceller3Config& config,
Aec3Optimization optimization,
int sample_rate_hz)
: optimization_(optimization),
: data_dumper_(
new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))),
optimization_(optimization),
config_(config),
state_change_duration_blocks_(
static_cast<int>(config_.filter.config_change_duration_blocks)),

View File

@ -69,6 +69,8 @@ class SuppressionGain {
float average_power_ = 32768.f * 32768.f;
};
static int instance_count_;
std::unique_ptr<ApmDataDumper> data_dumper_;
const Aec3Optimization optimization_;
const EchoCanceller3Config config_;
const int state_change_duration_blocks_;
@ -77,7 +79,6 @@ class SuppressionGain {
std::array<float, kFftLengthBy2Plus1> last_masker_;
std::array<float, kFftLengthBy2Plus1> gain_increase_;
std::array<float, kFftLengthBy2Plus1> last_echo_;
LowNoiseRenderDetector low_render_detector_;
bool initial_state_ = true;
int initial_state_change_counter_ = 0;