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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // Estimate the residual echo power. | 183 // Estimate the residual echo power. |
184 residual_echo_estimator_.Estimate(output_selector_.UseSubtractorOutput(), | 184 residual_echo_estimator_.Estimate(output_selector_.UseSubtractorOutput(), |
185 aec_state_, render_buffer, S2_linear, Y2, | 185 aec_state_, render_buffer, S2_linear, Y2, |
186 &R2); | 186 &R2); |
187 | 187 |
188 // Estimate the comfort noise. | 188 // Estimate the comfort noise. |
189 cng_.Compute(aec_state_, Y2, &comfort_noise, &high_band_comfort_noise); | 189 cng_.Compute(aec_state_, Y2, &comfort_noise, &high_band_comfort_noise); |
190 | 190 |
191 // A choose and apply echo suppression gain. | 191 // A choose and apply echo suppression gain. |
192 suppression_gain_.GetGain(E2, R2, cng_.NoiseSpectrum(), | 192 suppression_gain_.GetGain(E2, R2, cng_.NoiseSpectrum(), |
193 aec_state_.SaturatedEcho(), x, | 193 render_signal_analyzer_, aec_state_.SaturatedEcho(), |
194 aec_state_.ForcedZeroGain(), &high_bands_gain, &G); | 194 x, aec_state_.ForcedZeroGain(), &high_bands_gain, |
| 195 &G); |
195 suppression_filter_.ApplyGain(comfort_noise, high_band_comfort_noise, G, | 196 suppression_filter_.ApplyGain(comfort_noise, high_band_comfort_noise, G, |
196 high_bands_gain, y); | 197 high_bands_gain, y); |
197 | 198 |
198 // Update the metrics. | 199 // Update the metrics. |
199 metrics_.Update(aec_state_, cng_.NoiseSpectrum(), G); | 200 metrics_.Update(aec_state_, cng_.NoiseSpectrum(), G); |
200 | 201 |
201 // Update the aec state with the aec output characteristics. | 202 // Update the aec state with the aec output characteristics. |
202 aec_state_.UpdateWithOutput(y0); | 203 aec_state_.UpdateWithOutput(y0); |
203 | 204 |
204 // Debug outputs for the purpose of development and analysis. | 205 // Debug outputs for the purpose of development and analysis. |
205 data_dumper_->DumpWav("aec3_echo_estimate", kBlockSize, | 206 data_dumper_->DumpWav("aec3_echo_estimate", kBlockSize, |
206 &subtractor_output.s_main[0], | 207 &subtractor_output.s_main[0], |
207 LowestBandRate(sample_rate_hz_), 1); | 208 LowestBandRate(sample_rate_hz_), 1); |
208 data_dumper_->DumpRaw("aec3_output", y0); | 209 data_dumper_->DumpRaw("aec3_output", y0); |
| 210 data_dumper_->DumpRaw("aec3_narrow_render", |
| 211 render_signal_analyzer_.NarrowPeakBand() ? 1 : 0); |
209 data_dumper_->DumpRaw("aec3_N2", cng_.NoiseSpectrum()); | 212 data_dumper_->DumpRaw("aec3_N2", cng_.NoiseSpectrum()); |
210 data_dumper_->DumpRaw("aec3_suppressor_gain", G); | 213 data_dumper_->DumpRaw("aec3_suppressor_gain", G); |
211 data_dumper_->DumpWav("aec3_output", | 214 data_dumper_->DumpWav("aec3_output", |
212 rtc::ArrayView<const float>(&y0[0], kBlockSize), | 215 rtc::ArrayView<const float>(&y0[0], kBlockSize), |
213 LowestBandRate(sample_rate_hz_), 1); | 216 LowestBandRate(sample_rate_hz_), 1); |
214 data_dumper_->DumpRaw("aec3_using_subtractor_output", | 217 data_dumper_->DumpRaw("aec3_using_subtractor_output", |
215 output_selector_.UseSubtractorOutput() ? 1 : 0); | 218 output_selector_.UseSubtractorOutput() ? 1 : 0); |
216 data_dumper_->DumpRaw("aec3_E2", E2); | 219 data_dumper_->DumpRaw("aec3_E2", E2); |
217 data_dumper_->DumpRaw("aec3_E2_main", E2_main); | 220 data_dumper_->DumpRaw("aec3_E2_main", E2_main); |
218 data_dumper_->DumpRaw("aec3_E2_shadow", E2_shadow); | 221 data_dumper_->DumpRaw("aec3_E2_shadow", E2_shadow); |
(...skipping 18 matching lines...) Expand all Loading... |
237 | 240 |
238 } // namespace | 241 } // namespace |
239 | 242 |
240 EchoRemover* EchoRemover::Create( | 243 EchoRemover* EchoRemover::Create( |
241 const AudioProcessing::Config::EchoCanceller3& config, | 244 const AudioProcessing::Config::EchoCanceller3& config, |
242 int sample_rate_hz) { | 245 int sample_rate_hz) { |
243 return new EchoRemoverImpl(config, sample_rate_hz); | 246 return new EchoRemoverImpl(config, sample_rate_hz); |
244 } | 247 } |
245 | 248 |
246 } // namespace webrtc | 249 } // namespace webrtc |
OLD | NEW |