From 493dedaf69c8f4e0bdb910cca907a72b6a84fa4f Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Sat, 19 Aug 2017 01:06:13 +0200 Subject: [PATCH] renaming is hard --- .../GolangPort/Components/Decoder/Bits.cs | 36 ++++----- .../GolangPort/Components/Decoder/Bytes.cs | 54 ++++++------- .../Components/Decoder/DecoderThrowHelper.cs | 28 +++---- .../Components/Decoder/InputProcessor.cs | 78 +++++++++---------- .../Components/Decoder/JpegBlockProcessor.cs | 16 ++-- ...derErrorCode.cs => OldDecoderErrorCode.cs} | 2 +- .../{HuffmanTree.cs => OldHuffmanTree.cs} | 10 +-- .../{JpegPixelArea.cs => OldJpegPixelArea.cs} | 14 ++-- .../OldJpegScanDecoder.ComputationData.cs | 4 +- .../Components/Decoder/OldJpegScanDecoder.cs | 60 +++++++------- .../Components/Decoder/YCbCrImage.cs | 6 +- ...egDecoderCore.cs => OldJpegDecoderCore.cs} | 44 +++++------ .../Image/DecodeJpegMultiple.cs | 2 +- .../Formats/Jpg/JpegDecoderTests.cs | 2 +- .../Formats/Jpg/YCbCrImageTests.cs | 2 +- 15 files changed, 179 insertions(+), 179 deletions(-) rename src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/{DecoderErrorCode.cs => OldDecoderErrorCode.cs} (94%) rename src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/{HuffmanTree.cs => OldHuffmanTree.cs} (95%) rename src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/{JpegPixelArea.cs => OldJpegPixelArea.cs} (88%) rename src/ImageSharp/Formats/Jpeg/GolangPort/{JpegDecoderCore.cs => OldJpegDecoderCore.cs} (97%) diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bits.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bits.cs index 99ed593372..ea5a573402 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bits.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bits.cs @@ -40,7 +40,7 @@ internal struct Bits [MethodImpl(MethodImplOptions.AggressiveInlining)] public void EnsureNBits(int n, ref InputProcessor inputProcessor) { - DecoderErrorCode errorCode = this.EnsureNBitsUnsafe(n, ref inputProcessor); + OldDecoderErrorCode errorCode = this.EnsureNBitsUnsafe(n, ref inputProcessor); errorCode.EnsureNoError(); } @@ -48,17 +48,17 @@ public void EnsureNBits(int n, ref InputProcessor inputProcessor) /// Reads bytes from the byte buffer to ensure that bits.UnreadBits is at /// least n. For best performance (avoiding function calls inside hot loops), /// the caller is the one responsible for first checking that bits.UnreadBits < n. - /// This method does not throw. Returns instead. + /// This method does not throw. Returns instead. /// /// The number of bits to ensure. /// The /// Error code - public DecoderErrorCode EnsureNBitsUnsafe(int n, ref InputProcessor inputProcessor) + public OldDecoderErrorCode EnsureNBitsUnsafe(int n, ref InputProcessor inputProcessor) { while (true) { - DecoderErrorCode errorCode = this.EnsureBitsStepImpl(ref inputProcessor); - if (errorCode != DecoderErrorCode.NoError || this.UnreadBits >= n) + OldDecoderErrorCode errorCode = this.EnsureBitsStepImpl(ref inputProcessor); + if (errorCode != OldDecoderErrorCode.NoError || this.UnreadBits >= n) { return errorCode; } @@ -69,8 +69,8 @@ public DecoderErrorCode EnsureNBitsUnsafe(int n, ref InputProcessor inputProcess /// Unrolled version of for n==8 /// /// The - /// A - public DecoderErrorCode Ensure8BitsUnsafe(ref InputProcessor inputProcessor) + /// A + public OldDecoderErrorCode Ensure8BitsUnsafe(ref InputProcessor inputProcessor) { return this.EnsureBitsStepImpl(ref inputProcessor); } @@ -79,8 +79,8 @@ public DecoderErrorCode Ensure8BitsUnsafe(ref InputProcessor inputProcessor) /// Unrolled version of for n==1 /// /// The - /// A - public DecoderErrorCode Ensure1BitUnsafe(ref InputProcessor inputProcessor) + /// A + public OldDecoderErrorCode Ensure1BitUnsafe(ref InputProcessor inputProcessor) { return this.EnsureBitsStepImpl(ref inputProcessor); } @@ -95,7 +95,7 @@ public DecoderErrorCode Ensure1BitUnsafe(ref InputProcessor inputProcessor) public int ReceiveExtend(int t, ref InputProcessor inputProcessor) { int x; - DecoderErrorCode errorCode = this.ReceiveExtendUnsafe(t, ref inputProcessor, out x); + OldDecoderErrorCode errorCode = this.ReceiveExtendUnsafe(t, ref inputProcessor, out x); errorCode.EnsureNoError(); return x; } @@ -106,13 +106,13 @@ public int ReceiveExtend(int t, ref InputProcessor inputProcessor) /// Byte /// The /// Read bits value - /// The - public DecoderErrorCode ReceiveExtendUnsafe(int t, ref InputProcessor inputProcessor, out int x) + /// The + public OldDecoderErrorCode ReceiveExtendUnsafe(int t, ref InputProcessor inputProcessor, out int x) { if (this.UnreadBits < t) { - DecoderErrorCode errorCode = this.EnsureNBitsUnsafe(t, ref inputProcessor); - if (errorCode != DecoderErrorCode.NoError) + OldDecoderErrorCode errorCode = this.EnsureNBitsUnsafe(t, ref inputProcessor); + if (errorCode != OldDecoderErrorCode.NoError) { x = int.MaxValue; return errorCode; @@ -129,15 +129,15 @@ public DecoderErrorCode ReceiveExtendUnsafe(int t, ref InputProcessor inputProce x += ((-1) << t) + 1; } - return DecoderErrorCode.NoError; + return OldDecoderErrorCode.NoError; } - private DecoderErrorCode EnsureBitsStepImpl(ref InputProcessor inputProcessor) + private OldDecoderErrorCode EnsureBitsStepImpl(ref InputProcessor inputProcessor) { int c; - DecoderErrorCode errorCode = inputProcessor.Bytes.ReadByteStuffedByteUnsafe(inputProcessor.InputStream, out c); + OldDecoderErrorCode errorCode = inputProcessor.Bytes.ReadByteStuffedByteUnsafe(inputProcessor.InputStream, out c); - if (errorCode != DecoderErrorCode.NoError) + if (errorCode != OldDecoderErrorCode.NoError) { return errorCode; } diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs index 5a1be35ffd..15eec0b0e6 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs @@ -86,8 +86,8 @@ public void Dispose() /// /// Input stream /// The result byte as - /// The - public DecoderErrorCode ReadByteStuffedByteUnsafe(Stream inputStream, out int x) + /// The + public OldDecoderErrorCode ReadByteStuffedByteUnsafe(Stream inputStream, out int x) { // Take the fast path if bytes.buf contains at least two bytes. if (this.I + 2 <= this.J) @@ -97,48 +97,48 @@ public DecoderErrorCode ReadByteStuffedByteUnsafe(Stream inputStream, out int x) this.UnreadableBytes = 1; if (x != OldJpegConstants.Markers.XFFInt) { - return DecoderErrorCode.NoError; + return OldDecoderErrorCode.NoError; } if (this.BufferAsInt[this.I] != 0x00) { - return DecoderErrorCode.MissingFF00; + return OldDecoderErrorCode.MissingFF00; } this.I++; this.UnreadableBytes = 2; x = OldJpegConstants.Markers.XFF; - return DecoderErrorCode.NoError; + return OldDecoderErrorCode.NoError; } this.UnreadableBytes = 0; - DecoderErrorCode errorCode = this.ReadByteAsIntUnsafe(inputStream, out x); + OldDecoderErrorCode errorCode = this.ReadByteAsIntUnsafe(inputStream, out x); this.UnreadableBytes = 1; - if (errorCode != DecoderErrorCode.NoError) + if (errorCode != OldDecoderErrorCode.NoError) { return errorCode; } if (x != OldJpegConstants.Markers.XFF) { - return DecoderErrorCode.NoError; + return OldDecoderErrorCode.NoError; } errorCode = this.ReadByteAsIntUnsafe(inputStream, out x); this.UnreadableBytes = 2; - if (errorCode != DecoderErrorCode.NoError) + if (errorCode != OldDecoderErrorCode.NoError) { return errorCode; } if (x != 0x00) { - return DecoderErrorCode.MissingFF00; + return OldDecoderErrorCode.MissingFF00; } x = OldJpegConstants.Markers.XFF; - return DecoderErrorCode.NoError; + return OldDecoderErrorCode.NoError; } /// @@ -150,25 +150,25 @@ public DecoderErrorCode ReadByteStuffedByteUnsafe(Stream inputStream, out int x) public byte ReadByte(Stream inputStream) { byte result; - DecoderErrorCode errorCode = this.ReadByteUnsafe(inputStream, out result); + OldDecoderErrorCode errorCode = this.ReadByteUnsafe(inputStream, out result); errorCode.EnsureNoError(); return result; } /// /// Extracts the next byte, whether buffered or not buffered into the result out parameter. It does not care about byte stuffing. - /// This method does not throw on format error, it returns a instead. + /// This method does not throw on format error, it returns a instead. /// /// Input stream /// The result as out parameter - /// The - public DecoderErrorCode ReadByteUnsafe(Stream inputStream, out byte result) + /// The + public OldDecoderErrorCode ReadByteUnsafe(Stream inputStream, out byte result) { - DecoderErrorCode errorCode = DecoderErrorCode.NoError; + OldDecoderErrorCode errorCode = OldDecoderErrorCode.NoError; while (this.I == this.J) { errorCode = this.FillUnsafe(inputStream); - if (errorCode != DecoderErrorCode.NoError) + if (errorCode != OldDecoderErrorCode.NoError) { result = 0; return errorCode; @@ -186,15 +186,15 @@ public DecoderErrorCode ReadByteUnsafe(Stream inputStream, out byte result) /// /// The input stream /// The result - /// A + /// A [MethodImpl(MethodImplOptions.AggressiveInlining)] - public DecoderErrorCode ReadByteAsIntUnsafe(Stream inputStream, out int result) + public OldDecoderErrorCode ReadByteAsIntUnsafe(Stream inputStream, out int result) { - DecoderErrorCode errorCode = DecoderErrorCode.NoError; + OldDecoderErrorCode errorCode = OldDecoderErrorCode.NoError; while (this.I == this.J) { errorCode = this.FillUnsafe(inputStream); - if (errorCode != DecoderErrorCode.NoError) + if (errorCode != OldDecoderErrorCode.NoError) { result = 0; return errorCode; @@ -216,18 +216,18 @@ public DecoderErrorCode ReadByteAsIntUnsafe(Stream inputStream, out int result) [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Fill(Stream inputStream) { - DecoderErrorCode errorCode = this.FillUnsafe(inputStream); + OldDecoderErrorCode errorCode = this.FillUnsafe(inputStream); errorCode.EnsureNoError(); } /// /// Fills up the bytes buffer from the underlying stream. /// It should only be called when there are no unread bytes in bytes. - /// This method does not throw , returns a instead! + /// This method does not throw , returns a instead! /// /// Input stream - /// The - public DecoderErrorCode FillUnsafe(Stream inputStream) + /// The + public OldDecoderErrorCode FillUnsafe(Stream inputStream) { if (this.I != this.J) { @@ -249,7 +249,7 @@ public DecoderErrorCode FillUnsafe(Stream inputStream) int n = inputStream.Read(this.Buffer, this.J, this.Buffer.Length - this.J); if (n == 0) { - return DecoderErrorCode.UnexpectedEndOfStream; + return OldDecoderErrorCode.UnexpectedEndOfStream; } this.J += n; @@ -259,7 +259,7 @@ public DecoderErrorCode FillUnsafe(Stream inputStream) this.BufferAsInt[i] = this.Buffer[i]; } - return DecoderErrorCode.NoError; + return OldDecoderErrorCode.NoError; } } } \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/DecoderThrowHelper.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/DecoderThrowHelper.cs index 07c5afadb0..ac13ec2e8a 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/DecoderThrowHelper.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/DecoderThrowHelper.cs @@ -14,19 +14,19 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder internal static class DecoderThrowHelper { /// - /// Throws an exception that belongs to the given + /// Throws an exception that belongs to the given /// - /// The + /// The [MethodImpl(MethodImplOptions.NoInlining)] - public static void ThrowExceptionForErrorCode(this DecoderErrorCode errorCode) + public static void ThrowExceptionForErrorCode(this OldDecoderErrorCode errorCode) { switch (errorCode) { - case DecoderErrorCode.NoError: + case OldDecoderErrorCode.NoError: throw new ArgumentException("ThrowExceptionForErrorCode() called with NoError!", nameof(errorCode)); - case DecoderErrorCode.MissingFF00: + case OldDecoderErrorCode.MissingFF00: throw new MissingFF00Exception(); - case DecoderErrorCode.UnexpectedEndOfStream: + case OldDecoderErrorCode.UnexpectedEndOfStream: throw new EOFException(); default: throw new ArgumentOutOfRangeException(nameof(errorCode), errorCode, null); @@ -34,26 +34,26 @@ public static void ThrowExceptionForErrorCode(this DecoderErrorCode errorCode) } /// - /// Throws an exception if the given defines an error. + /// Throws an exception if the given defines an error. /// - /// The + /// The [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void EnsureNoError(this DecoderErrorCode errorCode) + public static void EnsureNoError(this OldDecoderErrorCode errorCode) { - if (errorCode != DecoderErrorCode.NoError) + if (errorCode != OldDecoderErrorCode.NoError) { ThrowExceptionForErrorCode(errorCode); } } /// - /// Throws an exception if the given is . + /// Throws an exception if the given is . /// - /// The + /// The [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void EnsureNoEOF(this DecoderErrorCode errorCode) + public static void EnsureNoEOF(this OldDecoderErrorCode errorCode) { - if (errorCode == DecoderErrorCode.UnexpectedEndOfStream) + if (errorCode == OldDecoderErrorCode.UnexpectedEndOfStream) { errorCode.ThrowExceptionForErrorCode(); } diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs index a9633c9771..b8da0551bb 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs @@ -10,7 +10,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder using System.Runtime.CompilerServices; /// - /// Encapsulates stream reading and processing data and operations for . + /// Encapsulates stream reading and processing data and operations for . /// It's a value type for imporved data locality, and reduced number of CALLVIRT-s /// internal struct InputProcessor : IDisposable @@ -29,7 +29,7 @@ internal struct InputProcessor : IDisposable /// Initializes a new instance of the struct. /// /// The input - /// Temporal buffer, same as + /// Temporal buffer, same as public InputProcessor(Stream inputStream, byte[] temp) { this.Bits = default(Bits); @@ -45,7 +45,7 @@ public InputProcessor(Stream inputStream, byte[] temp) public Stream InputStream { get; } /// - /// Gets the temporal buffer, same instance as + /// Gets the temporal buffer, same instance as /// public byte[] Temp { get; } @@ -58,11 +58,11 @@ public InputProcessor(Stream inputStream, byte[] temp) /// If errorCode indicates unexpected EOF, sets to true and returns false. /// Calls and returns true otherwise. /// - /// The + /// The /// indicating whether everything is OK - public bool CheckEOFEnsureNoError(DecoderErrorCode errorCode) + public bool CheckEOFEnsureNoError(OldDecoderErrorCode errorCode) { - if (errorCode == DecoderErrorCode.UnexpectedEndOfStream) + if (errorCode == OldDecoderErrorCode.UnexpectedEndOfStream) { this.UnexpectedEndOfStreamReached = true; return false; @@ -76,11 +76,11 @@ public bool CheckEOFEnsureNoError(DecoderErrorCode errorCode) /// If errorCode indicates unexpected EOF, sets to true and returns false. /// Returns true otherwise. /// - /// The + /// The /// indicating whether everything is OK - public bool CheckEOF(DecoderErrorCode errorCode) + public bool CheckEOF(OldDecoderErrorCode errorCode) { - if (errorCode == DecoderErrorCode.UnexpectedEndOfStream) + if (errorCode == OldDecoderErrorCode.UnexpectedEndOfStream) { this.UnexpectedEndOfStreamReached = true; return false; @@ -112,13 +112,13 @@ public byte ReadByte() /// TODO: This method (and also the usages) could be optimized by batching! /// /// The decoded bit as a - /// The - public DecoderErrorCode DecodeBitUnsafe(out bool result) + /// The + public OldDecoderErrorCode DecodeBitUnsafe(out bool result) { if (this.Bits.UnreadBits == 0) { - DecoderErrorCode errorCode = this.Bits.Ensure1BitUnsafe(ref this); - if (errorCode != DecoderErrorCode.NoError) + OldDecoderErrorCode errorCode = this.Bits.Ensure1BitUnsafe(ref this); + if (errorCode != OldDecoderErrorCode.NoError) { result = false; return errorCode; @@ -128,18 +128,18 @@ public DecoderErrorCode DecodeBitUnsafe(out bool result) result = (this.Bits.Accumulator & this.Bits.Mask) != 0; this.Bits.UnreadBits--; this.Bits.Mask >>= 1; - return DecoderErrorCode.NoError; + return OldDecoderErrorCode.NoError; } /// /// Reads exactly length bytes into data. It does not care about byte stuffing. - /// Does not throw on errors, returns instead! + /// Does not throw on errors, returns instead! /// /// The data to write to. /// The offset in the source buffer /// The number of bytes to read - /// The - public DecoderErrorCode ReadFullUnsafe(byte[] data, int offset, int length) + /// The + public OldDecoderErrorCode ReadFullUnsafe(byte[] data, int offset, int length) { // Unread the overshot bytes, if any. if (this.Bytes.UnreadableBytes != 0) @@ -152,7 +152,7 @@ public DecoderErrorCode ReadFullUnsafe(byte[] data, int offset, int length) this.Bytes.UnreadableBytes = 0; } - DecoderErrorCode errorCode = DecoderErrorCode.NoError; + OldDecoderErrorCode errorCode = OldDecoderErrorCode.NoError; while (length > 0) { if (this.Bytes.J - this.Bytes.I >= length) @@ -180,8 +180,8 @@ public DecoderErrorCode ReadFullUnsafe(byte[] data, int offset, int length) /// /// The number of bits to decode. /// The result - /// The - public DecoderErrorCode DecodeBitsUnsafe(int count, out int result) + /// The + public OldDecoderErrorCode DecodeBitsUnsafe(int count, out int result) { if (this.Bits.UnreadBits < count) { @@ -192,7 +192,7 @@ public DecoderErrorCode DecodeBitsUnsafe(int count, out int result) result = result & ((1 << count) - 1); this.Bits.UnreadBits -= count; this.Bits.Mask >>= count; - return DecoderErrorCode.NoError; + return OldDecoderErrorCode.NoError; } /// @@ -200,8 +200,8 @@ public DecoderErrorCode DecodeBitsUnsafe(int count, out int result) /// /// The huffman value /// The decoded - /// The - public DecoderErrorCode DecodeHuffmanUnsafe(ref HuffmanTree huffmanTree, out int result) + /// The + public OldDecoderErrorCode DecodeHuffmanUnsafe(ref OldHuffmanTree huffmanTree, out int result) { result = 0; @@ -212,11 +212,11 @@ public DecoderErrorCode DecodeHuffmanUnsafe(ref HuffmanTree huffmanTree, out int if (this.Bits.UnreadBits < 8) { - DecoderErrorCode errorCode = this.Bits.Ensure8BitsUnsafe(ref this); + OldDecoderErrorCode errorCode = this.Bits.Ensure8BitsUnsafe(ref this); - if (errorCode == DecoderErrorCode.NoError) + if (errorCode == OldDecoderErrorCode.NoError) { - int lutIndex = (this.Bits.Accumulator >> (this.Bits.UnreadBits - HuffmanTree.LutSizeLog2)) & 0xFF; + int lutIndex = (this.Bits.Accumulator >> (this.Bits.UnreadBits - OldHuffmanTree.LutSizeLog2)) & 0xFF; int v = huffmanTree.Lut[lutIndex]; if (v != 0) @@ -236,7 +236,7 @@ public DecoderErrorCode DecodeHuffmanUnsafe(ref HuffmanTree huffmanTree, out int } int code = 0; - for (int i = 0; i < HuffmanTree.MaxCodeLength; i++) + for (int i = 0; i < OldHuffmanTree.MaxCodeLength; i++) { if (this.Bits.UnreadBits == 0) { @@ -254,7 +254,7 @@ public DecoderErrorCode DecodeHuffmanUnsafe(ref HuffmanTree huffmanTree, out int if (code <= huffmanTree.MaxCodes[i]) { result = huffmanTree.GetValue(code, i); - return DecoderErrorCode.NoError; + return OldDecoderErrorCode.NoError; } code <<= 1; @@ -264,7 +264,7 @@ public DecoderErrorCode DecodeHuffmanUnsafe(ref HuffmanTree huffmanTree, out int DecoderThrowHelper.ThrowImageFormatException.BadHuffmanCode(); // DUMMY RETURN! C# doesn't know we have thrown an exception! - return DecoderErrorCode.NoError; + return OldDecoderErrorCode.NoError; } /// @@ -274,17 +274,17 @@ public DecoderErrorCode DecodeHuffmanUnsafe(ref HuffmanTree huffmanTree, out int [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Skip(int count) { - DecoderErrorCode errorCode = this.SkipUnsafe(count); + OldDecoderErrorCode errorCode = this.SkipUnsafe(count); errorCode.EnsureNoError(); } /// /// Skips the next n bytes. - /// Does not throw, returns instead! + /// Does not throw, returns instead! /// /// The number of bytes to ignore. - /// The - public DecoderErrorCode SkipUnsafe(int count) + /// The + public OldDecoderErrorCode SkipUnsafe(int count) { // Unread the overshot bytes, if any. if (this.Bytes.UnreadableBytes != 0) @@ -312,14 +312,14 @@ public DecoderErrorCode SkipUnsafe(int count) break; } - DecoderErrorCode errorCode = this.Bytes.FillUnsafe(this.InputStream); - if (errorCode != DecoderErrorCode.NoError) + OldDecoderErrorCode errorCode = this.Bytes.FillUnsafe(this.InputStream); + if (errorCode != OldDecoderErrorCode.NoError) { return errorCode; } } - return DecoderErrorCode.NoError; + return OldDecoderErrorCode.NoError; } /// @@ -331,7 +331,7 @@ public DecoderErrorCode SkipUnsafe(int count) [MethodImpl(MethodImplOptions.AggressiveInlining)] public void ReadFull(byte[] data, int offset, int length) { - DecoderErrorCode errorCode = this.ReadFullUnsafe(data, offset, length); + OldDecoderErrorCode errorCode = this.ReadFullUnsafe(data, offset, length); errorCode.EnsureNoError(); } @@ -359,8 +359,8 @@ public void UnreadByteStuffedByte() /// /// Byte /// Read bits value - /// The - public DecoderErrorCode ReceiveExtendUnsafe(int t, out int x) + /// The + public OldDecoderErrorCode ReceiveExtendUnsafe(int t, out int x) { return this.Bits.ReceiveExtendUnsafe(t, ref this, out x); } diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/JpegBlockProcessor.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/JpegBlockProcessor.cs index 1018fab54f..d1d23dd352 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/JpegBlockProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/JpegBlockProcessor.cs @@ -44,10 +44,10 @@ public static void Init(JpegBlockProcessor* processor, int componentIndex) } /// - /// Dequantize, perform the inverse DCT and store the blocks to the into the corresponding instances. + /// Dequantize, perform the inverse DCT and store the blocks to the into the corresponding instances. /// - /// The instance - public void ProcessAllBlocks(JpegDecoderCore decoder) + /// The instance + public void ProcessAllBlocks(OldJpegDecoderCore decoder) { Buffer blockArray = decoder.DecodedBlocks[this.componentIndex]; for (int i = 0; i < blockArray.Length; i++) @@ -57,11 +57,11 @@ public void ProcessAllBlocks(JpegDecoderCore decoder) } /// - /// Dequantize, perform the inverse DCT and store decodedBlock.Block to the into the corresponding instance. + /// Dequantize, perform the inverse DCT and store decodedBlock.Block to the into the corresponding instance. /// - /// The + /// The /// The - private void ProcessBlockColors(JpegDecoderCore decoder, ref DecodedBlock decodedBlock) + private void ProcessBlockColors(OldJpegDecoderCore decoder, ref DecodedBlock decodedBlock) { this.data.Block = decodedBlock.Block; int qtIndex = decoder.ComponentArray[this.componentIndex].Selector; @@ -73,8 +73,8 @@ private void ProcessBlockColors(JpegDecoderCore decoder, ref DecodedBlock decode DCT.TransformIDCT(ref *b, ref *this.pointers.Temp1, ref *this.pointers.Temp2); - JpegPixelArea destChannel = decoder.GetDestinationChannel(this.componentIndex); - JpegPixelArea destArea = destChannel.GetOffsetedSubAreaForBlock(decodedBlock.Bx, decodedBlock.By); + OldJpegPixelArea destChannel = decoder.GetDestinationChannel(this.componentIndex); + OldJpegPixelArea destArea = destChannel.GetOffsetedSubAreaForBlock(decodedBlock.Bx, decodedBlock.By); destArea.LoadColorsFrom(this.pointers.Temp1, this.pointers.Temp2); } diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/DecoderErrorCode.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldDecoderErrorCode.cs similarity index 94% rename from src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/DecoderErrorCode.cs rename to src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldDecoderErrorCode.cs index e8ce9c6030..3f763c45b4 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/DecoderErrorCode.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldDecoderErrorCode.cs @@ -8,7 +8,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder /// /// Represents "recoverable" decoder errors. /// - internal enum DecoderErrorCode + internal enum OldDecoderErrorCode { /// /// NoError diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/HuffmanTree.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldHuffmanTree.cs similarity index 95% rename from src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/HuffmanTree.cs rename to src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldHuffmanTree.cs index 108fdbd4b6..a5953e3c56 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/HuffmanTree.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldHuffmanTree.cs @@ -10,7 +10,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder /// /// Represents a Huffman tree /// - internal struct HuffmanTree : IDisposable + internal struct OldHuffmanTree : IDisposable { /// /// The index of the AC table row @@ -99,12 +99,12 @@ internal struct HuffmanTree : IDisposable private static readonly ArrayPool CodesPool16 = ArrayPool.Create(MaxCodeLength, 50); /// - /// Creates and initializes an array of instances of size + /// Creates and initializes an array of instances of size /// - /// An array of instances representing the Huffman tables - public static HuffmanTree[] CreateHuffmanTrees() + /// An array of instances representing the Huffman tables + public static OldHuffmanTree[] CreateHuffmanTrees() { - HuffmanTree[] result = new HuffmanTree[NumberOfTrees]; + OldHuffmanTree[] result = new OldHuffmanTree[NumberOfTrees]; for (int i = 0; i < MaxTc + 1; i++) { for (int j = 0; j < MaxTh + 1; j++) diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/JpegPixelArea.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegPixelArea.cs similarity index 88% rename from src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/JpegPixelArea.cs rename to src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegPixelArea.cs index db492c549a..7a11d76cf7 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/JpegPixelArea.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegPixelArea.cs @@ -14,15 +14,15 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder /// /// Represents an area of a Jpeg subimage (channel) /// - internal struct JpegPixelArea + internal struct OldJpegPixelArea { /// - /// Initializes a new instance of the struct from existing data. + /// Initializes a new instance of the struct from existing data. /// /// The pixel buffer /// The stride /// The offset - public JpegPixelArea(Buffer2D pixels, int stride, int offset) + public OldJpegPixelArea(Buffer2D pixels, int stride, int offset) { this.Stride = stride; this.Pixels = pixels; @@ -30,11 +30,11 @@ public JpegPixelArea(Buffer2D pixels, int stride, int offset) } /// - /// Initializes a new instance of the struct from existing buffer. + /// Initializes a new instance of the struct from existing buffer. /// will be set to of and will be set to 0. /// /// The pixel buffer - public JpegPixelArea(Buffer2D pixels) + public OldJpegPixelArea(Buffer2D pixels) : this(pixels, pixels.Width, 0) { } @@ -85,10 +85,10 @@ public JpegPixelArea(Buffer2D pixels) /// The block X index /// The block Y index /// The subarea offseted by block indices - public JpegPixelArea GetOffsetedSubAreaForBlock(int bx, int by) + public OldJpegPixelArea GetOffsetedSubAreaForBlock(int bx, int by) { int offset = this.Offset + (8 * ((by * this.Stride) + bx)); - return new JpegPixelArea(this.Pixels, this.Stride, offset); + return new OldJpegPixelArea(this.Pixels, this.Stride, offset); } /// diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegScanDecoder.ComputationData.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegScanDecoder.ComputationData.cs index 025f0d7b69..5250979a4e 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegScanDecoder.ComputationData.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegScanDecoder.ComputationData.cs @@ -32,12 +32,12 @@ public struct ComputationData /// /// The buffer storing the -s for each component /// - public fixed byte ScanData[3 * JpegDecoderCore.MaxComponents]; + public fixed byte ScanData[3 * OldJpegDecoderCore.MaxComponents]; /// /// The DC values for each component /// - public fixed int Dc[JpegDecoderCore.MaxComponents]; + public fixed int Dc[OldJpegDecoderCore.MaxComponents]; /// /// Creates and initializes a new instance diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegScanDecoder.cs index e6ea890e76..7932c2585f 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegScanDecoder.cs @@ -96,12 +96,12 @@ internal unsafe partial struct OldJpegScanDecoder private int eobRun; /// - /// Initializes a default-constructed instance for reading data from -s stream. + /// Initializes a default-constructed instance for reading data from -s stream. /// /// Pointer to on the stack - /// The instance + /// The instance /// The remaining bytes in the segment block. - public static void InitStreamReading(OldJpegScanDecoder* p, JpegDecoderCore decoder, int remaining) + public static void InitStreamReading(OldJpegScanDecoder* p, OldJpegDecoderCore decoder, int remaining) { p->data = ComputationData.Create(); p->pointers = new DataPointers(&p->data); @@ -109,8 +109,8 @@ public static void InitStreamReading(OldJpegScanDecoder* p, JpegDecoderCore deco } /// - /// Read Huffman data from Jpeg scans in , - /// and decode it as into . + /// Read Huffman data from Jpeg scans in , + /// and decode it as into . /// /// The blocks are traversed one MCU at a time. For 4:2:0 chroma /// subsampling, there are four Y 8x8 blocks in every 16x16 MCU. @@ -135,8 +135,8 @@ public static void InitStreamReading(OldJpegScanDecoder* p, JpegDecoderCore deco /// 0 1 2 /// 3 4 5 /// - /// The instance - public void DecodeBlocks(JpegDecoderCore decoder) + /// The instance + public void DecodeBlocks(OldJpegDecoderCore decoder) { int blockCount = 0; int mcu = 0; @@ -197,7 +197,7 @@ public void DecodeBlocks(JpegDecoderCore decoder) // but this one assumes well-formed input, and hence the restart marker follows immediately. if (!decoder.InputProcessor.UnexpectedEndOfStreamReached) { - DecoderErrorCode errorCode = decoder.InputProcessor.ReadFullUnsafe(decoder.Temp, 0, 2); + OldDecoderErrorCode errorCode = decoder.InputProcessor.ReadFullUnsafe(decoder.Temp, 0, 2); if (decoder.InputProcessor.CheckEOFEnsureNoError(errorCode)) { if (decoder.Temp[0] != 0xff || decoder.Temp[1] != expectedRst) @@ -230,15 +230,15 @@ public void DecodeBlocks(JpegDecoderCore decoder) private void ResetDc() { - Unsafe.InitBlock(this.pointers.Dc, default(byte), sizeof(int) * JpegDecoderCore.MaxComponents); + Unsafe.InitBlock(this.pointers.Dc, default(byte), sizeof(int) * OldJpegDecoderCore.MaxComponents); } /// /// The implementation part of as an instance method. /// - /// The + /// The /// The remaining bytes - private void InitStreamReadingImpl(JpegDecoderCore decoder, int remaining) + private void InitStreamReadingImpl(OldJpegDecoderCore decoder, int remaining) { if (decoder.ComponentCount == 0) { @@ -305,10 +305,10 @@ private void InitStreamReadingImpl(JpegDecoderCore decoder, int remaining) /// /// The decoder /// The index of the scan - private void DecodeBlock(JpegDecoderCore decoder, int scanIndex) + private void DecodeBlock(OldJpegDecoderCore decoder, int scanIndex) { Block8x8F* b = this.pointers.Block; - int huffmannIdx = (HuffmanTree.AcTableIndex * HuffmanTree.ThRowSize) + this.pointers.ComponentScan[scanIndex].AcTableSelector; + int huffmannIdx = (OldHuffmanTree.AcTableIndex * OldHuffmanTree.ThRowSize) + this.pointers.ComponentScan[scanIndex].AcTableSelector; if (this.ah != 0) { this.Refine(ref decoder.InputProcessor, ref decoder.HuffmanTrees[huffmannIdx], 1 << this.al); @@ -316,14 +316,14 @@ private void DecodeBlock(JpegDecoderCore decoder, int scanIndex) else { int zig = this.zigStart; - DecoderErrorCode errorCode; + OldDecoderErrorCode errorCode; if (zig == 0) { zig++; // Decode the DC coefficient, as specified in section F.2.2.1. int value; - int huffmanIndex = (HuffmanTree.DcTableIndex * HuffmanTree.ThRowSize) + this.pointers.ComponentScan[scanIndex].DcTableSelector; + int huffmanIndex = (OldHuffmanTree.DcTableIndex * OldHuffmanTree.ThRowSize) + this.pointers.ComponentScan[scanIndex].DcTableSelector; errorCode = decoder.InputProcessor.DecodeHuffmanUnsafe( ref decoder.HuffmanTrees[huffmanIndex], out value); @@ -411,30 +411,30 @@ private void DecodeBlock(JpegDecoderCore decoder, int scanIndex) } } - private DecoderErrorCode DecodeEobRun(int count, ref InputProcessor decoder) + private OldDecoderErrorCode DecodeEobRun(int count, ref InputProcessor decoder) { int bitsResult; - DecoderErrorCode errorCode = decoder.DecodeBitsUnsafe(count, out bitsResult); - if (errorCode != DecoderErrorCode.NoError) + OldDecoderErrorCode errorCode = decoder.DecodeBitsUnsafe(count, out bitsResult); + if (errorCode != OldDecoderErrorCode.NoError) { return errorCode; } this.eobRun |= bitsResult; - return DecoderErrorCode.NoError; + return OldDecoderErrorCode.NoError; } /// - /// Gets the block index used to retieve blocks from in + /// Gets the block index used to retieve blocks from in /// - /// The instance + /// The instance /// The index - private int GetBlockIndex(JpegDecoderCore decoder) + private int GetBlockIndex(OldJpegDecoderCore decoder) { return ((this.by * decoder.MCUCountX) * this.hi) + this.bx; } - private void InitComponentScan(JpegDecoderCore decoder, int i, ref OldComponentScan currentComponentScan, ref int totalHv) + private void InitComponentScan(OldJpegDecoderCore decoder, int i, ref OldComponentScan currentComponentScan, ref int totalHv) { // Component selector. int cs = decoder.Temp[1 + (2 * i)]; @@ -459,7 +459,7 @@ private void InitComponentScan(JpegDecoderCore decoder, int i, ref OldComponentS } private void ProcessComponentImpl( - JpegDecoderCore decoder, + OldJpegDecoderCore decoder, int i, ref OldComponentScan currentComponentScan, ref int totalHv, @@ -481,13 +481,13 @@ private void ProcessComponentImpl( totalHv += currentComponent.HorizontalFactor * currentComponent.VerticalFactor; currentComponentScan.DcTableSelector = (byte)(decoder.Temp[2 + (2 * i)] >> 4); - if (currentComponentScan.DcTableSelector > HuffmanTree.MaxTh) + if (currentComponentScan.DcTableSelector > OldHuffmanTree.MaxTh) { throw new ImageFormatException("Bad DC table selector value"); } currentComponentScan.AcTableSelector = (byte)(decoder.Temp[2 + (2 * i)] & 0x0f); - if (currentComponentScan.AcTableSelector > HuffmanTree.MaxTh) + if (currentComponentScan.AcTableSelector > OldHuffmanTree.MaxTh) { throw new ImageFormatException("Bad AC table selector value"); } @@ -499,7 +499,7 @@ private void ProcessComponentImpl( /// The instance /// The Huffman tree /// The low transform offset - private void Refine(ref InputProcessor bp, ref HuffmanTree h, int delta) + private void Refine(ref InputProcessor bp, ref OldHuffmanTree h, int delta) { Block8x8F* b = this.pointers.Block; @@ -512,7 +512,7 @@ private void Refine(ref InputProcessor bp, ref HuffmanTree h, int delta) } bool bit; - DecoderErrorCode errorCode = bp.DecodeBitUnsafe(out bit); + OldDecoderErrorCode errorCode = bp.DecodeBitUnsafe(out bit); if (!bp.CheckEOFEnsureNoError(errorCode)) { return; @@ -542,7 +542,7 @@ private void Refine(ref InputProcessor bp, ref HuffmanTree h, int delta) int z = 0; int val; - DecoderErrorCode errorCode = bp.DecodeHuffmanUnsafe(ref h, out val); + OldDecoderErrorCode errorCode = bp.DecodeHuffmanUnsafe(ref h, out val); if (!bp.CheckEOF(errorCode)) { return; @@ -651,7 +651,7 @@ private int RefineNonZeroes(ref InputProcessor bp, int zig, int nz, int delta) } bool bit; - DecoderErrorCode errorCode = bp.DecodeBitUnsafe(out bit); + OldDecoderErrorCode errorCode = bp.DecodeBitUnsafe(out bit); if (!bp.CheckEOFEnsureNoError(errorCode)) { return int.MinValue; diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/YCbCrImage.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/YCbCrImage.cs index 745ff6781a..c4ec8a9f96 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/YCbCrImage.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/YCbCrImage.cs @@ -18,17 +18,17 @@ internal class YCbCrImage : IDisposable // Complex value type field + mutable + available to other classes = the field MUST NOT be private :P #pragma warning disable SA1401 // FieldsMustBePrivate /// - /// Gets the luminance components channel as . + /// Gets the luminance components channel as . /// public Buffer2D YChannel; /// - /// Gets the blue chroma components channel as . + /// Gets the blue chroma components channel as . /// public Buffer2D CbChannel; /// - /// Gets an offseted to the Cr channel + /// Gets an offseted to the Cr channel /// public Buffer2D CrChannel; #pragma warning restore SA1401 diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/OldJpegDecoderCore.cs similarity index 97% rename from src/ImageSharp/Formats/Jpeg/GolangPort/JpegDecoderCore.cs rename to src/ImageSharp/Formats/Jpeg/GolangPort/OldJpegDecoderCore.cs index 0bd7a16607..d6b7ecbc97 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/OldJpegDecoderCore.cs @@ -19,7 +19,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort /// /// Performs the jpeg decoding operation. /// - internal sealed unsafe class JpegDecoderCore : IDisposable + internal sealed unsafe class OldJpegDecoderCore : IDisposable { /// /// The maximum number of color components @@ -35,7 +35,7 @@ internal sealed unsafe class JpegDecoderCore : IDisposable #pragma warning disable SA1401 // FieldsMustBePrivate /// - /// Encapsulates stream reading and processing data and operations for . + /// Encapsulates stream reading and processing data and operations for . /// It's a value type for imporved data locality, and reduced number of CALLVIRT-s /// public InputProcessor InputProcessor; @@ -64,12 +64,12 @@ internal sealed unsafe class JpegDecoderCore : IDisposable /// /// The black image to decode to. /// - private JpegPixelArea blackImage; + private OldJpegPixelArea blackImage; /// /// A grayscale image to decode to. /// - private JpegPixelArea grayImage; + private OldJpegPixelArea grayImage; /// /// The horizontal resolution. Calculated if the image has a JFIF header. @@ -97,15 +97,15 @@ internal sealed unsafe class JpegDecoderCore : IDisposable private YCbCrImage ycbcrImage; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The configuration. /// The options. - public JpegDecoderCore(Configuration configuration, IJpegDecoderOptions options) + public OldJpegDecoderCore(Configuration configuration, IJpegDecoderOptions options) { this.IgnoreMetadata = options.IgnoreMetadata; this.configuration = configuration ?? Configuration.Default; - this.HuffmanTrees = HuffmanTree.CreateHuffmanTrees(); + this.HuffmanTrees = OldHuffmanTree.CreateHuffmanTrees(); this.QuantizationTables = new Block8x8F[MaxTq + 1]; this.Temp = new byte[2 * Block8x8F.ScalarCount]; this.ComponentArray = new OldComponent[MaxComponents]; @@ -120,7 +120,7 @@ public JpegDecoderCore(Configuration configuration, IJpegDecoderOptions options) /// /// Gets the huffman trees /// - public HuffmanTree[] HuffmanTrees { get; } + public OldHuffmanTree[] HuffmanTrees { get; } /// /// Gets the array of -s storing the "raw" frequency-domain decoded blocks. @@ -231,11 +231,11 @@ public void Dispose() } /// - /// Gets the representing the channel at a given component index + /// Gets the representing the channel at a given component index /// /// The component index - /// The of the channel - public JpegPixelArea GetDestinationChannel(int compIndex) + /// The of the channel + public OldJpegPixelArea GetDestinationChannel(int compIndex) { if (this.ComponentCount == 1) { @@ -246,11 +246,11 @@ public JpegPixelArea GetDestinationChannel(int compIndex) switch (compIndex) { case 0: - return new JpegPixelArea(this.ycbcrImage.YChannel); + return new OldJpegPixelArea(this.ycbcrImage.YChannel); case 1: - return new JpegPixelArea(this.ycbcrImage.CbChannel); + return new OldJpegPixelArea(this.ycbcrImage.CbChannel); case 2: - return new JpegPixelArea(this.ycbcrImage.CrChannel); + return new OldJpegPixelArea(this.ycbcrImage.CrChannel); case 3: return this.blackImage; default: @@ -460,9 +460,9 @@ private void ProcessStartOfScan(int remaining) } /// - /// Process the blocks in into Jpeg image channels ( and ) + /// Process the blocks in into Jpeg image channels ( and ) /// are in a "raw" frequency-domain form. We need to apply IDCT, dequantization and unzigging to transform them into color-space blocks. - /// We can copy these blocks into -s afterwards. + /// We can copy these blocks into -s afterwards. /// /// The pixel type private void ProcessBlocksIntoJpegImageChannels() @@ -480,7 +480,7 @@ private void ProcessBlocksIntoJpegImageChannels() } /// - /// Convert the pixel data in and/or into pixels of + /// Convert the pixel data in and/or into pixels of /// /// The pixel type /// The metadata for the image. @@ -788,7 +788,7 @@ private void MakeImage() if (this.ComponentCount == 1) { Buffer2D buffer = Buffer2D.CreateClean(8 * this.MCUCountX, 8 * this.MCUCountY); - this.grayImage = new JpegPixelArea(buffer); + this.grayImage = new OldJpegPixelArea(buffer); } else { @@ -828,7 +828,7 @@ private void MakeImage() int v3 = this.ComponentArray[3].VerticalFactor; Buffer2D buffer = Buffer2D.CreateClean(8 * h3 * this.MCUCountX, 8 * v3 * this.MCUCountY); - this.blackImage = new JpegPixelArea(buffer); + this.blackImage = new OldJpegPixelArea(buffer); } } } @@ -1062,18 +1062,18 @@ private void ProcessDefineHuffmanTablesMarker(int remaining) this.InputProcessor.ReadFull(this.Temp, 0, 17); int tc = this.Temp[0] >> 4; - if (tc > HuffmanTree.MaxTc) + if (tc > OldHuffmanTree.MaxTc) { throw new ImageFormatException("Bad Tc value"); } int th = this.Temp[0] & 0x0f; - if (th > HuffmanTree.MaxTh || (!this.IsProgressive && (th > 1))) + if (th > OldHuffmanTree.MaxTh || (!this.IsProgressive && (th > 1))) { throw new ImageFormatException("Bad Th value"); } - int huffTreeIndex = (tc * HuffmanTree.ThRowSize) + th; + int huffTreeIndex = (tc * OldHuffmanTree.ThRowSize) + th; this.HuffmanTrees[huffTreeIndex].ProcessDefineHuffmanTablesMarkerLoop( ref this.InputProcessor, this.Temp, diff --git a/tests/ImageSharp.Benchmarks/Image/DecodeJpegMultiple.cs b/tests/ImageSharp.Benchmarks/Image/DecodeJpegMultiple.cs index 90816ec13f..840f5d83f5 100644 --- a/tests/ImageSharp.Benchmarks/Image/DecodeJpegMultiple.cs +++ b/tests/ImageSharp.Benchmarks/Image/DecodeJpegMultiple.cs @@ -65,7 +65,7 @@ public Image Decode(Configuration configuration, Stream stream) { Guard.NotNull(stream, "stream"); - using (var decoder = new JpegDecoderCore(configuration, this)) + using (var decoder = new OldJpegDecoderCore(configuration, this)) { return decoder.Decode(stream); } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs index 672c83895d..836f97e585 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs @@ -174,7 +174,7 @@ public void DecodeGenerated_MetadataOnly( image.Save(ms, new JpegEncoder()); ms.Seek(0, SeekOrigin.Begin); - using (var decoder = new JpegDecoderCore(null, new JpegDecoder())) + using (var decoder = new OldJpegDecoderCore(null, new JpegDecoder())) { decoder.Decode(ms); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/YCbCrImageTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/YCbCrImageTests.cs index 690b65ff9d..e8716d4aa2 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/YCbCrImageTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/YCbCrImageTests.cs @@ -64,7 +64,7 @@ internal void Create(YCbCrImage.YCbCrSubsampleRatio ratioValue, int expectedCStr Assert.Equal(img.CrChannel.Width, 400 / expectedCStrideDiv); } - private void PrintChannel(string name, JpegPixelArea channel) + private void PrintChannel(string name, OldJpegPixelArea channel) { this.Output.WriteLine($"{name}: Stride={channel.Stride}"); }