Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: webrtc/modules/audio_processing/noise_suppression_bitexactness_unittest.cc

Issue 1841213002: Renamed the test::BitExactFrame method to test::VectorDifferenceBounded. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Changed name of the StackedFrameDifferenceBounded and VectorDifferenceBounded methods Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 #include <vector> 10 #include <vector>
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 ProcessOneFrame(sample_rate_hz, &capture_buffer, &noise_suppressor); 70 ProcessOneFrame(sample_rate_hz, &capture_buffer, &noise_suppressor);
71 } 71 }
72 72
73 // Extract test results. 73 // Extract test results.
74 std::vector<float> capture_output; 74 std::vector<float> capture_output;
75 test::ExtractVectorFromAudioBuffer(capture_config, &capture_buffer, 75 test::ExtractVectorFromAudioBuffer(capture_config, &capture_buffer,
76 &capture_output); 76 &capture_output);
77 float speech_probability = noise_suppressor.speech_probability(); 77 float speech_probability = noise_suppressor.speech_probability();
78 std::vector<float> noise_estimate = noise_suppressor.NoiseEstimate(); 78 std::vector<float> noise_estimate = noise_suppressor.NoiseEstimate();
79 79
80 const float kTolerance = 1.0f / 32768.0f; 80 const float kVectorElementErrorBound = 1.0f / 32768.0f;
81 EXPECT_FLOAT_EQ(speech_probability_reference, speech_probability); 81 EXPECT_FLOAT_EQ(speech_probability_reference, speech_probability);
82 EXPECT_TRUE(test::BitExactVector(noise_estimate_reference, noise_estimate, 82 EXPECT_TRUE(test::VerifyArray(noise_estimate_reference, noise_estimate,
83 kTolerance)); 83 kVectorElementErrorBound));
84 84
85 // Compare the output with the reference. Only the first values of the output 85 // Compare the output with the reference. Only the first values of the output
86 // from last frame processed are compared in order not having to specify all 86 // from last frame processed are compared in order not having to specify all
87 // preceeding frames as testvectors. As the algorithm being tested has a 87 // preceeding frames as testvectors. As the algorithm being tested has a
88 // memory, testing only the last frame implicitly also tests the preceeding 88 // memory, testing only the last frame implicitly also tests the preceeding
89 // frames. 89 // frames.
90 EXPECT_TRUE(test::BitExactFrame( 90 EXPECT_TRUE(test::VerifyDeinterleavedArray(
91 capture_config.num_frames(), capture_config.num_channels(), 91 capture_config.num_frames(), capture_config.num_channels(),
92 output_reference, capture_output, kTolerance)); 92 output_reference, capture_output, kVectorElementErrorBound));
93 } 93 }
94 94
95 } // namespace 95 } // namespace
96 96
97 TEST(NoiseSuppresionBitExactnessTest, Mono8kHzLow) { 97 TEST(NoiseSuppresionBitExactnessTest, Mono8kHzLow) {
98 #if defined(WEBRTC_ARCH_ARM64) 98 #if defined(WEBRTC_ARCH_ARM64)
99 const float kSpeechProbabilityReference = -4.0f; 99 const float kSpeechProbabilityReference = -4.0f;
100 const float kNoiseEstimateReference[] = {2.797542f, 6.488125f, 14.995160f}; 100 const float kNoiseEstimateReference[] = {2.797542f, 6.488125f, 14.995160f};
101 const float kOutputReference[] = {0.003510f, 0.004517f, 0.004669f}; 101 const float kOutputReference[] = {0.003510f, 0.004517f, 0.004669f};
102 #elif defined(WEBRTC_ARCH_ARM) 102 #elif defined(WEBRTC_ARCH_ARM)
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 const float kNoiseEstimateReference[] = {0.068797f, 0.205191f, 0.481312f}; 251 const float kNoiseEstimateReference[] = {0.068797f, 0.205191f, 0.481312f};
252 const float kOutputReference[] = {0.004321f, 0.005247f, 0.005263f}; 252 const float kOutputReference[] = {0.004321f, 0.005247f, 0.005263f};
253 #endif 253 #endif
254 254
255 RunBitexactnessTest(16000, 1, NoiseSuppression::Level::kVeryHigh, 255 RunBitexactnessTest(16000, 1, NoiseSuppression::Level::kVeryHigh,
256 kSpeechProbabilityReference, kNoiseEstimateReference, 256 kSpeechProbabilityReference, kNoiseEstimateReference,
257 kOutputReference); 257 kOutputReference);
258 } 258 }
259 259
260 } // namespace webrtc 260 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698