From d7696c4ed11693f152917ffb50773228779b8e00 Mon Sep 17 00:00:00 2001 From: "andrew@webrtc.org" Date: Tue, 3 Dec 2013 23:39:16 +0000 Subject: [PATCH] Compile-out functions only used by the bit-exact test. Causes errors on platforms where the test is unused. TBR=bjornv Review URL: https://webrtc-codereview.appspot.com/4869004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5207 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../test/audio_processing_unittest.cc | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/webrtc/modules/audio_processing/test/audio_processing_unittest.cc b/webrtc/modules/audio_processing/test/audio_processing_unittest.cc index fffc498697..6be12c2e6a 100644 --- a/webrtc/modules/audio_processing/test/audio_processing_unittest.cc +++ b/webrtc/modules/audio_processing/test/audio_processing_unittest.cc @@ -113,21 +113,6 @@ void SetFrameTo(AudioFrame* frame, int16_t left, int16_t right) { } } -template -T AbsValue(T a) { - return a > 0 ? a: -a; -} - -int16_t MaxAudioFrame(const AudioFrame& frame) { - const int length = frame.samples_per_channel_ * frame.num_channels_; - int16_t max_data = AbsValue(frame.data_[0]); - for (int i = 1; i < length; i++) { - max_data = std::max(max_data, AbsValue(frame.data_[i])); - } - - return max_data; -} - bool FrameDataAreEqual(const AudioFrame& frame1, const AudioFrame& frame2) { if (frame1.samples_per_channel_ != frame2.samples_per_channel_) { @@ -145,6 +130,23 @@ bool FrameDataAreEqual(const AudioFrame& frame1, const AudioFrame& frame2) { return true; } +#ifdef WEBRTC_AUDIOPROC_BIT_EXACT +// These functions are only used by the bit-exact test. +template +T AbsValue(T a) { + return a > 0 ? a: -a; +} + +int16_t MaxAudioFrame(const AudioFrame& frame) { + const int length = frame.samples_per_channel_ * frame.num_channels_; + int16_t max_data = AbsValue(frame.data_[0]); + for (int i = 1; i < length; i++) { + max_data = std::max(max_data, AbsValue(frame.data_[i])); + } + + return max_data; +} + void TestStats(const AudioProcessing::Statistic& test, const webrtc::audioproc::Test::Statistic& reference) { EXPECT_EQ(reference.instant(), test.instant); @@ -196,6 +198,7 @@ void ReadMessageLiteFromFile(const std::string filename, delete [] array; fclose(file); } +#endif // WEBRTC_AUDIOPROC_BIT_EXACT struct ThreadData { ThreadData(int thread_num_, AudioProcessing* ap_)