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

Side by Side Diff: webrtc/modules/audio_processing/audio_processing_impl.cc

Issue 1510493004: Bitexactness test for the highpass filter (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Sorted the files in the build file Created 4 years, 12 months 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) 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
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 struct AudioProcessingImpl::ApmPrivateSubmodules { 169 struct AudioProcessingImpl::ApmPrivateSubmodules {
170 explicit ApmPrivateSubmodules(Beamformer<float>* beamformer) 170 explicit ApmPrivateSubmodules(Beamformer<float>* beamformer)
171 : beamformer(beamformer) {} 171 : beamformer(beamformer) {}
172 // Accessed internally from capture or during initialization 172 // Accessed internally from capture or during initialization
173 std::list<ProcessingComponent*> component_list; 173 std::list<ProcessingComponent*> component_list;
174 rtc::scoped_ptr<Beamformer<float>> beamformer; 174 rtc::scoped_ptr<Beamformer<float>> beamformer;
175 rtc::scoped_ptr<AgcManagerDirect> agc_manager; 175 rtc::scoped_ptr<AgcManagerDirect> agc_manager;
176 }; 176 };
177 177
178 const int AudioProcessing::kNativeSampleRatesHz[] = { 178 const int AudioProcessing::kNativeSampleRatesHz[] = {
179 AudioProcessing::kSampleRate8kHz, 179 AudioProcessing::kSampleRate8kHz, AudioProcessing::kSampleRate16kHz,
180 AudioProcessing::kSampleRate16kHz, 180 AudioProcessing::kSampleRate32kHz, AudioProcessing::kSampleRate48kHz};
181 AudioProcessing::kSampleRate32kHz,
182 AudioProcessing::kSampleRate48kHz};
183 const size_t AudioProcessing::kNumNativeSampleRates = 181 const size_t AudioProcessing::kNumNativeSampleRates =
184 arraysize(AudioProcessing::kNativeSampleRatesHz); 182 arraysize(AudioProcessing::kNativeSampleRatesHz);
185 const int AudioProcessing::kMaxNativeSampleRateHz = AudioProcessing:: 183 const int AudioProcessing::kMaxNativeSampleRateHz = AudioProcessing::
186 kNativeSampleRatesHz[AudioProcessing::kNumNativeSampleRates - 1]; 184 kNativeSampleRatesHz[AudioProcessing::kNumNativeSampleRates - 1];
187 const int AudioProcessing::kMaxAECMSampleRateHz = kSampleRate16kHz; 185 const int AudioProcessing::kMaxAECMSampleRateHz = kSampleRate16kHz;
188 186
189 AudioProcessing* AudioProcessing::Create() { 187 AudioProcessing* AudioProcessing::Create() {
190 Config config; 188 Config config;
191 return Create(config, nullptr); 189 return Create(config, nullptr);
192 } 190 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 return InitializeLocked(); 288 return InitializeLocked();
291 } 289 }
292 290
293 int AudioProcessingImpl::Initialize(int input_sample_rate_hz, 291 int AudioProcessingImpl::Initialize(int input_sample_rate_hz,
294 int output_sample_rate_hz, 292 int output_sample_rate_hz,
295 int reverse_sample_rate_hz, 293 int reverse_sample_rate_hz,
296 ChannelLayout input_layout, 294 ChannelLayout input_layout,
297 ChannelLayout output_layout, 295 ChannelLayout output_layout,
298 ChannelLayout reverse_layout) { 296 ChannelLayout reverse_layout) {
299 const ProcessingConfig processing_config = { 297 const ProcessingConfig processing_config = {
300 {{input_sample_rate_hz, 298 {{input_sample_rate_hz, ChannelsFromLayout(input_layout),
301 ChannelsFromLayout(input_layout),
302 LayoutHasKeyboard(input_layout)}, 299 LayoutHasKeyboard(input_layout)},
303 {output_sample_rate_hz, 300 {output_sample_rate_hz, ChannelsFromLayout(output_layout),
304 ChannelsFromLayout(output_layout),
305 LayoutHasKeyboard(output_layout)}, 301 LayoutHasKeyboard(output_layout)},
306 {reverse_sample_rate_hz, 302 {reverse_sample_rate_hz, ChannelsFromLayout(reverse_layout),
307 ChannelsFromLayout(reverse_layout),
308 LayoutHasKeyboard(reverse_layout)}, 303 LayoutHasKeyboard(reverse_layout)},
309 {reverse_sample_rate_hz, 304 {reverse_sample_rate_hz, ChannelsFromLayout(reverse_layout),
310 ChannelsFromLayout(reverse_layout),
311 LayoutHasKeyboard(reverse_layout)}}}; 305 LayoutHasKeyboard(reverse_layout)}}};
312 306
313 return Initialize(processing_config); 307 return Initialize(processing_config);
314 } 308 }
315 309
316 int AudioProcessingImpl::Initialize(const ProcessingConfig& processing_config) { 310 int AudioProcessingImpl::Initialize(const ProcessingConfig& processing_config) {
317 // Run in a single-threaded manner during initialization. 311 // Run in a single-threaded manner during initialization.
318 rtc::CritScope cs_render(&crit_render_); 312 rtc::CritScope cs_render(&crit_render_);
319 rtc::CritScope cs_capture(&crit_capture_); 313 rtc::CritScope cs_capture(&crit_capture_);
320 return InitializeLocked(processing_config); 314 return InitializeLocked(processing_config);
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 TRACE_EVENT0("webrtc", "AudioProcessing::AnalyzeReverseStream_AudioFrame"); 904 TRACE_EVENT0("webrtc", "AudioProcessing::AnalyzeReverseStream_AudioFrame");
911 rtc::CritScope cs(&crit_render_); 905 rtc::CritScope cs(&crit_render_);
912 if (frame == nullptr) { 906 if (frame == nullptr) {
913 return kNullPointerError; 907 return kNullPointerError;
914 } 908 }
915 // Must be a native rate. 909 // Must be a native rate.
916 if (frame->sample_rate_hz_ != kSampleRate8kHz && 910 if (frame->sample_rate_hz_ != kSampleRate8kHz &&
917 frame->sample_rate_hz_ != kSampleRate16kHz && 911 frame->sample_rate_hz_ != kSampleRate16kHz &&
918 frame->sample_rate_hz_ != kSampleRate32kHz && 912 frame->sample_rate_hz_ != kSampleRate32kHz &&
919 frame->sample_rate_hz_ != kSampleRate48kHz) { 913 frame->sample_rate_hz_ != kSampleRate48kHz) {
914 LOG(LS_ERROR)
915 << "This interface only supports native sample rates (sample rate = "
916 << frame->sample_rate_hz_ << ")";
920 return kBadSampleRateError; 917 return kBadSampleRateError;
921 } 918 }
919
920 if (public_submodules_->echo_control_mobile->is_enabled() &&
the sun 2016/01/07 14:35:35 Why is this change in this CL?
peah-webrtc 2016/02/22 13:38:36 Oups! That was supposed to go with another CL. Rem
921 frame->sample_rate_hz_ > kMaxAECMSampleRateHz) {
922 LOG(LS_ERROR)
923 << "AECM only supports 16 or 8 kHz sample rates (sample rate = "
924 << frame->sample_rate_hz_ << ")";
925 return kUnsupportedComponentError;
926 }
927
922 // This interface does not tolerate different forward and reverse rates. 928 // This interface does not tolerate different forward and reverse rates.
923 if (frame->sample_rate_hz_ != 929 if (frame->sample_rate_hz_ !=
924 formats_.api_format.input_stream().sample_rate_hz()) { 930 formats_.api_format.input_stream().sample_rate_hz()) {
925 return kBadSampleRateError; 931 return kBadSampleRateError;
926 } 932 }
927 933
928 if (frame->num_channels_ <= 0) { 934 if (frame->num_channels_ <= 0) {
929 return kBadNumberChannelsError; 935 return kBadNumberChannelsError;
930 } 936 }
931 937
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 debug_dump_.capture.event_msg->set_type(audioproc::Event::CONFIG); 1509 debug_dump_.capture.event_msg->set_type(audioproc::Event::CONFIG);
1504 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); 1510 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config);
1505 1511
1506 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), 1512 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
1507 &crit_debug_, &debug_dump_.capture)); 1513 &crit_debug_, &debug_dump_.capture));
1508 return kNoError; 1514 return kNoError;
1509 } 1515 }
1510 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP 1516 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
1511 1517
1512 } // namespace webrtc 1518 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698