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
    [...]
This commit is contained in:
Martin Storsjö 2026-10-20 13:31:05 +03:00
parent f249eaa72f
commit e84d8d586f

View File

@ -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;
}
}