diff options
Diffstat (limited to 'modules/audio_processing/aec3/subtractor.cc')
-rw-r--r-- | modules/audio_processing/aec3/subtractor.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/modules/audio_processing/aec3/subtractor.cc b/modules/audio_processing/aec3/subtractor.cc index d10e4ffc52..2eae686752 100644 --- a/modules/audio_processing/aec3/subtractor.cc +++ b/modules/audio_processing/aec3/subtractor.cc @@ -91,7 +91,20 @@ Subtractor::Subtractor(const EchoCanceller3Config& config, std::vector<float>(GetTimeDomainLength(std::max( config_.filter.refined_initial.length_blocks, config_.filter.refined.length_blocks)), - 0.f)) { + 0.f)), + coarse_impulse_responses_(0) { + // Set up the storing of coarse impulse responses if data dumping is + // available. + if (ApmDataDumper::IsAvailable()) { + coarse_impulse_responses_.resize(num_capture_channels_); + const size_t filter_size = GetTimeDomainLength( + std::max(config_.filter.coarse_initial.length_blocks, + config_.filter.coarse.length_blocks)); + for (std::vector<float>& impulse_response : coarse_impulse_responses_) { + impulse_response.resize(filter_size, 0.f); + } + } + for (size_t ch = 0; ch < num_capture_channels_; ++ch) { refined_filters_[ch] = std::make_unique<AdaptiveFirFilter>( config_.filter.refined.length_blocks, @@ -285,7 +298,14 @@ void Subtractor::Process(const RenderBuffer& render_buffer, config_.filter.coarse_reset_hangover_blocks; } - coarse_filter_[ch]->Adapt(render_buffer, G); + if (ApmDataDumper::IsAvailable()) { + RTC_DCHECK_LT(ch, coarse_impulse_responses_.size()); + coarse_filter_[ch]->Adapt(render_buffer, G, + &coarse_impulse_responses_[ch]); + } else { + coarse_filter_[ch]->Adapt(render_buffer, G); + } + if (ch == 0) { data_dumper_->DumpRaw("aec3_subtractor_G_coarse", G.re); data_dumper_->DumpRaw("aec3_subtractor_G_coarse", G.im); |