Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: webrtc/modules/audio_processing/echo_detector/normalized_covariance_estimator_unittest.cc

Issue 2419563003: Add algorithm for Residual Echo Detector. (Closed)
Patch Set: Merged residual_echo_detector and echo_detector. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1
2 /*
3 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
4 *
5 * Use of this source code is governed by a BSD-style license
6 * that can be found in the LICENSE file in the root of the source
7 * tree. An additional intellectual property rights grant can be found
8 * in the file PATENTS. All contributing project authors may
9 * be found in the AUTHORS file in the root of the source tree.
10 */
11
12 #include "webrtc/modules/audio_processing/echo_detector/normalized_covariance_es timator.h"
13 #include "webrtc/test/gtest.h"
14
15 namespace webrtc {
16
17 TEST(NormalizedCovarianceEstimatorTests, IdenticalSignalTest) {
18 NormalizedCovarianceEstimator test_estimator;
19 for (size_t i = 0; i < 10000; i++) {
20 test_estimator.Update(1.f, 0.f, 1.f, 1.f, 0.f, 1.f);
21 test_estimator.Update(-1.f, 0.f, 1.f, -1.f, 0.f, 1.f);
22 }
23 // A normalized covariance value close to 1 is expected.
24 EXPECT_NEAR(1.f, test_estimator.normalized_cross_correlation(), 0.01f);
25 test_estimator.Clear();
26 EXPECT_EQ(0.f, test_estimator.normalized_cross_correlation());
27 }
28
29 TEST(NormalizedCovarianceEstimatorTests, OppositeSignalTest) {
30 NormalizedCovarianceEstimator test_estimator;
31 // Insert the same value many times.
32 for (size_t i = 0; i < 10000; i++) {
33 test_estimator.Update(1.f, 0.f, 1.f, -1.f, 0.f, 1.f);
34 test_estimator.Update(-1.f, 0.f, 1.f, 1.f, 0.f, 1.f);
35 }
36 // A normalized covariance value close to -1 is expected.
37 EXPECT_NEAR(-1.f, test_estimator.normalized_cross_correlation(), 0.01f);
38 }
39
40 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698