From 7371ed051cf15e2bc75688e070ef74dd4272f4a9 Mon Sep 17 00:00:00 2001 From: Brian Popow Date: Thu, 31 Mar 2022 11:44:37 +0200 Subject: [PATCH] Revert fixedBin back to byte[] --- .../Jpeg/Components/Decoder/ArithmeticScanDecoder.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs index 6d5d2548f6..d3a5ea15b0 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs @@ -55,6 +55,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder private ArithmeticDecodingTable[] acDecodingTables; + private readonly byte[] fixedBin = { 113, 0, 0, 0 }; + private readonly CancellationToken cancellationToken; private static readonly int[] ArithmeticTable = @@ -197,9 +199,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder this.ct = -16; // Force reading 2 initial bytes to fill C. } - // Uses C# compiler's optimization to refer to static data segment directly, without any further allocation. - private static ReadOnlySpan FixedBin => new byte[] { 113, 0, 0, 0 }; - /// public int ResetInterval { @@ -234,7 +233,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder } } - private ref byte GetFixedBinReference() => ref MemoryMarshal.GetReference(FixedBin); + private ref byte GetFixedBinReference() => ref this.fixedBin[0]; /// /// Decodes the entropy coded data.