AEC3: Added parameters for bypassing the suppressor
Bug: webrtc:8671 Change-Id: I9d9ffae0ca66a457481860f619e20fe580632f1d Reviewed-on: https://webrtc-review.googlesource.com/94622 Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org> Commit-Queue: Per Åhgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24331}
This commit is contained in:
parent
c8993d8b01
commit
7343f56ca6
@ -166,6 +166,8 @@ struct EchoCanceller3Config {
|
||||
};
|
||||
MaskingThresholds mask_lf = {.2f, .3f, .3f};
|
||||
MaskingThresholds mask_hf = {.07f, .1f, .3f};
|
||||
bool enforce_transparent = false;
|
||||
bool enforce_empty_higher_bands = false;
|
||||
} suppressor;
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
@ -470,6 +470,13 @@ void SuppressionGain::GetGain(
|
||||
std::array<float, kFftLengthBy2Plus1>* low_band_gain) {
|
||||
RTC_DCHECK(high_bands_gain);
|
||||
RTC_DCHECK(low_band_gain);
|
||||
const auto& cfg = config_.suppressor;
|
||||
|
||||
if (cfg.enforce_transparent) {
|
||||
low_band_gain->fill(1.f);
|
||||
*high_bands_gain = cfg.enforce_empty_higher_bands ? 0.f : 1.f;
|
||||
return;
|
||||
}
|
||||
|
||||
std::array<float, kFftLengthBy2Plus1> nearend_average;
|
||||
moving_average_.Average(nearend_spectrum, nearend_average);
|
||||
@ -482,13 +489,12 @@ void SuppressionGain::GetGain(
|
||||
comfort_noise_spectrum, low_band_gain);
|
||||
|
||||
// Adjust the gain for bands where the coherence indicates not echo.
|
||||
if (config_.suppressor.bands_with_reliable_coherence > 0 &&
|
||||
if (cfg.bands_with_reliable_coherence > 0 &&
|
||||
!enable_transparency_improvements_) {
|
||||
std::array<float, kFftLengthBy2Plus1> G_coherence;
|
||||
coherence_gain_.ComputeGain(linear_aec_fft, render_fft, capture_fft,
|
||||
G_coherence);
|
||||
for (size_t k = 0; k < config_.suppressor.bands_with_reliable_coherence;
|
||||
++k) {
|
||||
for (size_t k = 0; k < cfg.bands_with_reliable_coherence; ++k) {
|
||||
(*low_band_gain)[k] = std::max((*low_band_gain)[k], G_coherence[k]);
|
||||
}
|
||||
}
|
||||
@ -504,6 +510,9 @@ void SuppressionGain::GetGain(
|
||||
// Compute the gain for the upper bands.
|
||||
*high_bands_gain = UpperBandsGain(narrow_peak_band, aec_state.SaturatedEcho(),
|
||||
render, *low_band_gain);
|
||||
if (cfg.enforce_empty_higher_bands) {
|
||||
*high_bands_gain = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
void SuppressionGain::SetInitialState(bool state) {
|
||||
|
||||
@ -325,6 +325,10 @@ EchoCanceller3Config ParseAec3Parameters(const std::string& filename) {
|
||||
&cfg.suppressor.nearend_average_blocks);
|
||||
ReadParam(section, "mask_lf", &cfg.suppressor.mask_lf);
|
||||
ReadParam(section, "mask_hf", &cfg.suppressor.mask_hf);
|
||||
ReadParam(section, "enforce_transparent",
|
||||
&cfg.suppressor.enforce_transparent);
|
||||
ReadParam(section, "enforce_empty_higher_bands",
|
||||
&cfg.suppressor.enforce_empty_higher_bands);
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user