| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 kAngle, | 158 kAngle, |
| 159 kFrequencyBin, | 159 kFrequencyBin, |
| 160 kFftSize, | 160 kFftSize, |
| 161 kNumberFrequencyBins, | 161 kNumberFrequencyBins, |
| 162 kSampleRate, | 162 kSampleRate, |
| 163 geometry, | 163 geometry, |
| 164 &actual_covariance_matrix); | 164 &actual_covariance_matrix); |
| 165 | 165 |
| 166 complex<float>* const* actual_els = actual_covariance_matrix.elements(); | 166 complex<float>* const* actual_els = actual_covariance_matrix.elements(); |
| 167 | 167 |
| 168 EXPECT_NEAR(actual_els[0][0].real(), 1.f, kTolerance); | 168 EXPECT_NEAR(actual_els[0][0].real(), 0.5f, kTolerance); |
| 169 EXPECT_NEAR(actual_els[0][1].real(), 0.9952f, kTolerance); | 169 EXPECT_NEAR(actual_els[0][1].real(), 0.4976f, kTolerance); |
| 170 EXPECT_NEAR(actual_els[1][0].real(), 0.9952f, kTolerance); | 170 EXPECT_NEAR(actual_els[1][0].real(), 0.4976f, kTolerance); |
| 171 EXPECT_NEAR(actual_els[1][1].real(), 1.f, kTolerance); | 171 EXPECT_NEAR(actual_els[1][1].real(), 0.5f, kTolerance); |
| 172 | 172 |
| 173 EXPECT_NEAR(actual_els[0][0].imag(), 0.f, kTolerance); | 173 EXPECT_NEAR(actual_els[0][0].imag(), 0.f, kTolerance); |
| 174 EXPECT_NEAR(actual_els[0][1].imag(), 0.0978f, kTolerance); | 174 EXPECT_NEAR(actual_els[0][1].imag(), 0.0489f, kTolerance); |
| 175 EXPECT_NEAR(actual_els[1][0].imag(), -0.0978f, kTolerance); | 175 EXPECT_NEAR(actual_els[1][0].imag(), -0.0489f, kTolerance); |
| 176 EXPECT_NEAR(actual_els[1][1].imag(), 0.f, kTolerance); | 176 EXPECT_NEAR(actual_els[1][1].imag(), 0.f, kTolerance); |
| 177 } | 177 } |
| 178 | 178 |
| 179 TEST(CovarianceMatrixGeneratorTest, TestAngledCovarianceMatrix3Mics) { | 179 TEST(CovarianceMatrixGeneratorTest, TestAngledCovarianceMatrix3Mics) { |
| 180 const float kSpeedOfSound = 340; | 180 const float kSpeedOfSound = 340; |
| 181 const float kAngle = static_cast<float>(M_PI) / 4.f; | 181 const float kAngle = static_cast<float>(M_PI) / 4.f; |
| 182 const float kFrequencyBin = 9; | 182 const float kFrequencyBin = 9; |
| 183 const float kFftSize = 512; | 183 const float kFftSize = 512; |
| 184 const int kNumberFrequencyBins = 257; | 184 const int kNumberFrequencyBins = 257; |
| 185 const int kSampleRate = 42000; | 185 const int kSampleRate = 42000; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 196 kAngle, | 196 kAngle, |
| 197 kFrequencyBin, | 197 kFrequencyBin, |
| 198 kFftSize, | 198 kFftSize, |
| 199 kNumberFrequencyBins, | 199 kNumberFrequencyBins, |
| 200 kSampleRate, | 200 kSampleRate, |
| 201 geometry, | 201 geometry, |
| 202 &actual_covariance_matrix); | 202 &actual_covariance_matrix); |
| 203 | 203 |
| 204 complex<float>* const* actual_els = actual_covariance_matrix.elements(); | 204 complex<float>* const* actual_els = actual_covariance_matrix.elements(); |
| 205 | 205 |
| 206 EXPECT_NEAR(actual_els[0][0].real(), 1.f, kTolerance); | 206 EXPECT_NEAR(actual_els[0][0].real(), 0.3333f, kTolerance); |
| 207 EXPECT_NEAR(actual_els[0][1].real(), 0.8859f, kTolerance); | 207 EXPECT_NEAR(actual_els[0][1].real(), 0.2953f, kTolerance); |
| 208 EXPECT_NEAR(actual_els[0][2].real(), 0.5696f, kTolerance); | 208 EXPECT_NEAR(actual_els[0][2].real(), 0.1899f, kTolerance); |
| 209 EXPECT_NEAR(actual_els[1][0].real(), 0.8859f, kTolerance); | 209 EXPECT_NEAR(actual_els[1][0].real(), 0.2953f, kTolerance); |
| 210 EXPECT_NEAR(actual_els[1][1].real(), 1.f, kTolerance); | 210 EXPECT_NEAR(actual_els[1][1].real(), 0.3333f, kTolerance); |
| 211 EXPECT_NEAR(actual_els[1][2].real(), 0.8859f, kTolerance); | 211 EXPECT_NEAR(actual_els[1][2].real(), 0.2953f, kTolerance); |
| 212 EXPECT_NEAR(actual_els[2][0].real(), 0.5696f, kTolerance); | 212 EXPECT_NEAR(actual_els[2][0].real(), 0.1899f, kTolerance); |
| 213 EXPECT_NEAR(actual_els[2][1].real(), 0.8859f, kTolerance); | 213 EXPECT_NEAR(actual_els[2][1].real(), 0.2953f, kTolerance); |
| 214 EXPECT_NEAR(actual_els[2][2].real(), 1.f, kTolerance); | 214 EXPECT_NEAR(actual_els[2][2].real(), 0.3333f, kTolerance); |
| 215 | 215 |
| 216 EXPECT_NEAR(actual_els[0][0].imag(), 0.f, kTolerance); | 216 EXPECT_NEAR(actual_els[0][0].imag(), 0.f, kTolerance); |
| 217 EXPECT_NEAR(actual_els[0][1].imag(), 0.4639f, kTolerance); | 217 EXPECT_NEAR(actual_els[0][1].imag(), 0.1546f, kTolerance); |
| 218 EXPECT_NEAR(actual_els[0][2].imag(), 0.8219f, kTolerance); | 218 EXPECT_NEAR(actual_els[0][2].imag(), 0.274f, kTolerance); |
| 219 EXPECT_NEAR(actual_els[1][0].imag(), -0.4639f, kTolerance); | 219 EXPECT_NEAR(actual_els[1][0].imag(), -0.1546f, kTolerance); |
| 220 EXPECT_NEAR(actual_els[1][1].imag(), 0.f, kTolerance); | 220 EXPECT_NEAR(actual_els[1][1].imag(), 0.f, kTolerance); |
| 221 EXPECT_NEAR(actual_els[1][2].imag(), 0.4639f, kTolerance); | 221 EXPECT_NEAR(actual_els[1][2].imag(), 0.1546f, kTolerance); |
| 222 EXPECT_NEAR(actual_els[2][0].imag(), -0.8219f, kTolerance); | 222 EXPECT_NEAR(actual_els[2][0].imag(), -0.274f, kTolerance); |
| 223 EXPECT_NEAR(actual_els[2][1].imag(), -0.4639f, kTolerance); | 223 EXPECT_NEAR(actual_els[2][1].imag(), -0.1546f, kTolerance); |
| 224 EXPECT_NEAR(actual_els[2][2].imag(), 0.f, kTolerance); | 224 EXPECT_NEAR(actual_els[2][2].imag(), 0.f, kTolerance); |
| 225 } | 225 } |
| 226 | 226 |
| 227 // PhaseAlignmentMasks is tested by AngledCovarianceMatrix and by | 227 // PhaseAlignmentMasks is tested by AngledCovarianceMatrix and by |
| 228 // InitBeamformerWeights in BeamformerUnittest. | 228 // InitBeamformerWeights in BeamformerUnittest. |
| 229 | 229 |
| 230 } // namespace webrtc | 230 } // namespace webrtc |
| OLD | NEW |