diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs index b4facfa3f..376bb4a06 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -using System.Runtime.InteropServices; +using System.Runtime.Intrinsics.X86; using Microsoft.DotNet.RemoteExecutor; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Gif; @@ -51,10 +51,11 @@ public class GifDecoderTests image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); - // Floating point differences result in minor pixel differences. + // Floating point differences in FMA used in the ResizeKernel result in minor pixel differences. // Output have been manually verified. + // For more details see discussion: https://github.com/SixLabors/ImageSharp/pull/1513#issuecomment-763643594 image.CompareToReferenceOutput( - ImageComparer.TolerantPercentage(TestEnvironment.OSArchitecture == Architecture.Arm64 ? 0.0002F : 0.0001F), + ImageComparer.TolerantPercentage(Fma.IsSupported ? 0.0001F : 0.0002F), provider, testOutputDetails: details, appendPixelTypeToFileName: false); diff --git a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs index afd33608c..ef1ccbed5 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. -using System.Runtime.InteropServices; +using System.Runtime.Intrinsics.X86; using Microsoft.DotNet.RemoteExecutor; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Png; @@ -122,10 +122,11 @@ public partial class PngDecoderTests image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); - // Floating point differences result in minor pixel differences. + // Floating point differences in FMA used in the ResizeKernel result in minor pixel differences. // Output have been manually verified. + // For more details see discussion: https://github.com/SixLabors/ImageSharp/pull/1513#issuecomment-763643594 image.CompareToReferenceOutput( - ImageComparer.TolerantPercentage(TestEnvironment.OSArchitecture == Architecture.Arm64 ? 0.0005F : 0.0003F), + ImageComparer.TolerantPercentage(Fma.IsSupported ? 0.0003F : 0.0005F), provider, testOutputDetails: details, appendPixelTypeToFileName: false); diff --git a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs index 0bbe1984f..da5de8e89 100644 --- a/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. using System.Runtime.InteropServices; +using System.Runtime.Intrinsics.X86; using Microsoft.DotNet.RemoteExecutor; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Tga; @@ -760,10 +761,11 @@ public class TgaDecoderTests image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); - // Floating point differences result in minor pixel differences. + // Floating point differences in FMA used in the ResizeKernel result in minor pixel differences. // Output have been manually verified. + // For more details see discussion: https://github.com/SixLabors/ImageSharp/pull/1513#issuecomment-763643594 image.CompareToReferenceOutput( - ImageComparer.TolerantPercentage(TestEnvironment.OSArchitecture == Architecture.Arm64 ? 0.0016F : 0.0001F), + ImageComparer.TolerantPercentage(Fma.IsSupported ? 0.0001F : 0.0016F), provider, testOutputDetails: details, appendPixelTypeToFileName: false); diff --git a/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs index 1f664cf64..a9e2b75c0 100644 --- a/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs @@ -3,6 +3,7 @@ // ReSharper disable InconsistentNaming using System.Runtime.InteropServices; +using System.Runtime.Intrinsics.X86; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Tiff; using SixLabors.ImageSharp.Metadata; @@ -695,10 +696,11 @@ public class TiffDecoderTests : TiffDecoderBaseTester image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); - // Floating point differences result in minor pixel differences. + // Floating point differences in FMA used in the ResizeKernel result in minor pixel differences. // Output have been manually verified. + // For more details see discussion: https://github.com/SixLabors/ImageSharp/pull/1513#issuecomment-763643594 image.CompareToReferenceOutput( - TestEnvironment.OSArchitecture == Architecture.Arm64 ? ImageComparer.TolerantPercentage(0.0006F) : ImageComparer.Exact, + Fma.IsSupported ? ImageComparer.Exact : ImageComparer.TolerantPercentage(0.0006F), provider, testOutputDetails: details, appendPixelTypeToFileName: false); diff --git a/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs b/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs index 010af3fbb..f95b003d0 100644 --- a/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs @@ -2,6 +2,7 @@ // Licensed under the Six Labors Split License. using System.Runtime.InteropServices; +using System.Runtime.Intrinsics.X86; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Webp; using SixLabors.ImageSharp.PixelFormats; @@ -367,10 +368,11 @@ public class WebpDecoderTests image.DebugSave(provider, testOutputDetails: details, appendPixelTypeToFileName: false); - // Floating point differences result in minor pixel differences. + // Floating point differences in FMA used in the ResizeKernel result in minor pixel differences. // Output have been manually verified. + // For more details see discussion: https://github.com/SixLabors/ImageSharp/pull/1513#issuecomment-763643594 image.CompareToReferenceOutput( - ImageComparer.TolerantPercentage(TestEnvironment.OSArchitecture == Architecture.Arm64 ? 0.0156F : 0.0007F), + ImageComparer.TolerantPercentage(Fma.IsSupported ? 0.0007F : 0.0156F), provider, testOutputDetails: details, appendPixelTypeToFileName: false);