diff --git a/src/ImageSharp/Formats/Jxl/IO/FrameHeader/JxlColorTransformHelpers.cs b/src/ImageSharp/Formats/Jxl/IO/FrameHeader/JxlColorTransformHelpers.cs index de6166414..81bc94187 100644 --- a/src/ImageSharp/Formats/Jxl/IO/FrameHeader/JxlColorTransformHelpers.cs +++ b/src/ImageSharp/Formats/Jxl/IO/FrameHeader/JxlColorTransformHelpers.cs @@ -8,32 +8,24 @@ namespace SixLabors.ImageSharp.Formats.Jxl.IO.FrameHeader; /// internal static class JxlColorTransformHelpers { - private static readonly int[][] JpegOrders = - [ - [0, 0, 0], // Grayscale - [1, 0, 2], // Y'Cb'Cr - [0, 1, 2], // None - [0, 1, 2] // Anything else - ]; + private static ReadOnlySpan Grayscale => [0, 0, 0]; + + private static ReadOnlySpan YCbCr => [1, 0, 2]; + + private static ReadOnlySpan None => [0, 1, 2]; public static ReadOnlySpan GetJpegOrder(JxlColorTransform transform, bool isGraysacle) { if (isGraysacle) { - return JpegOrders[0]; + return Grayscale; } if (transform == JxlColorTransform.YCbCr) { - return JpegOrders[1]; - } - else if (transform == JxlColorTransform.None) - { - return JpegOrders[2]; - } - else - { - return JpegOrders[3]; + return YCbCr; } + + return None; } }