From 70474c8fae925037899579bef0a37cfe0f42a9ac Mon Sep 17 00:00:00 2001 From: Dmitry Pentin Date: Thu, 27 May 2021 16:02:58 +0300 Subject: [PATCH] Removed redundant enum casting durint huffman encoding --- .../Jpeg/Components/Encoder/HuffmanScanEncoder.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs index 8f133f0deb..afd5acb4b5 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs @@ -257,10 +257,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder int dc = (int)refTemp2[0]; // Emit the DC delta. - this.EmitHuffRLE((HuffIndex)((2 * (int)index) + 0), 0, dc - prevDC); + this.EmitHuffRLE((2 * (int)index) + 0, 0, dc - prevDC); // Emit the AC components. - var h = (HuffIndex)((2 * (int)index) + 1); + int h = (2 * (int)index) + 1; int runLength = 0; for (int zig = 1; zig < Block8x8F.Size; zig++) @@ -348,9 +348,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder /// The index of the Huffman encoder /// The value to encode. [MethodImpl(InliningOptions.ShortMethod)] - private void EmitHuff(HuffIndex index, int value) + private void EmitHuff(int index, int value) { - uint x = HuffmanLut.TheHuffmanLut[(int)index].Values[value]; + uint x = HuffmanLut.TheHuffmanLut[index].Values[value]; this.Emit(x & ((1 << 24) - 1), x >> 24); } @@ -361,7 +361,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder /// The number of copies to encode. /// The value to encode. [MethodImpl(InliningOptions.ShortMethod)] - private void EmitHuffRLE(HuffIndex index, int runLength, int value) + private void EmitHuffRLE(int index, int runLength, int value) { int a = value; int b = value;