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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 void AimAndVerify(NonlinearBeamformer* bf, float target_azimuth_radians) { | 50 void AimAndVerify(NonlinearBeamformer* bf, float target_azimuth_radians) { |
51 bf->AimAt(AzimuthToSphericalPoint(target_azimuth_radians)); | 51 bf->AimAt(AzimuthToSphericalPoint(target_azimuth_radians)); |
52 Verify(bf, target_azimuth_radians); | 52 Verify(bf, target_azimuth_radians); |
53 } | 53 } |
54 | 54 |
55 // Bitexactness test code. | 55 // Bitexactness test code. |
56 const size_t kNumFramesToProcess = 1000; | 56 const size_t kNumFramesToProcess = 1000; |
57 | 57 |
58 void ProcessOneFrame(int sample_rate_hz, | 58 void ProcessOneFrame(int sample_rate_hz, |
59 AudioBuffer* capture_audio_buffer, | 59 AudioBuffer* capture_audio_buffer, |
60 Beamformer<float>* beamformer) { | 60 NonlinearBeamformer* beamformer) { |
61 if (sample_rate_hz > AudioProcessing::kSampleRate16kHz) { | 61 if (sample_rate_hz > AudioProcessing::kSampleRate16kHz) { |
62 capture_audio_buffer->SplitIntoFrequencyBands(); | 62 capture_audio_buffer->SplitIntoFrequencyBands(); |
63 } | 63 } |
64 | 64 |
65 beamformer->ProcessChunk(*capture_audio_buffer->split_data_f(), | 65 beamformer->AnalyzeChunk(*capture_audio_buffer->split_data_f()); |
66 capture_audio_buffer->split_data_f()); | |
67 capture_audio_buffer->set_num_channels(1); | 66 capture_audio_buffer->set_num_channels(1); |
peah-webrtc
2016/06/08 12:04:55
With the changes in this CL, the set_num_channels(
aluebs-webrtc
2016/06/09 02:11:46
If by downmix you mean it just discards all channe
| |
67 beamformer->PostFilter(capture_audio_buffer->split_data_f()); | |
68 | 68 |
69 if (sample_rate_hz > AudioProcessing::kSampleRate16kHz) { | 69 if (sample_rate_hz > AudioProcessing::kSampleRate16kHz) { |
70 capture_audio_buffer->MergeFrequencyBands(); | 70 capture_audio_buffer->MergeFrequencyBands(); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 int BeamformerSampleRate(int sample_rate_hz) { | 74 int BeamformerSampleRate(int sample_rate_hz) { |
75 return (sample_rate_hz > AudioProcessing::kSampleRate16kHz | 75 return (sample_rate_hz > AudioProcessing::kSampleRate16kHz |
76 ? AudioProcessing::kSampleRate16kHz | 76 ? AudioProcessing::kSampleRate16kHz |
77 : sample_rate_hz); | 77 : sample_rate_hz); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 DISABLED_Stereo8kHz_ArrayGeometry1_TargetDirection1) { | 255 DISABLED_Stereo8kHz_ArrayGeometry1_TargetDirection1) { |
256 const float kOutputReference[] = {0.001318f, -0.001091f, 0.000990f, | 256 const float kOutputReference[] = {0.001318f, -0.001091f, 0.000990f, |
257 0.001318f, -0.001091f, 0.000990f}; | 257 0.001318f, -0.001091f, 0.000990f}; |
258 | 258 |
259 RunBitExactnessTest(AudioProcessing::kSampleRate8kHz, CreateArrayGeometry(1), | 259 RunBitExactnessTest(AudioProcessing::kSampleRate8kHz, CreateArrayGeometry(1), |
260 TargetDirection1, kOutputReference); | 260 TargetDirection1, kOutputReference); |
261 } | 261 } |
262 | 262 |
263 TEST(BeamformerBitExactnessTest, | 263 TEST(BeamformerBitExactnessTest, |
264 Stereo16kHz_ArrayGeometry1_TargetDirection1) { | 264 Stereo16kHz_ArrayGeometry1_TargetDirection1) { |
265 const float kOutputReference[] = {0.000064f, 0.000211f, 0.000075f, | 265 const float kOutputReference[] = {-0.000077f, -0.000147f, -0.000138f, |
266 0.000064f, 0.000211f, 0.000075f}; | 266 -0.000077f, -0.000147f, -0.000138f}; |
267 | 267 |
268 RunBitExactnessTest(AudioProcessing::kSampleRate16kHz, CreateArrayGeometry(1), | 268 RunBitExactnessTest(AudioProcessing::kSampleRate16kHz, CreateArrayGeometry(1), |
269 TargetDirection1, kOutputReference); | 269 TargetDirection1, kOutputReference); |
270 } | 270 } |
271 | 271 |
272 TEST(BeamformerBitExactnessTest, | 272 TEST(BeamformerBitExactnessTest, |
273 Stereo32kHz_ArrayGeometry1_TargetDirection1) { | 273 Stereo32kHz_ArrayGeometry1_TargetDirection1) { |
274 const float kOutputReference[] = {0.000183f, 0.000183f, 0.000183f, | 274 const float kOutputReference[] = {-0.000061f, -0.000061f, -0.000061f, |
275 0.000183f, 0.000183f, 0.000183f}; | 275 -0.000061f, -0.000061f, -0.000061f}; |
276 | 276 |
277 RunBitExactnessTest(AudioProcessing::kSampleRate32kHz, CreateArrayGeometry(1), | 277 RunBitExactnessTest(AudioProcessing::kSampleRate32kHz, CreateArrayGeometry(1), |
278 TargetDirection1, kOutputReference); | 278 TargetDirection1, kOutputReference); |
279 } | 279 } |
280 | 280 |
281 TEST(BeamformerBitExactnessTest, | 281 TEST(BeamformerBitExactnessTest, |
282 Stereo48kHz_ArrayGeometry1_TargetDirection1) { | 282 Stereo48kHz_ArrayGeometry1_TargetDirection1) { |
283 const float kOutputReference[] = {0.000155f, 0.000152f, 0.000159f, | 283 const float kOutputReference[] = {0.000450f, 0.000436f, 0.000433f, |
284 0.000155f, 0.000152f, 0.000159f}; | 284 0.000450f, 0.000436f, 0.000433f}; |
285 | 285 |
286 RunBitExactnessTest(AudioProcessing::kSampleRate48kHz, CreateArrayGeometry(1), | 286 RunBitExactnessTest(AudioProcessing::kSampleRate48kHz, CreateArrayGeometry(1), |
287 TargetDirection1, kOutputReference); | 287 TargetDirection1, kOutputReference); |
288 } | 288 } |
289 | 289 |
290 // TODO(peah): Investigate why the nonlinear_beamformer.cc causes a DCHECK in | 290 // TODO(peah): Investigate why the nonlinear_beamformer.cc causes a DCHECK in |
291 // this setup. | 291 // this setup. |
292 TEST(BeamformerBitExactnessTest, | 292 TEST(BeamformerBitExactnessTest, |
293 DISABLED_Stereo8kHz_ArrayGeometry1_TargetDirection2) { | 293 DISABLED_Stereo8kHz_ArrayGeometry1_TargetDirection2) { |
294 const float kOutputReference[] = {0.001144f, -0.001026f, 0.001074f, | 294 const float kOutputReference[] = {0.001144f, -0.001026f, 0.001074f, |
295 -0.016205f, -0.007324f, -0.015656f}; | 295 -0.016205f, -0.007324f, -0.015656f}; |
296 | 296 |
297 RunBitExactnessTest(AudioProcessing::kSampleRate8kHz, CreateArrayGeometry(1), | 297 RunBitExactnessTest(AudioProcessing::kSampleRate8kHz, CreateArrayGeometry(1), |
298 TargetDirection2, kOutputReference); | 298 TargetDirection2, kOutputReference); |
299 } | 299 } |
300 | 300 |
301 TEST(BeamformerBitExactnessTest, | 301 TEST(BeamformerBitExactnessTest, |
302 Stereo16kHz_ArrayGeometry1_TargetDirection2) { | 302 Stereo16kHz_ArrayGeometry1_TargetDirection2) { |
303 const float kOutputReference[] = {0.001144f, -0.001026f, 0.001074f, | 303 const float kOutputReference[] = {0.000221f, -0.000249f, 0.000140f, |
304 0.001144f, -0.001026f, 0.001074f}; | 304 0.000221f, -0.000249f, 0.000140f}; |
305 | 305 |
306 RunBitExactnessTest(AudioProcessing::kSampleRate16kHz, CreateArrayGeometry(1), | 306 RunBitExactnessTest(AudioProcessing::kSampleRate16kHz, CreateArrayGeometry(1), |
307 TargetDirection2, kOutputReference); | 307 TargetDirection2, kOutputReference); |
308 } | 308 } |
309 | 309 |
310 TEST(BeamformerBitExactnessTest, | 310 TEST(BeamformerBitExactnessTest, |
311 Stereo32kHz_ArrayGeometry1_TargetDirection2) { | 311 Stereo32kHz_ArrayGeometry1_TargetDirection2) { |
312 const float kOutputReference[] = {0.000732f, -0.000397f, 0.000610f, | 312 const float kOutputReference[] = {0.000763f, -0.000336f, 0.000549f, |
313 0.000732f, -0.000397f, 0.000610f}; | 313 0.000763f, -0.000336f, 0.000549f}; |
314 | 314 |
315 RunBitExactnessTest(AudioProcessing::kSampleRate32kHz, CreateArrayGeometry(1), | 315 RunBitExactnessTest(AudioProcessing::kSampleRate32kHz, CreateArrayGeometry(1), |
316 TargetDirection2, kOutputReference); | 316 TargetDirection2, kOutputReference); |
317 } | 317 } |
318 | 318 |
319 TEST(BeamformerBitExactnessTest, | 319 TEST(BeamformerBitExactnessTest, |
320 Stereo48kHz_ArrayGeometry1_TargetDirection2) { | 320 Stereo48kHz_ArrayGeometry1_TargetDirection2) { |
321 const float kOutputReference[] = {0.000106f, -0.000464f, 0.000188f, | 321 const float kOutputReference[] = {-0.000004f, -0.000494f, 0.000255f, |
322 0.000106f, -0.000464f, 0.000188f}; | 322 -0.000004f, -0.000494f, 0.000255f}; |
323 | 323 |
324 RunBitExactnessTest(AudioProcessing::kSampleRate48kHz, CreateArrayGeometry(1), | 324 RunBitExactnessTest(AudioProcessing::kSampleRate48kHz, CreateArrayGeometry(1), |
325 TargetDirection2, kOutputReference); | 325 TargetDirection2, kOutputReference); |
326 } | 326 } |
327 | 327 |
328 TEST(BeamformerBitExactnessTest, | 328 TEST(BeamformerBitExactnessTest, |
329 Stereo8kHz_ArrayGeometry2_TargetDirection2) { | 329 Stereo8kHz_ArrayGeometry2_TargetDirection2) { |
330 const float kOutputReference[] = {-0.000649f, 0.000576f, -0.000148f, | 330 const float kOutputReference[] = {-0.000914f, 0.002170f, -0.002382f, |
331 -0.000649f, 0.000576f, -0.000148f}; | 331 -0.000914f, 0.002170f, -0.002382f}; |
332 | 332 |
333 RunBitExactnessTest(AudioProcessing::kSampleRate8kHz, CreateArrayGeometry(2), | 333 RunBitExactnessTest(AudioProcessing::kSampleRate8kHz, CreateArrayGeometry(2), |
334 TargetDirection2, kOutputReference); | 334 TargetDirection2, kOutputReference); |
335 } | 335 } |
336 | 336 |
337 TEST(BeamformerBitExactnessTest, | 337 TEST(BeamformerBitExactnessTest, |
338 Stereo16kHz_ArrayGeometry2_TargetDirection2) { | 338 Stereo16kHz_ArrayGeometry2_TargetDirection2) { |
339 const float kOutputReference[] = {0.000808f, -0.000695f, 0.000739f, | 339 const float kOutputReference[] = {0.000179f, -0.000179f, 0.000081f, |
340 0.000808f, -0.000695f, 0.000739f}; | 340 0.000179f, -0.000179f, 0.000081f}; |
341 | 341 |
342 RunBitExactnessTest(AudioProcessing::kSampleRate16kHz, CreateArrayGeometry(2), | 342 RunBitExactnessTest(AudioProcessing::kSampleRate16kHz, CreateArrayGeometry(2), |
343 TargetDirection2, kOutputReference); | 343 TargetDirection2, kOutputReference); |
344 } | 344 } |
345 | 345 |
346 TEST(BeamformerBitExactnessTest, | 346 TEST(BeamformerBitExactnessTest, |
347 Stereo32kHz_ArrayGeometry2_TargetDirection2) { | 347 Stereo32kHz_ArrayGeometry2_TargetDirection2) { |
348 const float kOutputReference[] = {0.000580f, -0.000183f, 0.000458f, | 348 const float kOutputReference[] = {0.000549f, -0.000214f, 0.000366f, |
349 0.000580f, -0.000183f, 0.000458f}; | 349 0.000549f, -0.000214f, 0.000366f}; |
350 | 350 |
351 RunBitExactnessTest(AudioProcessing::kSampleRate32kHz, CreateArrayGeometry(2), | 351 RunBitExactnessTest(AudioProcessing::kSampleRate32kHz, CreateArrayGeometry(2), |
352 TargetDirection2, kOutputReference); | 352 TargetDirection2, kOutputReference); |
353 } | 353 } |
354 | 354 |
355 TEST(BeamformerBitExactnessTest, | 355 TEST(BeamformerBitExactnessTest, |
356 Stereo48kHz_ArrayGeometry2_TargetDirection2) { | 356 Stereo48kHz_ArrayGeometry2_TargetDirection2) { |
357 const float kOutputReference[] = {0.000075f, -0.000288f, 0.000156f, | 357 const float kOutputReference[] = {0.000019f, -0.000310f, 0.000182f, |
358 0.000075f, -0.000288f, 0.000156f}; | 358 0.000019f, -0.000310f, 0.000182f}; |
359 | 359 |
360 RunBitExactnessTest(AudioProcessing::kSampleRate48kHz, CreateArrayGeometry(2), | 360 RunBitExactnessTest(AudioProcessing::kSampleRate48kHz, CreateArrayGeometry(2), |
361 TargetDirection2, kOutputReference); | 361 TargetDirection2, kOutputReference); |
362 } | 362 } |
363 | 363 |
364 // TODO(peah): Investigate why the nonlinear_beamformer.cc causes a DCHECK in | 364 // TODO(peah): Investigate why the nonlinear_beamformer.cc causes a DCHECK in |
365 // this setup. | 365 // this setup. |
366 TEST(BeamformerBitExactnessTest, | 366 TEST(BeamformerBitExactnessTest, |
367 DISABLED_Stereo16kHz_ArrayGeometry3_TargetDirection1) { | 367 DISABLED_Stereo16kHz_ArrayGeometry3_TargetDirection1) { |
368 const float kOutputReference[] = {-0.000161f, 0.000171f, -0.000096f, | 368 const float kOutputReference[] = {-0.000161f, 0.000171f, -0.000096f, |
369 0.001007f, 0.000427f, 0.000977f}; | 369 0.001007f, 0.000427f, 0.000977f}; |
370 | 370 |
371 RunBitExactnessTest(AudioProcessing::kSampleRate16kHz, CreateArrayGeometry(3), | 371 RunBitExactnessTest(AudioProcessing::kSampleRate16kHz, CreateArrayGeometry(3), |
372 TargetDirection1, kOutputReference); | 372 TargetDirection1, kOutputReference); |
373 } | 373 } |
374 | 374 |
375 } // namespace webrtc | 375 } // namespace webrtc |
OLD | NEW |