From 94d970860e2ced833ca6ae9de26085bb5f3644cf 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 [...] Change-Id: Id109058a89da78e38a8a7224a071a5c2075c66d6 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/8615658 Reviewed-by: Frank Barchard Reviewed-by: richard winterton --- 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..e78f04019 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.0001) << "width " << width << " offset " << offset; } }