diff --git a/src/ImageSharp/Formats/Webp/Lossless/PredictorEncoder.cs b/src/ImageSharp/Formats/Webp/Lossless/PredictorEncoder.cs index abb727447..c6dc6b8b2 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/PredictorEncoder.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/PredictorEncoder.cs @@ -17,7 +17,8 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless /// internal static unsafe class PredictorEncoder { - private static readonly sbyte[] DeltaLut = { 16, 16, 8, 4, 2, 2, 2 }; + // This uses C#'s compiler optimization to refer to assembly's static data directly. + private static ReadOnlySpan DeltaLut => new sbyte[] { 16, 16, 8, 4, 2, 2, 2 }; private static readonly sbyte[][] Offset = { diff --git a/src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs b/src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs index c46e7193f..1a9036ec9 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/Vp8LEncoder.cs @@ -85,7 +85,8 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless private const int PaletteInvSize = 1 << PaletteInvSizeBits; - private static readonly byte[] Order = { 1, 2, 0, 3 }; + // This uses C#'s compiler optimization to refer to assembly's static data directly. + private static ReadOnlySpan Order => new byte[] { 1, 2, 0, 3 }; /// /// Initializes a new instance of the class.