diff --git a/src/ImageSharp/Formats/Png/PngCgbiProcessor.cs b/src/ImageSharp/Formats/Png/PngCgbiProcessor.cs index 9243896de7..e4847ad67f 100644 --- a/src/ImageSharp/Formats/Png/PngCgbiProcessor.cs +++ b/src/ImageSharp/Formats/Png/PngCgbiProcessor.cs @@ -26,13 +26,14 @@ internal static class PngCgbiProcessor { // Per-pixel byte indices that swap CgBI's BGRA layout to Rgba32's RGBA. // MMShuffle3012 expands to [2, 1, 0, 3] per 4-byte pixel; the same 64-byte - // sequence seeds all three shuffle masks (V128/V256 ctors take the leading - // 16/32 bytes). - private static readonly Vector128 BgraToRgbaShuffle128 = Vector128.Create(BuildShuffleBytes()); + // sequence seeds all three shuffle masks (Vector128/256 take a leading slice). + private static readonly byte[] BgraToRgbaShuffleBytes = BuildShuffleBytes(); - private static readonly Vector256 BgraToRgbaShuffle256 = Vector256.Create(BuildShuffleBytes()); + private static readonly Vector128 BgraToRgbaShuffle128 = Vector128.Create(new ReadOnlySpan(BgraToRgbaShuffleBytes, 0, Vector128.Count)); - private static readonly Vector512 BgraToRgbaShuffle512 = Vector512.Create(BuildShuffleBytes()); + private static readonly Vector256 BgraToRgbaShuffle256 = Vector256.Create(new ReadOnlySpan(BgraToRgbaShuffleBytes, 0, Vector256.Count)); + + private static readonly Vector512 BgraToRgbaShuffle512 = Vector512.Create(BgraToRgbaShuffleBytes); /// /// Applies the inverse of Apple's CgBI pixel mangling to a defiltered scanline in place.