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

Side by Side Diff: webrtc/modules/audio_processing/beamformer/array_util_unittest.cc

Issue 1394103003: Make the nonlinear beamformer steerable (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@highfreq
Patch Set: Generalize interferer scenarios Created 5 years, 2 months 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
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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
(...skipping 11 matching lines...) Expand all
22 array_geometry.push_back(Point(0.1f, 0.f, 0.f)); 22 array_geometry.push_back(Point(0.1f, 0.f, 0.f));
23 EXPECT_FLOAT_EQ(0.1f, GetMinimumSpacing(array_geometry)); 23 EXPECT_FLOAT_EQ(0.1f, GetMinimumSpacing(array_geometry));
24 array_geometry.push_back(Point(0.f, 0.05f, 0.f)); 24 array_geometry.push_back(Point(0.f, 0.05f, 0.f));
25 EXPECT_FLOAT_EQ(0.05f, GetMinimumSpacing(array_geometry)); 25 EXPECT_FLOAT_EQ(0.05f, GetMinimumSpacing(array_geometry));
26 array_geometry.push_back(Point(0.f, 0.f, 0.02f)); 26 array_geometry.push_back(Point(0.f, 0.f, 0.02f));
27 EXPECT_FLOAT_EQ(0.02f, GetMinimumSpacing(array_geometry)); 27 EXPECT_FLOAT_EQ(0.02f, GetMinimumSpacing(array_geometry));
28 array_geometry.push_back(Point(-0.003f, -0.004f, 0.02f)); 28 array_geometry.push_back(Point(-0.003f, -0.004f, 0.02f));
29 EXPECT_FLOAT_EQ(0.005f, GetMinimumSpacing(array_geometry)); 29 EXPECT_FLOAT_EQ(0.005f, GetMinimumSpacing(array_geometry));
30 } 30 }
31 31
32 TEST(ArrayUtilTest, DegreesToRadians) {
33 EXPECT_FLOAT_EQ(0.f, DegreesToRadians(0.f));
34 EXPECT_FLOAT_EQ(M_PI / 6.f, DegreesToRadians(30.f));
35 EXPECT_FLOAT_EQ(-M_PI / 4.f, DegreesToRadians(-45.f));
36 EXPECT_FLOAT_EQ(M_PI / 3.f, DegreesToRadians(60.f));
37 EXPECT_FLOAT_EQ(-M_PI / 2.f, DegreesToRadians(-90.f));
38 EXPECT_FLOAT_EQ(2.f * M_PI / 3.f, DegreesToRadians(120.f));
39 EXPECT_FLOAT_EQ(-3.f * M_PI / 4.f, DegreesToRadians(-135.f));
40 EXPECT_FLOAT_EQ(5.f * M_PI / 6.f, DegreesToRadians(150.f));
41 EXPECT_FLOAT_EQ(-M_PI, DegreesToRadians(-180.f));
42 }
43
44 TEST(ArrayUtilTest, RadiansToDegrees) {
45 EXPECT_FLOAT_EQ(0.f, RadiansToDegrees(0.f));
46 EXPECT_FLOAT_EQ(30.f, RadiansToDegrees(M_PI / 6.f));
47 EXPECT_FLOAT_EQ(-45.f, RadiansToDegrees(-M_PI / 4.f));
48 EXPECT_FLOAT_EQ(60.f, RadiansToDegrees(M_PI / 3.f));
49 EXPECT_FLOAT_EQ(-90.f, RadiansToDegrees(-M_PI / 2.f));
50 EXPECT_FLOAT_EQ(120.f, RadiansToDegrees(2.f * M_PI / 3.f));
51 EXPECT_FLOAT_EQ(-135.f, RadiansToDegrees(-3.f * M_PI / 4.f));
52 EXPECT_FLOAT_EQ(150.f, RadiansToDegrees(5.f * M_PI / 6.f));
53 EXPECT_FLOAT_EQ(-180.f, RadiansToDegrees(-M_PI));
54 }
55
32 } // namespace webrtc 56 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698