Browse Source

Merge remote-tracking branch 'upstream/master' into je/nonstandard-png-exif

pull/1877/head
James Jackson-South 4 years ago
parent
commit
3c421bbc12
  1. 6
      src/ImageSharp/Formats/Jpeg/Components/FastFloatingPointDCT.cs
  2. 12
      tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs

6
src/ImageSharp/Formats/Jpeg/Components/FastFloatingPointDCT.cs

@ -146,11 +146,13 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
/// <summary> /// <summary>
/// Apply floating point IDCT inplace using <see cref="Vector4"/> API. /// Apply floating point IDCT inplace using <see cref="Vector4"/> API.
/// </summary> /// </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> /// <param name="transposedBlock">Input block.</param>
private static void IDCT_Vector4(ref Block8x8F transposedBlock) 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 // First pass - process columns
IDCT8x4_Vector4(ref transposedBlock.V0L); IDCT8x4_Vector4(ref transposedBlock.V0L);
IDCT8x4_Vector4(ref transposedBlock.V0R); IDCT8x4_Vector4(ref transposedBlock.V0R);

12
tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs

@ -149,12 +149,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
// 4 paths: // 4 paths:
// 1. AllowAll - call avx/fma implementation // 1. AllowAll - call avx/fma implementation
// 2. DisableFMA - call avx without fma implementation // 2. DisableFMA - call avx without fma implementation
// 3. DisableAvx - call sse Vector4 implementation // 3. DisableAvx - call sse implementation
// 4. DisableHWIntrinsic - call scalar fallback implementation // 4. DisableSIMD - call Vector4 fallback implementation
FeatureTestRunner.RunWithHwIntrinsicsFeature( FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest, RunTest,
seed, seed,
HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSIMD);
} }
// Forward transform // Forward transform
@ -197,12 +197,12 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
// 4 paths: // 4 paths:
// 1. AllowAll - call avx/fma implementation // 1. AllowAll - call avx/fma implementation
// 2. DisableFMA - call avx without fma implementation // 2. DisableFMA - call avx without fma implementation
// 3. DisableAvx - call sse Vector4 implementation // 3. DisableAvx - call Vector4 implementation
// 4. DisableHWIntrinsic - call scalar fallback implementation // 4. DisableSIMD - call scalar fallback implementation
FeatureTestRunner.RunWithHwIntrinsicsFeature( FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest, RunTest,
seed, seed,
HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic); HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSIMD);
} }
} }
} }

Loading…
Cancel
Save