| OLD | NEW |
| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Compare the output with the reference. Only the first values of the output | 116 // Compare the output with the reference. Only the first values of the output |
| 117 // from last frame processed are compared in order not having to specify all | 117 // from last frame processed are compared in order not having to specify all |
| 118 // preceeding frames as testvectors. As the algorithm being tested has a | 118 // preceeding frames as testvectors. As the algorithm being tested has a |
| 119 // memory, testing only the last frame implicitly also tests the preceeding | 119 // memory, testing only the last frame implicitly also tests the preceeding |
| 120 // frames. | 120 // frames. |
| 121 EXPECT_TRUE(test::BitExactFrame( | 121 EXPECT_TRUE(test::BitExactFrame( |
| 122 capture_config.num_frames(), capture_config.num_channels(), | 122 capture_config.num_frames(), capture_config.num_channels(), |
| 123 output_reference, capture_output, kTolerance)); | 123 output_reference, capture_output, kTolerance)); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // TODO(peah): Add bitexactness tests for scenarios with more than 2 input |
| 127 // channels. |
| 126 std::vector<Point> CreateArrayGeometry(int variant) { | 128 std::vector<Point> CreateArrayGeometry(int variant) { |
| 127 std::vector<Point> array_geometry; | 129 std::vector<Point> array_geometry; |
| 128 switch (variant) { | 130 switch (variant) { |
| 129 case 1: | 131 case 1: |
| 130 array_geometry.push_back(Point(-0.025f, 0.f, 0.f)); | 132 array_geometry.push_back(Point(-0.025f, 0.f, 0.f)); |
| 131 array_geometry.push_back(Point(0.025f, 0.f, 0.f)); | 133 array_geometry.push_back(Point(0.025f, 0.f, 0.f)); |
| 132 break; | 134 break; |
| 133 case 2: | 135 case 2: |
| 134 array_geometry.push_back(Point(-0.035f, 0.f, 0.f)); | 136 array_geometry.push_back(Point(-0.035f, 0.f, 0.f)); |
| 135 array_geometry.push_back(Point(0.035f, 0.f, 0.f)); | 137 array_geometry.push_back(Point(0.035f, 0.f, 0.f)); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 bf.interf_angles_radians_[0]); | 242 bf.interf_angles_radians_[0]); |
| 241 EXPECT_FLOAT_EQ(M_PI / 2.f + bf.away_radians_, | 243 EXPECT_FLOAT_EQ(M_PI / 2.f + bf.away_radians_, |
| 242 bf.interf_angles_radians_[1]); | 244 bf.interf_angles_radians_[1]); |
| 243 bf.AimAt(AzimuthToSphericalPoint(bf.away_radians_ / 2.f)); | 245 bf.AimAt(AzimuthToSphericalPoint(bf.away_radians_ / 2.f)); |
| 244 EXPECT_EQ(2u, bf.interf_angles_radians_.size()); | 246 EXPECT_EQ(2u, bf.interf_angles_radians_.size()); |
| 245 EXPECT_FLOAT_EQ(-bf.away_radians_ / 2.f, bf.interf_angles_radians_[0]); | 247 EXPECT_FLOAT_EQ(-bf.away_radians_ / 2.f, bf.interf_angles_radians_[0]); |
| 246 EXPECT_FLOAT_EQ(3.f * bf.away_radians_ / 2.f, bf.interf_angles_radians_[1]); | 248 EXPECT_FLOAT_EQ(3.f * bf.away_radians_ / 2.f, bf.interf_angles_radians_[1]); |
| 247 } | 249 } |
| 248 } | 250 } |
| 249 | 251 |
| 252 // TODO(peah): Reenable all bitexactness tests once the division-by-zero issue |
| 253 // has been resolved. |
| 254 |
| 250 // TODO(peah): Investigate why the nonlinear_beamformer.cc causes a DCHECK in | 255 // TODO(peah): Investigate why the nonlinear_beamformer.cc causes a DCHECK in |
| 251 // this setup. | 256 // this setup. |
| 252 TEST(BeamformerBitExactnessTest, | 257 TEST(BeamformerBitExactnessTest, |
| 253 DISABLED_Stereo8kHz_ArrayGeometry1_TargetDirection1) { | 258 DISABLED_Stereo8kHz_ArrayGeometry1_TargetDirection1) { |
| 254 const float kOutputReference[] = {0.001318f, -0.001091f, 0.000990f, | 259 const float kOutputReference[] = {0.001318f, -0.001091f, 0.000990f, |
| 255 0.001318f, -0.001091f, 0.000990f}; | 260 0.001318f, -0.001091f, 0.000990f}; |
| 256 | 261 |
| 257 RunBitExactnessTest(AudioProcessing::kSampleRate8kHz, CreateArrayGeometry(1), | 262 RunBitExactnessTest(AudioProcessing::kSampleRate8kHz, CreateArrayGeometry(1), |
| 258 TargetDirection1, kOutputReference); | 263 TargetDirection1, kOutputReference); |
| 259 } | 264 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 TEST(BeamformerBitExactnessTest, | 369 TEST(BeamformerBitExactnessTest, |
| 365 DISABLED_Stereo16kHz_ArrayGeometry3_TargetDirection1) { | 370 DISABLED_Stereo16kHz_ArrayGeometry3_TargetDirection1) { |
| 366 const float kOutputReference[] = {-0.000161f, 0.000171f, -0.000096f, | 371 const float kOutputReference[] = {-0.000161f, 0.000171f, -0.000096f, |
| 367 0.001007f, 0.000427f, 0.000977f}; | 372 0.001007f, 0.000427f, 0.000977f}; |
| 368 | 373 |
| 369 RunBitExactnessTest(AudioProcessing::kSampleRate16kHz, CreateArrayGeometry(3), | 374 RunBitExactnessTest(AudioProcessing::kSampleRate16kHz, CreateArrayGeometry(3), |
| 370 TargetDirection1, kOutputReference); | 375 TargetDirection1, kOutputReference); |
| 371 } | 376 } |
| 372 | 377 |
| 373 } // namespace webrtc | 378 } // namespace webrtc |
| OLD | NEW |