Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: webrtc/modules/audio_processing/level_controller/noise_spectrum_estimator.cc

Issue 2535593002: RTC_[D]CHECK_op: Remove "u" suffix on integer constants (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 16 matching lines...) Expand all
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);
33 } 33 }
34 34
35 void NoiseSpectrumEstimator::Update(rtc::ArrayView<const float> spectrum, 35 void NoiseSpectrumEstimator::Update(rtc::ArrayView<const float> spectrum,
36 bool first_update) { 36 bool first_update) {
37 RTC_DCHECK_EQ(65u, spectrum.size()); 37 RTC_DCHECK_EQ(65, spectrum.size());
38 38
39 if (first_update) { 39 if (first_update) {
40 // Initialize the noise spectral estimate with the signal spectrum. 40 // Initialize the noise spectral estimate with the signal spectrum.
41 std::copy(spectrum.data(), spectrum.data() + spectrum.size(), 41 std::copy(spectrum.data(), spectrum.data() + spectrum.size(),
42 noise_spectrum_); 42 noise_spectrum_);
43 } else { 43 } else {
44 // Smoothly update the noise spectral estimate towards the signal spectrum 44 // Smoothly update the noise spectral estimate towards the signal spectrum
45 // such that the magnitude of the updates are limited. 45 // such that the magnitude of the updates are limited.
46 for (size_t k = 0; k < spectrum.size(); ++k) { 46 for (size_t k = 0; k < spectrum.size(); ++k) {
47 if (noise_spectrum_[k] < spectrum[k]) { 47 if (noise_spectrum_[k] < spectrum[k]) {
(...skipping 11 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698