Browse Source
Merge pull request #1922 from br3aker/dp/jpeg-idct-scalar
Fixed Jpeg IDCT missing scalar implementation
pull/1924/head
James Jackson-South
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
10 additions and
8 deletions
-
src/ImageSharp/Formats/Jpeg/Components/FastFloatingPointDCT.cs
-
tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs
|
|
|
@ -146,11 +146,13 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components |
|
|
|
/// <summary>
|
|
|
|
/// Apply floating point IDCT inplace using <see cref="Vector4"/> API.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// This method can be used even if there's no SIMD intrinsics available
|
|
|
|
/// as <see cref="Vector4"/> can be compiled to scalar instructions.
|
|
|
|
/// </remarks>
|
|
|
|
/// <param name="transposedBlock">Input block.</param>
|
|
|
|
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); |
|
|
|
|
|
|
|
@ -149,12 +149,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg |
|
|
|
// 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 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg |
|
|
|
// 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 Vector4 implementation
|
|
|
|
// 4. DisableSIMD - call scalar fallback implementation
|
|
|
|
FeatureTestRunner.RunWithHwIntrinsicsFeature( |
|
|
|
RunTest, |
|
|
|
seed, |
|
|
|
HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); |
|
|
|
HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSIMD); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|