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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 &capture_buffer); | 104 &capture_buffer); |
105 | 105 |
106 ProcessOneFrame(sample_rate_hz, &capture_buffer, &beamformer); | 106 ProcessOneFrame(sample_rate_hz, &capture_buffer, &beamformer); |
107 } | 107 } |
108 | 108 |
109 // Extract and verify the test results. | 109 // Extract and verify the test results. |
110 std::vector<float> capture_output; | 110 std::vector<float> capture_output; |
111 test::ExtractVectorFromAudioBuffer(capture_config, &capture_buffer, | 111 test::ExtractVectorFromAudioBuffer(capture_config, &capture_buffer, |
112 &capture_output); | 112 &capture_output); |
113 | 113 |
114 const float kTolerance = 1.f / static_cast<float>(1 << 15); | 114 const float kVectorElementErrorBound = 1.f / static_cast<float>(1 << 15); |
aluebs-webrtc
2016/03/29 22:04:43
I think it is not necessary to rename the toleranc
peah-webrtc
2016/03/30 04:14:44
Acknowledged.
| |
115 | 115 |
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::VectorDifferenceBounded( |
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, kVectorElementErrorBound)); |
124 } | 124 } |
125 | 125 |
126 std::vector<Point> CreateArrayGeometry(int variant) { | 126 std::vector<Point> CreateArrayGeometry(int variant) { |
127 std::vector<Point> array_geometry; | 127 std::vector<Point> array_geometry; |
128 switch (variant) { | 128 switch (variant) { |
129 case 1: | 129 case 1: |
130 array_geometry.push_back(Point(-0.025f, 0.f, 0.f)); | 130 array_geometry.push_back(Point(-0.025f, 0.f, 0.f)); |
131 array_geometry.push_back(Point(0.025f, 0.f, 0.f)); | 131 array_geometry.push_back(Point(0.025f, 0.f, 0.f)); |
132 break; | 132 break; |
133 case 2: | 133 case 2: |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 TEST(BeamformerBitExactnessTest, | 364 TEST(BeamformerBitExactnessTest, |
365 DISABLED_Stereo16kHz_ArrayGeometry3_TargetDirection1) { | 365 DISABLED_Stereo16kHz_ArrayGeometry3_TargetDirection1) { |
366 const float kOutputReference[] = {-0.000161f, 0.000171f, -0.000096f, | 366 const float kOutputReference[] = {-0.000161f, 0.000171f, -0.000096f, |
367 0.001007f, 0.000427f, 0.000977f}; | 367 0.001007f, 0.000427f, 0.000977f}; |
368 | 368 |
369 RunBitExactnessTest(AudioProcessing::kSampleRate16kHz, CreateArrayGeometry(3), | 369 RunBitExactnessTest(AudioProcessing::kSampleRate16kHz, CreateArrayGeometry(3), |
370 TargetDirection1, kOutputReference); | 370 TargetDirection1, kOutputReference); |
371 } | 371 } |
372 | 372 |
373 } // namespace webrtc | 373 } // namespace webrtc |
OLD | NEW |