diff --git a/src/ImageSharp.Formats.Jpeg/Components/Decoder/JpegScanDecoder.cs b/src/ImageSharp.Formats.Jpeg/Components/Decoder/JpegScanDecoder.cs index 86c558af7b..6a3072f8e1 100644 --- a/src/ImageSharp.Formats.Jpeg/Components/Decoder/JpegScanDecoder.cs +++ b/src/ImageSharp.Formats.Jpeg/Components/Decoder/JpegScanDecoder.cs @@ -10,6 +10,7 @@ namespace ImageSharp.Formats.Jpg /// /// Encapsulates the impementation of Jpeg SOS decoder. See JpegScanDecoder.md! + /// TODO: Split JpegScanDecoder: 1. JpegScanDecoder for Huffman-decoding () 2. JpegBlockProcessor for processing () /// and are the spectral selection bounds. /// and are the successive approximation high and low values. /// The spec calls these values Ss, Se, Ah and Al. @@ -131,7 +132,9 @@ namespace ImageSharp.Formats.Jpg } /// - /// Reads the blocks from the -s stream, and processes them into the corresponding instances. + /// 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. /// For a baseline 32x16 pixel image, the Y blocks visiting order is: @@ -156,7 +159,7 @@ namespace ImageSharp.Formats.Jpg /// 3 4 5 /// /// The instance - public void ReadBlocks(JpegDecoderCore decoder) + public void DecodeBlocks(JpegDecoderCore decoder) { int blockCount = 0; int mcu = 0; @@ -191,7 +194,7 @@ namespace ImageSharp.Formats.Jpg } } - this.ReadBlock(decoder, scanIndex); + this.DecodeBlock(decoder, scanIndex); } // for j @@ -236,7 +239,7 @@ namespace ImageSharp.Formats.Jpg /// Dequantize, perform the inverse DCT and store the block to the into the corresponding instances. /// /// The instance - public void ProcessBlock(JpegDecoderCore decoder) + public void ProcessBlockColors(JpegDecoderCore decoder) { int qtIndex = decoder.ComponentArray[this.ComponentIndex].Selector; this.data.QuantiazationTable = decoder.QuantizationTables[qtIndex]; @@ -329,7 +332,7 @@ namespace ImageSharp.Formats.Jpg /// /// The decoder /// The index of the scan - private void ReadBlock(JpegDecoderCore decoder, int scanIndex) + private void DecodeBlock(JpegDecoderCore decoder, int scanIndex) { int blockIndex = this.GetBlockIndex(decoder); this.data.Block = decoder.DecodedBlocks[this.ComponentIndex][blockIndex].Block; diff --git a/src/ImageSharp.Formats.Jpeg/JpegDecoderCore.cs b/src/ImageSharp.Formats.Jpeg/JpegDecoderCore.cs index d4cb6ffaf1..e79711dd48 100644 --- a/src/ImageSharp.Formats.Jpeg/JpegDecoderCore.cs +++ b/src/ImageSharp.Formats.Jpeg/JpegDecoderCore.cs @@ -181,7 +181,7 @@ namespace ImageSharp.Formats this.ProcessStream(image, stream, metadataOnly); if (!metadataOnly) { - this.DecodeBlocksIntoJpegImageChannels(); + this.ProcessBlockColorsIntoJpegImageChannels(); this.ConvertJpegPixelsToImagePixels(image); } } @@ -636,7 +636,7 @@ namespace ImageSharp.Formats /// Process the blocks in into Jpeg image channels ( and ) /// /// The pixel type - private void DecodeBlocksIntoJpegImageChannels() + private void ProcessBlockColorsIntoJpegImageChannels() where TColor : struct, IPackedPixel, IEquatable { JpegScanDecoder scanDecoder = default(JpegScanDecoder); @@ -649,7 +649,7 @@ namespace ImageSharp.Formats for (int i = 0; i < blockArray.Length; i++) { scanDecoder.LoadMemento(ref blockArray[i]); - scanDecoder.ProcessBlock(this); + scanDecoder.ProcessBlockColors(this); } } } @@ -1499,7 +1499,7 @@ namespace ImageSharp.Formats JpegScanDecoder.InitStreamReading(&scan, this, remaining); this.Bits = default(Bits); this.MakeImage(); - scan.ReadBlocks(this); + scan.DecodeBlocks(this); } ///