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

Side by Side Diff: webrtc/modules/audio_processing/level_controller/signal_classifier.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
11 #include "webrtc/modules/audio_processing/level_controller/signal_classifier.h" 11 #include "webrtc/modules/audio_processing/level_controller/signal_classifier.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <numeric> 14 #include <numeric>
15 #include <vector> 15 #include <vector>
16 16
17 #include "webrtc/base/array_view.h" 17 #include "webrtc/base/array_view.h"
18 #include "webrtc/base/constructormagic.h" 18 #include "webrtc/base/constructormagic.h"
19 #include "webrtc/modules/audio_processing/audio_buffer.h" 19 #include "webrtc/modules/audio_processing/audio_buffer.h"
20 #include "webrtc/modules/audio_processing/level_controller/down_sampler.h" 20 #include "webrtc/modules/audio_processing/level_controller/down_sampler.h"
21 #include "webrtc/modules/audio_processing/level_controller/noise_spectrum_estima tor.h" 21 #include "webrtc/modules/audio_processing/level_controller/noise_spectrum_estima tor.h"
22 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" 22 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
23 23
24 namespace webrtc { 24 namespace webrtc {
25 namespace { 25 namespace {
26 26
27 void RemoveDcLevel(rtc::ArrayView<float> x) { 27 void RemoveDcLevel(rtc::ArrayView<float> x) {
28 RTC_DCHECK_LT(0u, x.size()); 28 RTC_DCHECK_LT(0, x.size());
29 float mean = std::accumulate(x.data(), x.data() + x.size(), 0.f); 29 float mean = std::accumulate(x.data(), x.data() + x.size(), 0.f);
30 mean /= x.size(); 30 mean /= x.size();
31 31
32 for (float& v : x) { 32 for (float& v : x) {
33 v -= mean; 33 v -= mean;
34 } 34 }
35 } 35 }
36 36
37 void PowerSpectrum(const OouraFft* ooura_fft, 37 void PowerSpectrum(const OouraFft* ooura_fft,
38 rtc::ArrayView<const float> x, 38 rtc::ArrayView<const float> x,
39 rtc::ArrayView<float> spectrum) { 39 rtc::ArrayView<float> spectrum) {
40 RTC_DCHECK_EQ(65u, spectrum.size()); 40 RTC_DCHECK_EQ(65, spectrum.size());
41 RTC_DCHECK_EQ(128u, x.size()); 41 RTC_DCHECK_EQ(128, x.size());
42 float X[128]; 42 float X[128];
43 std::copy(x.data(), x.data() + x.size(), X); 43 std::copy(x.data(), x.data() + x.size(), X);
44 ooura_fft->Fft(X); 44 ooura_fft->Fft(X);
45 45
46 float* X_p = X; 46 float* X_p = X;
47 RTC_DCHECK_EQ(X_p, &X[0]); 47 RTC_DCHECK_EQ(X_p, &X[0]);
48 spectrum[0] = (*X_p) * (*X_p); 48 spectrum[0] = (*X_p) * (*X_p);
49 ++X_p; 49 ++X_p;
50 RTC_DCHECK_EQ(X_p, &X[1]); 50 RTC_DCHECK_EQ(X_p, &X[1]);
51 spectrum[64] = (*X_p) * (*X_p); 51 spectrum[64] = (*X_p) * (*X_p);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 last_signal_type_ = *signal_type; 162 last_signal_type_ = *signal_type;
163 consistent_classification_counter_ = 3; 163 consistent_classification_counter_ = 3;
164 } 164 }
165 165
166 if (consistent_classification_counter_ > 0) { 166 if (consistent_classification_counter_ > 0) {
167 *signal_type = SignalClassifier::SignalType::kNonStationary; 167 *signal_type = SignalClassifier::SignalType::kNonStationary;
168 } 168 }
169 } 169 }
170 170
171 } // namespace webrtc 171 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698