OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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/level_controller/noise_spectrum_estima
tor.h" | 11 #include "webrtc/modules/audio_processing/level_controller/noise_spectrum_estima
tor.h" |
12 | 12 |
13 #include <string.h> | 13 #include <string.h> |
14 #include <algorithm> | 14 #include <algorithm> |
15 | 15 |
16 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" | 16 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" |
17 #include "webrtc/rtc_base/array_view.h" | 17 #include "webrtc/rtc_base/array_view.h" |
18 #include "webrtc/rtc_base/arraysize.h" | 18 #include "webrtc/rtc_base/arraysize.h" |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 namespace { | 21 namespace { |
22 float kMinNoisePower = 100.f; | 22 constexpr float kMinNoisePower = 100.f; |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 NoiseSpectrumEstimator::NoiseSpectrumEstimator(ApmDataDumper* data_dumper) | 25 NoiseSpectrumEstimator::NoiseSpectrumEstimator(ApmDataDumper* data_dumper) |
26 : data_dumper_(data_dumper) { | 26 : data_dumper_(data_dumper) { |
27 Initialize(); | 27 Initialize(); |
28 } | 28 } |
29 | 29 |
30 void NoiseSpectrumEstimator::Initialize() { | 30 void NoiseSpectrumEstimator::Initialize() { |
31 std::fill(noise_spectrum_, noise_spectrum_ + arraysize(noise_spectrum_), | 31 std::fill(noise_spectrum_, noise_spectrum_ + arraysize(noise_spectrum_), |
32 kMinNoisePower); | 32 kMinNoisePower); |
(...skipping 26 matching lines...) Expand all Loading... |
59 // Ensure that the noise spectal estimate does not become too low. | 59 // Ensure that the noise spectal estimate does not become too low. |
60 for (auto& v : noise_spectrum_) { | 60 for (auto& v : noise_spectrum_) { |
61 v = std::max(v, kMinNoisePower); | 61 v = std::max(v, kMinNoisePower); |
62 } | 62 } |
63 | 63 |
64 data_dumper_->DumpRaw("lc_noise_spectrum", 65, noise_spectrum_); | 64 data_dumper_->DumpRaw("lc_noise_spectrum", 65, noise_spectrum_); |
65 data_dumper_->DumpRaw("lc_signal_spectrum", spectrum); | 65 data_dumper_->DumpRaw("lc_signal_spectrum", spectrum); |
66 } | 66 } |
67 | 67 |
68 } // namespace webrtc | 68 } // namespace webrtc |
OLD | NEW |