bitexactness_tools.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  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. #ifndef MODULES_AUDIO_PROCESSING_TEST_BITEXACTNESS_TOOLS_H_
  11. #define MODULES_AUDIO_PROCESSING_TEST_BITEXACTNESS_TOOLS_H_
  12. #include <string>
  13. #include "api/array_view.h"
  14. #include "modules/audio_coding/neteq/tools/input_audio_file.h"
  15. #include "test/gtest.h"
  16. namespace webrtc {
  17. namespace test {
  18. // Returns test vector to use for the render signal in an
  19. // APM bitexactness test.
  20. std::string GetApmRenderTestVectorFileName(int sample_rate_hz);
  21. // Returns test vector to use for the capture signal in an
  22. // APM bitexactness test.
  23. std::string GetApmCaptureTestVectorFileName(int sample_rate_hz);
  24. // Extract float samples of up to two channels from a pcm file.
  25. void ReadFloatSamplesFromStereoFile(size_t samples_per_channel,
  26. size_t num_channels,
  27. InputAudioFile* stereo_pcm_file,
  28. rtc::ArrayView<float> data);
  29. // Verifies a frame against a reference and returns the results as an
  30. // AssertionResult.
  31. ::testing::AssertionResult VerifyDeinterleavedArray(
  32. size_t samples_per_channel,
  33. size_t num_channels,
  34. rtc::ArrayView<const float> reference,
  35. rtc::ArrayView<const float> output,
  36. float element_error_bound);
  37. // Verifies a vector against a reference and returns the results as an
  38. // AssertionResult.
  39. ::testing::AssertionResult VerifyArray(rtc::ArrayView<const float> reference,
  40. rtc::ArrayView<const float> output,
  41. float element_error_bound);
  42. } // namespace test
  43. } // namespace webrtc
  44. #endif // MODULES_AUDIO_PROCESSING_TEST_BITEXACTNESS_TOOLS_H_