Browse Source

better names and comments

af/merge-core
Anton Firszov 9 years ago
parent
commit
76a8afadfb
  1. 13
      src/ImageSharp.Formats.Jpeg/Components/Decoder/JpegScanDecoder.cs
  2. 8
      src/ImageSharp.Formats.Jpeg/JpegDecoderCore.cs

13
src/ImageSharp.Formats.Jpeg/Components/Decoder/JpegScanDecoder.cs

@ -10,6 +10,7 @@ namespace ImageSharp.Formats.Jpg
/// <summary>
/// Encapsulates the impementation of Jpeg SOS decoder. See JpegScanDecoder.md!
/// TODO: Split JpegScanDecoder: 1. JpegScanDecoder for Huffman-decoding (<see cref="DecodeBlocks"/>) 2. JpegBlockProcessor for processing (<see cref="ProcessBlockColors"/>)
/// <see cref="zigStart"/> and <see cref="zigEnd"/> are the spectral selection bounds.
/// <see cref="ah"/> and <see cref="al"/> 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
}
/// <summary>
/// Reads the blocks from the <see cref="JpegDecoderCore"/>-s stream, and processes them into the corresponding <see cref="JpegPixelArea"/> instances.
/// Read Huffman data from Jpeg scans in <see cref="JpegDecoderCore.InputStream"/>,
/// and decode it as <see cref="Block8x8F"/> into <see cref="JpegDecoderCore.DecodedBlocks"/>.
///
/// 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
/// </summary>
/// <param name="decoder">The <see cref="JpegDecoderCore"/> instance</param>
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 <see cref="JpegPixelArea"/> instances.
/// </summary>
/// <param name="decoder">The <see cref="JpegDecoderCore"/> instance</param>
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
/// </summary>
/// <param name="decoder">The decoder</param>
/// <param name="scanIndex">The index of the scan</param>
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;

8
src/ImageSharp.Formats.Jpeg/JpegDecoderCore.cs

@ -181,7 +181,7 @@ namespace ImageSharp.Formats
this.ProcessStream(image, stream, metadataOnly);
if (!metadataOnly)
{
this.DecodeBlocksIntoJpegImageChannels<TColor>();
this.ProcessBlockColorsIntoJpegImageChannels<TColor>();
this.ConvertJpegPixelsToImagePixels(image);
}
}
@ -636,7 +636,7 @@ namespace ImageSharp.Formats
/// Process the blocks in <see cref="DecodedBlocks"/> into Jpeg image channels (<see cref="YCbCrImage"/> and <see cref="JpegPixelArea"/>)
/// </summary>
/// <typeparam name="TColor">The pixel type</typeparam>
private void DecodeBlocksIntoJpegImageChannels<TColor>()
private void ProcessBlockColorsIntoJpegImageChannels<TColor>()
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
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);
}
/// <summary>

Loading…
Cancel
Save