Smoothed the application of the NLP gain in AEC3

This CL adds a smooth rampup of the NLP gain in AEC3.

Bug: webrtc:8361
Change-Id: I49aa75904751ffe9150db1572271fe7a26232449
Reviewed-on: https://webrtc-review.googlesource.com/7740
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20213}
This commit is contained in:
Per Åhgren
2017-10-09 23:50:44 +02:00
committed by Commit Bot
parent deeba1f298
commit d309b0081d
2 changed files with 24 additions and 11 deletions

View File

@ -187,12 +187,19 @@ void GainToNoAudibleEcho(
float nearend_masking_margin = 0.f;
if (linear_echo_estimate) {
nearend_masking_margin = low_noise_render
? 0.3f
? config.param.gain_mask.m9
: (saturated_echo ? config.param.gain_mask.m2
: config.param.gain_mask.m3);
} else {
nearend_masking_margin = config.param.gain_mask.m7;
}
RTC_DCHECK_LE(0.f, nearend_masking_margin);
RTC_DCHECK_GT(1.f, nearend_masking_margin);
const float one_by_one_minus_nearend_masking_margin =
1.f / (1.0f - nearend_masking_margin);
const float masker_margin = linear_echo_estimate ? config.param.gain_mask.m1
: config.param.gain_mask.m8;
for (size_t k = 0; k < gain->size(); ++k) {
const float unity_gain_masker = std::max(nearend[k], masker[k]);
@ -201,7 +208,11 @@ void GainToNoAudibleEcho(
unity_gain_masker <= 0.f) {
(*gain)[k] = 1.f;
} else {
(*gain)[k] = config.param.gain_mask.m1 * masker[k] * one_by_echo[k];
RTC_DCHECK_LT(0.f, unity_gain_masker);
(*gain)[k] = std::max(0.f, (1.f - echo[k] / unity_gain_masker) *
one_by_one_minus_nearend_masking_margin);
(*gain)[k] =
std::max(masker_margin * masker[k] * one_by_echo[k], (*gain)[k]);
}
(*gain)[k] = std::min(std::max((*gain)[k], min_gain[k]), max_gain[k]);

View File

@ -290,13 +290,15 @@ class AudioProcessing : public rtc::RefCountInterface {
} ep_strength;
struct Mask {
float m1 = 0.01f;
float m2 = 0.001f;
float m3 = 0.02f; // Do not change.
float m4 = 0.3f;
float m5 = 0.3f;
float m6 = 0.0001f;
float m1 = 0.0001f;
float m2 = 0.0001f;
float m3 = 0.0001f;
float m4 = 0.1f;
float m5 = 0.1f;
float m6 = 0.00001f;
float m7 = 0.01f;
float m8 = 0.0001f;
float m9 = 0.0001f;
} gain_mask;
struct EchoAudibility {
@ -320,12 +322,12 @@ class AudioProcessing : public rtc::RefCountInterface {
float min_dec;
};
GainChanges low_noise = {8.f, 10.f, 2.f, 4.f, 4.f, 4.f};
GainChanges normal = {4.f, 10.f, 1.5f, 4.f, 2.f, 4.f};
GainChanges low_noise = {1.5f, 1.5f, 1.2f, 1.2f, 1.1f, 1.1f};
GainChanges normal = {1.5f, 1.5f, 1.2f, 1.2f, 1.1f, 1.1f};
GainChanges saturation = {1.2f, 1.2f, 1.5f, 1.5f, 1.f, 1.f};
GainChanges nonlinear = {1.5f, 1.5f, 1.2f, 1.2f, 1.1f, 1.1f};
float floor_first_increase = 0.001f;
float floor_first_increase = 0.0001f;
} gain_updates;
} param;
bool enabled = false;