diff --git a/libs/ardour/test/fpu_test.cc b/libs/ardour/test/fpu_test.cc index b0b89621ee..dd4b865e76 100644 --- a/libs/ardour/test/fpu_test.cc +++ b/libs/ardour/test/fpu_test.cc @@ -37,7 +37,7 @@ FPUTest::tearDown () } void -FPUTest::run (size_t align_max) +FPUTest::run (size_t align_max, float const max_diff) { apply_gain_to_buffer (_test1, _size, 1.33); default_apply_gain_to_buffer (_comp1, _size, 1.33); @@ -58,16 +58,16 @@ FPUTest::run (size_t align_max) CPPUNIT_ASSERT_MESSAGE (string_compose ("Compute peak not aligned off: %1 cnt: %2", off, cnt), fabsf (pk_test - pk_comp) < 1e-6); - /* mix buffers w/gain */ - mix_buffers_with_gain (&_test1[off], &_test2[off], cnt, 0.45); - default_mix_buffers_with_gain (&_comp1[off], &_comp2[off], cnt, 0.45); - compare (string_compose ("Mix Buffers w/gain not aligned off: %1 cnt: %2", off, cnt), cnt); - /* mix buffers w/o gain */ mix_buffers_no_gain (&_test1[off], &_test2[off], cnt); default_mix_buffers_no_gain (&_comp1[off], &_comp2[off], cnt); compare (string_compose ("Mix Buffers no gain not aligned off: %1 cnt: %2", off, cnt), cnt); + /* mix buffers w/gain */ + mix_buffers_with_gain (&_test1[off], &_test2[off], cnt, 0.45); + default_mix_buffers_with_gain (&_comp1[off], &_comp2[off], cnt, 0.45); + compare (string_compose ("Mix Buffers w/gain not aligned off: %1 cnt: %2", off, cnt), cnt, max_diff); + /* copy vector */ copy_vector (&_test1[off], &_test2[off], cnt); default_copy_vector (&_comp1[off], &_comp2[off], cnt); @@ -86,11 +86,11 @@ FPUTest::run (size_t align_max) } void -FPUTest::compare (std::string msg, size_t cnt) +FPUTest::compare (std::string msg, size_t cnt, float max_diff) { size_t err = 0; for (size_t i = 0; i < cnt; ++i) { - if (_test1[i] != _comp1[i]) { + if (fabsf (_test1[i] - _comp1[i]) > max_diff) { ++err; } } @@ -123,7 +123,7 @@ FPUTest::avxFmaTest () mix_buffers_no_gain = x86_sse_avx_mix_buffers_no_gain; copy_vector = x86_sse_avx_copy_vector; - run (align_max); + run (align_max, FLT_EPSILON); } void diff --git a/libs/ardour/test/fpu_test.h b/libs/ardour/test/fpu_test.h index d66673322e..552a69126e 100644 --- a/libs/ardour/test/fpu_test.h +++ b/libs/ardour/test/fpu_test.h @@ -36,8 +36,8 @@ public: #endif private: - void run (size_t); - void compare (std::string, size_t); + void run (size_t, float const max_diff = 0); + void compare (std::string, size_t, float const max_diff = 0); ARDOUR::compute_peak_t compute_peak; ARDOUR::find_peaks_t find_peaks;