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 #include "webrtc/modules/audio_processing/vad/gmm.h" | 11 #include "webrtc/modules/audio_processing/agc/gmm.h" |
12 | 12 |
13 #include <math.h> | 13 #include <math.h> |
14 | 14 |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "webrtc/modules/audio_processing/vad/noise_gmm_tables.h" | 16 #include "webrtc/modules/audio_processing/agc/noise_gmm_tables.h" |
17 #include "webrtc/modules/audio_processing/vad/voice_gmm_tables.h" | 17 #include "webrtc/modules/audio_processing/agc/voice_gmm_tables.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 | 20 |
21 TEST(GmmTest, EvaluateGmm) { | 21 TEST(GmmTest, EvaluateGmm) { |
22 GmmParameters noise_gmm; | 22 GmmParameters noise_gmm; |
23 GmmParameters voice_gmm; | 23 GmmParameters voice_gmm; |
24 | 24 |
25 // Setup noise GMM. | 25 // Setup noise GMM. |
26 noise_gmm.dimension = kNoiseGmmDim; | 26 noise_gmm.dimension = kNoiseGmmDim; |
27 noise_gmm.num_mixtures = kNoiseGmmNumMixtures; | 27 noise_gmm.num_mixtures = kNoiseGmmNumMixtures; |
(...skipping 28 matching lines...) Expand all Loading... |
56 EXPECT_LE(relative_error, kAcceptedRelativeErr); | 56 EXPECT_LE(relative_error, kAcceptedRelativeErr); |
57 | 57 |
58 // Test Noise. | 58 // Test Noise. |
59 pdf = EvaluateGmm(kXNoise, noise_gmm); | 59 pdf = EvaluateGmm(kXNoise, noise_gmm); |
60 EXPECT_GT(pdf, 0); | 60 EXPECT_GT(pdf, 0); |
61 relative_error = fabs(pdf - kPdfNoise) / kPdfNoise; | 61 relative_error = fabs(pdf - kPdfNoise) / kPdfNoise; |
62 EXPECT_LE(relative_error, kAcceptedRelativeErr); | 62 EXPECT_LE(relative_error, kAcceptedRelativeErr); |
63 } | 63 } |
64 | 64 |
65 } // namespace webrtc | 65 } // namespace webrtc |
OLD | NEW |