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

Side by Side Diff: webrtc/modules/audio_processing/test/audio_processing_unittest.cc

Issue 1234463003: Integrate Intelligibility with APM (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Copy on no conversion or processing Created 5 years, 4 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 333
334 // Used to select between int and float interface tests. 334 // Used to select between int and float interface tests.
335 enum Format { 335 enum Format {
336 kIntFormat, 336 kIntFormat,
337 kFloatFormat 337 kFloatFormat
338 }; 338 };
339 339
340 void Init(int sample_rate_hz, 340 void Init(int sample_rate_hz,
341 int output_sample_rate_hz, 341 int output_sample_rate_hz,
342 int reverse_sample_rate_hz, 342 int reverse_sample_rate_hz,
343 int num_reverse_channels,
344 int num_input_channels, 343 int num_input_channels,
345 int num_output_channels, 344 int num_output_channels,
345 int num_reverse_channels,
346 bool open_output_file); 346 bool open_output_file);
347 void Init(AudioProcessing* ap); 347 void Init(AudioProcessing* ap);
348 void EnableAllComponents(); 348 void EnableAllComponents();
349 bool ReadFrame(FILE* file, AudioFrame* frame); 349 bool ReadFrame(FILE* file, AudioFrame* frame);
350 bool ReadFrame(FILE* file, AudioFrame* frame, ChannelBuffer<float>* cb); 350 bool ReadFrame(FILE* file, AudioFrame* frame, ChannelBuffer<float>* cb);
351 void ReadFrameWithRewind(FILE* file, AudioFrame* frame); 351 void ReadFrameWithRewind(FILE* file, AudioFrame* frame);
352 void ReadFrameWithRewind(FILE* file, AudioFrame* frame, 352 void ReadFrameWithRewind(FILE* file, AudioFrame* frame,
353 ChannelBuffer<float>* cb); 353 ChannelBuffer<float>* cb);
354 void ProcessWithDefaultStreamParameters(AudioFrame* frame); 354 void ProcessWithDefaultStreamParameters(AudioFrame* frame);
355 void ProcessDelayVerificationTest(int delay_ms, int system_delay_ms, 355 void ProcessDelayVerificationTest(int delay_ms, int system_delay_ms,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 ASSERT_EQ(0, fclose(out_file_)); 451 ASSERT_EQ(0, fclose(out_file_));
452 } 452 }
453 out_file_ = NULL; 453 out_file_ = NULL;
454 } 454 }
455 455
456 void ApmTest::Init(AudioProcessing* ap) { 456 void ApmTest::Init(AudioProcessing* ap) {
457 ASSERT_EQ(kNoErr, 457 ASSERT_EQ(kNoErr,
458 ap->Initialize( 458 ap->Initialize(
459 {{{frame_->sample_rate_hz_, frame_->num_channels_}, 459 {{{frame_->sample_rate_hz_, frame_->num_channels_},
460 {output_sample_rate_hz_, num_output_channels_}, 460 {output_sample_rate_hz_, num_output_channels_},
461 {revframe_->sample_rate_hz_, revframe_->num_channels_},
461 {revframe_->sample_rate_hz_, revframe_->num_channels_}}})); 462 {revframe_->sample_rate_hz_, revframe_->num_channels_}}}));
462 } 463 }
463 464
464 void ApmTest::Init(int sample_rate_hz, 465 void ApmTest::Init(int sample_rate_hz,
465 int output_sample_rate_hz, 466 int output_sample_rate_hz,
466 int reverse_sample_rate_hz, 467 int reverse_sample_rate_hz,
467 int num_input_channels, 468 int num_input_channels,
468 int num_output_channels, 469 int num_output_channels,
469 int num_reverse_channels, 470 int num_reverse_channels,
470 bool open_output_file) { 471 bool open_output_file) {
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 } 817 }
817 818
818 void ApmTest::TestChangingReverseChannels( 819 void ApmTest::TestChangingReverseChannels(
819 int num_rev_channels, 820 int num_rev_channels,
820 AudioProcessing::Error expected_return) { 821 AudioProcessing::Error expected_return) {
821 const ProcessingConfig processing_config = { 822 const ProcessingConfig processing_config = {
822 {{ frame_->sample_rate_hz_, apm_->num_input_channels() }, 823 {{ frame_->sample_rate_hz_, apm_->num_input_channels() },
823 { output_sample_rate_hz_, apm_->num_output_channels() }, 824 { output_sample_rate_hz_, apm_->num_output_channels() },
824 { frame_->sample_rate_hz_, num_rev_channels }}}; 825 { frame_->sample_rate_hz_, num_rev_channels }}};
825 826
826 EXPECT_EQ(expected_return, 827 EXPECT_EQ(
827 apm_->AnalyzeReverseStream(float_cb_->channels(), 828 expected_return,
828 processing_config.reverse_stream())); 829 apm_->ProcessReverseStream(
830 float_cb_->channels(), processing_config.reverse_input_stream(),
831 processing_config.reverse_output_stream(), float_cb_->channels()));
829 } 832 }
830 833
831 TEST_F(ApmTest, ChannelsInt16Interface) { 834 TEST_F(ApmTest, ChannelsInt16Interface) {
832 // Testing number of invalid and valid channels. 835 // Testing number of invalid and valid channels.
833 Init(16000, 16000, 16000, 4, 4, 4, false); 836 Init(16000, 16000, 16000, 4, 4, 4, false);
834 837
835 TestChangingChannelsInt16Interface(0, apm_->kBadNumberChannelsError); 838 TestChangingChannelsInt16Interface(0, apm_->kBadNumberChannelsError);
836 839
837 for (int i = 1; i < 4; i++) { 840 for (int i = 1; i < 4; i++) {
838 TestChangingChannelsInt16Interface(i, kNoErr); 841 TestChangingChannelsInt16Interface(i, kNoErr);
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 std::tr1::make_tuple(16000, 16000, 32000, 40), 2677 std::tr1::make_tuple(16000, 16000, 32000, 40),
2675 std::tr1::make_tuple(16000, 16000, 16000, 0))); 2678 std::tr1::make_tuple(16000, 16000, 16000, 0)));
2676 #endif 2679 #endif
2677 2680
2678 // TODO(henrike): re-implement functionality lost when removing the old main 2681 // TODO(henrike): re-implement functionality lost when removing the old main
2679 // function. See 2682 // function. See
2680 // https://code.google.com/p/webrtc/issues/detail?id=1981 2683 // https://code.google.com/p/webrtc/issues/detail?id=1981
2681 2684
2682 } // namespace 2685 } // namespace
2683 } // namespace webrtc 2686 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698