AEC3: Improve dominant nearend detection

This change makes the dominant nearend detection more accurate.
- The hangover is increased not leave nearend state between words.
- The SNR requirement is increased to not enter nearend state without
  speech activity.
- An early exit mechanism has been added to leave nearend state quickly
  when the echo is strong.

Bug: chromium:897701,webrtc:9897
Change-Id: I9e0f3e6ecb80eee1c0c917d4835f110555f74acf
Reviewed-on: https://webrtc-review.googlesource.com/c/107347
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25299}
This commit is contained in:
Gustaf Ullberg 2018-10-22 15:15:36 +02:00 committed by Commit Bot
parent ac19414512
commit c9f9b8711f
4 changed files with 17 additions and 4 deletions

View File

@ -181,10 +181,11 @@ struct RTC_EXPORT EchoCanceller3Config {
0.25f);
struct DominantNearendDetection {
float enr_threshold = 6.f;
float snr_threshold = 6.f;
int hold_duration = 5;
int trigger_threshold = 15;
float enr_threshold = 4.f;
float enr_exit_threshold = .1f;
float snr_threshold = 30.f;
int hold_duration = 50;
int trigger_threshold = 12;
} dominant_nearend_detection;
struct HighBandsSuppression {

View File

@ -287,6 +287,8 @@ EchoCanceller3Config Aec3ConfigFromJsonString(absl::string_view json_string) {
&subsection)) {
ReadParam(subsection, "enr_threshold",
&cfg.suppressor.dominant_nearend_detection.enr_threshold);
ReadParam(subsection, "enr_exit_threshold",
&cfg.suppressor.dominant_nearend_detection.enr_exit_threshold);
ReadParam(subsection, "snr_threshold",
&cfg.suppressor.dominant_nearend_detection.snr_threshold);
ReadParam(subsection, "hold_duration",
@ -520,6 +522,8 @@ std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
ost << "\"dominant_nearend_detection\": {";
ost << "\"enr_threshold\": "
<< config.suppressor.dominant_nearend_detection.enr_threshold << ",";
ost << "\"enr_exit_threshold\": "
<< config.suppressor.dominant_nearend_detection.enr_exit_threshold << ",";
ost << "\"snr_threshold\": "
<< config.suppressor.dominant_nearend_detection.snr_threshold << ",";
ost << "\"hold_duration\": "

View File

@ -398,6 +398,7 @@ bool SuppressionGain::LowNoiseRenderDetector::Detect(
SuppressionGain::DominantNearendDetector::DominantNearendDetector(
const EchoCanceller3Config::Suppressor::DominantNearendDetection config)
: enr_threshold_(config.enr_threshold),
enr_exit_threshold_(config.enr_exit_threshold),
snr_threshold_(config.snr_threshold),
hold_duration_(config.hold_duration),
trigger_threshold_(config.trigger_threshold) {}
@ -428,6 +429,12 @@ void SuppressionGain::DominantNearendDetector::Update(
trigger_counter_ = std::max(0, trigger_counter_ - 1);
}
// Exit nearend-state early at strong echo.
if (ne_sum < enr_exit_threshold_ * echo_sum &&
echo_sum > snr_threshold_ * noise_sum) {
hold_counter_ = 0;
}
// Remain in any nearend mode for a certain duration.
hold_counter_ = std::max(0, hold_counter_ - 1);
nearend_state_ = hold_counter_ > 0;

View File

@ -106,6 +106,7 @@ class SuppressionGain {
private:
const float enr_threshold_;
const float enr_exit_threshold_;
const float snr_threshold_;
const int hold_duration_;
const int trigger_threshold_;