From ce5882ab254e49c10be156899fafb636817e86d2 Mon Sep 17 00:00:00 2001 From: antonfirsov Date: Wed, 28 Dec 2016 20:23:18 +0100 Subject: [PATCH] Merge branch 'master' of https://github.com/JimBobSquarePants/ImageSharp into jpeg-optimizations-experimental Conflicts: tests/ImageSharp.Tests/Formats/Jpg/JpegTests.cs --- .../Jpg/Components/Decoder/HuffmanTree.cs | 46 +++++++++---------- .../Jpg/Components/Decoder/JpegScanDecoder.cs | 24 +++++----- .../Formats/Jpg/Components/Decoder/Scan.cs | 8 ++-- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/ImageSharp/Formats/Jpg/Components/Decoder/HuffmanTree.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/HuffmanTree.cs index bdf3468e68..44fce5cdc1 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Decoder/HuffmanTree.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/HuffmanTree.cs @@ -8,77 +8,77 @@ namespace ImageSharp.Formats.Jpg using System.Buffers; /// - /// Represents a Huffman tree + /// Represents a Huffman tree /// internal struct HuffmanTree : IDisposable { /// - /// The maximum (inclusive) number of codes in a Huffman tree. + /// The maximum (inclusive) number of codes in a Huffman tree. /// public const int MaxNCodes = 256; /// - /// The maximum (inclusive) number of bits in a Huffman code. + /// The maximum (inclusive) number of bits in a Huffman code. /// public const int MaxCodeLength = 16; /// - /// The maximum number of Huffman table classes + /// The maximum number of Huffman table classes /// public const int MaxTc = 1; /// - /// The maximum number of Huffman table identifiers + /// The maximum number of Huffman table identifiers /// public const int MaxTh = 3; /// - /// Row size of the Huffman table + /// Row size of the Huffman table /// public const int ThRowSize = MaxTh + 1; /// - /// Number of Hufman Trees in the Huffman table + /// Number of Hufman Trees in the Huffman table /// public const int NumberOfTrees = (MaxTc + 1) * (MaxTh + 1); /// - /// The log-2 size of the Huffman decoder's look-up table. + /// The log-2 size of the Huffman decoder's look-up table. /// public const int LutSize = 8; /// - /// Gets or sets the number of codes in the tree. + /// Gets or sets the number of codes in the tree. /// public int Length; /// - /// Gets the look-up table for the next LutSize bits in the bit-stream. - /// The high 8 bits of the uint16 are the encoded value. The low 8 bits - /// are 1 plus the code length, or 0 if the value is too large to fit in - /// lutSize bits. + /// Gets the look-up table for the next LutSize bits in the bit-stream. + /// The high 8 bits of the uint16 are the encoded value. The low 8 bits + /// are 1 plus the code length, or 0 if the value is too large to fit in + /// lutSize bits. /// public ushort[] Lut; /// - /// Gets the the decoded values, sorted by their encoding. + /// Gets the the decoded values, sorted by their encoding. /// public byte[] Values; /// - /// Gets the array of minimum codes. - /// MinCodes[i] is the minimum code of length i, or -1 if there are no codes of that length. + /// Gets the array of minimum codes. + /// MinCodes[i] is the minimum code of length i, or -1 if there are no codes of that length. /// public int[] MinCodes; /// - /// Gets the array of maximum codes. - /// MaxCodes[i] is the maximum code of length i, or -1 if there are no codes of that length. + /// Gets the array of maximum codes. + /// MaxCodes[i] is the maximum code of length i, or -1 if there are no codes of that length. /// public int[] MaxCodes; /// - /// Gets the array of indices. Indices[i] is the index into Values of MinCodes[i]. + /// Gets the array of indices. Indices[i] is the index into Values of MinCodes[i]. /// public int[] Indices; @@ -89,7 +89,7 @@ namespace ImageSharp.Formats.Jpg private static readonly ArrayPool IntBuffer = ArrayPool.Create(MaxCodeLength, 50); /// - /// Creates and initializes an array of instances of size + /// Creates and initializes an array of instances of size /// /// An array of instances representing the Huffman tables public static HuffmanTree[] CreateHuffmanTrees() @@ -107,7 +107,7 @@ namespace ImageSharp.Formats.Jpg } /// - /// Initializes the Huffman tree + /// Initializes the Huffman tree /// private void Init() { @@ -119,7 +119,7 @@ namespace ImageSharp.Formats.Jpg } /// - /// Disposes the underlying buffers + /// Disposes the underlying buffers /// public void Dispose() { @@ -131,7 +131,7 @@ namespace ImageSharp.Formats.Jpg } /// - /// Internal part of the DHT processor, whatever does it mean + /// Internal part of the DHT processor, whatever does it mean /// /// The decoder instance /// The temporal buffer that holds the data that has been read from the Jpeg stream diff --git a/src/ImageSharp/Formats/Jpg/Components/Decoder/JpegScanDecoder.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/JpegScanDecoder.cs index 162874f024..ea2ab92300 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Decoder/JpegScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/JpegScanDecoder.cs @@ -12,12 +12,12 @@ namespace ImageSharp.Formats.Jpg internal unsafe struct JpegScanDecoder { /// - /// The AC table index + /// The AC table index /// internal const int AcTableIndex = 1; /// - /// The DC table index + /// The DC table index /// internal const int DcTableIndex = 0; @@ -37,9 +37,9 @@ namespace ImageSharp.Formats.Jpg public UnzigData Unzig; - public fixed byte ScanData [3 * JpegDecoderCore.MaxComponents]; + public fixed byte ScanData[3 * JpegDecoderCore.MaxComponents]; - public fixed int Dc [JpegDecoderCore.MaxComponents]; + public fixed int Dc[JpegDecoderCore.MaxComponents]; public static ComponentData Create() { @@ -133,7 +133,7 @@ namespace ImageSharp.Formats.Jpg private ComponentData Data; private ComponentPointers Pointers; - + public static void Init(JpegScanDecoder* p, JpegDecoderCore decoder, int remaining) { p->Data = ComponentData.Create(); @@ -387,7 +387,7 @@ namespace ImageSharp.Formats.Jpg // Reset the DC components, as per section F.2.1.3.1. this.ResetDc(); - + // Reset the progressive decoder state, as per section G.1.2.2. decoder.EobRun = 0; } @@ -398,7 +398,7 @@ namespace ImageSharp.Formats.Jpg } /// - /// Decodes a successive approximation refinement block, as specified in section G.1.2. + /// Decodes a successive approximation refinement block, as specified in section G.1.2. /// /// The Huffman tree /// The low transform offset @@ -473,7 +473,7 @@ namespace ImageSharp.Formats.Jpg { break; } - + zig = this.RefineNonZeroes(decoder, zig, val0, delta); if (zig > this.zigEnd) { @@ -491,13 +491,13 @@ namespace ImageSharp.Formats.Jpg if (decoder.EobRun > 0) { decoder.EobRun--; - this.RefineNonZeroes(decoder, zig,-1, delta); + this.RefineNonZeroes(decoder, zig, -1, delta); } } /// - /// Refines non-zero entries of b in zig-zag order. - /// If >= 0, the first zero entries are skipped over. + /// Refines non-zero entries of b in zig-zag order. + /// If >= 0, the first zero entries are skipped over. /// /// The decoder /// The zig-zag start index @@ -649,5 +649,5 @@ namespace ImageSharp.Formats.Jpg destArea.LoadColorsFrom(this.Pointers.Temp1, this.Pointers.Temp2); } } - + } \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpg/Components/Decoder/Scan.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/Scan.cs index a2f439c5a2..a140d989ce 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Decoder/Scan.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/Scan.cs @@ -3,23 +3,23 @@ using System.Runtime.InteropServices; /// - /// Represents a component scan + /// Represents a component scan /// [StructLayout(LayoutKind.Sequential)] internal struct Scan { /// - /// Gets or sets the component index. + /// Gets or sets the component index. /// public byte Index; /// - /// Gets or sets the DC table selector + /// Gets or sets the DC table selector /// public byte DcTableSelector; /// - /// Gets or sets the AC table selector + /// Gets or sets the AC table selector /// public byte AcTableSelector; }