Browse Source
Merge branch 'main' into sn/promote-pixeltype
pull/2601/head
James Jackson-South
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
4 deletions
-
src/ImageSharp/Formats/Png/Filters/PaethFilter.cs
-
src/ImageSharp/Formats/Webp/WebpFormat.cs
-
tests/ImageSharp.Tests/Formats/Png/PngDecoderFilterTests.cs
|
|
|
@ -35,9 +35,9 @@ internal static class PaethFilter |
|
|
|
// row: a d
|
|
|
|
// The Paeth function predicts d to be whichever of a, b, or c is nearest to
|
|
|
|
// p = a + b - c.
|
|
|
|
if (Sse2.IsSupported && bytesPerPixel is 4) |
|
|
|
if (Ssse3.IsSupported && bytesPerPixel is 4) |
|
|
|
{ |
|
|
|
DecodeSse3(scanline, previousScanline); |
|
|
|
DecodeSsse3(scanline, previousScanline); |
|
|
|
} |
|
|
|
else if (AdvSimd.Arm64.IsSupported && bytesPerPixel is 4) |
|
|
|
{ |
|
|
|
@ -50,7 +50,7 @@ internal static class PaethFilter |
|
|
|
} |
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
private static void DecodeSse3(Span<byte> scanline, Span<byte> previousScanline) |
|
|
|
private static void DecodeSsse3(Span<byte> scanline, Span<byte> previousScanline) |
|
|
|
{ |
|
|
|
ref byte scanBaseRef = ref MemoryMarshal.GetReference(scanline); |
|
|
|
ref byte prevBaseRef = ref MemoryMarshal.GetReference(previousScanline); |
|
|
|
|
|
|
|
@ -18,7 +18,7 @@ public sealed class WebpFormat : IImageFormat<WebpMetadata, WebpFrameMetadata> |
|
|
|
public static WebpFormat Instance { get; } = new WebpFormat(); |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public string Name => "Webp"; |
|
|
|
public string Name => "WEBP"; |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public string DefaultMimeType => "image/webp"; |
|
|
|
|
|
|
|
@ -170,6 +170,9 @@ public class PngDecoderFilterTests |
|
|
|
[Fact] |
|
|
|
public void PaethFilter_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.AllowAll); |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void PaethFilter_WithoutSsse3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.DisableSSSE3); |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void PaethFilter_WithoutHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.DisableHWIntrinsic); |
|
|
|
} |
|
|
|
|