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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 lambda = -1.f; | 402 lambda = -1.f; |
403 enh_->SolveForGainsGivenLambda(lambda, enh_->start_freq_, sols.data()); | 403 enh_->SolveForGainsGivenLambda(lambda, enh_->start_freq_, sols.data()); |
404 for (size_t i = 0; i < enh_->bank_size_; i++) { | 404 for (size_t i = 0; i < enh_->bank_size_; i++) { |
405 EXPECT_NEAR(kTestNonZeroVarLambdaTop[i], sols[i], kMaxTestError); | 405 EXPECT_NEAR(kTestNonZeroVarLambdaTop[i], sols[i], kMaxTestError); |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 TEST_F(IntelligibilityEnhancerTest, TestNoiseGainHasExpectedResult) { | 409 TEST_F(IntelligibilityEnhancerTest, TestNoiseGainHasExpectedResult) { |
410 const int kGainDB = 6; | 410 const int kGainDB = 6; |
411 const float kGainFactor = std::pow(10.f, kGainDB / 20.f); | 411 const float kGainFactor = std::pow(10.f, kGainDB / 20.f); |
412 const float kTolerance = 0.003f; | 412 const float kTolerance = 0.007f; |
413 std::vector<float> noise(kNumNoiseBins); | 413 std::vector<float> noise(kNumNoiseBins); |
414 std::vector<float> noise_psd(kNumNoiseBins); | 414 std::vector<float> noise_psd(kNumNoiseBins); |
415 std::generate(noise.begin(), noise.end(), float_rand); | 415 std::generate(noise.begin(), noise.end(), float_rand); |
416 for (size_t i = 0; i < kNumNoiseBins; ++i) { | 416 for (size_t i = 0; i < kNumNoiseBins; ++i) { |
417 noise_psd[i] = kGainFactor * kGainFactor * noise[i] * noise[i]; | 417 noise_psd[i] = kGainFactor * kGainFactor * noise[i] * noise[i]; |
418 } | 418 } |
419 float* clear_cursor = clear_data_.data(); | 419 float* clear_cursor = clear_data_.data(); |
420 for (size_t i = 0; i < kNumFramesToProcess; ++i) { | 420 for (size_t i = 0; i < kNumFramesToProcess; ++i) { |
421 enh_->SetCaptureNoiseEstimate(noise, kGainDB); | 421 enh_->SetCaptureNoiseEstimate(noise, kGainDB); |
422 enh_->ProcessRenderAudio(&clear_cursor, kSampleRate, kNumChannels); | 422 enh_->ProcessRenderAudio(&clear_cursor, kSampleRate, kNumChannels); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 475 } |
476 | 476 |
477 TEST(IntelligibilityEnhancerBitExactnessTest, DISABLED_Stereo48kHz) { | 477 TEST(IntelligibilityEnhancerBitExactnessTest, DISABLED_Stereo48kHz) { |
478 const float kOutputReference[] = {-0.009276f, -0.001601f, -0.008255f, | 478 const float kOutputReference[] = {-0.009276f, -0.001601f, -0.008255f, |
479 -0.012975f, -0.015940f, -0.017820f}; | 479 -0.012975f, -0.015940f, -0.017820f}; |
480 | 480 |
481 RunBitexactnessTest(AudioProcessing::kSampleRate48kHz, 2, kOutputReference); | 481 RunBitexactnessTest(AudioProcessing::kSampleRate48kHz, 2, kOutputReference); |
482 } | 482 } |
483 | 483 |
484 } // namespace webrtc | 484 } // namespace webrtc |
OLD | NEW |