Browse Source

renaming is hard

af/merge-core
Anton Firszov 9 years ago
parent
commit
4f97c8302a
  1. 36
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bits.cs
  2. 54
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs
  3. 28
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/DecoderThrowHelper.cs
  4. 78
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs
  5. 16
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/JpegBlockProcessor.cs
  6. 2
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldDecoderErrorCode.cs
  7. 10
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldHuffmanTree.cs
  8. 14
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegPixelArea.cs
  9. 4
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegScanDecoder.ComputationData.cs
  10. 60
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegScanDecoder.cs
  11. 6
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/YCbCrImage.cs
  12. 44
      src/ImageSharp/Formats/Jpeg/GolangPort/OldJpegDecoderCore.cs
  13. 2
      tests/ImageSharp.Benchmarks/Image/DecodeJpegMultiple.cs
  14. 2
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
  15. 2
      tests/ImageSharp.Tests/Formats/Jpg/YCbCrImageTests.cs

36
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bits.cs

@ -40,7 +40,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void EnsureNBits(int n, ref InputProcessor inputProcessor) public void EnsureNBits(int n, ref InputProcessor inputProcessor)
{ {
DecoderErrorCode errorCode = this.EnsureNBitsUnsafe(n, ref inputProcessor); OldDecoderErrorCode errorCode = this.EnsureNBitsUnsafe(n, ref inputProcessor);
errorCode.EnsureNoError(); errorCode.EnsureNoError();
} }
@ -48,17 +48,17 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// Reads bytes from the byte buffer to ensure that bits.UnreadBits is at /// Reads bytes from the byte buffer to ensure that bits.UnreadBits is at
/// least n. For best performance (avoiding function calls inside hot loops), /// least n. For best performance (avoiding function calls inside hot loops),
/// the caller is the one responsible for first checking that bits.UnreadBits < n. /// the caller is the one responsible for first checking that bits.UnreadBits < n.
/// This method does not throw. Returns <see cref="DecoderErrorCode"/> instead. /// This method does not throw. Returns <see cref="OldDecoderErrorCode"/> instead.
/// </summary> /// </summary>
/// <param name="n">The number of bits to ensure.</param> /// <param name="n">The number of bits to ensure.</param>
/// <param name="inputProcessor">The <see cref="InputProcessor"/></param> /// <param name="inputProcessor">The <see cref="InputProcessor"/></param>
/// <returns>Error code</returns> /// <returns>Error code</returns>
public DecoderErrorCode EnsureNBitsUnsafe(int n, ref InputProcessor inputProcessor) public OldDecoderErrorCode EnsureNBitsUnsafe(int n, ref InputProcessor inputProcessor)
{ {
while (true) while (true)
{ {
DecoderErrorCode errorCode = this.EnsureBitsStepImpl(ref inputProcessor); OldDecoderErrorCode errorCode = this.EnsureBitsStepImpl(ref inputProcessor);
if (errorCode != DecoderErrorCode.NoError || this.UnreadBits >= n) if (errorCode != OldDecoderErrorCode.NoError || this.UnreadBits >= n)
{ {
return errorCode; return errorCode;
} }
@ -69,8 +69,8 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// Unrolled version of <see cref="EnsureNBitsUnsafe"/> for n==8 /// Unrolled version of <see cref="EnsureNBitsUnsafe"/> for n==8
/// </summary> /// </summary>
/// <param name="inputProcessor">The <see cref="InputProcessor"/></param> /// <param name="inputProcessor">The <see cref="InputProcessor"/></param>
/// <returns>A <see cref="DecoderErrorCode"/></returns> /// <returns>A <see cref="OldDecoderErrorCode"/></returns>
public DecoderErrorCode Ensure8BitsUnsafe(ref InputProcessor inputProcessor) public OldDecoderErrorCode Ensure8BitsUnsafe(ref InputProcessor inputProcessor)
{ {
return this.EnsureBitsStepImpl(ref inputProcessor); return this.EnsureBitsStepImpl(ref inputProcessor);
} }
@ -79,8 +79,8 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// Unrolled version of <see cref="EnsureNBitsUnsafe"/> for n==1 /// Unrolled version of <see cref="EnsureNBitsUnsafe"/> for n==1
/// </summary> /// </summary>
/// <param name="inputProcessor">The <see cref="InputProcessor"/></param> /// <param name="inputProcessor">The <see cref="InputProcessor"/></param>
/// <returns>A <see cref="DecoderErrorCode"/></returns> /// <returns>A <see cref="OldDecoderErrorCode"/></returns>
public DecoderErrorCode Ensure1BitUnsafe(ref InputProcessor inputProcessor) public OldDecoderErrorCode Ensure1BitUnsafe(ref InputProcessor inputProcessor)
{ {
return this.EnsureBitsStepImpl(ref inputProcessor); return this.EnsureBitsStepImpl(ref inputProcessor);
} }
@ -95,7 +95,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
public int ReceiveExtend(int t, ref InputProcessor inputProcessor) public int ReceiveExtend(int t, ref InputProcessor inputProcessor)
{ {
int x; int x;
DecoderErrorCode errorCode = this.ReceiveExtendUnsafe(t, ref inputProcessor, out x); OldDecoderErrorCode errorCode = this.ReceiveExtendUnsafe(t, ref inputProcessor, out x);
errorCode.EnsureNoError(); errorCode.EnsureNoError();
return x; return x;
} }
@ -106,13 +106,13 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// <param name="t">Byte</param> /// <param name="t">Byte</param>
/// <param name="inputProcessor">The <see cref="InputProcessor"/></param> /// <param name="inputProcessor">The <see cref="InputProcessor"/></param>
/// <param name="x">Read bits value</param> /// <param name="x">Read bits value</param>
/// <returns>The <see cref="DecoderErrorCode"/></returns> /// <returns>The <see cref="OldDecoderErrorCode"/></returns>
public DecoderErrorCode ReceiveExtendUnsafe(int t, ref InputProcessor inputProcessor, out int x) public OldDecoderErrorCode ReceiveExtendUnsafe(int t, ref InputProcessor inputProcessor, out int x)
{ {
if (this.UnreadBits < t) if (this.UnreadBits < t)
{ {
DecoderErrorCode errorCode = this.EnsureNBitsUnsafe(t, ref inputProcessor); OldDecoderErrorCode errorCode = this.EnsureNBitsUnsafe(t, ref inputProcessor);
if (errorCode != DecoderErrorCode.NoError) if (errorCode != OldDecoderErrorCode.NoError)
{ {
x = int.MaxValue; x = int.MaxValue;
return errorCode; return errorCode;
@ -129,15 +129,15 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
x += ((-1) << t) + 1; x += ((-1) << t) + 1;
} }
return DecoderErrorCode.NoError; return OldDecoderErrorCode.NoError;
} }
private DecoderErrorCode EnsureBitsStepImpl(ref InputProcessor inputProcessor) private OldDecoderErrorCode EnsureBitsStepImpl(ref InputProcessor inputProcessor)
{ {
int c; 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; return errorCode;
} }

54
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs

@ -86,8 +86,8 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// </summary> /// </summary>
/// <param name="inputStream">Input stream</param> /// <param name="inputStream">Input stream</param>
/// <param name="x">The result byte as <see cref="int"/></param> /// <param name="x">The result byte as <see cref="int"/></param>
/// <returns>The <see cref="DecoderErrorCode"/></returns> /// <returns>The <see cref="OldDecoderErrorCode"/></returns>
public DecoderErrorCode ReadByteStuffedByteUnsafe(Stream inputStream, out int x) public OldDecoderErrorCode ReadByteStuffedByteUnsafe(Stream inputStream, out int x)
{ {
// Take the fast path if bytes.buf contains at least two bytes. // Take the fast path if bytes.buf contains at least two bytes.
if (this.I + 2 <= this.J) if (this.I + 2 <= this.J)
@ -97,48 +97,48 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
this.UnreadableBytes = 1; this.UnreadableBytes = 1;
if (x != OldJpegConstants.Markers.XFFInt) if (x != OldJpegConstants.Markers.XFFInt)
{ {
return DecoderErrorCode.NoError; return OldDecoderErrorCode.NoError;
} }
if (this.BufferAsInt[this.I] != 0x00) if (this.BufferAsInt[this.I] != 0x00)
{ {
return DecoderErrorCode.MissingFF00; return OldDecoderErrorCode.MissingFF00;
} }
this.I++; this.I++;
this.UnreadableBytes = 2; this.UnreadableBytes = 2;
x = OldJpegConstants.Markers.XFF; x = OldJpegConstants.Markers.XFF;
return DecoderErrorCode.NoError; return OldDecoderErrorCode.NoError;
} }
this.UnreadableBytes = 0; this.UnreadableBytes = 0;
DecoderErrorCode errorCode = this.ReadByteAsIntUnsafe(inputStream, out x); OldDecoderErrorCode errorCode = this.ReadByteAsIntUnsafe(inputStream, out x);
this.UnreadableBytes = 1; this.UnreadableBytes = 1;
if (errorCode != DecoderErrorCode.NoError) if (errorCode != OldDecoderErrorCode.NoError)
{ {
return errorCode; return errorCode;
} }
if (x != OldJpegConstants.Markers.XFF) if (x != OldJpegConstants.Markers.XFF)
{ {
return DecoderErrorCode.NoError; return OldDecoderErrorCode.NoError;
} }
errorCode = this.ReadByteAsIntUnsafe(inputStream, out x); errorCode = this.ReadByteAsIntUnsafe(inputStream, out x);
this.UnreadableBytes = 2; this.UnreadableBytes = 2;
if (errorCode != DecoderErrorCode.NoError) if (errorCode != OldDecoderErrorCode.NoError)
{ {
return errorCode; return errorCode;
} }
if (x != 0x00) if (x != 0x00)
{ {
return DecoderErrorCode.MissingFF00; return OldDecoderErrorCode.MissingFF00;
} }
x = OldJpegConstants.Markers.XFF; x = OldJpegConstants.Markers.XFF;
return DecoderErrorCode.NoError; return OldDecoderErrorCode.NoError;
} }
/// <summary> /// <summary>
@ -150,25 +150,25 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
public byte ReadByte(Stream inputStream) public byte ReadByte(Stream inputStream)
{ {
byte result; byte result;
DecoderErrorCode errorCode = this.ReadByteUnsafe(inputStream, out result); OldDecoderErrorCode errorCode = this.ReadByteUnsafe(inputStream, out result);
errorCode.EnsureNoError(); errorCode.EnsureNoError();
return result; return result;
} }
/// <summary> /// <summary>
/// Extracts the next byte, whether buffered or not buffered into the result out parameter. It does not care about byte stuffing. /// 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 <see cref="DecoderErrorCode"/> instead. /// This method does not throw on format error, it returns a <see cref="OldDecoderErrorCode"/> instead.
/// </summary> /// </summary>
/// <param name="inputStream">Input stream</param> /// <param name="inputStream">Input stream</param>
/// <param name="result">The result <see cref="byte"/> as out parameter</param> /// <param name="result">The result <see cref="byte"/> as out parameter</param>
/// <returns>The <see cref="DecoderErrorCode"/></returns> /// <returns>The <see cref="OldDecoderErrorCode"/></returns>
public DecoderErrorCode ReadByteUnsafe(Stream inputStream, out byte result) public OldDecoderErrorCode ReadByteUnsafe(Stream inputStream, out byte result)
{ {
DecoderErrorCode errorCode = DecoderErrorCode.NoError; OldDecoderErrorCode errorCode = OldDecoderErrorCode.NoError;
while (this.I == this.J) while (this.I == this.J)
{ {
errorCode = this.FillUnsafe(inputStream); errorCode = this.FillUnsafe(inputStream);
if (errorCode != DecoderErrorCode.NoError) if (errorCode != OldDecoderErrorCode.NoError)
{ {
result = 0; result = 0;
return errorCode; return errorCode;
@ -186,15 +186,15 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// </summary> /// </summary>
/// <param name="inputStream">The input stream</param> /// <param name="inputStream">The input stream</param>
/// <param name="result">The result <see cref="int"/></param> /// <param name="result">The result <see cref="int"/></param>
/// <returns>A <see cref="DecoderErrorCode"/></returns> /// <returns>A <see cref="OldDecoderErrorCode"/></returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [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) while (this.I == this.J)
{ {
errorCode = this.FillUnsafe(inputStream); errorCode = this.FillUnsafe(inputStream);
if (errorCode != DecoderErrorCode.NoError) if (errorCode != OldDecoderErrorCode.NoError)
{ {
result = 0; result = 0;
return errorCode; return errorCode;
@ -216,18 +216,18 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Fill(Stream inputStream) public void Fill(Stream inputStream)
{ {
DecoderErrorCode errorCode = this.FillUnsafe(inputStream); OldDecoderErrorCode errorCode = this.FillUnsafe(inputStream);
errorCode.EnsureNoError(); errorCode.EnsureNoError();
} }
/// <summary> /// <summary>
/// Fills up the bytes buffer from the underlying stream. /// Fills up the bytes buffer from the underlying stream.
/// It should only be called when there are no unread bytes in bytes. /// It should only be called when there are no unread bytes in bytes.
/// This method does not throw <see cref="EOFException"/>, returns a <see cref="DecoderErrorCode"/> instead! /// This method does not throw <see cref="EOFException"/>, returns a <see cref="OldDecoderErrorCode"/> instead!
/// </summary> /// </summary>
/// <param name="inputStream">Input stream</param> /// <param name="inputStream">Input stream</param>
/// <returns>The <see cref="DecoderErrorCode"/></returns> /// <returns>The <see cref="OldDecoderErrorCode"/></returns>
public DecoderErrorCode FillUnsafe(Stream inputStream) public OldDecoderErrorCode FillUnsafe(Stream inputStream)
{ {
if (this.I != this.J) if (this.I != this.J)
{ {
@ -249,7 +249,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
int n = inputStream.Read(this.Buffer, this.J, this.Buffer.Length - this.J); int n = inputStream.Read(this.Buffer, this.J, this.Buffer.Length - this.J);
if (n == 0) if (n == 0)
{ {
return DecoderErrorCode.UnexpectedEndOfStream; return OldDecoderErrorCode.UnexpectedEndOfStream;
} }
this.J += n; this.J += n;
@ -259,7 +259,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
this.BufferAsInt[i] = this.Buffer[i]; this.BufferAsInt[i] = this.Buffer[i];
} }
return DecoderErrorCode.NoError; return OldDecoderErrorCode.NoError;
} }
} }
} }

28
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/DecoderThrowHelper.cs

@ -14,19 +14,19 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
internal static class DecoderThrowHelper internal static class DecoderThrowHelper
{ {
/// <summary> /// <summary>
/// Throws an exception that belongs to the given <see cref="DecoderErrorCode"/> /// Throws an exception that belongs to the given <see cref="OldDecoderErrorCode"/>
/// </summary> /// </summary>
/// <param name="errorCode">The <see cref="DecoderErrorCode"/></param> /// <param name="errorCode">The <see cref="OldDecoderErrorCode"/></param>
[MethodImpl(MethodImplOptions.NoInlining)] [MethodImpl(MethodImplOptions.NoInlining)]
public static void ThrowExceptionForErrorCode(this DecoderErrorCode errorCode) public static void ThrowExceptionForErrorCode(this OldDecoderErrorCode errorCode)
{ {
switch (errorCode) switch (errorCode)
{ {
case DecoderErrorCode.NoError: case OldDecoderErrorCode.NoError:
throw new ArgumentException("ThrowExceptionForErrorCode() called with NoError!", nameof(errorCode)); throw new ArgumentException("ThrowExceptionForErrorCode() called with NoError!", nameof(errorCode));
case DecoderErrorCode.MissingFF00: case OldDecoderErrorCode.MissingFF00:
throw new MissingFF00Exception(); throw new MissingFF00Exception();
case DecoderErrorCode.UnexpectedEndOfStream: case OldDecoderErrorCode.UnexpectedEndOfStream:
throw new EOFException(); throw new EOFException();
default: default:
throw new ArgumentOutOfRangeException(nameof(errorCode), errorCode, null); throw new ArgumentOutOfRangeException(nameof(errorCode), errorCode, null);
@ -34,26 +34,26 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
} }
/// <summary> /// <summary>
/// Throws an exception if the given <see cref="DecoderErrorCode"/> defines an error. /// Throws an exception if the given <see cref="OldDecoderErrorCode"/> defines an error.
/// </summary> /// </summary>
/// <param name="errorCode">The <see cref="DecoderErrorCode"/></param> /// <param name="errorCode">The <see cref="OldDecoderErrorCode"/></param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [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); ThrowExceptionForErrorCode(errorCode);
} }
} }
/// <summary> /// <summary>
/// Throws an exception if the given <see cref="DecoderErrorCode"/> is <see cref="DecoderErrorCode.UnexpectedEndOfStream"/>. /// Throws an exception if the given <see cref="OldDecoderErrorCode"/> is <see cref="OldDecoderErrorCode.UnexpectedEndOfStream"/>.
/// </summary> /// </summary>
/// <param name="errorCode">The <see cref="DecoderErrorCode"/></param> /// <param name="errorCode">The <see cref="OldDecoderErrorCode"/></param>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [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(); errorCode.ThrowExceptionForErrorCode();
} }

78
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs

@ -10,7 +10,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
/// <summary> /// <summary>
/// Encapsulates stream reading and processing data and operations for <see cref="JpegDecoderCore"/>. /// Encapsulates stream reading and processing data and operations for <see cref="OldJpegDecoderCore"/>.
/// It's a value type for imporved data locality, and reduced number of CALLVIRT-s /// It's a value type for imporved data locality, and reduced number of CALLVIRT-s
/// </summary> /// </summary>
internal struct InputProcessor : IDisposable internal struct InputProcessor : IDisposable
@ -29,7 +29,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// Initializes a new instance of the <see cref="InputProcessor"/> struct. /// Initializes a new instance of the <see cref="InputProcessor"/> struct.
/// </summary> /// </summary>
/// <param name="inputStream">The input <see cref="Stream"/></param> /// <param name="inputStream">The input <see cref="Stream"/></param>
/// <param name="temp">Temporal buffer, same as <see cref="JpegDecoderCore.Temp"/></param> /// <param name="temp">Temporal buffer, same as <see cref="OldJpegDecoderCore.Temp"/></param>
public InputProcessor(Stream inputStream, byte[] temp) public InputProcessor(Stream inputStream, byte[] temp)
{ {
this.Bits = default(Bits); this.Bits = default(Bits);
@ -45,7 +45,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
public Stream InputStream { get; } public Stream InputStream { get; }
/// <summary> /// <summary>
/// Gets the temporal buffer, same instance as <see cref="JpegDecoderCore.Temp"/> /// Gets the temporal buffer, same instance as <see cref="OldJpegDecoderCore.Temp"/>
/// </summary> /// </summary>
public byte[] Temp { get; } public byte[] Temp { get; }
@ -58,11 +58,11 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// If errorCode indicates unexpected EOF, sets <see cref="UnexpectedEndOfStreamReached"/> to true and returns false. /// If errorCode indicates unexpected EOF, sets <see cref="UnexpectedEndOfStreamReached"/> to true and returns false.
/// Calls <see cref="DecoderThrowHelper.EnsureNoError"/> and returns true otherwise. /// Calls <see cref="DecoderThrowHelper.EnsureNoError"/> and returns true otherwise.
/// </summary> /// </summary>
/// <param name="errorCode">The <see cref="DecoderErrorCode"/></param> /// <param name="errorCode">The <see cref="OldDecoderErrorCode"/></param>
/// <returns><see cref="bool"/> indicating whether everything is OK</returns> /// <returns><see cref="bool"/> indicating whether everything is OK</returns>
public bool CheckEOFEnsureNoError(DecoderErrorCode errorCode) public bool CheckEOFEnsureNoError(OldDecoderErrorCode errorCode)
{ {
if (errorCode == DecoderErrorCode.UnexpectedEndOfStream) if (errorCode == OldDecoderErrorCode.UnexpectedEndOfStream)
{ {
this.UnexpectedEndOfStreamReached = true; this.UnexpectedEndOfStreamReached = true;
return false; return false;
@ -76,11 +76,11 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// If errorCode indicates unexpected EOF, sets <see cref="UnexpectedEndOfStreamReached"/> to true and returns false. /// If errorCode indicates unexpected EOF, sets <see cref="UnexpectedEndOfStreamReached"/> to true and returns false.
/// Returns true otherwise. /// Returns true otherwise.
/// </summary> /// </summary>
/// <param name="errorCode">The <see cref="DecoderErrorCode"/></param> /// <param name="errorCode">The <see cref="OldDecoderErrorCode"/></param>
/// <returns><see cref="bool"/> indicating whether everything is OK</returns> /// <returns><see cref="bool"/> indicating whether everything is OK</returns>
public bool CheckEOF(DecoderErrorCode errorCode) public bool CheckEOF(OldDecoderErrorCode errorCode)
{ {
if (errorCode == DecoderErrorCode.UnexpectedEndOfStream) if (errorCode == OldDecoderErrorCode.UnexpectedEndOfStream)
{ {
this.UnexpectedEndOfStreamReached = true; this.UnexpectedEndOfStreamReached = true;
return false; return false;
@ -112,13 +112,13 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// TODO: This method (and also the usages) could be optimized by batching! /// TODO: This method (and also the usages) could be optimized by batching!
/// </summary> /// </summary>
/// <param name="result">The decoded bit as a <see cref="bool"/></param> /// <param name="result">The decoded bit as a <see cref="bool"/></param>
/// <returns>The <see cref="DecoderErrorCode" /></returns> /// <returns>The <see cref="OldDecoderErrorCode" /></returns>
public DecoderErrorCode DecodeBitUnsafe(out bool result) public OldDecoderErrorCode DecodeBitUnsafe(out bool result)
{ {
if (this.Bits.UnreadBits == 0) if (this.Bits.UnreadBits == 0)
{ {
DecoderErrorCode errorCode = this.Bits.Ensure1BitUnsafe(ref this); OldDecoderErrorCode errorCode = this.Bits.Ensure1BitUnsafe(ref this);
if (errorCode != DecoderErrorCode.NoError) if (errorCode != OldDecoderErrorCode.NoError)
{ {
result = false; result = false;
return errorCode; return errorCode;
@ -128,18 +128,18 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
result = (this.Bits.Accumulator & this.Bits.Mask) != 0; result = (this.Bits.Accumulator & this.Bits.Mask) != 0;
this.Bits.UnreadBits--; this.Bits.UnreadBits--;
this.Bits.Mask >>= 1; this.Bits.Mask >>= 1;
return DecoderErrorCode.NoError; return OldDecoderErrorCode.NoError;
} }
/// <summary> /// <summary>
/// Reads exactly length bytes into data. It does not care about byte stuffing. /// Reads exactly length bytes into data. It does not care about byte stuffing.
/// Does not throw on errors, returns <see cref="JpegDecoderCore"/> instead! /// Does not throw on errors, returns <see cref="OldJpegDecoderCore"/> instead!
/// </summary> /// </summary>
/// <param name="data">The data to write to.</param> /// <param name="data">The data to write to.</param>
/// <param name="offset">The offset in the source buffer</param> /// <param name="offset">The offset in the source buffer</param>
/// <param name="length">The number of bytes to read</param> /// <param name="length">The number of bytes to read</param>
/// <returns>The <see cref="DecoderErrorCode"/></returns> /// <returns>The <see cref="OldDecoderErrorCode"/></returns>
public DecoderErrorCode ReadFullUnsafe(byte[] data, int offset, int length) public OldDecoderErrorCode ReadFullUnsafe(byte[] data, int offset, int length)
{ {
// Unread the overshot bytes, if any. // Unread the overshot bytes, if any.
if (this.Bytes.UnreadableBytes != 0) if (this.Bytes.UnreadableBytes != 0)
@ -152,7 +152,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
this.Bytes.UnreadableBytes = 0; this.Bytes.UnreadableBytes = 0;
} }
DecoderErrorCode errorCode = DecoderErrorCode.NoError; OldDecoderErrorCode errorCode = OldDecoderErrorCode.NoError;
while (length > 0) while (length > 0)
{ {
if (this.Bytes.J - this.Bytes.I >= length) if (this.Bytes.J - this.Bytes.I >= length)
@ -180,8 +180,8 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// </summary> /// </summary>
/// <param name="count">The number of bits to decode.</param> /// <param name="count">The number of bits to decode.</param>
/// <param name="result">The <see cref="uint" /> result</param> /// <param name="result">The <see cref="uint" /> result</param>
/// <returns>The <see cref="DecoderErrorCode"/></returns> /// <returns>The <see cref="OldDecoderErrorCode"/></returns>
public DecoderErrorCode DecodeBitsUnsafe(int count, out int result) public OldDecoderErrorCode DecodeBitsUnsafe(int count, out int result)
{ {
if (this.Bits.UnreadBits < count) if (this.Bits.UnreadBits < count)
{ {
@ -192,7 +192,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
result = result & ((1 << count) - 1); result = result & ((1 << count) - 1);
this.Bits.UnreadBits -= count; this.Bits.UnreadBits -= count;
this.Bits.Mask >>= count; this.Bits.Mask >>= count;
return DecoderErrorCode.NoError; return OldDecoderErrorCode.NoError;
} }
/// <summary> /// <summary>
@ -200,8 +200,8 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// </summary> /// </summary>
/// <param name="huffmanTree">The huffman value</param> /// <param name="huffmanTree">The huffman value</param>
/// <param name="result">The decoded <see cref="byte" /></param> /// <param name="result">The decoded <see cref="byte" /></param>
/// <returns>The <see cref="DecoderErrorCode"/></returns> /// <returns>The <see cref="OldDecoderErrorCode"/></returns>
public DecoderErrorCode DecodeHuffmanUnsafe(ref HuffmanTree huffmanTree, out int result) public OldDecoderErrorCode DecodeHuffmanUnsafe(ref OldHuffmanTree huffmanTree, out int result)
{ {
result = 0; result = 0;
@ -212,11 +212,11 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
if (this.Bits.UnreadBits < 8) 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]; int v = huffmanTree.Lut[lutIndex];
if (v != 0) if (v != 0)
@ -236,7 +236,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
} }
int code = 0; int code = 0;
for (int i = 0; i < HuffmanTree.MaxCodeLength; i++) for (int i = 0; i < OldHuffmanTree.MaxCodeLength; i++)
{ {
if (this.Bits.UnreadBits == 0) if (this.Bits.UnreadBits == 0)
{ {
@ -254,7 +254,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
if (code <= huffmanTree.MaxCodes[i]) if (code <= huffmanTree.MaxCodes[i])
{ {
result = huffmanTree.GetValue(code, i); result = huffmanTree.GetValue(code, i);
return DecoderErrorCode.NoError; return OldDecoderErrorCode.NoError;
} }
code <<= 1; code <<= 1;
@ -264,7 +264,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
DecoderThrowHelper.ThrowImageFormatException.BadHuffmanCode(); DecoderThrowHelper.ThrowImageFormatException.BadHuffmanCode();
// DUMMY RETURN! C# doesn't know we have thrown an exception! // DUMMY RETURN! C# doesn't know we have thrown an exception!
return DecoderErrorCode.NoError; return OldDecoderErrorCode.NoError;
} }
/// <summary> /// <summary>
@ -274,17 +274,17 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Skip(int count) public void Skip(int count)
{ {
DecoderErrorCode errorCode = this.SkipUnsafe(count); OldDecoderErrorCode errorCode = this.SkipUnsafe(count);
errorCode.EnsureNoError(); errorCode.EnsureNoError();
} }
/// <summary> /// <summary>
/// Skips the next n bytes. /// Skips the next n bytes.
/// Does not throw, returns <see cref="DecoderErrorCode"/> instead! /// Does not throw, returns <see cref="OldDecoderErrorCode"/> instead!
/// </summary> /// </summary>
/// <param name="count">The number of bytes to ignore.</param> /// <param name="count">The number of bytes to ignore.</param>
/// <returns>The <see cref="DecoderErrorCode"/></returns> /// <returns>The <see cref="OldDecoderErrorCode"/></returns>
public DecoderErrorCode SkipUnsafe(int count) public OldDecoderErrorCode SkipUnsafe(int count)
{ {
// Unread the overshot bytes, if any. // Unread the overshot bytes, if any.
if (this.Bytes.UnreadableBytes != 0) if (this.Bytes.UnreadableBytes != 0)
@ -312,14 +312,14 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
break; break;
} }
DecoderErrorCode errorCode = this.Bytes.FillUnsafe(this.InputStream); OldDecoderErrorCode errorCode = this.Bytes.FillUnsafe(this.InputStream);
if (errorCode != DecoderErrorCode.NoError) if (errorCode != OldDecoderErrorCode.NoError)
{ {
return errorCode; return errorCode;
} }
} }
return DecoderErrorCode.NoError; return OldDecoderErrorCode.NoError;
} }
/// <summary> /// <summary>
@ -331,7 +331,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReadFull(byte[] data, int offset, int length) 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(); errorCode.EnsureNoError();
} }
@ -359,8 +359,8 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// </summary> /// </summary>
/// <param name="t">Byte</param> /// <param name="t">Byte</param>
/// <param name="x">Read bits value</param> /// <param name="x">Read bits value</param>
/// <returns>The <see cref="DecoderErrorCode"/></returns> /// <returns>The <see cref="OldDecoderErrorCode"/></returns>
public DecoderErrorCode ReceiveExtendUnsafe(int t, out int x) public OldDecoderErrorCode ReceiveExtendUnsafe(int t, out int x)
{ {
return this.Bits.ReceiveExtendUnsafe(t, ref this, out x); return this.Bits.ReceiveExtendUnsafe(t, ref this, out x);
} }

16
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/JpegBlockProcessor.cs

@ -44,10 +44,10 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
} }
/// <summary> /// <summary>
/// Dequantize, perform the inverse DCT and store the blocks to the into the corresponding <see cref="JpegPixelArea"/> instances. /// Dequantize, perform the inverse DCT and store the blocks to the into the corresponding <see cref="OldJpegPixelArea"/> instances.
/// </summary> /// </summary>
/// <param name="decoder">The <see cref="JpegDecoderCore"/> instance</param> /// <param name="decoder">The <see cref="OldJpegDecoderCore"/> instance</param>
public void ProcessAllBlocks(JpegDecoderCore decoder) public void ProcessAllBlocks(OldJpegDecoderCore decoder)
{ {
Buffer<DecodedBlock> blockArray = decoder.DecodedBlocks[this.componentIndex]; Buffer<DecodedBlock> blockArray = decoder.DecodedBlocks[this.componentIndex];
for (int i = 0; i < blockArray.Length; i++) for (int i = 0; i < blockArray.Length; i++)
@ -57,11 +57,11 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
} }
/// <summary> /// <summary>
/// Dequantize, perform the inverse DCT and store decodedBlock.Block to the into the corresponding <see cref="JpegPixelArea"/> instance. /// Dequantize, perform the inverse DCT and store decodedBlock.Block to the into the corresponding <see cref="OldJpegPixelArea"/> instance.
/// </summary> /// </summary>
/// <param name="decoder">The <see cref="JpegDecoderCore"/></param> /// <param name="decoder">The <see cref="OldJpegDecoderCore"/></param>
/// <param name="decodedBlock">The <see cref="DecodedBlock"/></param> /// <param name="decodedBlock">The <see cref="DecodedBlock"/></param>
private void ProcessBlockColors(JpegDecoderCore decoder, ref DecodedBlock decodedBlock) private void ProcessBlockColors(OldJpegDecoderCore decoder, ref DecodedBlock decodedBlock)
{ {
this.data.Block = decodedBlock.Block; this.data.Block = decodedBlock.Block;
int qtIndex = decoder.ComponentArray[this.componentIndex].Selector; int qtIndex = decoder.ComponentArray[this.componentIndex].Selector;
@ -73,8 +73,8 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
DCT.TransformIDCT(ref *b, ref *this.pointers.Temp1, ref *this.pointers.Temp2); DCT.TransformIDCT(ref *b, ref *this.pointers.Temp1, ref *this.pointers.Temp2);
JpegPixelArea destChannel = decoder.GetDestinationChannel(this.componentIndex); OldJpegPixelArea destChannel = decoder.GetDestinationChannel(this.componentIndex);
JpegPixelArea destArea = destChannel.GetOffsetedSubAreaForBlock(decodedBlock.Bx, decodedBlock.By); OldJpegPixelArea destArea = destChannel.GetOffsetedSubAreaForBlock(decodedBlock.Bx, decodedBlock.By);
destArea.LoadColorsFrom(this.pointers.Temp1, this.pointers.Temp2); destArea.LoadColorsFrom(this.pointers.Temp1, this.pointers.Temp2);
} }

2
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/DecoderErrorCode.cs → src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldDecoderErrorCode.cs

@ -8,7 +8,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// <summary> /// <summary>
/// Represents "recoverable" decoder errors. /// Represents "recoverable" decoder errors.
/// </summary> /// </summary>
internal enum DecoderErrorCode internal enum OldDecoderErrorCode
{ {
/// <summary> /// <summary>
/// NoError /// NoError

10
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/HuffmanTree.cs → src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldHuffmanTree.cs

@ -10,7 +10,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// <summary> /// <summary>
/// Represents a Huffman tree /// Represents a Huffman tree
/// </summary> /// </summary>
internal struct HuffmanTree : IDisposable internal struct OldHuffmanTree : IDisposable
{ {
/// <summary> /// <summary>
/// The index of the AC table row /// The index of the AC table row
@ -99,12 +99,12 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
private static readonly ArrayPool<int> CodesPool16 = ArrayPool<int>.Create(MaxCodeLength, 50); private static readonly ArrayPool<int> CodesPool16 = ArrayPool<int>.Create(MaxCodeLength, 50);
/// <summary> /// <summary>
/// Creates and initializes an array of <see cref="HuffmanTree" /> instances of size <see cref="NumberOfTrees" /> /// Creates and initializes an array of <see cref="OldHuffmanTree" /> instances of size <see cref="NumberOfTrees" />
/// </summary> /// </summary>
/// <returns>An array of <see cref="HuffmanTree" /> instances representing the Huffman tables</returns> /// <returns>An array of <see cref="OldHuffmanTree" /> instances representing the Huffman tables</returns>
public static HuffmanTree[] CreateHuffmanTrees() public static OldHuffmanTree[] CreateHuffmanTrees()
{ {
HuffmanTree[] result = new HuffmanTree[NumberOfTrees]; OldHuffmanTree[] result = new OldHuffmanTree[NumberOfTrees];
for (int i = 0; i < MaxTc + 1; i++) for (int i = 0; i < MaxTc + 1; i++)
{ {
for (int j = 0; j < MaxTh + 1; j++) for (int j = 0; j < MaxTh + 1; j++)

14
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/JpegPixelArea.cs → src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegPixelArea.cs

@ -14,15 +14,15 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// <summary> /// <summary>
/// Represents an area of a Jpeg subimage (channel) /// Represents an area of a Jpeg subimage (channel)
/// </summary> /// </summary>
internal struct JpegPixelArea internal struct OldJpegPixelArea
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="JpegPixelArea" /> struct from existing data. /// Initializes a new instance of the <see cref="OldJpegPixelArea" /> struct from existing data.
/// </summary> /// </summary>
/// <param name="pixels">The pixel buffer</param> /// <param name="pixels">The pixel buffer</param>
/// <param name="stride">The stride</param> /// <param name="stride">The stride</param>
/// <param name="offset">The offset</param> /// <param name="offset">The offset</param>
public JpegPixelArea(Buffer2D<byte> pixels, int stride, int offset) public OldJpegPixelArea(Buffer2D<byte> pixels, int stride, int offset)
{ {
this.Stride = stride; this.Stride = stride;
this.Pixels = pixels; this.Pixels = pixels;
@ -30,11 +30,11 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="JpegPixelArea" /> struct from existing buffer. /// Initializes a new instance of the <see cref="OldJpegPixelArea" /> struct from existing buffer.
/// <see cref="Stride"/> will be set to <see cref="Buffer2D{T}.Width"/> of <paramref name="pixels"/> and <see cref="Offset"/> will be set to 0. /// <see cref="Stride"/> will be set to <see cref="Buffer2D{T}.Width"/> of <paramref name="pixels"/> and <see cref="Offset"/> will be set to 0.
/// </summary> /// </summary>
/// <param name="pixels">The pixel buffer</param> /// <param name="pixels">The pixel buffer</param>
public JpegPixelArea(Buffer2D<byte> pixels) public OldJpegPixelArea(Buffer2D<byte> pixels)
: this(pixels, pixels.Width, 0) : this(pixels, pixels.Width, 0)
{ {
} }
@ -85,10 +85,10 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// <param name="bx">The block X index</param> /// <param name="bx">The block X index</param>
/// <param name="by">The block Y index</param> /// <param name="by">The block Y index</param>
/// <returns>The subarea offseted by block indices</returns> /// <returns>The subarea offseted by block indices</returns>
public JpegPixelArea GetOffsetedSubAreaForBlock(int bx, int by) public OldJpegPixelArea GetOffsetedSubAreaForBlock(int bx, int by)
{ {
int offset = this.Offset + (8 * ((by * this.Stride) + bx)); 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);
} }
/// <summary> /// <summary>

4
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegScanDecoder.ComputationData.cs

@ -32,12 +32,12 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// <summary> /// <summary>
/// The buffer storing the <see cref="OldComponentScan"/>-s for each component /// The buffer storing the <see cref="OldComponentScan"/>-s for each component
/// </summary> /// </summary>
public fixed byte ScanData[3 * JpegDecoderCore.MaxComponents]; public fixed byte ScanData[3 * OldJpegDecoderCore.MaxComponents];
/// <summary> /// <summary>
/// The DC values for each component /// The DC values for each component
/// </summary> /// </summary>
public fixed int Dc[JpegDecoderCore.MaxComponents]; public fixed int Dc[OldJpegDecoderCore.MaxComponents];
/// <summary> /// <summary>
/// Creates and initializes a new <see cref="ComputationData"/> instance /// Creates and initializes a new <see cref="ComputationData"/> instance

60
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OldJpegScanDecoder.cs

@ -96,12 +96,12 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
private int eobRun; private int eobRun;
/// <summary> /// <summary>
/// Initializes a default-constructed <see cref="OldJpegScanDecoder"/> instance for reading data from <see cref="JpegDecoderCore"/>-s stream. /// Initializes a default-constructed <see cref="OldJpegScanDecoder"/> instance for reading data from <see cref="OldJpegDecoderCore"/>-s stream.
/// </summary> /// </summary>
/// <param name="p">Pointer to <see cref="OldJpegScanDecoder"/> on the stack</param> /// <param name="p">Pointer to <see cref="OldJpegScanDecoder"/> on the stack</param>
/// <param name="decoder">The <see cref="JpegDecoderCore"/> instance</param> /// <param name="decoder">The <see cref="OldJpegDecoderCore"/> instance</param>
/// <param name="remaining">The remaining bytes in the segment block.</param> /// <param name="remaining">The remaining bytes in the segment block.</param>
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->data = ComputationData.Create();
p->pointers = new DataPointers(&p->data); p->pointers = new DataPointers(&p->data);
@ -109,8 +109,8 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
} }
/// <summary> /// <summary>
/// Read Huffman data from Jpeg scans in <see cref="JpegDecoderCore.InputStream"/>, /// Read Huffman data from Jpeg scans in <see cref="OldJpegDecoderCore.InputStream"/>,
/// and decode it as <see cref="Block8x8F"/> into <see cref="JpegDecoderCore.DecodedBlocks"/>. /// and decode it as <see cref="Block8x8F"/> into <see cref="OldJpegDecoderCore.DecodedBlocks"/>.
/// ///
/// The blocks are traversed one MCU at a time. For 4:2:0 chroma /// 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. /// subsampling, there are four Y 8x8 blocks in every 16x16 MCU.
@ -135,8 +135,8 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// 0 1 2 /// 0 1 2
/// 3 4 5 /// 3 4 5
/// </summary> /// </summary>
/// <param name="decoder">The <see cref="JpegDecoderCore"/> instance</param> /// <param name="decoder">The <see cref="OldJpegDecoderCore"/> instance</param>
public void DecodeBlocks(JpegDecoderCore decoder) public void DecodeBlocks(OldJpegDecoderCore decoder)
{ {
int blockCount = 0; int blockCount = 0;
int mcu = 0; int mcu = 0;
@ -197,7 +197,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
// but this one assumes well-formed input, and hence the restart marker follows immediately. // but this one assumes well-formed input, and hence the restart marker follows immediately.
if (!decoder.InputProcessor.UnexpectedEndOfStreamReached) 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.InputProcessor.CheckEOFEnsureNoError(errorCode))
{ {
if (decoder.Temp[0] != 0xff || decoder.Temp[1] != expectedRst) if (decoder.Temp[0] != 0xff || decoder.Temp[1] != expectedRst)
@ -230,15 +230,15 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
private void ResetDc() 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);
} }
/// <summary> /// <summary>
/// The implementation part of <see cref="InitStreamReading"/> as an instance method. /// The implementation part of <see cref="InitStreamReading"/> as an instance method.
/// </summary> /// </summary>
/// <param name="decoder">The <see cref="JpegDecoderCore"/></param> /// <param name="decoder">The <see cref="OldJpegDecoderCore"/></param>
/// <param name="remaining">The remaining bytes</param> /// <param name="remaining">The remaining bytes</param>
private void InitStreamReadingImpl(JpegDecoderCore decoder, int remaining) private void InitStreamReadingImpl(OldJpegDecoderCore decoder, int remaining)
{ {
if (decoder.ComponentCount == 0) if (decoder.ComponentCount == 0)
{ {
@ -305,10 +305,10 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// </summary> /// </summary>
/// <param name="decoder">The decoder</param> /// <param name="decoder">The decoder</param>
/// <param name="scanIndex">The index of the scan</param> /// <param name="scanIndex">The index of the scan</param>
private void DecodeBlock(JpegDecoderCore decoder, int scanIndex) private void DecodeBlock(OldJpegDecoderCore decoder, int scanIndex)
{ {
Block8x8F* b = this.pointers.Block; 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) if (this.ah != 0)
{ {
this.Refine(ref decoder.InputProcessor, ref decoder.HuffmanTrees[huffmannIdx], 1 << this.al); this.Refine(ref decoder.InputProcessor, ref decoder.HuffmanTrees[huffmannIdx], 1 << this.al);
@ -316,14 +316,14 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
else else
{ {
int zig = this.zigStart; int zig = this.zigStart;
DecoderErrorCode errorCode; OldDecoderErrorCode errorCode;
if (zig == 0) if (zig == 0)
{ {
zig++; zig++;
// Decode the DC coefficient, as specified in section F.2.2.1. // Decode the DC coefficient, as specified in section F.2.2.1.
int value; 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( errorCode = decoder.InputProcessor.DecodeHuffmanUnsafe(
ref decoder.HuffmanTrees[huffmanIndex], ref decoder.HuffmanTrees[huffmanIndex],
out value); out value);
@ -411,30 +411,30 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
} }
} }
private DecoderErrorCode DecodeEobRun(int count, ref InputProcessor decoder) private OldDecoderErrorCode DecodeEobRun(int count, ref InputProcessor decoder)
{ {
int bitsResult; int bitsResult;
DecoderErrorCode errorCode = decoder.DecodeBitsUnsafe(count, out bitsResult); OldDecoderErrorCode errorCode = decoder.DecodeBitsUnsafe(count, out bitsResult);
if (errorCode != DecoderErrorCode.NoError) if (errorCode != OldDecoderErrorCode.NoError)
{ {
return errorCode; return errorCode;
} }
this.eobRun |= bitsResult; this.eobRun |= bitsResult;
return DecoderErrorCode.NoError; return OldDecoderErrorCode.NoError;
} }
/// <summary> /// <summary>
/// Gets the block index used to retieve blocks from in <see cref="JpegDecoderCore.DecodedBlocks"/> /// Gets the block index used to retieve blocks from in <see cref="OldJpegDecoderCore.DecodedBlocks"/>
/// </summary> /// </summary>
/// <param name="decoder">The <see cref="JpegDecoderCore"/> instance</param> /// <param name="decoder">The <see cref="OldJpegDecoderCore"/> instance</param>
/// <returns>The index</returns> /// <returns>The index</returns>
private int GetBlockIndex(JpegDecoderCore decoder) private int GetBlockIndex(OldJpegDecoderCore decoder)
{ {
return ((this.by * decoder.MCUCountX) * this.hi) + this.bx; 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. // Component selector.
int cs = decoder.Temp[1 + (2 * i)]; int cs = decoder.Temp[1 + (2 * i)];
@ -459,7 +459,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
} }
private void ProcessComponentImpl( private void ProcessComponentImpl(
JpegDecoderCore decoder, OldJpegDecoderCore decoder,
int i, int i,
ref OldComponentScan currentComponentScan, ref OldComponentScan currentComponentScan,
ref int totalHv, ref int totalHv,
@ -481,13 +481,13 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
totalHv += currentComponent.HorizontalFactor * currentComponent.VerticalFactor; totalHv += currentComponent.HorizontalFactor * currentComponent.VerticalFactor;
currentComponentScan.DcTableSelector = (byte)(decoder.Temp[2 + (2 * i)] >> 4); 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"); throw new ImageFormatException("Bad DC table selector value");
} }
currentComponentScan.AcTableSelector = (byte)(decoder.Temp[2 + (2 * i)] & 0x0f); 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"); throw new ImageFormatException("Bad AC table selector value");
} }
@ -499,7 +499,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// <param name="bp">The <see cref="InputProcessor"/> instance</param> /// <param name="bp">The <see cref="InputProcessor"/> instance</param>
/// <param name="h">The Huffman tree</param> /// <param name="h">The Huffman tree</param>
/// <param name="delta">The low transform offset</param> /// <param name="delta">The low transform offset</param>
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; Block8x8F* b = this.pointers.Block;
@ -512,7 +512,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
} }
bool bit; bool bit;
DecoderErrorCode errorCode = bp.DecodeBitUnsafe(out bit); OldDecoderErrorCode errorCode = bp.DecodeBitUnsafe(out bit);
if (!bp.CheckEOFEnsureNoError(errorCode)) if (!bp.CheckEOFEnsureNoError(errorCode))
{ {
return; return;
@ -542,7 +542,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
int z = 0; int z = 0;
int val; int val;
DecoderErrorCode errorCode = bp.DecodeHuffmanUnsafe(ref h, out val); OldDecoderErrorCode errorCode = bp.DecodeHuffmanUnsafe(ref h, out val);
if (!bp.CheckEOF(errorCode)) if (!bp.CheckEOF(errorCode))
{ {
return; return;
@ -651,7 +651,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
} }
bool bit; bool bit;
DecoderErrorCode errorCode = bp.DecodeBitUnsafe(out bit); OldDecoderErrorCode errorCode = bp.DecodeBitUnsafe(out bit);
if (!bp.CheckEOFEnsureNoError(errorCode)) if (!bp.CheckEOFEnsureNoError(errorCode))
{ {
return int.MinValue; return int.MinValue;

6
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/YCbCrImage.cs

@ -18,17 +18,17 @@ namespace ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
// Complex value type field + mutable + available to other classes = the field MUST NOT be private :P // Complex value type field + mutable + available to other classes = the field MUST NOT be private :P
#pragma warning disable SA1401 // FieldsMustBePrivate #pragma warning disable SA1401 // FieldsMustBePrivate
/// <summary> /// <summary>
/// Gets the luminance components channel as <see cref="JpegPixelArea" />. /// Gets the luminance components channel as <see cref="OldJpegPixelArea" />.
/// </summary> /// </summary>
public Buffer2D<byte> YChannel; public Buffer2D<byte> YChannel;
/// <summary> /// <summary>
/// Gets the blue chroma components channel as <see cref="JpegPixelArea" />. /// Gets the blue chroma components channel as <see cref="OldJpegPixelArea" />.
/// </summary> /// </summary>
public Buffer2D<byte> CbChannel; public Buffer2D<byte> CbChannel;
/// <summary> /// <summary>
/// Gets an offseted <see cref="JpegPixelArea" /> to the Cr channel /// Gets an offseted <see cref="OldJpegPixelArea" /> to the Cr channel
/// </summary> /// </summary>
public Buffer2D<byte> CrChannel; public Buffer2D<byte> CrChannel;
#pragma warning restore SA1401 #pragma warning restore SA1401

44
src/ImageSharp/Formats/Jpeg/GolangPort/JpegDecoderCore.cs → src/ImageSharp/Formats/Jpeg/GolangPort/OldJpegDecoderCore.cs

@ -19,7 +19,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort
/// <summary> /// <summary>
/// Performs the jpeg decoding operation. /// Performs the jpeg decoding operation.
/// </summary> /// </summary>
internal sealed unsafe class JpegDecoderCore : IDisposable internal sealed unsafe class OldJpegDecoderCore : IDisposable
{ {
/// <summary> /// <summary>
/// The maximum number of color components /// The maximum number of color components
@ -35,7 +35,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort
#pragma warning disable SA1401 // FieldsMustBePrivate #pragma warning disable SA1401 // FieldsMustBePrivate
/// <summary> /// <summary>
/// Encapsulates stream reading and processing data and operations for <see cref="JpegDecoderCore"/>. /// Encapsulates stream reading and processing data and operations for <see cref="OldJpegDecoderCore"/>.
/// It's a value type for imporved data locality, and reduced number of CALLVIRT-s /// It's a value type for imporved data locality, and reduced number of CALLVIRT-s
/// </summary> /// </summary>
public InputProcessor InputProcessor; public InputProcessor InputProcessor;
@ -64,12 +64,12 @@ namespace ImageSharp.Formats.Jpeg.GolangPort
/// <summary> /// <summary>
/// The black image to decode to. /// The black image to decode to.
/// </summary> /// </summary>
private JpegPixelArea blackImage; private OldJpegPixelArea blackImage;
/// <summary> /// <summary>
/// A grayscale image to decode to. /// A grayscale image to decode to.
/// </summary> /// </summary>
private JpegPixelArea grayImage; private OldJpegPixelArea grayImage;
/// <summary> /// <summary>
/// The horizontal resolution. Calculated if the image has a JFIF header. /// The horizontal resolution. Calculated if the image has a JFIF header.
@ -97,15 +97,15 @@ namespace ImageSharp.Formats.Jpeg.GolangPort
private YCbCrImage ycbcrImage; private YCbCrImage ycbcrImage;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="JpegDecoderCore" /> class. /// Initializes a new instance of the <see cref="OldJpegDecoderCore" /> class.
/// </summary> /// </summary>
/// <param name="configuration">The configuration.</param> /// <param name="configuration">The configuration.</param>
/// <param name="options">The options.</param> /// <param name="options">The options.</param>
public JpegDecoderCore(Configuration configuration, IJpegDecoderOptions options) public OldJpegDecoderCore(Configuration configuration, IJpegDecoderOptions options)
{ {
this.IgnoreMetadata = options.IgnoreMetadata; this.IgnoreMetadata = options.IgnoreMetadata;
this.configuration = configuration ?? Configuration.Default; this.configuration = configuration ?? Configuration.Default;
this.HuffmanTrees = HuffmanTree.CreateHuffmanTrees(); this.HuffmanTrees = OldHuffmanTree.CreateHuffmanTrees();
this.QuantizationTables = new Block8x8F[MaxTq + 1]; this.QuantizationTables = new Block8x8F[MaxTq + 1];
this.Temp = new byte[2 * Block8x8F.ScalarCount]; this.Temp = new byte[2 * Block8x8F.ScalarCount];
this.ComponentArray = new OldComponent[MaxComponents]; this.ComponentArray = new OldComponent[MaxComponents];
@ -120,7 +120,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort
/// <summary> /// <summary>
/// Gets the huffman trees /// Gets the huffman trees
/// </summary> /// </summary>
public HuffmanTree[] HuffmanTrees { get; } public OldHuffmanTree[] HuffmanTrees { get; }
/// <summary> /// <summary>
/// Gets the array of <see cref="Buffer{T}"/>-s storing the "raw" frequency-domain decoded blocks. /// Gets the array of <see cref="Buffer{T}"/>-s storing the "raw" frequency-domain decoded blocks.
@ -231,11 +231,11 @@ namespace ImageSharp.Formats.Jpeg.GolangPort
} }
/// <summary> /// <summary>
/// Gets the <see cref="JpegPixelArea"/> representing the channel at a given component index /// Gets the <see cref="OldJpegPixelArea"/> representing the channel at a given component index
/// </summary> /// </summary>
/// <param name="compIndex">The component index</param> /// <param name="compIndex">The component index</param>
/// <returns>The <see cref="JpegPixelArea"/> of the channel</returns> /// <returns>The <see cref="OldJpegPixelArea"/> of the channel</returns>
public JpegPixelArea GetDestinationChannel(int compIndex) public OldJpegPixelArea GetDestinationChannel(int compIndex)
{ {
if (this.ComponentCount == 1) if (this.ComponentCount == 1)
{ {
@ -246,11 +246,11 @@ namespace ImageSharp.Formats.Jpeg.GolangPort
switch (compIndex) switch (compIndex)
{ {
case 0: case 0:
return new JpegPixelArea(this.ycbcrImage.YChannel); return new OldJpegPixelArea(this.ycbcrImage.YChannel);
case 1: case 1:
return new JpegPixelArea(this.ycbcrImage.CbChannel); return new OldJpegPixelArea(this.ycbcrImage.CbChannel);
case 2: case 2:
return new JpegPixelArea(this.ycbcrImage.CrChannel); return new OldJpegPixelArea(this.ycbcrImage.CrChannel);
case 3: case 3:
return this.blackImage; return this.blackImage;
default: default:
@ -460,9 +460,9 @@ namespace ImageSharp.Formats.Jpeg.GolangPort
} }
/// <summary> /// <summary>
/// Process the blocks in <see cref="DecodedBlocks"/> into Jpeg image channels (<see cref="YCbCrImage"/> and <see cref="JpegPixelArea"/>) /// Process the blocks in <see cref="DecodedBlocks"/> into Jpeg image channels (<see cref="YCbCrImage"/> and <see cref="OldJpegPixelArea"/>)
/// <see cref="DecodedBlocks"/> are in a "raw" frequency-domain form. We need to apply IDCT, dequantization and unzigging to transform them into color-space blocks. /// <see cref="DecodedBlocks"/> 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 <see cref="JpegPixelArea"/>-s afterwards. /// We can copy these blocks into <see cref="OldJpegPixelArea"/>-s afterwards.
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel type</typeparam> /// <typeparam name="TPixel">The pixel type</typeparam>
private void ProcessBlocksIntoJpegImageChannels<TPixel>() private void ProcessBlocksIntoJpegImageChannels<TPixel>()
@ -480,7 +480,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort
} }
/// <summary> /// <summary>
/// Convert the pixel data in <see cref="YCbCrImage"/> and/or <see cref="JpegPixelArea"/> into pixels of <see cref="Image{TPixel}"/> /// Convert the pixel data in <see cref="YCbCrImage"/> and/or <see cref="OldJpegPixelArea"/> into pixels of <see cref="Image{TPixel}"/>
/// </summary> /// </summary>
/// <typeparam name="TPixel">The pixel type</typeparam> /// <typeparam name="TPixel">The pixel type</typeparam>
/// <param name="metadata">The metadata for the image.</param> /// <param name="metadata">The metadata for the image.</param>
@ -788,7 +788,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort
if (this.ComponentCount == 1) if (this.ComponentCount == 1)
{ {
Buffer2D<byte> buffer = Buffer2D<byte>.CreateClean(8 * this.MCUCountX, 8 * this.MCUCountY); Buffer2D<byte> buffer = Buffer2D<byte>.CreateClean(8 * this.MCUCountX, 8 * this.MCUCountY);
this.grayImage = new JpegPixelArea(buffer); this.grayImage = new OldJpegPixelArea(buffer);
} }
else else
{ {
@ -828,7 +828,7 @@ namespace ImageSharp.Formats.Jpeg.GolangPort
int v3 = this.ComponentArray[3].VerticalFactor; int v3 = this.ComponentArray[3].VerticalFactor;
Buffer2D<byte> buffer = Buffer2D<byte>.CreateClean(8 * h3 * this.MCUCountX, 8 * v3 * this.MCUCountY); Buffer2D<byte> buffer = Buffer2D<byte>.CreateClean(8 * h3 * this.MCUCountX, 8 * v3 * this.MCUCountY);
this.blackImage = new JpegPixelArea(buffer); this.blackImage = new OldJpegPixelArea(buffer);
} }
} }
} }
@ -1062,18 +1062,18 @@ namespace ImageSharp.Formats.Jpeg.GolangPort
this.InputProcessor.ReadFull(this.Temp, 0, 17); this.InputProcessor.ReadFull(this.Temp, 0, 17);
int tc = this.Temp[0] >> 4; int tc = this.Temp[0] >> 4;
if (tc > HuffmanTree.MaxTc) if (tc > OldHuffmanTree.MaxTc)
{ {
throw new ImageFormatException("Bad Tc value"); throw new ImageFormatException("Bad Tc value");
} }
int th = this.Temp[0] & 0x0f; 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"); throw new ImageFormatException("Bad Th value");
} }
int huffTreeIndex = (tc * HuffmanTree.ThRowSize) + th; int huffTreeIndex = (tc * OldHuffmanTree.ThRowSize) + th;
this.HuffmanTrees[huffTreeIndex].ProcessDefineHuffmanTablesMarkerLoop( this.HuffmanTrees[huffTreeIndex].ProcessDefineHuffmanTablesMarkerLoop(
ref this.InputProcessor, ref this.InputProcessor,
this.Temp, this.Temp,

2
tests/ImageSharp.Benchmarks/Image/DecodeJpegMultiple.cs

@ -65,7 +65,7 @@ namespace ImageSharp.Benchmarks.Image
{ {
Guard.NotNull(stream, "stream"); Guard.NotNull(stream, "stream");
using (var decoder = new JpegDecoderCore(configuration, this)) using (var decoder = new OldJpegDecoderCore(configuration, this))
{ {
return decoder.Decode<TPixel>(stream); return decoder.Decode<TPixel>(stream);
} }

2
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs

@ -174,7 +174,7 @@ namespace ImageSharp.Tests
image.Save(ms, new JpegEncoder()); image.Save(ms, new JpegEncoder());
ms.Seek(0, SeekOrigin.Begin); ms.Seek(0, SeekOrigin.Begin);
using (var decoder = new JpegDecoderCore(null, new JpegDecoder())) using (var decoder = new OldJpegDecoderCore(null, new JpegDecoder()))
{ {
decoder.Decode<TPixel>(ms); decoder.Decode<TPixel>(ms);

2
tests/ImageSharp.Tests/Formats/Jpg/YCbCrImageTests.cs

@ -64,7 +64,7 @@ namespace ImageSharp.Tests
Assert.Equal(img.CrChannel.Width, 400 / expectedCStrideDiv); 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}"); this.Output.WriteLine($"{name}: Stride={channel.Stride}");
} }

Loading…
Cancel
Save