From e84d8d586fdd8a86d59629620f9a57983355a7ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 20 Oct 2026 13:31:05 +0300 Subject: [PATCH] Don't require exact float matches in TestSsimAnyWidth Float computations can get different rounding depending on the implementation. In particular, if the C code is built with a compiler that uses x87 for float math, it is common that there is a small variance in the results. This fixes test failures on GCC i686 mingw targets, where it previously failed like this: unit_test/compare_test.cc:725: Failure Expected equality of these values: c_ssim Which is: -0.076010095487114751 opt_ssim Which is: -0.076010095487114751 width 17 offset 1 [...] --- unit_test/compare_test.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unit_test/compare_test.cc b/unit_test/compare_test.cc index c6d19fb37..6b703bb2a 100644 --- a/unit_test/compare_test.cc +++ b/unit_test/compare_test.cc @@ -722,7 +722,8 @@ TEST_F(LibYUVCompareTest, TestSsimAnyWidth) { double c_ssim = CalcFrameSsim(a, width, b, width, width, kHeight); MaskCpuFlags(benchmark_cpu_info_); double opt_ssim = CalcFrameSsim(a, width, b, width, width, kHeight); - EXPECT_EQ(c_ssim, opt_ssim) << "width " << width << " offset " << offset; + double ssim_diff = c_ssim - opt_ssim; + EXPECT_LT(ssim_diff, 0.01) << "width " << width << " offset " << offset; } }