OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 | 10 |
11 #include "webrtc/modules/audio_processing/audio_processing_impl.h" | 11 #include "webrtc/modules/audio_processing/audio_processing_impl.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 | 14 |
15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
16 #include "webrtc/base/platform_file.h" | 16 #include "webrtc/base/platform_file.h" |
17 #include "webrtc/base/trace_event.h" | 17 #include "webrtc/base/trace_event.h" |
18 #include "webrtc/common_audio/audio_converter.h" | 18 #include "webrtc/common_audio/audio_converter.h" |
19 #include "webrtc/common_audio/channel_buffer.h" | 19 #include "webrtc/common_audio/channel_buffer.h" |
20 #include "webrtc/common_audio/include/audio_util.h" | 20 #include "webrtc/common_audio/include/audio_util.h" |
21 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 21 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
22 #include "webrtc/modules/audio_processing/aec/aec_core.h" | 22 #include "webrtc/modules/audio_processing/aec/aec_core.h" |
23 #include "webrtc/modules/audio_processing/agc/agc_manager_direct.h" | 23 #include "webrtc/modules/audio_processing/agc/agc_manager_direct.h" |
24 #include "webrtc/modules/audio_processing/audio_buffer.h" | 24 #include "webrtc/modules/audio_processing/audio_buffer.h" |
25 #include "webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h" | 25 #include "webrtc/modules/audio_processing/beamformer/nonlinear_beamformer.h" |
| 26 #include "webrtc/modules/audio_processing/biquad_high_pass_filter.h" |
26 #include "webrtc/modules/audio_processing/common.h" | 27 #include "webrtc/modules/audio_processing/common.h" |
27 #include "webrtc/modules/audio_processing/echo_cancellation_impl.h" | 28 #include "webrtc/modules/audio_processing/echo_cancellation_impl.h" |
28 #include "webrtc/modules/audio_processing/echo_control_mobile_impl.h" | 29 #include "webrtc/modules/audio_processing/echo_control_mobile_impl.h" |
29 #include "webrtc/modules/audio_processing/gain_control_for_experimental_agc.h" | 30 #include "webrtc/modules/audio_processing/gain_control_for_experimental_agc.h" |
30 #include "webrtc/modules/audio_processing/gain_control_impl.h" | 31 #include "webrtc/modules/audio_processing/gain_control_impl.h" |
31 #include "webrtc/modules/audio_processing/high_pass_filter_impl.h" | |
32 #if WEBRTC_INTELLIGIBILITY_ENHANCER | 32 #if WEBRTC_INTELLIGIBILITY_ENHANCER |
33 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhanc
er.h" | 33 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhanc
er.h" |
34 #endif | 34 #endif |
35 #include "webrtc/modules/audio_processing/level_controller/level_controller.h" | 35 #include "webrtc/modules/audio_processing/level_controller/level_controller.h" |
36 #include "webrtc/modules/audio_processing/level_estimator_impl.h" | 36 #include "webrtc/modules/audio_processing/level_estimator_impl.h" |
37 #include "webrtc/modules/audio_processing/noise_suppression_impl.h" | 37 #include "webrtc/modules/audio_processing/noise_suppression_impl.h" |
38 #include "webrtc/modules/audio_processing/transient/transient_suppressor.h" | 38 #include "webrtc/modules/audio_processing/transient/transient_suppressor.h" |
39 #include "webrtc/modules/audio_processing/voice_detection_impl.h" | 39 #include "webrtc/modules/audio_processing/voice_detection_impl.h" |
40 #include "webrtc/modules/include/module_common_types.h" | 40 #include "webrtc/modules/include/module_common_types.h" |
41 #include "webrtc/system_wrappers/include/file_wrapper.h" | 41 #include "webrtc/system_wrappers/include/file_wrapper.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 return false; | 211 return false; |
212 #endif | 212 #endif |
213 } | 213 } |
214 | 214 |
215 struct AudioProcessingImpl::ApmPublicSubmodules { | 215 struct AudioProcessingImpl::ApmPublicSubmodules { |
216 ApmPublicSubmodules() {} | 216 ApmPublicSubmodules() {} |
217 // Accessed externally of APM without any lock acquired. | 217 // Accessed externally of APM without any lock acquired. |
218 std::unique_ptr<EchoCancellationImpl> echo_cancellation; | 218 std::unique_ptr<EchoCancellationImpl> echo_cancellation; |
219 std::unique_ptr<EchoControlMobileImpl> echo_control_mobile; | 219 std::unique_ptr<EchoControlMobileImpl> echo_control_mobile; |
220 std::unique_ptr<GainControlImpl> gain_control; | 220 std::unique_ptr<GainControlImpl> gain_control; |
221 std::unique_ptr<HighPassFilterImpl> high_pass_filter; | |
222 std::unique_ptr<LevelEstimatorImpl> level_estimator; | 221 std::unique_ptr<LevelEstimatorImpl> level_estimator; |
223 std::unique_ptr<NoiseSuppressionImpl> noise_suppression; | 222 std::unique_ptr<NoiseSuppressionImpl> noise_suppression; |
224 std::unique_ptr<VoiceDetectionImpl> voice_detection; | 223 std::unique_ptr<VoiceDetectionImpl> voice_detection; |
225 std::unique_ptr<GainControlForExperimentalAgc> | 224 std::unique_ptr<GainControlForExperimentalAgc> |
226 gain_control_for_experimental_agc; | 225 gain_control_for_experimental_agc; |
227 | 226 |
228 // Accessed internally from both render and capture. | 227 // Accessed internally from both render and capture. |
229 std::unique_ptr<TransientSuppressor> transient_suppressor; | 228 std::unique_ptr<TransientSuppressor> transient_suppressor; |
230 #if WEBRTC_INTELLIGIBILITY_ENHANCER | 229 #if WEBRTC_INTELLIGIBILITY_ENHANCER |
231 std::unique_ptr<IntelligibilityEnhancer> intelligibility_enhancer; | 230 std::unique_ptr<IntelligibilityEnhancer> intelligibility_enhancer; |
232 #endif | 231 #endif |
233 }; | 232 }; |
234 | 233 |
235 struct AudioProcessingImpl::ApmPrivateSubmodules { | 234 struct AudioProcessingImpl::ApmPrivateSubmodules { |
236 explicit ApmPrivateSubmodules(NonlinearBeamformer* beamformer) | 235 explicit ApmPrivateSubmodules(NonlinearBeamformer* beamformer) |
237 : beamformer(beamformer) {} | 236 : beamformer(beamformer) {} |
238 // Accessed internally from capture or during initialization | 237 // Accessed internally from capture or during initialization |
239 std::unique_ptr<NonlinearBeamformer> beamformer; | 238 std::unique_ptr<NonlinearBeamformer> beamformer; |
240 std::unique_ptr<AgcManagerDirect> agc_manager; | 239 std::unique_ptr<AgcManagerDirect> agc_manager; |
| 240 std::unique_ptr<BiquadHighPassFilter> high_pass_filter; |
241 std::unique_ptr<LevelController> level_controller; | 241 std::unique_ptr<LevelController> level_controller; |
242 }; | 242 }; |
243 | 243 |
244 AudioProcessing* AudioProcessing::Create() { | 244 AudioProcessing* AudioProcessing::Create() { |
245 webrtc::Config config; | 245 webrtc::Config config; |
246 return Create(config, nullptr); | 246 return Create(config, nullptr); |
247 } | 247 } |
248 | 248 |
249 AudioProcessing* AudioProcessing::Create(const webrtc::Config& config) { | 249 AudioProcessing* AudioProcessing::Create(const webrtc::Config& config) { |
250 return Create(config, nullptr); | 250 return Create(config, nullptr); |
251 } | 251 } |
252 | 252 |
253 AudioProcessing* AudioProcessing::Create(const webrtc::Config& config, | 253 AudioProcessing* AudioProcessing::Create(const webrtc::Config& config, |
254 NonlinearBeamformer* beamformer) { | 254 NonlinearBeamformer* beamformer) { |
255 AudioProcessingImpl* apm = new AudioProcessingImpl(config, beamformer); | 255 AudioProcessingImpl* apm = new AudioProcessingImpl(config, beamformer); |
256 if (apm->Initialize() != kNoError) { | 256 if (apm->Initialize() != kNoError) { |
257 delete apm; | 257 delete apm; |
258 apm = nullptr; | 258 apm = nullptr; |
259 } | 259 } |
260 | 260 |
261 return apm; | 261 return apm; |
262 } | 262 } |
263 | 263 |
264 AudioProcessingImpl::AudioProcessingImpl(const webrtc::Config& config) | 264 AudioProcessingImpl::AudioProcessingImpl(const webrtc::Config& config) |
265 : AudioProcessingImpl(config, nullptr) {} | 265 : AudioProcessingImpl(config, nullptr) {} |
266 | 266 |
267 AudioProcessingImpl::AudioProcessingImpl(const webrtc::Config& config, | 267 AudioProcessingImpl::AudioProcessingImpl(const webrtc::Config& config, |
268 NonlinearBeamformer* beamformer) | 268 NonlinearBeamformer* beamformer) |
269 : public_submodules_(new ApmPublicSubmodules()), | 269 : high_pass_filter_impl_(new HighPassFilterImpl(this)), |
| 270 public_submodules_(new ApmPublicSubmodules()), |
270 private_submodules_(new ApmPrivateSubmodules(beamformer)), | 271 private_submodules_(new ApmPrivateSubmodules(beamformer)), |
271 constants_(config.Get<ExperimentalAgc>().startup_min_volume, | 272 constants_(config.Get<ExperimentalAgc>().startup_min_volume, |
272 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 273 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
273 false), | 274 false), |
274 #else | 275 #else |
275 config.Get<ExperimentalAgc>().enabled), | 276 config.Get<ExperimentalAgc>().enabled), |
276 #endif | 277 #endif |
277 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) | 278 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
278 capture_(false, | 279 capture_(false, |
279 #else | 280 #else |
280 capture_(config.Get<ExperimentalNs>().enabled, | 281 capture_(config.Get<ExperimentalNs>().enabled, |
281 #endif | 282 #endif |
282 config.Get<Beamforming>().array_geometry, | 283 config.Get<Beamforming>().array_geometry, |
283 config.Get<Beamforming>().target_direction), | 284 config.Get<Beamforming>().target_direction), |
284 capture_nonlocked_(config.Get<Beamforming>().enabled, | 285 capture_nonlocked_(config.Get<Beamforming>().enabled, |
285 config.Get<Intelligibility>().enabled) { | 286 config.Get<Intelligibility>().enabled) { |
286 { | 287 { |
287 rtc::CritScope cs_render(&crit_render_); | 288 rtc::CritScope cs_render(&crit_render_); |
288 rtc::CritScope cs_capture(&crit_capture_); | 289 rtc::CritScope cs_capture(&crit_capture_); |
289 | 290 |
290 public_submodules_->echo_cancellation.reset( | 291 public_submodules_->echo_cancellation.reset( |
291 new EchoCancellationImpl(&crit_render_, &crit_capture_)); | 292 new EchoCancellationImpl(&crit_render_, &crit_capture_)); |
292 public_submodules_->echo_control_mobile.reset( | 293 public_submodules_->echo_control_mobile.reset( |
293 new EchoControlMobileImpl(&crit_render_, &crit_capture_)); | 294 new EchoControlMobileImpl(&crit_render_, &crit_capture_)); |
294 public_submodules_->gain_control.reset( | 295 public_submodules_->gain_control.reset( |
295 new GainControlImpl(&crit_capture_, &crit_capture_)); | 296 new GainControlImpl(&crit_capture_, &crit_capture_)); |
296 public_submodules_->high_pass_filter.reset( | |
297 new HighPassFilterImpl(&crit_capture_)); | |
298 public_submodules_->level_estimator.reset( | 297 public_submodules_->level_estimator.reset( |
299 new LevelEstimatorImpl(&crit_capture_)); | 298 new LevelEstimatorImpl(&crit_capture_)); |
300 public_submodules_->noise_suppression.reset( | 299 public_submodules_->noise_suppression.reset( |
301 new NoiseSuppressionImpl(&crit_capture_)); | 300 new NoiseSuppressionImpl(&crit_capture_)); |
302 public_submodules_->voice_detection.reset( | 301 public_submodules_->voice_detection.reset( |
303 new VoiceDetectionImpl(&crit_capture_)); | 302 new VoiceDetectionImpl(&crit_capture_)); |
304 public_submodules_->gain_control_for_experimental_agc.reset( | 303 public_submodules_->gain_control_for_experimental_agc.reset( |
305 new GainControlForExperimentalAgc( | 304 new GainControlForExperimentalAgc( |
306 public_submodules_->gain_control.get(), &crit_capture_)); | 305 public_submodules_->gain_control.get(), &crit_capture_)); |
307 | 306 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 } | 454 } |
456 private_submodules_->agc_manager->Initialize(); | 455 private_submodules_->agc_manager->Initialize(); |
457 private_submodules_->agc_manager->SetCaptureMuted( | 456 private_submodules_->agc_manager->SetCaptureMuted( |
458 capture_.output_will_be_muted); | 457 capture_.output_will_be_muted); |
459 } | 458 } |
460 InitializeTransient(); | 459 InitializeTransient(); |
461 InitializeBeamformer(); | 460 InitializeBeamformer(); |
462 #if WEBRTC_INTELLIGIBILITY_ENHANCER | 461 #if WEBRTC_INTELLIGIBILITY_ENHANCER |
463 InitializeIntelligibility(); | 462 InitializeIntelligibility(); |
464 #endif | 463 #endif |
465 public_submodules_->high_pass_filter->Initialize(num_proc_channels(), | 464 InitializeHighPassFilter(); |
466 proc_sample_rate_hz()); | |
467 public_submodules_->noise_suppression->Initialize(num_proc_channels(), | 465 public_submodules_->noise_suppression->Initialize(num_proc_channels(), |
468 proc_sample_rate_hz()); | 466 proc_sample_rate_hz()); |
469 public_submodules_->voice_detection->Initialize(proc_split_sample_rate_hz()); | 467 public_submodules_->voice_detection->Initialize(proc_split_sample_rate_hz()); |
470 public_submodules_->level_estimator->Initialize(); | 468 public_submodules_->level_estimator->Initialize(); |
471 InitializeLevelController(); | 469 InitializeLevelController(); |
472 | 470 |
473 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 471 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
474 if (debug_dump_.debug_file->is_open()) { | 472 if (debug_dump_.debug_file->is_open()) { |
475 int err = WriteInitMessage(); | 473 int err = WriteInitMessage(); |
476 if (err != kNoError) { | 474 if (err != kNoError) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 capture_nonlocked_.level_controller_enabled = | 576 capture_nonlocked_.level_controller_enabled = |
579 config_.level_controller.enabled; | 577 config_.level_controller.enabled; |
580 // TODO(peah): Remove the conditional initialization to always initialize | 578 // TODO(peah): Remove the conditional initialization to always initialize |
581 // the level controller regardless of whether it is enabled or not. | 579 // the level controller regardless of whether it is enabled or not. |
582 InitializeLevelController(); | 580 InitializeLevelController(); |
583 } | 581 } |
584 LOG(LS_INFO) << "Level controller activated: " | 582 LOG(LS_INFO) << "Level controller activated: " |
585 << capture_nonlocked_.level_controller_enabled; | 583 << capture_nonlocked_.level_controller_enabled; |
586 | 584 |
587 private_submodules_->level_controller->ApplyConfig(config_.level_controller); | 585 private_submodules_->level_controller->ApplyConfig(config_.level_controller); |
| 586 |
| 587 InitializeHighPassFilter(); |
| 588 |
| 589 LOG(LS_INFO) << "Highpass filter activated: " |
| 590 << config_.high_pass_filter.enabled; |
588 } | 591 } |
589 | 592 |
590 void AudioProcessingImpl::SetExtraOptions(const webrtc::Config& config) { | 593 void AudioProcessingImpl::SetExtraOptions(const webrtc::Config& config) { |
591 // Run in a single-threaded manner when setting the extra options. | 594 // Run in a single-threaded manner when setting the extra options. |
592 rtc::CritScope cs_render(&crit_render_); | 595 rtc::CritScope cs_render(&crit_render_); |
593 rtc::CritScope cs_capture(&crit_capture_); | 596 rtc::CritScope cs_capture(&crit_capture_); |
594 | 597 |
595 public_submodules_->echo_cancellation->SetExtraOptions(config); | 598 public_submodules_->echo_cancellation->SetExtraOptions(config); |
596 | 599 |
597 if (capture_.transient_suppressor_enabled != | 600 if (capture_.transient_suppressor_enabled != |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 capture_buffer->SplitIntoFrequencyBands(); | 1029 capture_buffer->SplitIntoFrequencyBands(); |
1027 } | 1030 } |
1028 | 1031 |
1029 if (capture_nonlocked_.beamformer_enabled) { | 1032 if (capture_nonlocked_.beamformer_enabled) { |
1030 private_submodules_->beamformer->AnalyzeChunk( | 1033 private_submodules_->beamformer->AnalyzeChunk( |
1031 *capture_buffer->split_data_f()); | 1034 *capture_buffer->split_data_f()); |
1032 // Discards all channels by the leftmost one. | 1035 // Discards all channels by the leftmost one. |
1033 capture_buffer->set_num_channels(1); | 1036 capture_buffer->set_num_channels(1); |
1034 } | 1037 } |
1035 | 1038 |
1036 public_submodules_->high_pass_filter->ProcessCaptureAudio(capture_buffer); | 1039 if (private_submodules_->high_pass_filter) { |
| 1040 private_submodules_->high_pass_filter->Process(capture_buffer); |
| 1041 } |
1037 RETURN_ON_ERR( | 1042 RETURN_ON_ERR( |
1038 public_submodules_->gain_control->AnalyzeCaptureAudio(capture_buffer)); | 1043 public_submodules_->gain_control->AnalyzeCaptureAudio(capture_buffer)); |
1039 public_submodules_->noise_suppression->AnalyzeCaptureAudio(capture_buffer); | 1044 public_submodules_->noise_suppression->AnalyzeCaptureAudio(capture_buffer); |
1040 | 1045 |
1041 // Ensure that the stream delay was set before the call to the | 1046 // Ensure that the stream delay was set before the call to the |
1042 // AEC ProcessCaptureAudio function. | 1047 // AEC ProcessCaptureAudio function. |
1043 if (public_submodules_->echo_cancellation->is_enabled() && | 1048 if (public_submodules_->echo_cancellation->is_enabled() && |
1044 !was_stream_delay_set()) { | 1049 !was_stream_delay_set()) { |
1045 return AudioProcessing::kStreamParameterNotSetError; | 1050 return AudioProcessing::kStreamParameterNotSetError; |
1046 } | 1051 } |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 } | 1431 } |
1427 | 1432 |
1428 GainControl* AudioProcessingImpl::gain_control() const { | 1433 GainControl* AudioProcessingImpl::gain_control() const { |
1429 if (constants_.use_experimental_agc) { | 1434 if (constants_.use_experimental_agc) { |
1430 return public_submodules_->gain_control_for_experimental_agc.get(); | 1435 return public_submodules_->gain_control_for_experimental_agc.get(); |
1431 } | 1436 } |
1432 return public_submodules_->gain_control.get(); | 1437 return public_submodules_->gain_control.get(); |
1433 } | 1438 } |
1434 | 1439 |
1435 HighPassFilter* AudioProcessingImpl::high_pass_filter() const { | 1440 HighPassFilter* AudioProcessingImpl::high_pass_filter() const { |
1436 return public_submodules_->high_pass_filter.get(); | 1441 return high_pass_filter_impl_.get(); |
1437 } | 1442 } |
1438 | 1443 |
1439 LevelEstimator* AudioProcessingImpl::level_estimator() const { | 1444 LevelEstimator* AudioProcessingImpl::level_estimator() const { |
1440 return public_submodules_->level_estimator.get(); | 1445 return public_submodules_->level_estimator.get(); |
1441 } | 1446 } |
1442 | 1447 |
1443 NoiseSuppression* AudioProcessingImpl::noise_suppression() const { | 1448 NoiseSuppression* AudioProcessingImpl::noise_suppression() const { |
1444 return public_submodules_->noise_suppression.get(); | 1449 return public_submodules_->noise_suppression.get(); |
1445 } | 1450 } |
1446 | 1451 |
1447 VoiceDetection* AudioProcessingImpl::voice_detection() const { | 1452 VoiceDetection* AudioProcessingImpl::voice_detection() const { |
1448 return public_submodules_->voice_detection.get(); | 1453 return public_submodules_->voice_detection.get(); |
1449 } | 1454 } |
1450 | 1455 |
1451 bool AudioProcessingImpl::UpdateActiveSubmoduleStates() { | 1456 bool AudioProcessingImpl::UpdateActiveSubmoduleStates() { |
1452 return submodule_states_.Update( | 1457 return submodule_states_.Update( |
1453 public_submodules_->high_pass_filter->is_enabled(), | 1458 config_.high_pass_filter.enabled, |
1454 public_submodules_->echo_cancellation->is_enabled(), | 1459 public_submodules_->echo_cancellation->is_enabled(), |
1455 public_submodules_->echo_control_mobile->is_enabled(), | 1460 public_submodules_->echo_control_mobile->is_enabled(), |
1456 public_submodules_->noise_suppression->is_enabled(), | 1461 public_submodules_->noise_suppression->is_enabled(), |
1457 capture_nonlocked_.intelligibility_enabled, | 1462 capture_nonlocked_.intelligibility_enabled, |
1458 capture_nonlocked_.beamformer_enabled, | 1463 capture_nonlocked_.beamformer_enabled, |
1459 public_submodules_->gain_control->is_enabled(), | 1464 public_submodules_->gain_control->is_enabled(), |
1460 capture_nonlocked_.level_controller_enabled, | 1465 capture_nonlocked_.level_controller_enabled, |
1461 public_submodules_->voice_detection->is_enabled(), | 1466 public_submodules_->voice_detection->is_enabled(), |
1462 public_submodules_->level_estimator->is_enabled(), | 1467 public_submodules_->level_estimator->is_enabled(), |
1463 capture_.transient_suppressor_enabled); | 1468 capture_.transient_suppressor_enabled); |
(...skipping 27 matching lines...) Expand all Loading... |
1491 if (capture_nonlocked_.intelligibility_enabled) { | 1496 if (capture_nonlocked_.intelligibility_enabled) { |
1492 public_submodules_->intelligibility_enhancer.reset( | 1497 public_submodules_->intelligibility_enhancer.reset( |
1493 new IntelligibilityEnhancer(capture_nonlocked_.split_rate, | 1498 new IntelligibilityEnhancer(capture_nonlocked_.split_rate, |
1494 render_.render_audio->num_channels(), | 1499 render_.render_audio->num_channels(), |
1495 render_.render_audio->num_bands(), | 1500 render_.render_audio->num_bands(), |
1496 NoiseSuppressionImpl::num_noise_bins())); | 1501 NoiseSuppressionImpl::num_noise_bins())); |
1497 } | 1502 } |
1498 #endif | 1503 #endif |
1499 } | 1504 } |
1500 | 1505 |
| 1506 void AudioProcessingImpl::InitializeHighPassFilter() { |
| 1507 if (config_.high_pass_filter.enabled) { |
| 1508 private_submodules_->high_pass_filter.reset( |
| 1509 new BiquadHighPassFilter(num_proc_channels(), proc_sample_rate_hz())); |
| 1510 } else { |
| 1511 private_submodules_->high_pass_filter.reset(); |
| 1512 } |
| 1513 } |
| 1514 |
1501 void AudioProcessingImpl::InitializeLevelController() { | 1515 void AudioProcessingImpl::InitializeLevelController() { |
1502 private_submodules_->level_controller->Initialize(proc_sample_rate_hz()); | 1516 private_submodules_->level_controller->Initialize(proc_sample_rate_hz()); |
1503 } | 1517 } |
1504 | 1518 |
1505 void AudioProcessingImpl::MaybeUpdateHistograms() { | 1519 void AudioProcessingImpl::MaybeUpdateHistograms() { |
1506 static const int kMinDiffDelayMs = 60; | 1520 static const int kMinDiffDelayMs = 60; |
1507 | 1521 |
1508 if (echo_cancellation()->is_enabled()) { | 1522 if (echo_cancellation()->is_enabled()) { |
1509 // Activate delay_jumps_ counters if we know echo_cancellation is runnning. | 1523 // Activate delay_jumps_ counters if we know echo_cancellation is runnning. |
1510 // If a stream has echo we know that the echo_cancellation is in process. | 1524 // If a stream has echo we know that the echo_cancellation is in process. |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1670 config.set_aecm_routing_mode(static_cast<int>( | 1684 config.set_aecm_routing_mode(static_cast<int>( |
1671 public_submodules_->echo_control_mobile->routing_mode())); | 1685 public_submodules_->echo_control_mobile->routing_mode())); |
1672 | 1686 |
1673 config.set_agc_enabled(public_submodules_->gain_control->is_enabled()); | 1687 config.set_agc_enabled(public_submodules_->gain_control->is_enabled()); |
1674 config.set_agc_mode( | 1688 config.set_agc_mode( |
1675 static_cast<int>(public_submodules_->gain_control->mode())); | 1689 static_cast<int>(public_submodules_->gain_control->mode())); |
1676 config.set_agc_limiter_enabled( | 1690 config.set_agc_limiter_enabled( |
1677 public_submodules_->gain_control->is_limiter_enabled()); | 1691 public_submodules_->gain_control->is_limiter_enabled()); |
1678 config.set_noise_robust_agc_enabled(constants_.use_experimental_agc); | 1692 config.set_noise_robust_agc_enabled(constants_.use_experimental_agc); |
1679 | 1693 |
1680 config.set_hpf_enabled(public_submodules_->high_pass_filter->is_enabled()); | 1694 config.set_hpf_enabled(config_.high_pass_filter.enabled); |
1681 | 1695 |
1682 config.set_ns_enabled(public_submodules_->noise_suppression->is_enabled()); | 1696 config.set_ns_enabled(public_submodules_->noise_suppression->is_enabled()); |
1683 config.set_ns_level( | 1697 config.set_ns_level( |
1684 static_cast<int>(public_submodules_->noise_suppression->level())); | 1698 static_cast<int>(public_submodules_->noise_suppression->level())); |
1685 | 1699 |
1686 config.set_transient_suppression_enabled( | 1700 config.set_transient_suppression_enabled( |
1687 capture_.transient_suppressor_enabled); | 1701 capture_.transient_suppressor_enabled); |
1688 config.set_intelligibility_enhancer_enabled( | 1702 config.set_intelligibility_enhancer_enabled( |
1689 capture_nonlocked_.intelligibility_enabled); | 1703 capture_nonlocked_.intelligibility_enabled); |
1690 | 1704 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1733 capture_processing_format(kSampleRate16kHz), | 1747 capture_processing_format(kSampleRate16kHz), |
1734 split_rate(kSampleRate16kHz) {} | 1748 split_rate(kSampleRate16kHz) {} |
1735 | 1749 |
1736 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; | 1750 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; |
1737 | 1751 |
1738 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; | 1752 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; |
1739 | 1753 |
1740 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; | 1754 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; |
1741 | 1755 |
1742 } // namespace webrtc | 1756 } // namespace webrtc |
OLD | NEW |