From: Steinar H. Gunderson Date: Sun, 13 Dec 2015 13:13:32 +0000 (+0100) Subject: Work around a rounding precision issue that would cause spurious test failures on... X-Git-Tag: 1.3.0~15 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=f63ded271f3189d2a1996a7b22bf91017ad24865;hp=f71dd67f6a2abca2bb95eb3e0902f9fdcf8e8ed9 Work around a rounding precision issue that would cause spurious test failures on AMD. --- diff --git a/ycbcr_conversion_effect_test.cpp b/ycbcr_conversion_effect_test.cpp index bea04c5..10085ab 100644 --- a/ycbcr_conversion_effect_test.cpp +++ b/ycbcr_conversion_effect_test.cpp @@ -179,6 +179,15 @@ TEST(YCbCrConversionEffectTest, LimitedRangeToFullRange) { tester.get_chain()->add_input(input); tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_sRGB); + + // This specific data element has the correct value (110-128)*(255/224) + 128 = 107.509, + // which rounds the wrong way on some cards. In normal use, we detect this and round off + // in DitherEffect instead (so it's not a problem in pratice), but in unit tests like this, + // we don't run with dither, so we simply fudge this one value instead. + if (out_data[18] == 107) { + out_data[18] = 108; + } + expect_equal(expected_data, out_data, 4 * width, height); }