peah | 19b7b66 | 2016-03-20 08:36:28 -0700 | [diff] [blame] | 1 | |
peah | 5585001 | 2016-03-19 18:01:09 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license |
| 6 | * that can be found in the LICENSE file in the root of the source |
| 7 | * tree. An additional intellectual property rights grant can be found |
| 8 | * in the file PATENTS. All contributing project authors may |
| 9 | * be found in the AUTHORS file in the root of the source tree. |
| 10 | */ |
| 11 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 12 | #ifndef MODULES_AUDIO_PROCESSING_TEST_BITEXACTNESS_TOOLS_H_ |
| 13 | #define MODULES_AUDIO_PROCESSING_TEST_BITEXACTNESS_TOOLS_H_ |
peah | 5585001 | 2016-03-19 18:01:09 -0700 | [diff] [blame] | 14 | |
| 15 | #include <string> |
| 16 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 17 | #include "api/array_view.h" |
| 18 | #include "modules/audio_coding/neteq/tools/input_audio_file.h" |
| 19 | #include "test/gtest.h" |
peah | 5585001 | 2016-03-19 18:01:09 -0700 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | namespace test { |
| 23 | |
| 24 | // Returns test vector to use for the render signal in an |
| 25 | // APM bitexactness test. |
| 26 | std::string GetApmRenderTestVectorFileName(int sample_rate_hz); |
| 27 | |
| 28 | // Returns test vector to use for the capture signal in an |
| 29 | // APM bitexactness test. |
| 30 | std::string GetApmCaptureTestVectorFileName(int sample_rate_hz); |
| 31 | |
| 32 | // Extract float samples from a pcm file. |
| 33 | void ReadFloatSamplesFromStereoFile(size_t samples_per_channel, |
| 34 | size_t num_channels, |
| 35 | InputAudioFile* stereo_pcm_file, |
| 36 | rtc::ArrayView<float> data); |
| 37 | |
| 38 | // Verifies a frame against a reference and returns the results as an |
| 39 | // AssertionResult. |
peah | 7ea928e | 2016-03-30 08:13:57 -0700 | [diff] [blame] | 40 | ::testing::AssertionResult VerifyDeinterleavedArray( |
| 41 | size_t samples_per_channel, |
| 42 | size_t num_channels, |
| 43 | rtc::ArrayView<const float> reference, |
| 44 | rtc::ArrayView<const float> output, |
| 45 | float element_error_bound); |
peah | 5585001 | 2016-03-19 18:01:09 -0700 | [diff] [blame] | 46 | |
| 47 | // Verifies a vector against a reference and returns the results as an |
| 48 | // AssertionResult. |
peah | 7ea928e | 2016-03-30 08:13:57 -0700 | [diff] [blame] | 49 | ::testing::AssertionResult VerifyArray(rtc::ArrayView<const float> reference, |
| 50 | rtc::ArrayView<const float> output, |
| 51 | float element_error_bound); |
peah | 5585001 | 2016-03-19 18:01:09 -0700 | [diff] [blame] | 52 | |
| 53 | } // namespace test |
| 54 | } // namespace webrtc |
| 55 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 56 | #endif // MODULES_AUDIO_PROCESSING_TEST_BITEXACTNESS_TOOLS_H_ |