From c50935f5ca30652437a776642bea2330658f0213 Mon Sep 17 00:00:00 2001 From: Dmitry Pentin Date: Tue, 4 Jan 2022 06:21:26 +0300 Subject: [PATCH 1/3] Fixed runtime error --- .../Formats/Jpeg/Components/FastFloatingPointDCT.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/Components/FastFloatingPointDCT.cs b/src/ImageSharp/Formats/Jpeg/Components/FastFloatingPointDCT.cs index 81bfe2135d..c27ad5b82b 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/FastFloatingPointDCT.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/FastFloatingPointDCT.cs @@ -146,11 +146,13 @@ public static void TransformFDCT(ref Block8x8F block) /// /// Apply floating point IDCT inplace using API. /// + /// + /// This method can be used even if there's no SIMD intrinsics available + /// as can be compiled to scalar instructions. + /// /// Input block. private static void IDCT_Vector4(ref Block8x8F transposedBlock) { - DebugGuard.IsTrue(Vector.IsHardwareAccelerated, "Scalar implementation should be called for non-accelerated hardware."); - // First pass - process columns IDCT8x4_Vector4(ref transposedBlock.V0L); IDCT8x4_Vector4(ref transposedBlock.V0R); From c719cf2d718e9e58997e947bcaba8e5a2009fda8 Mon Sep 17 00:00:00 2001 From: Dmitry Pentin Date: Tue, 4 Jan 2022 08:21:53 +0300 Subject: [PATCH 2/3] Fixed intrinsic flag in DCT tests --- tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs index 85f30d28d7..75572b943f 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs @@ -149,12 +149,12 @@ static void RunTest(string serialized) // 4 paths: // 1. AllowAll - call avx/fma implementation // 2. DisableFMA - call avx without fma implementation - // 3. DisableAvx - call sse Vector4 implementation - // 4. DisableHWIntrinsic - call scalar fallback implementation + // 3. DisableAvx - call sse implementation + // 4. DisableSIMD - call Vector4 fallback implementation FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, seed, - HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSIMD); } // Forward transform @@ -197,12 +197,12 @@ static void RunTest(string serialized) // 4 paths: // 1. AllowAll - call avx/fma implementation // 2. DisableFMA - call avx without fma implementation - // 3. DisableAvx - call sse Vector4 implementation - // 4. DisableHWIntrinsic - call scalar fallback implementation + // 3. DisableAvx - call sse implementation + // 4. DisableSIMD - call Vector4 fallback implementation FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, seed, - HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); + HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSIMD); } } } From d61b845fd93fff6875638966bcc1b97445ccc3fb Mon Sep 17 00:00:00 2001 From: Dmitry Pentin Date: Tue, 4 Jan 2022 08:22:44 +0300 Subject: [PATCH 3/3] Fixed FDCT test comment --- tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs index 75572b943f..36570ce55a 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs @@ -197,8 +197,8 @@ static void RunTest(string serialized) // 4 paths: // 1. AllowAll - call avx/fma implementation // 2. DisableFMA - call avx without fma implementation - // 3. DisableAvx - call sse implementation - // 4. DisableSIMD - call Vector4 fallback implementation + // 3. DisableAvx - call Vector4 implementation + // 4. DisableSIMD - call scalar fallback implementation FeatureTestRunner.RunWithHwIntrinsicsFeature( RunTest, seed,