diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigHuffmanTree.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigHuffmanTree.cs
index 4c97d57415..e96421a2d6 100644
--- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigHuffmanTree.cs
+++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigHuffmanTree.cs
@@ -9,7 +9,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
///
/// Represents a Huffman tree
///
- internal struct OrigHuffmanTree : IDisposable
+ internal struct OrigHuffmanTree
{
///
/// The index of the AC table row
@@ -91,12 +91,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
///
public int[] Indices;
- private static readonly ArrayPool IntPool256 = ArrayPool.Create(MaxNCodes, 50);
-
- private static readonly ArrayPool BytePool256 = ArrayPool.Create(MaxNCodes, 50);
-
- private static readonly ArrayPool CodesPool16 = ArrayPool.Create(MaxCodeLength, 50);
-
///
/// Creates and initializes an array of instances of size
///
@@ -115,18 +109,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
return result;
}
- ///
- /// Disposes the underlying buffers
- ///
- public void Dispose()
- {
- IntPool256.Return(this.Lut, true);
- IntPool256.Return(this.Values, true);
- CodesPool16.Return(this.MinCodes, true);
- CodesPool16.Return(this.MaxCodes, true);
- CodesPool16.Return(this.Indices, true);
- }
-
///
/// Internal part of the DHT processor, whatever does it mean
///
@@ -166,20 +148,12 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
throw new ImageFormatException("DHT has wrong length");
}
- byte[] values = null;
- try
- {
- values = BytePool256.Rent(MaxNCodes);
- inputProcessor.ReadFull(values, 0, this.Length);
+ byte[] values = new byte[MaxNCodes];
+ inputProcessor.ReadFull(values, 0, this.Length);
- for (int i = 0; i < values.Length; i++)
- {
- this.Values[i] = values[i];
- }
- }
- finally
+ for (int i = 0; i < values.Length; i++)
{
- BytePool256.Return(values, true);
+ this.Values[i] = values[i];
}
// Derive the look-up table.
@@ -254,11 +228,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
///
private void Init()
{
- this.Lut = IntPool256.Rent(MaxNCodes);
- this.Values = IntPool256.Rent(MaxNCodes);
- this.MinCodes = CodesPool16.Rent(MaxCodeLength);
- this.MaxCodes = CodesPool16.Rent(MaxCodeLength);
- this.Indices = CodesPool16.Rent(MaxCodeLength);
+ this.Lut = new int[MaxNCodes];
+ this.Values = new int[MaxNCodes];
+ this.MinCodes = new int[MaxCodeLength];
+ this.MaxCodes = new int[MaxCodeLength];
+ this.Indices = new int[MaxCodeLength];
}
}
}
\ No newline at end of file
diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs
index 053b016e64..0a0ddeba43 100644
--- a/src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs
+++ b/src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs
@@ -190,11 +190,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort
///
public void Dispose()
{
- for (int i = 0; i < this.HuffmanTrees.Length; i++)
- {
- this.HuffmanTrees[i].Dispose();
- }
-
if (this.Components != null)
{
foreach (OrigComponent component in this.Components)