OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include "webrtc/modules/audio_processing/aec3/echo_remover.h" | 10 #include "webrtc/modules/audio_processing/aec3/echo_remover.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // Estimate the residual echo power. | 179 // Estimate the residual echo power. |
180 residual_echo_estimator_.Estimate(output_selector_.UseSubtractorOutput(), | 180 residual_echo_estimator_.Estimate(output_selector_.UseSubtractorOutput(), |
181 aec_state_, render_buffer, S2_linear, Y2, | 181 aec_state_, render_buffer, S2_linear, Y2, |
182 &R2); | 182 &R2); |
183 | 183 |
184 // Estimate the comfort noise. | 184 // Estimate the comfort noise. |
185 cng_.Compute(aec_state_, Y2, &comfort_noise, &high_band_comfort_noise); | 185 cng_.Compute(aec_state_, Y2, &comfort_noise, &high_band_comfort_noise); |
186 | 186 |
187 // A choose and apply echo suppression gain. | 187 // A choose and apply echo suppression gain. |
188 suppression_gain_.GetGain(E2, R2, cng_.NoiseSpectrum(), | 188 suppression_gain_.GetGain(E2, R2, cng_.NoiseSpectrum(), |
189 aec_state_.SaturatedEcho(), x, | 189 render_signal_analyzer_, aec_state_.SaturatedEcho(), |
190 aec_state_.ForcedZeroGain(), &high_bands_gain, &G); | 190 x, aec_state_.ForcedZeroGain(), &high_bands_gain, |
| 191 &G); |
191 suppression_filter_.ApplyGain(comfort_noise, high_band_comfort_noise, G, | 192 suppression_filter_.ApplyGain(comfort_noise, high_band_comfort_noise, G, |
192 high_bands_gain, y); | 193 high_bands_gain, y); |
193 | 194 |
194 // Update the metrics. | 195 // Update the metrics. |
195 metrics_.Update(aec_state_, cng_.NoiseSpectrum(), G); | 196 metrics_.Update(aec_state_, cng_.NoiseSpectrum(), G); |
196 | 197 |
197 // Debug outputs for the purpose of development and analysis. | 198 // Debug outputs for the purpose of development and analysis. |
| 199 data_dumper_->DumpRaw("aec3_narrow_render", |
| 200 render_signal_analyzer_.NarrowPeakBand() ? 1 : 0); |
198 data_dumper_->DumpRaw("aec3_N2", cng_.NoiseSpectrum()); | 201 data_dumper_->DumpRaw("aec3_N2", cng_.NoiseSpectrum()); |
199 data_dumper_->DumpRaw("aec3_suppressor_gain", G); | 202 data_dumper_->DumpRaw("aec3_suppressor_gain", G); |
200 data_dumper_->DumpWav("aec3_output", | 203 data_dumper_->DumpWav("aec3_output", |
201 rtc::ArrayView<const float>(&y0[0], kBlockSize), | 204 rtc::ArrayView<const float>(&y0[0], kBlockSize), |
202 LowestBandRate(sample_rate_hz_), 1); | 205 LowestBandRate(sample_rate_hz_), 1); |
203 data_dumper_->DumpRaw("aec3_using_subtractor_output", | 206 data_dumper_->DumpRaw("aec3_using_subtractor_output", |
204 output_selector_.UseSubtractorOutput() ? 1 : 0); | 207 output_selector_.UseSubtractorOutput() ? 1 : 0); |
205 data_dumper_->DumpRaw("aec3_E2", E2); | 208 data_dumper_->DumpRaw("aec3_E2", E2); |
206 data_dumper_->DumpRaw("aec3_E2_main", E2_main); | 209 data_dumper_->DumpRaw("aec3_E2_main", E2_main); |
207 data_dumper_->DumpRaw("aec3_E2_shadow", E2_shadow); | 210 data_dumper_->DumpRaw("aec3_E2_shadow", E2_shadow); |
(...skipping 18 matching lines...) Expand all Loading... |
226 | 229 |
227 } // namespace | 230 } // namespace |
228 | 231 |
229 EchoRemover* EchoRemover::Create( | 232 EchoRemover* EchoRemover::Create( |
230 const AudioProcessing::Config::EchoCanceller3& config, | 233 const AudioProcessing::Config::EchoCanceller3& config, |
231 int sample_rate_hz) { | 234 int sample_rate_hz) { |
232 return new EchoRemoverImpl(config, sample_rate_hz); | 235 return new EchoRemoverImpl(config, sample_rate_hz); |
233 } | 236 } |
234 | 237 |
235 } // namespace webrtc | 238 } // namespace webrtc |
OLD | NEW |