diff --git a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_unittest.cc b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_unittest.cc index 8242571c71..66a564c32c 100644 --- a/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_unittest.cc +++ b/webrtc/modules/audio_processing/beamformer/nonlinear_beamformer_unittest.cc @@ -111,16 +111,16 @@ void RunBitExactnessTest(int sample_rate_hz, test::ExtractVectorFromAudioBuffer(capture_config, &capture_buffer, &capture_output); - const float kTolerance = 1.f / static_cast(1 << 15); + const float kElementErrorBound = 1.f / static_cast(1 << 15); // Compare the output with the reference. Only the first values of the output // from last frame processed are compared in order not having to specify all // preceeding frames as testvectors. As the algorithm being tested has a // memory, testing only the last frame implicitly also tests the preceeding // frames. - EXPECT_TRUE(test::BitExactFrame( + EXPECT_TRUE(test::VerifyDeinterleavedArray( capture_config.num_frames(), capture_config.num_channels(), - output_reference, capture_output, kTolerance)); + output_reference, capture_output, kElementErrorBound)); } // TODO(peah): Add bitexactness tests for scenarios with more than 2 input diff --git a/webrtc/modules/audio_processing/echo_cancellation_unittest.cc b/webrtc/modules/audio_processing/echo_cancellation_unittest.cc index ccf80f3ff5..97849d7590 100644 --- a/webrtc/modules/audio_processing/echo_cancellation_unittest.cc +++ b/webrtc/modules/audio_processing/echo_cancellation_unittest.cc @@ -125,10 +125,10 @@ void RunBitexactnessTest(int sample_rate_hz, // preceeding frames as testvectors. As the algorithm being tested has a // memory, testing only the last frame implicitly also tests the preceeding // frames. - const float kTolerance = 1.0f / 32768.0f; - EXPECT_TRUE(test::BitExactFrame( + const float kElementErrorBound = 1.0f / 32768.0f; + EXPECT_TRUE(test::VerifyDeinterleavedArray( capture_config.num_frames(), capture_config.num_channels(), - output_reference, capture_output, kTolerance)); + output_reference, capture_output, kElementErrorBound)); } const bool kStreamHasEchoReference = false; diff --git a/webrtc/modules/audio_processing/echo_control_mobile_unittest.cc b/webrtc/modules/audio_processing/echo_control_mobile_unittest.cc index 3e6c070595..d163781866 100644 --- a/webrtc/modules/audio_processing/echo_control_mobile_unittest.cc +++ b/webrtc/modules/audio_processing/echo_control_mobile_unittest.cc @@ -107,10 +107,10 @@ void RunBitexactnessTest(int sample_rate_hz, // preceeding frames as testvectors. As the algorithm being tested has a // memory, testing only the last frame implicitly also tests the preceeding // frames. - const float kTolerance = 1.0f / 32768.0f; - EXPECT_TRUE(test::BitExactFrame( + const float kElementErrorBound = 1.0f / 32768.0f; + EXPECT_TRUE(test::VerifyDeinterleavedArray( capture_config.num_frames(), capture_config.num_channels(), - output_reference, capture_output, kTolerance)); + output_reference, capture_output, kElementErrorBound)); } } // namespace diff --git a/webrtc/modules/audio_processing/gain_control_unittest.cc b/webrtc/modules/audio_processing/gain_control_unittest.cc index fe8980618c..ebb14ef69f 100644 --- a/webrtc/modules/audio_processing/gain_control_unittest.cc +++ b/webrtc/modules/audio_processing/gain_control_unittest.cc @@ -124,10 +124,10 @@ void RunBitExactnessTest(int sample_rate_hz, // preceeding frames as testvectors. As the algorithm being tested has a // memory, testing only the last frame implicitly also tests the preceeding // frames. - const float kTolerance = 1.0f / 32768.0f; - EXPECT_TRUE(test::BitExactFrame( + const float kElementErrorBound = 1.0f / 32768.0f; + EXPECT_TRUE(test::VerifyDeinterleavedArray( capture_config.num_frames(), capture_config.num_channels(), - output_reference, capture_output, kTolerance)); + output_reference, capture_output, kElementErrorBound)); } } // namespace diff --git a/webrtc/modules/audio_processing/high_pass_filter_bitexactness_unittest.cc b/webrtc/modules/audio_processing/high_pass_filter_bitexactness_unittest.cc index ba53bfac05..00336628df 100644 --- a/webrtc/modules/audio_processing/high_pass_filter_bitexactness_unittest.cc +++ b/webrtc/modules/audio_processing/high_pass_filter_bitexactness_unittest.cc @@ -82,9 +82,10 @@ void RunBitexactnessTest(int sample_rate, reference_frame_length); } - const float kTolerance = 1.0f / 32768.0f; - EXPECT_TRUE(test::BitExactFrame(reference_frame_length, num_channels, - reference, output_to_verify, kTolerance)); + const float kElementErrorBound = 1.0f / 32768.0f; + EXPECT_TRUE(test::VerifyDeinterleavedArray( + reference_frame_length, num_channels, reference, output_to_verify, + kElementErrorBound)); } // Method for forming a vector out of an array. diff --git a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc index 2e05cb5ba0..080e228cb8 100644 --- a/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc +++ b/webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer_unittest.cc @@ -299,16 +299,16 @@ void RunBitexactnessTest(int sample_rate_hz, test::ExtractVectorFromAudioBuffer(render_config, &render_buffer, &render_output); - const float kTolerance = 1.f / static_cast(1 << 15); + const float kElementErrorBound = 1.f / static_cast(1 << 15); // Compare the output with the reference. Only the first values of the output // from last frame processed are compared in order not having to specify all // preceeding frames as testvectors. As the algorithm being tested has a // memory, testing only the last frame implicitly also tests the preceeding // frames. - EXPECT_TRUE(test::BitExactFrame(render_buffer.num_frames(), - render_config.num_channels(), - output_reference, render_output, kTolerance)); + EXPECT_TRUE(test::VerifyDeinterleavedArray( + render_buffer.num_frames(), render_config.num_channels(), + output_reference, render_output, kElementErrorBound)); } } // namespace diff --git a/webrtc/modules/audio_processing/noise_suppression_bitexactness_unittest.cc b/webrtc/modules/audio_processing/noise_suppression_bitexactness_unittest.cc index 38551d39f9..b41d127d8d 100644 --- a/webrtc/modules/audio_processing/noise_suppression_bitexactness_unittest.cc +++ b/webrtc/modules/audio_processing/noise_suppression_bitexactness_unittest.cc @@ -77,19 +77,19 @@ void RunBitexactnessTest(int sample_rate_hz, float speech_probability = noise_suppressor.speech_probability(); std::vector noise_estimate = noise_suppressor.NoiseEstimate(); - const float kTolerance = 1.0f / 32768.0f; + const float kVectorElementErrorBound = 1.0f / 32768.0f; EXPECT_FLOAT_EQ(speech_probability_reference, speech_probability); - EXPECT_TRUE(test::BitExactVector(noise_estimate_reference, noise_estimate, - kTolerance)); + EXPECT_TRUE(test::VerifyArray(noise_estimate_reference, noise_estimate, + kVectorElementErrorBound)); // Compare the output with the reference. Only the first values of the output // from last frame processed are compared in order not having to specify all // preceeding frames as testvectors. As the algorithm being tested has a // memory, testing only the last frame implicitly also tests the preceeding // frames. - EXPECT_TRUE(test::BitExactFrame( + EXPECT_TRUE(test::VerifyDeinterleavedArray( capture_config.num_frames(), capture_config.num_channels(), - output_reference, capture_output, kTolerance)); + output_reference, capture_output, kVectorElementErrorBound)); } } // namespace diff --git a/webrtc/modules/audio_processing/test/bitexactness_tools.cc b/webrtc/modules/audio_processing/test/bitexactness_tools.cc index 965820ca3b..59b9325ad7 100644 --- a/webrtc/modules/audio_processing/test/bitexactness_tools.cc +++ b/webrtc/modules/audio_processing/test/bitexactness_tools.cc @@ -70,11 +70,12 @@ void ReadFloatSamplesFromStereoFile(size_t samples_per_channel, } } -::testing::AssertionResult BitExactFrame(size_t samples_per_channel, - size_t num_channels, - rtc::ArrayView reference, - rtc::ArrayView output, - float tolerance) { +::testing::AssertionResult VerifyDeinterleavedArray( + size_t samples_per_channel, + size_t num_channels, + rtc::ArrayView reference, + rtc::ArrayView output, + float element_error_bound) { // Form vectors to compare the reference to. Only the first values of the // outputs are compared in order not having to specify all preceeding frames // as testvectors. @@ -89,12 +90,12 @@ void ReadFloatSamplesFromStereoFile(size_t samples_per_channel, reference_frame_length); } - return BitExactVector(reference, output_to_verify, tolerance); + return VerifyArray(reference, output_to_verify, element_error_bound); } -::testing::AssertionResult BitExactVector(rtc::ArrayView reference, - rtc::ArrayView output, - float tolerance) { +::testing::AssertionResult VerifyArray(rtc::ArrayView reference, + rtc::ArrayView output, + float element_error_bound) { // The vectors are deemed to be bitexact only if // a) output have a size at least as long as the reference. // b) the samples in the reference are bitexact with the corresponding samples @@ -106,7 +107,7 @@ void ReadFloatSamplesFromStereoFile(size_t samples_per_channel, } else { // Compare the first samples in the vectors. for (size_t k = 0; k < reference.size(); ++k) { - if (fabs(output[k] - reference[k]) > tolerance) { + if (fabs(output[k] - reference[k]) > element_error_bound) { equal = false; break; } diff --git a/webrtc/modules/audio_processing/test/bitexactness_tools.h b/webrtc/modules/audio_processing/test/bitexactness_tools.h index e9650ff3a7..d4c09d49c6 100644 --- a/webrtc/modules/audio_processing/test/bitexactness_tools.h +++ b/webrtc/modules/audio_processing/test/bitexactness_tools.h @@ -37,17 +37,18 @@ void ReadFloatSamplesFromStereoFile(size_t samples_per_channel, // Verifies a frame against a reference and returns the results as an // AssertionResult. -::testing::AssertionResult BitExactFrame(size_t samples_per_channel, - size_t num_channels, - rtc::ArrayView reference, - rtc::ArrayView output, - float tolerance); +::testing::AssertionResult VerifyDeinterleavedArray( + size_t samples_per_channel, + size_t num_channels, + rtc::ArrayView reference, + rtc::ArrayView output, + float element_error_bound); // Verifies a vector against a reference and returns the results as an // AssertionResult. -::testing::AssertionResult BitExactVector(rtc::ArrayView reference, - rtc::ArrayView output, - float tolerance); +::testing::AssertionResult VerifyArray(rtc::ArrayView reference, + rtc::ArrayView output, + float element_error_bound); } // namespace test } // namespace webrtc