Update AEC3 echo tail estimation.

Note: estimation is turned OFF if config_.ep_strength.default_len
is set >= 0 (in this case config_.ep_strength.default_len defines a
constant echo decay factor), and hence turned ON if < 0. In case the
echo tail estimation is turned ON, -config_.ep_strength.default_len is
the starting point for the estimator.

The estimation is done in two passes; first we go through all "sections"
(corresponding to chunks of length kFftLengthBy2) of the filter impulse
response to determine which sections correspond to a "stable" decay",
and then the second pass we go through each stable decay section and
estimate the decay. The actual decay estimation is based on linear
regression of the log magnitude of the squared impulse response.
A bunch of sanity checks are also performed continuously to avoid
estimation error during e.g., filter adaptation.

Bug: webrtc:8924
Change-Id: I686ce3f3e8b6b472348f8d6e01fb44c31e25145d
Reviewed-on: https://webrtc-review.googlesource.com/48440
Commit-Queue: Christian Schuldt <cschuldt@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22247}
This commit is contained in:
Christian Schuldt
2018-03-01 11:32:50 +01:00
committed by Commit Bot
parent b12e434d4c
commit f4e99dba41
3 changed files with 168 additions and 58 deletions

View File

@ -11,6 +11,8 @@
#ifndef MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_
#define MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_
#include <math.h>
#include <algorithm>
#include <memory>
#include <vector>
@ -159,13 +161,20 @@ class AecState {
bool active_render_seen_ = false;
int filter_delay_ = 0;
size_t blocks_since_last_saturation_ = 1000;
float reverb_decay_to_test_ = 0.9f;
float reverb_decay_candidate_ = 0.f;
float reverb_decay_candidate_residual_ = -1.f;
float tail_energy_ = 0.f;
float accumulated_nz_ = 0.f;
float accumulated_nn_ = 0.f;
float accumulated_count_ = 0.f;
size_t current_reverb_decay_section_ = 0;
size_t num_reverb_decay_sections_ = 0;
size_t num_reverb_decay_sections_next_ = 0;
bool found_end_of_reverb_decay_ = false;
bool main_filter_is_adapting_ = true;
std::array<float, kMaxAdaptiveFilterLength> block_energies_;
EchoAudibility echo_audibility_;
const EchoCanceller3Config config_;
std::vector<float> max_render_;
float reverb_decay_;
float reverb_decay_ = fabsf(config_.ep_strength.default_len);
bool saturating_echo_path_ = false;
bool filter_has_had_time_to_converge_ = false;
bool initial_state_ = true;