blob: e9650ff3a77cdf6f91ef9fc5b2e6941ced916290 [file] [log] [blame]
peah19b7b662016-03-20 08:36:28 -07001
peah55850012016-03-19 18:01:09 -07002/*
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
12#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_BITEXACTNESS_TOOLS_H_
13#define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_BITEXACTNESS_TOOLS_H_
14
15#include <string>
16
17#include "webrtc/base/array_view.h"
18#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
19#include "testing/gtest/include/gtest/gtest.h"
20
21namespace webrtc {
22namespace test {
23
24// Returns test vector to use for the render signal in an
25// APM bitexactness test.
26std::string GetApmRenderTestVectorFileName(int sample_rate_hz);
27
28// Returns test vector to use for the capture signal in an
29// APM bitexactness test.
30std::string GetApmCaptureTestVectorFileName(int sample_rate_hz);
31
32// Extract float samples from a pcm file.
33void 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.
40::testing::AssertionResult BitExactFrame(size_t samples_per_channel,
41 size_t num_channels,
42 rtc::ArrayView<const float> reference,
43 rtc::ArrayView<const float> output,
44 float tolerance);
45
46// Verifies a vector against a reference and returns the results as an
47// AssertionResult.
48::testing::AssertionResult BitExactVector(rtc::ArrayView<const float> reference,
49 rtc::ArrayView<const float> output,
50 float tolerance);
51
52} // namespace test
53} // namespace webrtc
54
55#endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_BITEXACTNESS_TOOLS_H_