From 0c0748e1c77fc68a47b9b68b98e1923d3e7f3413 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Wed, 4 Jun 2025 12:24:53 +1000 Subject: [PATCH] Update LosslessUtils.cs --- src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs b/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs index b96525b426..8cc9fd05b9 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs @@ -97,14 +97,14 @@ internal static unsafe class LosslessUtils { if (Vector256.IsHardwareAccelerated && pixelData.Length >= 8) { - Vector256 addGreenToBlueAndRedMaskAvx2 = Vector256.Create(1, 255, 1, 255, 5, 255, 5, 255, 9, 255, 9, 255, 13, 255, 13, 255, 17, 255, 17, 255, 21, 255, 21, 255, 25, 255, 25, 255, 29, 255, 29, 255); + Vector256 addGreenToBlueAndRedMask = Vector256.Create(1, 255, 1, 255, 5, 255, 5, 255, 9, 255, 9, 255, 13, 255, 13, 255, 17, 255, 17, 255, 21, 255, 21, 255, 25, 255, 25, 255, 29, 255, 29, 255); nuint numPixels = (uint)pixelData.Length; nuint i = 0; do { ref uint pos = ref Unsafe.Add(ref MemoryMarshal.GetReference(pixelData), i); Vector256 input = Unsafe.As>(ref pos).AsByte(); - Vector256 in0g0g = Vector256_.ShuffleNative(input, addGreenToBlueAndRedMaskAvx2); + Vector256 in0g0g = Vector256_.ShuffleNative(input, addGreenToBlueAndRedMask); Vector256 output = input + in0g0g; Unsafe.As>(ref pos) = output.AsUInt32(); i += 8; @@ -161,14 +161,14 @@ internal static unsafe class LosslessUtils { if (Vector256.IsHardwareAccelerated && pixelData.Length >= 8) { - Vector256 subtractGreenFromBlueAndRedMaskAvx2 = Vector256.Create(1, 255, 1, 255, 5, 255, 5, 255, 9, 255, 9, 255, 13, 255, 13, 255, 17, 255, 17, 255, 21, 255, 21, 255, 25, 255, 25, 255, 29, 255, 29, 255); + Vector256 subtractGreenFromBlueAndRedMask = Vector256.Create(1, 255, 1, 255, 5, 255, 5, 255, 9, 255, 9, 255, 13, 255, 13, 255, 17, 255, 17, 255, 21, 255, 21, 255, 25, 255, 25, 255, 29, 255, 29, 255); nuint numPixels = (uint)pixelData.Length; nuint i = 0; do { ref uint pos = ref Unsafe.Add(ref MemoryMarshal.GetReference(pixelData), i); Vector256 input = Unsafe.As>(ref pos).AsByte(); - Vector256 in0g0g = Vector256_.ShuffleNative(input, subtractGreenFromBlueAndRedMaskAvx2); + Vector256 in0g0g = Vector256_.ShuffleNative(input, subtractGreenFromBlueAndRedMask); Vector256 output = input - in0g0g; Unsafe.As>(ref pos) = output.AsUInt32(); i += 8;