OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 // Use CreateHistUnittestFile.m to generate the input file. | 11 // Use CreateHistUnittestFile.m to generate the input file. |
12 | 12 |
13 #include "webrtc/modules/audio_processing/agc/histogram.h" | 13 #include "webrtc/modules/audio_processing/agc/histogram.h" |
14 | 14 |
15 #include <stdio.h> | 15 #include <stdio.h> |
16 #include <cmath> | 16 #include <cmath> |
17 | 17 |
18 #include "gtest/gtest.h" | 18 #include "gtest/gtest.h" |
19 #include "webrtc/test/testsupport/fileutils.h" | 19 #include "webrtc/test/testsupport/fileutils.h" |
20 #include "webrtc/test/testsupport/gtest_disable.h" | |
21 #include "webrtc/modules/audio_processing/agc/utility.h" | 20 #include "webrtc/modules/audio_processing/agc/utility.h" |
22 | 21 |
23 namespace webrtc { | 22 namespace webrtc { |
24 | 23 |
25 struct InputOutput { | 24 struct InputOutput { |
26 double rms; | 25 double rms; |
27 double activity_probability; | 26 double activity_probability; |
28 double audio_content; | 27 double audio_content; |
29 double loudness; | 28 double loudness; |
30 }; | 29 }; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 82 |
84 ASSERT_NEAR(audio_content, io.audio_content, abs_err); | 83 ASSERT_NEAR(audio_content, io.audio_content, abs_err); |
85 double current_loudness = Linear2Loudness(hist_->CurrentRms()); | 84 double current_loudness = Linear2Loudness(hist_->CurrentRms()); |
86 abs_err = std::min(fabs(current_loudness), fabs(io.loudness)) * | 85 abs_err = std::min(fabs(current_loudness), fabs(io.loudness)) * |
87 kRelativeErrTol; | 86 kRelativeErrTol; |
88 ASSERT_NEAR(current_loudness, io.loudness, abs_err); | 87 ASSERT_NEAR(current_loudness, io.loudness, abs_err); |
89 } | 88 } |
90 fclose(in_file); | 89 fclose(in_file); |
91 } | 90 } |
92 | 91 |
93 TEST_F(HistogramTest, DISABLED_ON_IOS(ActiveCircularBuffer)) { | 92 TEST_F(HistogramTest, ActiveCircularBuffer) { |
94 RunTest(true, | 93 RunTest(true, |
95 test::ResourcePath("audio_processing/agc/agc_with_circular_buffer", | 94 test::ResourcePath("audio_processing/agc/agc_with_circular_buffer", |
96 "dat").c_str()); | 95 "dat").c_str()); |
97 } | 96 } |
98 | 97 |
99 TEST_F(HistogramTest, DISABLED_ON_IOS(InactiveCircularBuffer)) { | 98 TEST_F(HistogramTest, InactiveCircularBuffer) { |
100 RunTest(false, | 99 RunTest(false, |
101 test::ResourcePath("audio_processing/agc/agc_no_circular_buffer", | 100 test::ResourcePath("audio_processing/agc/agc_no_circular_buffer", |
102 "dat").c_str()); | 101 "dat").c_str()); |
103 } | 102 } |
104 | 103 |
105 } // namespace webrtc | 104 } // namespace webrtc |
OLD | NEW |