blob: a66a3f4b165a81dd44a940bd2252ef5d78cd2af1 [file] [log] [blame]
peah55850012016-03-19 18:01:09 -07001/*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_BITEXACTNESS_TOOLS_H_
12#define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_BITEXACTNESS_TOOLS_H_
13
14#include <string>
15
16#include "webrtc/base/array_view.h"
17#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
18#include "testing/gtest/include/gtest/gtest.h"
19
20namespace webrtc {
21namespace test {
22
23// Returns test vector to use for the render signal in an
24// APM bitexactness test.
25std::string GetApmRenderTestVectorFileName(int sample_rate_hz);
26
27// Returns test vector to use for the capture signal in an
28// APM bitexactness test.
29std::string GetApmCaptureTestVectorFileName(int sample_rate_hz);
30
31// Extract float samples from a pcm file.
32void ReadFloatSamplesFromStereoFile(size_t samples_per_channel,
33 size_t num_channels,
34 InputAudioFile* stereo_pcm_file,
35 rtc::ArrayView<float> data);
36
37// Verifies a frame against a reference and returns the results as an
38// AssertionResult.
39::testing::AssertionResult BitExactFrame(size_t samples_per_channel,
40 size_t num_channels,
41 rtc::ArrayView<const float> reference,
42 rtc::ArrayView<const float> output,
43 float tolerance);
44
45// Verifies a vector against a reference and returns the results as an
46// AssertionResult.
47::testing::AssertionResult BitExactVector(rtc::ArrayView<const float> reference,
48 rtc::ArrayView<const float> output,
49 float tolerance);
50
51} // namespace test
52} // namespace webrtc
53
54#endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_BITEXACTNESS_TOOLS_H_