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

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

Issue 2534683002: RTC_[D]CHECK_op: Remove superfluous casts (Closed)
Patch Set: test 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 noise_spectrum_estimator_.Initialize(); 122 noise_spectrum_estimator_.Initialize();
123 frame_extender_.reset(new FrameExtender(80, 128)); 123 frame_extender_.reset(new FrameExtender(80, 128));
124 sample_rate_hz_ = sample_rate_hz; 124 sample_rate_hz_ = sample_rate_hz;
125 initialization_frames_left_ = 2; 125 initialization_frames_left_ = 2;
126 consistent_classification_counter_ = 3; 126 consistent_classification_counter_ = 3;
127 last_signal_type_ = SignalClassifier::SignalType::kNonStationary; 127 last_signal_type_ = SignalClassifier::SignalType::kNonStationary;
128 } 128 }
129 129
130 void SignalClassifier::Analyze(const AudioBuffer& audio, 130 void SignalClassifier::Analyze(const AudioBuffer& audio,
131 SignalType* signal_type) { 131 SignalType* signal_type) {
132 RTC_DCHECK_EQ(audio.num_frames(), static_cast<size_t>(sample_rate_hz_ / 100)); 132 RTC_DCHECK_EQ(audio.num_frames(), sample_rate_hz_ / 100);
133 133
134 // Compute the signal power spectrum. 134 // Compute the signal power spectrum.
135 float downsampled_frame[80]; 135 float downsampled_frame[80];
136 down_sampler_.DownSample(rtc::ArrayView<const float>( 136 down_sampler_.DownSample(rtc::ArrayView<const float>(
137 audio.channels_const_f()[0], audio.num_frames()), 137 audio.channels_const_f()[0], audio.num_frames()),
138 downsampled_frame); 138 downsampled_frame);
139 float extended_frame[128]; 139 float extended_frame[128];
140 frame_extender_->ExtendFrame(downsampled_frame, extended_frame); 140 frame_extender_->ExtendFrame(downsampled_frame, extended_frame);
141 RemoveDcLevel(extended_frame); 141 RemoveDcLevel(extended_frame);
142 float signal_spectrum[65]; 142 float signal_spectrum[65];
(...skipping 19 matching lines...) Expand all
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