| 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" |
| 20 #include "webrtc/modules/audio_processing/agc/utility.h" | 21 #include "webrtc/modules/audio_processing/agc/utility.h" |
| 21 | 22 |
| 22 namespace webrtc { | 23 namespace webrtc { |
| 23 | 24 |
| 24 struct InputOutput { | 25 struct InputOutput { |
| 25 double rms; | 26 double rms; |
| 26 double activity_probability; | 27 double activity_probability; |
| 27 double audio_content; | 28 double audio_content; |
| 28 double loudness; | 29 double loudness; |
| 29 }; | 30 }; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 83 |
| 83 ASSERT_NEAR(audio_content, io.audio_content, abs_err); | 84 ASSERT_NEAR(audio_content, io.audio_content, abs_err); |
| 84 double current_loudness = Linear2Loudness(hist_->CurrentRms()); | 85 double current_loudness = Linear2Loudness(hist_->CurrentRms()); |
| 85 abs_err = std::min(fabs(current_loudness), fabs(io.loudness)) * | 86 abs_err = std::min(fabs(current_loudness), fabs(io.loudness)) * |
| 86 kRelativeErrTol; | 87 kRelativeErrTol; |
| 87 ASSERT_NEAR(current_loudness, io.loudness, abs_err); | 88 ASSERT_NEAR(current_loudness, io.loudness, abs_err); |
| 88 } | 89 } |
| 89 fclose(in_file); | 90 fclose(in_file); |
| 90 } | 91 } |
| 91 | 92 |
| 92 TEST_F(HistogramTest, ActiveCircularBuffer) { | 93 TEST_F(HistogramTest, DISABLED_ON_IOS(ActiveCircularBuffer)) { |
| 93 RunTest(true, | 94 RunTest(true, |
| 94 test::ResourcePath("audio_processing/agc/agc_with_circular_buffer", | 95 test::ResourcePath("audio_processing/agc/agc_with_circular_buffer", |
| 95 "dat").c_str()); | 96 "dat").c_str()); |
| 96 } | 97 } |
| 97 | 98 |
| 98 TEST_F(HistogramTest, InactiveCircularBuffer) { | 99 TEST_F(HistogramTest, DISABLED_ON_IOS(InactiveCircularBuffer)) { |
| 99 RunTest(false, | 100 RunTest(false, |
| 100 test::ResourcePath("audio_processing/agc/agc_no_circular_buffer", | 101 test::ResourcePath("audio_processing/agc/agc_no_circular_buffer", |
| 101 "dat").c_str()); | 102 "dat").c_str()); |
| 102 } | 103 } |
| 103 | 104 |
| 104 } // namespace webrtc | 105 } // namespace webrtc |
| OLD | NEW |