From 285f8dde83c937142a5a6584e9698e0dececea8e Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Wed, 9 May 2018 01:30:11 +1000 Subject: [PATCH 01/36] Begin porting stb_image --- .../Jpeg/PdfJsPort/Components/FastACTables.cs | 34 + .../Components/FixedInt16Buffer257.cs | 24 + .../Components/PdfJsFrameComponent.cs | 4 +- .../PdfJsPort/Components/PdfJsHuffmanTable.cs | 70 +- .../Components/PdfJsHuffmanTables.cs | 2 +- .../PdfJsPort/Components/PdfJsScanDecoder.cs | 17 +- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 628 ++++++++++++++++++ .../Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs | 59 +- 8 files changed, 798 insertions(+), 40 deletions(-) create mode 100644 src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs create mode 100644 src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer257.cs create mode 100644 src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs new file mode 100644 index 000000000..8d37c567e --- /dev/null +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs @@ -0,0 +1,34 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using System; +using SixLabors.ImageSharp.Memory; + +namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components +{ + /// + /// The collection of tables used for fast AC entropy scan decoding. + /// + internal sealed class FastACTables : IDisposable + { + /// + /// Initializes a new instance of the class. + /// + /// The memory manager used to allocate memory for image processing operations. + public FastACTables(MemoryManager memoryManager) + { + this.Tables = memoryManager.AllocateClean2D(512, 4); + } + + /// + /// Gets the collection of tables. + /// + public Buffer2D Tables { get; } + + /// + public void Dispose() + { + this.Tables?.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer257.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer257.cs new file mode 100644 index 000000000..b304dbf8c --- /dev/null +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer257.cs @@ -0,0 +1,24 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components +{ + [StructLayout(LayoutKind.Sequential)] + internal unsafe struct FixedInt16Buffer257 + { + public fixed short Data[257]; + + public short this[int idx] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ref short self = ref Unsafe.As(ref this); + return Unsafe.Add(ref self, idx); + } + } + } +} \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs index 7f50a8529..f063309ea 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs @@ -36,9 +36,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components public byte Id { get; } /// - /// Gets or sets Pred TODO: What does pred stand for? + /// Gets or sets DC coefficient predictor /// - public int Pred { get; set; } + public int DcPredictor { get; set; } /// /// Gets the horizontal sampling factor. diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs index 875a86263..0541de91b 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs @@ -27,13 +27,18 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// /// Gets the huffman value array /// - public FixedByteBuffer256 HuffVal; + public FixedByteBuffer256 Values; /// /// Gets the lookahead array /// public FixedInt16Buffer256 Lookahead; + /// + /// Gets the sizes array + /// + public FixedInt16Buffer257 Sizes; + /// /// Initializes a new instance of the struct. /// @@ -42,20 +47,18 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// The huffman values public PdfJsHuffmanTable(MemoryManager memoryManager, ReadOnlySpan lengths, ReadOnlySpan values) { - const int length = 257; - using (IBuffer huffsize = memoryManager.Allocate(length)) - using (IBuffer huffcode = memoryManager.Allocate(length)) + const int Length = 257; + using (IBuffer huffcode = memoryManager.Allocate(Length)) { - ref short huffsizeRef = ref MemoryMarshal.GetReference(huffsize.Span); ref short huffcodeRef = ref MemoryMarshal.GetReference(huffcode.Span); - GenerateSizeTable(lengths, ref huffsizeRef); - GenerateCodeTable(ref huffsizeRef, ref huffcodeRef, length); + this.GenerateSizeTable(lengths); + this.GenerateCodeTable(ref huffcodeRef, Length); this.GenerateDecoderTables(lengths, ref huffcodeRef); this.GenerateLookaheadTables(lengths, values, ref huffcodeRef); } - fixed (byte* huffValRef = this.HuffVal.Data) + fixed (byte* huffValRef = this.Values.Data) { var huffValSpan = new Span(huffValRef, 256); @@ -67,45 +70,49 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// Figure C.1: make table of Huffman code length for each symbol /// /// The code lengths - /// The huffman size span ref - private static void GenerateSizeTable(ReadOnlySpan lengths, ref short huffsizeRef) + private void GenerateSizeTable(ReadOnlySpan lengths) { - short index = 0; - for (short l = 1; l <= 16; l++) + fixed (short* sizesRef = this.Sizes.Data) { - byte i = lengths[l]; - for (short j = 0; j < i; j++) + short index = 0; + for (short l = 1; l <= 16; l++) { - Unsafe.Add(ref huffsizeRef, index) = l; - index++; + byte i = lengths[l]; + for (short j = 0; j < i; j++) + { + sizesRef[index] = l; + index++; + } } - } - Unsafe.Add(ref huffsizeRef, index) = 0; + sizesRef[index] = 0; + } } /// /// Figure C.2: generate the codes themselves /// - /// The huffman size span ref /// The huffman code span ref /// The length of the huffsize span - private static void GenerateCodeTable(ref short huffsizeRef, ref short huffcodeRef, int length) + private void GenerateCodeTable(ref short huffcodeRef, int length) { - short k = 0; - short si = huffsizeRef; - short code = 0; - for (short i = 0; i < length; i++) + fixed (short* sizesRef = this.Sizes.Data) { - while (Unsafe.Add(ref huffsizeRef, k) == si) + short k = 0; + short si = sizesRef[0]; + short code = 0; + for (short i = 0; i < length; i++) { - Unsafe.Add(ref huffcodeRef, k) = code; - code++; - k++; - } + while (sizesRef[k] == si) + { + Unsafe.Add(ref huffcodeRef, k) = code; + code++; + k++; + } - code <<= 1; - si++; + code <<= 1; + si++; + } } } @@ -148,6 +155,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// The huffman code span ref private void GenerateLookaheadTables(ReadOnlySpan lengths, ReadOnlySpan huffval, ref short huffcodeRef) { + // TODO: Rewrite this to match stb_Image // TODO: This generation code matches the libJpeg code but the lookahead table is not actually used yet. // To use it we need to implement fast lookup path in PdfJsScanDecoder.DecodeHuffman // This should yield much faster scan decoding as usually, more than 95% of the Huffman codes diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTables.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTables.cs index 3a559bb86..5cbde2b88 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTables.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTables.cs @@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// Gets or sets the table at the given index. /// /// The index - /// The + /// The public ref PdfJsHuffmanTable this[int index] { [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs index c6b14d6fb..62c8f984f 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs @@ -107,7 +107,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components for (int i = 0; i < components.Length; i++) { PdfJsFrameComponent c = components[i]; - c.Pred = 0; + c.DcPredictor = 0; } this.eobrun = 0; @@ -552,7 +552,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } int j = tree.ValOffset[i]; - value = tree.HuffVal[(j + code) & 0xFF]; + value = tree.Values[(j + code) & 0xFF]; return true; } @@ -618,7 +618,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } - Unsafe.Add(ref blockDataRef, offset) = (short)(component.Pred += diff); + Unsafe.Add(ref blockDataRef, offset) = (short)(component.DcPredictor += diff); int k = 1; while (k < 64) @@ -673,7 +673,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } - Unsafe.Add(ref blockDataRef, offset) = (short)(component.Pred += diff << this.successiveState); + Unsafe.Add(ref blockDataRef, offset) = (short)(component.DcPredictor += diff << this.successiveState); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -860,5 +860,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } } + + private void Reset() + { + // Reset + // TODO: I do not understand why these values are reset? We should surely be tracking the bits across mcu's? + this.bitsCount = 0; + this.bitsData = 0; + this.unexpectedMarkerReached = false; + } } } \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs new file mode 100644 index 000000000..af7233bfe --- /dev/null +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -0,0 +1,628 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Memory; + +namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components +{ + internal class ScanDecoder + { + public const int FastBits = 9; + + // bmask[n] = (1 << n) - 1 + private static readonly uint[] stbi__bmask = { 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535 }; + + // bias[n] = (-1 << n) + 1 + private static readonly int[] stbi__jbias = { 0, -1, -3, -7, -15, -31, -63, -127, -255, -511, -1023, -2047, -4095, -8191, -16383, -32767 }; + + private readonly DoubleBufferedStreamReader stream; + private readonly PdfJsFrameComponent[] components; + private readonly ZigZag dctZigZag; + private int codeBits; + private uint codeBuffer; + private bool nomore; + private byte marker; + + private int todo; + private int restartInterval; + private int componentIndex; + private int componentsLength; + private int eobrun; + private int spectralStart; + private int spectralEnd; + private int successiveHigh; + private int successiveLow; + + /// + /// Initializes a new instance of the class. + /// + /// The input stream + /// The scan components + /// The component index within the array + /// The length of the components. Different to the array length + /// The reset interval + /// The spectral selection start + /// The spectral selection end + /// The successive approximation bit high end + /// The successive approximation bit low end + public ScanDecoder( + DoubleBufferedStreamReader stream, + PdfJsFrameComponent[] components, + int componentIndex, + int componentsLength, + int restartInterval, + int spectralStart, + int spectralEnd, + int successiveHigh, + int successiveLow) + { + this.dctZigZag = ZigZag.CreateUnzigTable(); + this.stream = stream; + this.components = components; + this.marker = PdfJsJpegConstants.Markers.Prefix; + this.componentIndex = componentIndex; + this.componentsLength = componentsLength; + this.restartInterval = restartInterval; + this.spectralStart = spectralStart; + this.spectralEnd = spectralEnd; + this.successiveHigh = successiveHigh; + this.successiveLow = successiveLow; + } + + /// + /// Decodes the entropy coded data. + /// + /// The image frame. + /// The DC Huffman tables. + /// The AC Huffman tables. + /// The fast AC decoding tables. + /// The + public int ParseEntropyCodedData( + PdfJsFrame frame, + PdfJsHuffmanTables dcHuffmanTables, + PdfJsHuffmanTables acHuffmanTables, + FastACTables fastACTables) + { + this.Reset(); + + if (!frame.Progressive) + { + if (this.componentsLength == 1) + { + int i, j; + int n = this.componentIndex; + PdfJsFrameComponent component = this.components[n]; + + // Non-interleaved data, we just need to process one block at a time, + // in trivial scanline order + // number of blocks to do just depends on how many actual "pixels" this + // component has, independent of interleaved MCU blocking and such + int w = component.WidthInBlocks; + int h = component.HeightInBlocks; + ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; + Span fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + + int mcu = 0; + for (j = 0; j < h; j++) + { + for (i = 0; i < w; i++) + { + int blockRow = mcu / w; + int blockCol = mcu % w; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, fastAC); + mcu++; + } + } + } + } + + return 1; + } + + private int DecodeBlock( + PdfJsFrameComponent component, + ref short blockDataRef, + ref PdfJsHuffmanTable dcTable, + ref PdfJsHuffmanTable acTable, + Span fac) + { + if (this.codeBits < 16) + { + this.GrowBufferUnsafe(); + } + + int t = this.DecodeHuffman(ref dcTable); + + if (t < 0) + { + throw new ImageFormatException("Bad Huffman code"); + } + + int diff = t > 0 ? this.ExtendReceive(t) : 0; + int dc = component.DcPredictor + diff; + component.DcPredictor = dc; + blockDataRef = (short)dc; + + // Decode AC Components, See Jpeg Spec + int k = 1; + do + { + int zig; + int s; + + this.CheckBits(); + int c = this.PeekBits(); + int r = fac[c]; + + if (r > 0) + { + // Fast AC path + k += (r >> 4) & 15; // Run + s = r & 15; // Combined Length + this.codeBuffer <<= s; + this.codeBits -= s; + + // Decode into unzigzag location + zig = this.dctZigZag[k++]; + Unsafe.Add(ref blockDataRef, zig) = (short)(r >> 8); + } + else + { + int rs = this.DecodeHuffman(ref acTable); + + if (rs < 0) + { + throw new ImageFormatException("Bad Huffman code"); + } + + s = rs & 15; + r = rs >> 4; + + if (s == 0) + { + if (rs != 0xF0) + { + break; // End block + } + + k += 16; + } + else + { + k += r; + + // Decode into unzigzag location + zig = this.dctZigZag[k++]; + Unsafe.Add(ref blockDataRef, zig) = (short)this.ExtendReceive(s); + } + } + } while (k < 64); + + return 1; + } + + private int DecodeBlockProgressiveDC( + PdfJsFrameComponent component, + ref short blockDataRef, + ref PdfJsHuffmanTable dcTable) + { + if (this.spectralEnd != 0) + { + throw new ImageFormatException("Can't merge DC and AC."); + } + + this.CheckBits(); + + if (this.successiveHigh == 0) + { + // First scan for DC coefficient, must be first + int t = this.DecodeHuffman(ref dcTable); + int diff = t > 0 ? this.ExtendReceive(t) : 0; + + int dc = component.DcPredictor + diff; + component.DcPredictor = dc; + + blockDataRef = (short)(dc << this.successiveLow); + } + else + { + // Refinement scan for DC coefficient + if (this.GetBit() > 0) + { + blockDataRef += (short)(1 << this.successiveLow); + } + } + + return 1; + } + + private int DecodeBlockProgressiveAC( + PdfJsFrameComponent component, + ref short blockDataRef, + ref PdfJsHuffmanTable acTable, + Span fac) + { + int k; + + if (this.spectralStart == 0) + { + throw new ImageFormatException("Can't merge DC and AC."); + } + + if (this.successiveHigh == 0) + { + int shift = this.successiveLow; + + if (this.eobrun > 0) + { + this.eobrun--; + return 1; + } + + k = this.spectralStart; + do + { + int zig; + int s; + + this.CheckBits(); + int c = this.PeekBits(); + int r = fac[c]; + + if (r > 0) + { + // Fast AC path + k += (r >> 4) & 15; // Run + s = r & 15; // Combined length + this.codeBuffer <<= s; + this.codeBits -= s; + + // Decode into unzigzag location + zig = this.dctZigZag[k++]; + Unsafe.Add(ref blockDataRef, zig) = (short)((r >> 8) << shift); + } + else + { + int rs = this.DecodeHuffman(ref acTable); + + if (rs < 0) + { + throw new ImageFormatException("Bad Huffman code."); + } + + s = rs & 15; + r = rs >> 4; + + if (s == 0) + { + if (r < 15) + { + this.eobrun = 1 << r; + if (r > 0) + { + this.eobrun += this.GetBits(r); + } + + this.eobrun--; + break; + } + + k += 16; + } + else + { + k += r; + zig = this.dctZigZag[k++]; + Unsafe.Add(ref blockDataRef, zig) = (short)(this.ExtendReceive(s) << shift); + } + } + } + while (k <= this.spectralEnd); + } + else + { + // Refinement scan for these AC coefficients + short bit = (short)(1 << this.successiveLow); + + if (this.eobrun > 0) + { + this.eobrun--; + for (k = this.spectralStart; k < this.spectralEnd; k++) + { + ref short p = ref Unsafe.Add(ref blockDataRef, this.dctZigZag[k]); + if (p != 0) + { + if (this.GetBit() > 0) + { + if ((p & bit) == 0) + { + if (p > 0) + { + p += bit; + } + else + { + p -= bit; + } + } + } + } + } + } + else + { + k = this.spectralStart; + do + { + int rs = this.DecodeHuffman(ref acTable); + if (rs < 0) + { + throw new ImageFormatException("Bad Huffman code."); + } + + int s = rs & 15; + int r = rs >> 4; + + if (s == 0) + { + // r=15 s=0 should write 16 0s, so we just do + // a run of 15 0s and then write s (which is 0), + // so we don't have to do anything special here + if (r < 15) + { + this.eobrun = (1 << r) - 1; + + if (r > 0) + { + this.eobrun += this.GetBits(r); + } + + r = 64; // Force end of block + } + } + else + { + if (s != 1) + { + throw new ImageFormatException("Bad Huffman code."); + } + + // Sign bit + if (this.GetBit() > 0) + { + s = bit; + } + else + { + s -= bit; + } + } + + // Advance by r + while (k <= this.spectralEnd) + { + ref short p = ref Unsafe.Add(ref blockDataRef, this.dctZigZag[k++]); + if (p != 0) + { + if (this.GetBit() > 0) + { + if ((p & bit) == 0) + { + if (p > 0) + { + p += bit; + } + else + { + p -= bit; + } + } + } + } + else + { + if (r == 0) + { + p = (short)s; + break; + } + + r--; + } + } + } + while (k <= this.spectralEnd); + } + } + + return 1; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private int GetBits(int n) + { + if (this.codeBits < n) + { + this.GrowBufferUnsafe(); + } + + uint k = this.Lrot(this.codeBuffer, n); + this.codeBuffer = k & ~stbi__bmask[n]; + k &= stbi__bmask[n]; + this.codeBits -= n; + return (int)k; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private int GetBit() + { + if (this.codeBits < 1) + { + this.GrowBufferUnsafe(); + } + + uint k = this.codeBuffer; + this.codeBuffer <<= 1; + this.codeBits--; + + return (int)(k & 0x80000000); + } + + private void GrowBufferUnsafe() + { + do + { + // TODO: EOF + uint b = (uint)(this.nomore ? 0 : this.stream.ReadByte()); + if (b == PdfJsJpegConstants.Markers.Prefix) + { + long position = this.stream.Position - 1; + int c = this.stream.ReadByte(); + while (c == PdfJsJpegConstants.Markers.Prefix) + { + if (c != 0) + { + this.marker = (byte)c; + this.nomore = true; + this.stream.Position = position; + return; + } + } + } + + this.codeBuffer |= b << (24 - this.codeBits); + this.codeBits += 8; + } + while (this.codeBits <= 24); + } + + private int DecodeHuffman(ref PdfJsHuffmanTable table) + { + this.CheckBits(); + + // Look at the top FastBits and determine what symbol ID it is, + // if the code is <= FastBits. + int c = this.PeekBits(); + int k = table.Lookahead[c]; + if (k < byte.MaxValue) + { + int s = table.Sizes[k]; + if (s > this.codeBits) + { + return -1; + } + + this.codeBuffer <<= s; + this.codeBits -= s; + return table.Values[k]; + } + + // Naive test is to shift the code_buffer down so k bits are + // valid, then test against MaxCode. To speed this up, we've + // preshifted maxcode left so that it has (16-k) 0s at the + // end; in other words, regardless of the number of bits, it + // wants to be compared against something shifted to have 16; + // that way we don't need to shift inside the loop. + uint temp = this.codeBuffer >> 16; + for (k = FastBits + 1; ; ++k) + { + if (temp < table.MaxCode[k]) + { + break; + } + } + + if (k == 17) + { + // Error! code not found + this.codeBits -= 16; + return -1; + } + + if (k > this.codeBits) + { + return -1; + } + + // Convert the huffman code to the symbol id + c = (int)((this.codeBuffer >> (32 - k)) & stbi__bmask[k]) + table.ValOffset[k]; + + // Convert the id to a symbol + this.codeBits -= k; + this.codeBuffer <<= k; + return table.Values[c]; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private int ExtendReceive(int n) + { + if (this.codeBits < n) + { + this.GrowBufferUnsafe(); + } + + int sgn = (int)(this.codeBuffer >> 31); + uint k = this.Lrot(this.codeBuffer, n); + this.codeBuffer = k & ~stbi__bmask[n]; + k &= stbi__bmask[n]; + this.codeBits -= n; + return (int)(k + (stbi__jbias[n] & ~sgn)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private void CheckBits() + { + if (this.codeBuffer < 16) + { + this.GrowBufferUnsafe(); + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private int PeekBits() + { + return (int)(this.codeBuffer >> ((32 - FastBits) & ((1 << FastBits) - 1))); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private uint Lrot(uint x, int y) + { + return (x << y) | (x >> (32 - y)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private bool IsRestartMarker(byte x) + { + return x >= PdfJsJpegConstants.Markers.RST0 && x <= PdfJsJpegConstants.Markers.RST7; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private void Reset() + { + this.codeBits = 0; + this.codeBuffer = 0; + this.nomore = false; + + for (int i = 0; i < this.components.Length; i++) + { + PdfJsFrameComponent c = this.components[i]; + c.DcPredictor = 0; + } + + this.marker = PdfJsJpegConstants.Markers.Prefix; + this.todo = this.restartInterval > 0 ? this.restartInterval : 0x7FFFFFFF; + this.eobrun = 0; + + // No more than 1<<31 MCUs if no restartInterval? that's plenty safe, + // since we don't even allow 1<<30 pixels + } + } +} \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs index df803a920..18a444c5b 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs @@ -57,6 +57,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort /// private PdfJsHuffmanTables acHuffmanTables; + /// + /// The fast AC tables used for entropy decoding + /// + private FastACTables fastACTables; + /// /// The reset interval determined by RST markers /// @@ -228,6 +233,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort this.QuantizationTables = new Block8x8F[4]; this.dcHuffmanTables = new PdfJsHuffmanTables(); this.acHuffmanTables = new PdfJsHuffmanTables(); + this.fastACTables = new FastACTables(this.configuration.MemoryManager); } while (fileMarker.Marker != PdfJsJpegConstants.Markers.EOI) @@ -341,12 +347,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort { this.InputStream?.Dispose(); this.Frame?.Dispose(); + this.fastACTables?.Dispose(); // Set large fields to null. this.InputStream = null; this.Frame = null; this.dcHuffmanTables = null; this.acHuffmanTables = null; + this.fastACTables = null; } /// @@ -714,11 +722,20 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort i += 17 + codeLengthSum; + int tableType = huffmanTableSpec >> 4; + int tableIndex = huffmanTableSpec & 15; + this.BuildHuffmanTable( - huffmanTableSpec >> 4 == 0 ? this.dcHuffmanTables : this.acHuffmanTables, - huffmanTableSpec & 15, + tableType == 0 ? this.dcHuffmanTables : this.acHuffmanTables, + tableIndex, codeLengths.Span, huffmanValues.Span); + + if (tableType != 0) + { + // Build a table that decodes both magnitude and value of small ACs in one go. + this.BuildFastACTable(tableIndex); + } } } } @@ -829,5 +846,43 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort return image; } } + + private void BuildFastACTable(int index) + { + const int FastBits = ScanDecoder.FastBits; + Span fastac = this.fastACTables.Tables.GetRowSpan(index); + ref PdfJsHuffmanTable huffman = ref this.acHuffmanTables[index]; + + int i; + for (i = 0; i < (1 << FastBits); i++) + { + short fast = huffman.Lookahead[i]; + fastac[i] = 0; + if (fast < 255) + { + int rs = huffman.Values[fast]; + int run = (rs >> 4) & 15; + int magbits = rs & 15; + int len = huffman.Sizes[fast]; + + if (magbits > 0 && len + magbits <= FastBits) + { + // Magnitude code followed by receive_extend code + int k = ((i << len) & ((1 << FastBits) - 1)) >> (FastBits - magbits); + int m = 1 << (magbits - 1); + if (k < m) + { + k += (int)((~0U << magbits) + 1); + } + + // if the result is small enough, we can fit it in fastac table + if (k >= -128 && k <= 127) + { + fastac[i] = (short)((k * 256) + (run * 16) + (len + magbits)); + } + } + } + } + } } } \ No newline at end of file From 71903c5dbaf7356426370950a417ce3d264bfef7 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Wed, 9 May 2018 10:57:43 +1000 Subject: [PATCH 02/36] Minor cleanup --- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index af7233bfe..e9f91ef06 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -94,9 +94,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { if (this.componentsLength == 1) { - int i, j; - int n = this.componentIndex; - PdfJsFrameComponent component = this.components[n]; + PdfJsFrameComponent component = this.components[this.componentIndex]; // Non-interleaved data, we just need to process one block at a time, // in trivial scanline order @@ -110,18 +108,42 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components Span fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); int mcu = 0; - for (j = 0; j < h; j++) + for (int j = 0; j < h; j++) { - for (i = 0; i < w; i++) + for (int i = 0; i < w; i++) { int blockRow = mcu / w; int blockCol = mcu % w; int offset = component.GetBlockBufferOffset(blockRow, blockCol); this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, fastAC); mcu++; + + // Every data block is an MCU, so countdown the restart interval + if (this.todo-- <= 0) + { + if (this.codeBits < 24) + { + this.GrowBufferUnsafe(); + } + + // If it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!this.IsRestartMarker(this.marker)) + { + return 1; + } + + this.Reset(); + } } } } + else + { + // Interleaved + int i, j, k, x, y; + + } } return 1; From c8a9b30457ac9580d49aec0f1bfe427553a92886 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 10 May 2018 00:47:16 +1000 Subject: [PATCH 03/36] Wire up huffman tables. (doesn't work) --- .../Components/FixedByteBuffer512.cs | 24 ++++ .../PdfJsPort/Components/PdfJsHuffmanTable.cs | 126 +++++++++++++----- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 87 +++++++++--- .../Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs | 50 ++++--- 4 files changed, 219 insertions(+), 68 deletions(-) create mode 100644 src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedByteBuffer512.cs diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedByteBuffer512.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedByteBuffer512.cs new file mode 100644 index 000000000..c509903c9 --- /dev/null +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedByteBuffer512.cs @@ -0,0 +1,24 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components +{ + [StructLayout(LayoutKind.Sequential)] + internal unsafe struct FixedByteBuffer512 + { + public fixed byte Data[1 << ScanDecoder.FastBits]; + + public byte this[int idx] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ref byte self = ref Unsafe.As(ref this); + return Unsafe.Add(ref self, idx); + } + } + } +} \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs index 0541de91b..1cc342f5a 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs @@ -32,7 +32,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// /// Gets the lookahead array /// - public FixedInt16Buffer256 Lookahead; + public FixedByteBuffer512 Lookahead; /// /// Gets the sizes array @@ -43,19 +43,76 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// Initializes a new instance of the struct. /// /// The to use for buffer allocations. - /// The code lengths + /// The code lengths /// The huffman values - public PdfJsHuffmanTable(MemoryManager memoryManager, ReadOnlySpan lengths, ReadOnlySpan values) + public PdfJsHuffmanTable(MemoryManager memoryManager, ReadOnlySpan count, ReadOnlySpan values) { const int Length = 257; using (IBuffer huffcode = memoryManager.Allocate(Length)) { + // Span codes = huffcode.Span; ref short huffcodeRef = ref MemoryMarshal.GetReference(huffcode.Span); - this.GenerateSizeTable(lengths); - this.GenerateCodeTable(ref huffcodeRef, Length); - this.GenerateDecoderTables(lengths, ref huffcodeRef); - this.GenerateLookaheadTables(lengths, values, ref huffcodeRef); + this.GenerateSizeTable(count); + + //int k = 0; + //fixed (short* sizesRef = this.Sizes.Data) + //fixed (short* deltaRef = this.ValOffset.Data) + //fixed (long* maxcodeRef = this.MaxCode.Data) + //{ + // uint code = 0; + // int j; + // for (j = 1; j <= 16; j++) + // { + // // Compute delta to add to code to compute symbol id. + // deltaRef[j] = (short)(k - code); + // if (sizesRef[k] == j) + // { + // while (sizesRef[k] == j) + // { + // codes[k++] = (short)code++; + + // // Unsafe.Add(ref huffcodeRef, k++) = (short)code++; + + // // TODO: Throw if invalid? + // } + // } + + // // Compute largest code + 1 for this size. preshifted as neeed later. + // maxcodeRef[j] = code << (16 - j); + // code <<= 1; + // } + + // maxcodeRef[j] = 0xFFFFFFFF; + //} + + //fixed (short* lookaheadRef = this.Lookahead.Data) + //{ + // const int FastBits = ScanDecoder.FastBits; + // var fast = new Span(lookaheadRef, 1 << FastBits); + // fast.Fill(255); // Flag for non-accelerated + + // fixed (short* sizesRef = this.Sizes.Data) + // { + // for (int i = 0; i < k; i++) + // { + // int s = sizesRef[i]; + // if (s <= ScanDecoder.FastBits) + // { + // int c = codes[i] << (FastBits - s); + // int m = 1 << (FastBits - s); + // for (int j = 0; j < m; j++) + // { + // fast[c + j] = (byte)i; + // } + // } + // } + // } + //} + + this.GenerateCodeTable(ref huffcodeRef, Length, out int k); + this.GenerateDecoderTables(count, ref huffcodeRef); + this.GenerateLookaheadTables(count, values, ref huffcodeRef, k); } fixed (byte* huffValRef = this.Values.Data) @@ -74,18 +131,18 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { fixed (short* sizesRef = this.Sizes.Data) { - short index = 0; - for (short l = 1; l <= 16; l++) + short k = 0; + for (short i = 1; i < 17; i++) { - byte i = lengths[l]; - for (short j = 0; j < i; j++) + byte l = lengths[i]; + for (short j = 0; j < l; j++) { - sizesRef[index] = l; - index++; + sizesRef[k] = i; + k++; } } - sizesRef[index] = 0; + sizesRef[k] = 0; } } @@ -94,11 +151,12 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// /// The huffman code span ref /// The length of the huffsize span - private void GenerateCodeTable(ref short huffcodeRef, int length) + /// The length of any valid codes + private void GenerateCodeTable(ref short huffcodeRef, int length, out int k) { fixed (short* sizesRef = this.Sizes.Data) { - short k = 0; + k = 0; short si = sizesRef[0]; short code = 0; for (short i = 0; i < length; i++) @@ -134,7 +192,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components // valOffsetRef[l] = huffcodeRef[] index of 1st symbol of code length i, minus the minimum code of length i valOffsetRef[i] = (short)(bitcount - Unsafe.Add(ref huffcodeRef, bitcount)); bitcount += lengths[i]; - maxcodeRef[i] = Unsafe.Add(ref huffcodeRef, bitcount - 1); // maximum code of length i + maxcodeRef[i] = Unsafe.Add(ref huffcodeRef, bitcount - 1) << (16 - i); // maximum code of length i preshifted for faster reading later } else { @@ -143,41 +201,43 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } valOffsetRef[17] = 0; - maxcodeRef[17] = 0xFFFFFL; + maxcodeRef[17] = 0xFFFFFFFFL; } } /// - /// Generates lookup tables to speed up decoding + /// Generates non-spec lookup tables to speed up decoding /// /// The code lengths /// The huffman value array /// The huffman code span ref - private void GenerateLookaheadTables(ReadOnlySpan lengths, ReadOnlySpan huffval, ref short huffcodeRef) + /// The lengths of any valid codes + private void GenerateLookaheadTables(ReadOnlySpan lengths, ReadOnlySpan huffval, ref short huffcodeRef, int k) { // TODO: Rewrite this to match stb_Image // TODO: This generation code matches the libJpeg code but the lookahead table is not actually used yet. // To use it we need to implement fast lookup path in PdfJsScanDecoder.DecodeHuffman // This should yield much faster scan decoding as usually, more than 95% of the Huffman codes // will be 8 or fewer bits long and can be handled without looping. - fixed (short* lookaheadRef = this.Lookahead.Data) + fixed (byte* lookaheadRef = this.Lookahead.Data) { - var lookaheadSpan = new Span(lookaheadRef, 256); - - lookaheadSpan.Fill(2034); // 9 << 8; + const int FastBits = ScanDecoder.FastBits; + var lookaheadSpan = new Span(lookaheadRef, 1 << ScanDecoder.FastBits); - int p = 0; - for (int l = 1; l <= 8; l++) + lookaheadSpan.Fill(255); // Flag for non-accelerated + fixed (short* sizesRef = this.Sizes.Data) { - for (int i = 1; i <= lengths[l]; i++, p++) + for (int i = 0; i < k; ++i) { - // l = current code's length, p = its index in huffcode[] & huffval[]. - // Generate left-justified code followed by all possible bit sequences - int lookBits = Unsafe.Add(ref huffcodeRef, p) << (8 - l); - for (int ctr = 1 << (8 - l); ctr > 0; ctr--) + int s = sizesRef[i]; + if (s <= ScanDecoder.FastBits) { - lookaheadRef[lookBits] = (short)((l << 8) | huffval[p]); - lookBits++; + int c = Unsafe.Add(ref huffcodeRef, i) << (FastBits - s); + int m = 1 << (FastBits - s); + for (int j = 0; j < m; ++j) + { + lookaheadRef[c + j] = (byte)i; + } } } } diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index e9f91ef06..217b3cb62 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -15,10 +15,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components public const int FastBits = 9; // bmask[n] = (1 << n) - 1 - private static readonly uint[] stbi__bmask = { 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535 }; + private static readonly uint[] Bmask = { 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535 }; // bias[n] = (-1 << n) + 1 - private static readonly int[] stbi__jbias = { 0, -1, -3, -7, -15, -31, -63, -127, -255, -511, -1023, -2047, -4095, -8191, -16383, -32767 }; + private static readonly int[] Bias = { 0, -1, -3, -7, -15, -31, -63, -127, -255, -511, -1023, -2047, -4095, -8191, -16383, -32767 }; private readonly DoubleBufferedStreamReader stream; private readonly PdfJsFrameComponent[] components; @@ -141,8 +141,61 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components else { // Interleaved - int i, j, k, x, y; + int mcu = 0; + int mcusPerColumn = frame.McusPerColumn; + int mcusPerLine = frame.McusPerLine; + for (int j = 0; j < mcusPerColumn; j++) + { + for (int i = 0; i < mcusPerLine; i++) + { + // Scan an interleaved mcu... process components in order + for (int k = 0; k < this.componentsLength; k++) + { + PdfJsFrameComponent component = this.components[k]; + ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; + Span fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + int h = component.HorizontalSamplingFactor; + int v = component.VerticalSamplingFactor; + + // Scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (int y = 0; y < v; y++) + { + for (int x = 0; x < h; x++) + { + int mcuRow = mcu / mcusPerLine; + int mcuCol = mcu % mcusPerLine; + int blockRow = (mcuRow * v) + y; + int blockCol = (mcuCol * h) + x; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, fastAC); + } + } + } + + // After all interleaved components, that's an interleaved MCU, + // so now count down the restart interval + mcu++; + if (this.todo-- <= 0) + { + if (this.codeBits < 24) + { + this.GrowBufferUnsafe(); + } + + // If it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!this.IsRestartMarker(this.marker)) + { + return 1; + } + this.Reset(); + } + } + } } } @@ -156,11 +209,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref PdfJsHuffmanTable acTable, Span fac) { - if (this.codeBits < 16) - { - this.GrowBufferUnsafe(); - } - + this.CheckBits(); int t = this.DecodeHuffman(ref dcTable); if (t < 0) @@ -477,8 +526,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } uint k = this.Lrot(this.codeBuffer, n); - this.codeBuffer = k & ~stbi__bmask[n]; - k &= stbi__bmask[n]; + this.codeBuffer = k & ~Bmask[n]; + k &= Bmask[n]; this.codeBits -= n; return (int)k; } @@ -503,7 +552,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components do { // TODO: EOF - uint b = (uint)(this.nomore ? 0 : this.stream.ReadByte()); + int b = this.nomore ? 0 : this.stream.ReadByte(); if (b == PdfJsJpegConstants.Markers.Prefix) { long position = this.stream.Position - 1; @@ -514,13 +563,17 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { this.marker = (byte)c; this.nomore = true; - this.stream.Position = position; + if (!this.IsRestartMarker(this.marker)) + { + this.stream.Position = position; + } + return; } } } - this.codeBuffer |= b << (24 - this.codeBits); + this.codeBuffer |= (uint)b << (24 - this.codeBits); this.codeBits += 8; } while (this.codeBits <= 24); @@ -575,7 +628,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } // Convert the huffman code to the symbol id - c = (int)((this.codeBuffer >> (32 - k)) & stbi__bmask[k]) + table.ValOffset[k]; + c = (int)((this.codeBuffer >> (32 - k)) & Bmask[k]) + table.ValOffset[k]; // Convert the id to a symbol this.codeBits -= k; @@ -593,10 +646,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int sgn = (int)(this.codeBuffer >> 31); uint k = this.Lrot(this.codeBuffer, n); - this.codeBuffer = k & ~stbi__bmask[n]; - k &= stbi__bmask[n]; + this.codeBuffer = k & ~Bmask[n]; + k &= Bmask[n]; this.codeBits -= n; - return (int)(k + (stbi__jbias[n] & ~sgn)); + return (int)(k + (Bias[n] & ~sgn)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs index 18a444c5b..5bf4ab5aa 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs @@ -731,10 +731,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort codeLengths.Span, huffmanValues.Span); - if (tableType != 0) + if (huffmanTableSpec >> 4 != 0) { // Build a table that decodes both magnitude and value of small ACs in one go. - this.BuildFastACTable(tableIndex); + this.BuildFastACTable(huffmanTableSpec & 15); } } } @@ -794,21 +794,35 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort int spectralStart = this.temp[0]; int spectralEnd = this.temp[1]; int successiveApproximation = this.temp[2]; - var scanDecoder = default(PdfJsScanDecoder); - - scanDecoder.DecodeScan( - this.Frame, - this.InputStream, - this.dcHuffmanTables, - this.acHuffmanTables, - this.Frame.Components, - componentIndex, - selectorsCount, - this.resetInterval, - spectralStart, - spectralEnd, - successiveApproximation >> 4, - successiveApproximation & 15); + + var sd = new ScanDecoder( + this.InputStream, + this.Frame.Components, + componentIndex, + selectorsCount, + this.resetInterval, + spectralStart, + spectralEnd, + successiveApproximation >> 4, + successiveApproximation & 15); + + sd.ParseEntropyCodedData(this.Frame, this.dcHuffmanTables, this.acHuffmanTables, this.fastACTables); + + //var scanDecoder = default(PdfJsScanDecoder); + + //scanDecoder.DecodeScan( + // this.Frame, + // this.InputStream, + // this.dcHuffmanTables, + // this.acHuffmanTables, + // this.Frame.Components, + // componentIndex, + // selectorsCount, + // this.resetInterval, + // spectralStart, + // spectralEnd, + // successiveApproximation >> 4, + // successiveApproximation & 15); } /// @@ -856,7 +870,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort int i; for (i = 0; i < (1 << FastBits); i++) { - short fast = huffman.Lookahead[i]; + byte fast = huffman.Lookahead[i]; fastac[i] = 0; if (fast < 255) { From 6d928f66401d7fd81208b1cb2ff1174932fffc97 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Fri, 11 May 2018 11:32:01 +1000 Subject: [PATCH 04/36] Meh --- .../Components/FixedByteBuffer257.cs | 24 ++++ .../PdfJsPort/Components/PdfJsHuffmanTable.cs | 120 +++++++++--------- .../PdfJsPort/Components/PdfJsScanDecoder.cs | 9 -- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 2 +- 4 files changed, 85 insertions(+), 70 deletions(-) create mode 100644 src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedByteBuffer257.cs diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedByteBuffer257.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedByteBuffer257.cs new file mode 100644 index 000000000..301524316 --- /dev/null +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedByteBuffer257.cs @@ -0,0 +1,24 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components +{ + [StructLayout(LayoutKind.Sequential)] + internal unsafe struct FixedByteBuffer257 + { + public fixed byte Data[257]; + + public byte this[int idx] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + ref byte self = ref Unsafe.As(ref this); + return Unsafe.Add(ref self, idx); + } + } + } +} \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs index 1cc342f5a..a63573030 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs @@ -50,69 +50,69 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components const int Length = 257; using (IBuffer huffcode = memoryManager.Allocate(Length)) { - // Span codes = huffcode.Span; + Span codes = huffcode.Span; ref short huffcodeRef = ref MemoryMarshal.GetReference(huffcode.Span); this.GenerateSizeTable(count); - //int k = 0; - //fixed (short* sizesRef = this.Sizes.Data) - //fixed (short* deltaRef = this.ValOffset.Data) - //fixed (long* maxcodeRef = this.MaxCode.Data) - //{ - // uint code = 0; - // int j; - // for (j = 1; j <= 16; j++) - // { - // // Compute delta to add to code to compute symbol id. - // deltaRef[j] = (short)(k - code); - // if (sizesRef[k] == j) - // { - // while (sizesRef[k] == j) - // { - // codes[k++] = (short)code++; - - // // Unsafe.Add(ref huffcodeRef, k++) = (short)code++; - - // // TODO: Throw if invalid? - // } - // } - - // // Compute largest code + 1 for this size. preshifted as neeed later. - // maxcodeRef[j] = code << (16 - j); - // code <<= 1; - // } - - // maxcodeRef[j] = 0xFFFFFFFF; - //} - - //fixed (short* lookaheadRef = this.Lookahead.Data) - //{ - // const int FastBits = ScanDecoder.FastBits; - // var fast = new Span(lookaheadRef, 1 << FastBits); - // fast.Fill(255); // Flag for non-accelerated - - // fixed (short* sizesRef = this.Sizes.Data) - // { - // for (int i = 0; i < k; i++) - // { - // int s = sizesRef[i]; - // if (s <= ScanDecoder.FastBits) - // { - // int c = codes[i] << (FastBits - s); - // int m = 1 << (FastBits - s); - // for (int j = 0; j < m; j++) - // { - // fast[c + j] = (byte)i; - // } - // } - // } - // } - //} - - this.GenerateCodeTable(ref huffcodeRef, Length, out int k); - this.GenerateDecoderTables(count, ref huffcodeRef); - this.GenerateLookaheadTables(count, values, ref huffcodeRef, k); + int k = 0; + fixed (short* size = this.Sizes.Data) + fixed (short* delta = this.ValOffset.Data) + fixed (long* maxcode = this.MaxCode.Data) + { + uint code = 0; + int j; + for (j = 1; j <= 16; j++) + { + // Compute delta to add to code to compute symbol id. + delta[j] = (short)(k - code); + if (size[k] == j) + { + while (size[k] == j) + { + codes[k++] = (short)code++; + + // Unsafe.Add(ref huffcodeRef, k++) = (short)code++; + + // TODO: Throw if invalid? + } + } + + // Compute largest code + 1 for this size. preshifted as neeed later. + maxcode[j] = code << (16 - j); + code <<= 1; + } + + maxcode[j] = 0xFFFFFFFF; + } + + fixed (byte* lookaheadRef = this.Lookahead.Data) + { + const int FastBits = ScanDecoder.FastBits; + var fast = new Span(lookaheadRef, 1 << FastBits); + fast.Fill(255); // Flag for non-accelerated + + fixed (short* sizesRef = this.Sizes.Data) + { + for (int i = 0; i < k; i++) + { + int s = sizesRef[i]; + if (s <= ScanDecoder.FastBits) + { + int c = codes[i] << (FastBits - s); + int m = 1 << (FastBits - s); + for (int j = 0; j < m; j++) + { + fast[c + j] = (byte)i; + } + } + } + } + } + + // this.GenerateCodeTable(ref huffcodeRef, Length, out int k); + // this.GenerateDecoderTables(count, ref huffcodeRef); + // this.GenerateLookaheadTables(count, values, ref huffcodeRef, k); } fixed (byte* huffValRef = this.Values.Data) @@ -224,7 +224,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components const int FastBits = ScanDecoder.FastBits; var lookaheadSpan = new Span(lookaheadRef, 1 << ScanDecoder.FastBits); - lookaheadSpan.Fill(255); // Flag for non-accelerated + lookaheadSpan.Fill(byte.MaxValue); // Flag for non-accelerated fixed (short* sizesRef = this.Sizes.Data) { for (int i = 0; i < k; ++i) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs index 62c8f984f..0736fd342 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs @@ -860,14 +860,5 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } } - - private void Reset() - { - // Reset - // TODO: I do not understand why these values are reset? We should surely be tracking the bits across mcu's? - this.bitsCount = 0; - this.bitsData = 0; - this.unexpectedMarkerReached = false; - } } } \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 217b3cb62..8322be2fe 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -607,7 +607,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components // wants to be compared against something shifted to have 16; // that way we don't need to shift inside the loop. uint temp = this.codeBuffer >> 16; - for (k = FastBits + 1; ; ++k) + for (k = FastBits + 1; ; k++) { if (temp < table.MaxCode[k]) { From f064d955c2b96cc6fcc169cf106631e8de31e4c8 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 31 May 2018 16:16:03 +1000 Subject: [PATCH 05/36] Baseline decoding seems to work --- .../Components/FixedInt16Buffer18.cs | 6 +- .../Components/FixedInt64Buffer18.cs | 6 +- .../PdfJsPort/Components/PdfJsHuffmanTable.cs | 22 +++--- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 70 ++++++++++--------- .../Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs | 6 +- 5 files changed, 58 insertions(+), 52 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer18.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer18.cs index 20d4b7733..b193bf59e 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer18.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer18.cs @@ -9,14 +9,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components [StructLayout(LayoutKind.Sequential)] internal unsafe struct FixedInt16Buffer18 { - public fixed short Data[18]; + public fixed int Data[18]; - public short this[int idx] + public int this[int idx] { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - ref short self = ref Unsafe.As(ref this); + ref int self = ref Unsafe.As(ref this); return Unsafe.Add(ref self, idx); } } diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt64Buffer18.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt64Buffer18.cs index 51381cb27..a9266bd6b 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt64Buffer18.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt64Buffer18.cs @@ -9,14 +9,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components [StructLayout(LayoutKind.Sequential)] internal unsafe struct FixedInt64Buffer18 { - public fixed long Data[18]; + public fixed uint Data[18]; - public long this[int idx] + public uint this[int idx] { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - ref long self = ref Unsafe.As(ref this); + ref uint self = ref Unsafe.As(ref this); return Unsafe.Add(ref self, idx); } } diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs index a63573030..fb18340ad 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs @@ -57,15 +57,15 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int k = 0; fixed (short* size = this.Sizes.Data) - fixed (short* delta = this.ValOffset.Data) - fixed (long* maxcode = this.MaxCode.Data) + fixed (int* delta = this.ValOffset.Data) + fixed (uint* maxcode = this.MaxCode.Data) { uint code = 0; int j; for (j = 1; j <= 16; j++) { // Compute delta to add to code to compute symbol id. - delta[j] = (short)(k - code); + delta[j] = (int)(k - code); if (size[k] == j) { while (size[k] == j) @@ -89,8 +89,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components fixed (byte* lookaheadRef = this.Lookahead.Data) { const int FastBits = ScanDecoder.FastBits; - var fast = new Span(lookaheadRef, 1 << FastBits); - fast.Fill(255); // Flag for non-accelerated + var fast = new Span(lookaheadRef, 1 << FastBits); + fast.Fill(0xFF); // Flag for non-accelerated fixed (short* sizesRef = this.Sizes.Data) { @@ -181,8 +181,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// The huffman code span ref private void GenerateDecoderTables(ReadOnlySpan lengths, ref short huffcodeRef) { - fixed (short* valOffsetRef = this.ValOffset.Data) - fixed (long* maxcodeRef = this.MaxCode.Data) + fixed (int* valOffsetRef = this.ValOffset.Data) + fixed (uint* maxcodeRef = this.MaxCode.Data) { short bitcount = 0; for (int i = 1; i <= 16; i++) @@ -190,18 +190,18 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components if (lengths[i] != 0) { // valOffsetRef[l] = huffcodeRef[] index of 1st symbol of code length i, minus the minimum code of length i - valOffsetRef[i] = (short)(bitcount - Unsafe.Add(ref huffcodeRef, bitcount)); + valOffsetRef[i] = (int)(bitcount - Unsafe.Add(ref huffcodeRef, bitcount)); bitcount += lengths[i]; - maxcodeRef[i] = Unsafe.Add(ref huffcodeRef, bitcount - 1) << (16 - i); // maximum code of length i preshifted for faster reading later + maxcodeRef[i] = (uint)Unsafe.Add(ref huffcodeRef, bitcount - 1) << (16 - i); // maximum code of length i preshifted for faster reading later } else { - maxcodeRef[i] = -1; // -1 if no codes of this length + // maxcodeRef[i] = -1; // -1 if no codes of this length } } valOffsetRef[17] = 0; - maxcodeRef[17] = 0xFFFFFFFFL; + maxcodeRef[17] = 0xFFFFFFFF; } } diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 8322be2fe..9aec5173b 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -148,32 +148,39 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { for (int i = 0; i < mcusPerLine; i++) { - // Scan an interleaved mcu... process components in order - for (int k = 0; k < this.componentsLength; k++) + try { - PdfJsFrameComponent component = this.components[k]; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - Span fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); - int h = component.HorizontalSamplingFactor; - int v = component.VerticalSamplingFactor; - - // Scan out an mcu's worth of this component; that's just determined - // by the basic H and V specified for the component - for (int y = 0; y < v; y++) + // Scan an interleaved mcu... process components in order + for (int k = 0; k < this.componentsLength; k++) { - for (int x = 0; x < h; x++) + PdfJsFrameComponent component = this.components[k]; + ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; + Span fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + int h = component.HorizontalSamplingFactor; + int v = component.VerticalSamplingFactor; + + // Scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (int y = 0; y < v; y++) { - int mcuRow = mcu / mcusPerLine; - int mcuCol = mcu % mcusPerLine; - int blockRow = (mcuRow * v) + y; - int blockCol = (mcuCol * h) + x; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, fastAC); + for (int x = 0; x < h; x++) + { + int mcuRow = mcu / mcusPerLine; + int mcuCol = mcu % mcusPerLine; + int blockRow = (mcuRow * v) + y; + int blockCol = (mcuCol * h) + x; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, fastAC); + } } } } + catch + { + break; + } // After all interleaved components, that's an interleaved MCU, // so now count down the restart interval @@ -207,7 +214,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref short blockDataRef, ref PdfJsHuffmanTable dcTable, ref PdfJsHuffmanTable acTable, - Span fac) + Span fastAc) { this.CheckBits(); int t = this.DecodeHuffman(ref dcTable); @@ -217,7 +224,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components throw new ImageFormatException("Bad Huffman code"); } - int diff = t > 0 ? this.ExtendReceive(t) : 0; + int diff = t != 0 ? this.ExtendReceive(t) : 0; int dc = component.DcPredictor + diff; component.DcPredictor = dc; blockDataRef = (short)dc; @@ -231,9 +238,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components this.CheckBits(); int c = this.PeekBits(); - int r = fac[c]; + int r = fastAc[c]; - if (r > 0) + if (r != 0) { // Fast AC path k += (r >> 4) & 15; // Run @@ -587,7 +594,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components // if the code is <= FastBits. int c = this.PeekBits(); int k = table.Lookahead[c]; - if (k < byte.MaxValue) + if (k < 0xFF) { int s = table.Sizes[k]; if (s > this.codeBits) @@ -628,7 +635,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } // Convert the huffman code to the symbol id - c = (int)((this.codeBuffer >> (32 - k)) & Bmask[k]) + table.ValOffset[k]; + c = (int)(((this.codeBuffer >> (32 - k)) & Bmask[k]) + table.ValOffset[k]); // Convert the id to a symbol this.codeBits -= k; @@ -644,7 +651,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components this.GrowBufferUnsafe(); } - int sgn = (int)(this.codeBuffer >> 31); + int sgn = (int)((int)this.codeBuffer >> 31); uint k = this.Lrot(this.codeBuffer, n); this.codeBuffer = k & ~Bmask[n]; k &= Bmask[n]; @@ -655,7 +662,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components [MethodImpl(MethodImplOptions.AggressiveInlining)] private void CheckBits() { - if (this.codeBuffer < 16) + if (this.codeBits < 16) { this.GrowBufferUnsafe(); } @@ -664,7 +671,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components [MethodImpl(MethodImplOptions.AggressiveInlining)] private int PeekBits() { - return (int)(this.codeBuffer >> ((32 - FastBits) & ((1 << FastBits) - 1))); + return (int)((this.codeBuffer >> (32 - FastBits)) & ((1 << FastBits) - 1)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -693,11 +700,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } this.marker = PdfJsJpegConstants.Markers.Prefix; - this.todo = this.restartInterval > 0 ? this.restartInterval : 0x7FFFFFFF; this.eobrun = 0; - // No more than 1<<31 MCUs if no restartInterval? that's plenty safe, - // since we don't even allow 1<<30 pixels + // No more than 1<<31 MCUs if no restartInterval? that's plenty safe since we don't even allow 1<<30 pixels + this.todo = this.restartInterval > 0 ? this.restartInterval : 0x7FFFFFFF; } } } \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs index 5bf4ab5aa..f1d105388 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs @@ -808,9 +808,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort sd.ParseEntropyCodedData(this.Frame, this.dcHuffmanTables, this.acHuffmanTables, this.fastACTables); - //var scanDecoder = default(PdfJsScanDecoder); - - //scanDecoder.DecodeScan( + // var scanDecoder = default(PdfJsScanDecoder); + // + // scanDecoder.DecodeScan( // this.Frame, // this.InputStream, // this.dcHuffmanTables, From bdd3291d69c78e4b7c5d6219e9268fc523c005d2 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 31 May 2018 18:37:43 +1000 Subject: [PATCH 06/36] Update reference types --- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 9aec5173b..9a9348f7f 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -4,8 +4,7 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; - -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Memory; namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components @@ -64,7 +63,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components this.dctZigZag = ZigZag.CreateUnzigTable(); this.stream = stream; this.components = components; - this.marker = PdfJsJpegConstants.Markers.Prefix; + this.marker = JpegConstants.Markers.XFF; this.componentIndex = componentIndex; this.componentsLength = componentsLength; this.restartInterval = restartInterval; @@ -532,7 +531,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components this.GrowBufferUnsafe(); } - uint k = this.Lrot(this.codeBuffer, n); + uint k = this.LRot(this.codeBuffer, n); this.codeBuffer = k & ~Bmask[n]; k &= Bmask[n]; this.codeBits -= n; @@ -554,17 +553,18 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components return (int)(k & 0x80000000); } + [MethodImpl(MethodImplOptions.NoInlining)] private void GrowBufferUnsafe() { do { // TODO: EOF int b = this.nomore ? 0 : this.stream.ReadByte(); - if (b == PdfJsJpegConstants.Markers.Prefix) + if (b == JpegConstants.Markers.XFF) { long position = this.stream.Position - 1; int c = this.stream.ReadByte(); - while (c == PdfJsJpegConstants.Markers.Prefix) + while (c == JpegConstants.Markers.XFF) { if (c != 0) { @@ -586,6 +586,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components while (this.codeBits <= 24); } + // TODO: Split into Fast/Slow and inline Fast private int DecodeHuffman(ref PdfJsHuffmanTable table) { this.CheckBits(); @@ -651,8 +652,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components this.GrowBufferUnsafe(); } - int sgn = (int)((int)this.codeBuffer >> 31); - uint k = this.Lrot(this.codeBuffer, n); + int sgn = (int)this.codeBuffer >> 31; + uint k = this.LRot(this.codeBuffer, n); this.codeBuffer = k & ~Bmask[n]; k &= Bmask[n]; this.codeBits -= n; @@ -675,7 +676,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private uint Lrot(uint x, int y) + private uint LRot(uint x, int y) { return (x << y) | (x >> (32 - y)); } @@ -683,7 +684,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components [MethodImpl(MethodImplOptions.AggressiveInlining)] private bool IsRestartMarker(byte x) { - return x >= PdfJsJpegConstants.Markers.RST0 && x <= PdfJsJpegConstants.Markers.RST7; + return x >= JpegConstants.Markers.RST0 && x <= JpegConstants.Markers.RST7; } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -699,7 +700,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components c.DcPredictor = 0; } - this.marker = PdfJsJpegConstants.Markers.Prefix; + this.marker = JpegConstants.Markers.XFF; this.eobrun = 0; // No more than 1<<31 MCUs if no restartInterval? that's plenty safe since we don't even allow 1<<30 pixels From 9e59ac19e0c27920fdfc8148f02492283204a6bd Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 30 Jun 2018 11:16:35 +1000 Subject: [PATCH 07/36] 6/10 baseline images now pass. --- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 9a9348f7f..f1edd55de 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -562,21 +562,17 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int b = this.nomore ? 0 : this.stream.ReadByte(); if (b == JpegConstants.Markers.XFF) { - long position = this.stream.Position - 1; int c = this.stream.ReadByte(); while (c == JpegConstants.Markers.XFF) { - if (c != 0) - { - this.marker = (byte)c; - this.nomore = true; - if (!this.IsRestartMarker(this.marker)) - { - this.stream.Position = position; - } + c = this.stream.ReadByte(); + } - return; - } + if (c != 0) + { + this.marker = (byte)c; + this.nomore = true; + return; } } @@ -586,7 +582,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components while (this.codeBits <= 24); } - // TODO: Split into Fast/Slow and inline Fast + [MethodImpl(MethodImplOptions.AggressiveInlining)] private int DecodeHuffman(ref PdfJsHuffmanTable table) { this.CheckBits(); @@ -608,6 +604,12 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components return table.Values[k]; } + return this.DecodeHuffmanSlow(ref table); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private int DecodeHuffmanSlow(ref PdfJsHuffmanTable table) + { // Naive test is to shift the code_buffer down so k bits are // valid, then test against MaxCode. To speed this up, we've // preshifted maxcode left so that it has (16-k) 0s at the @@ -615,6 +617,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components // wants to be compared against something shifted to have 16; // that way we don't need to shift inside the loop. uint temp = this.codeBuffer >> 16; + int k; for (k = FastBits + 1; ; k++) { if (temp < table.MaxCode[k]) @@ -636,7 +639,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } // Convert the huffman code to the symbol id - c = (int)(((this.codeBuffer >> (32 - k)) & Bmask[k]) + table.ValOffset[k]); + int c = (int)(((this.codeBuffer >> (32 - k)) & Bmask[k]) + table.ValOffset[k]); // Convert the id to a symbol this.codeBits -= k; From 588e423410a57cc9efd3abb7a76ca086d9912117 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 30 Jun 2018 19:08:00 +1000 Subject: [PATCH 08/36] 9/10 baseline now pass! --- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 51 ++++++++----------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 61482569a..21763c522 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -118,7 +118,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components mcu++; // Every data block is an MCU, so countdown the restart interval - if (this.todo-- <= 0) + if (--this.todo <= 0) { if (this.codeBits < 24) { @@ -147,44 +147,37 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { for (int i = 0; i < mcusPerLine; i++) { - try + // Scan an interleaved mcu... process components in order + for (int k = 0; k < this.componentsLength; k++) { - // Scan an interleaved mcu... process components in order - for (int k = 0; k < this.componentsLength; k++) + PdfJsFrameComponent component = this.components[k]; + ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; + Span fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + int h = component.HorizontalSamplingFactor; + int v = component.VerticalSamplingFactor; + + // Scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (int y = 0; y < v; y++) { - PdfJsFrameComponent component = this.components[k]; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - Span fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); - int h = component.HorizontalSamplingFactor; - int v = component.VerticalSamplingFactor; - - // Scan out an mcu's worth of this component; that's just determined - // by the basic H and V specified for the component - for (int y = 0; y < v; y++) + for (int x = 0; x < h; x++) { - for (int x = 0; x < h; x++) - { - int mcuRow = mcu / mcusPerLine; - int mcuCol = mcu % mcusPerLine; - int blockRow = (mcuRow * v) + y; - int blockCol = (mcuCol * h) + x; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, fastAC); - } + int mcuRow = mcu / mcusPerLine; + int mcuCol = mcu % mcusPerLine; + int blockRow = (mcuRow * v) + y; + int blockCol = (mcuCol * h) + x; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, fastAC); } } } - catch - { - break; - } // After all interleaved components, that's an interleaved MCU, // so now count down the restart interval mcu++; - if (this.todo-- <= 0) + if (--this.todo <= 0) { if (this.codeBits < 24) { From 681f99f9145a1ca2a81553028e5931ccc0d34c25 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sun, 1 Jul 2018 02:01:29 +1000 Subject: [PATCH 09/36] Can now decode baseline + progressive --- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 207 ++++++++++++++++-- 1 file changed, 187 insertions(+), 20 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 21763c522..6c781dc8d 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -25,7 +25,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components private int codeBits; private uint codeBuffer; private bool nomore; + private bool eof; private byte marker; + private bool badMarker; + private long markerPosition; private int todo; private int restartInterval; @@ -64,6 +67,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components this.stream = stream; this.components = components; this.marker = JpegConstants.Markers.XFF; + this.markerPosition = 0; this.componentIndex = componentIndex; this.componentsLength = componentsLength; this.restartInterval = restartInterval; @@ -104,13 +108,18 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - Span fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); int mcu = 0; for (int j = 0; j < h; j++) { for (int i = 0; i < w; i++) { + if (this.eof) + { + continue; + } + int blockRow = mcu / w; int blockCol = mcu % w; int offset = component.GetBlockBufferOffset(blockRow, blockCol); @@ -154,7 +163,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - Span fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); int h = component.HorizontalSamplingFactor; int v = component.VerticalSamplingFactor; @@ -164,6 +173,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { for (int x = 0; x < h; x++) { + if (this.eof) + { + continue; + } + int mcuRow = mcu / mcusPerLine; int mcuCol = mcu % mcusPerLine; int blockRow = (mcuRow * v) + y; @@ -197,6 +211,138 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } } + else + { + if (this.componentsLength == 1) + { + PdfJsFrameComponent component = this.components[this.componentIndex]; + + // Non-interleaved data, we just need to process one block at a time, + // in trivial scanline order + // number of blocks to do just depends on how many actual "pixels" this + // component has, independent of interleaved MCU blocking and such + int w = component.WidthInBlocks; + int h = component.HeightInBlocks; + ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; + ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + + int mcu = 0; + for (int j = 0; j < h; j++) + { + for (int i = 0; i < w; i++) + { + if (this.eof) + { + continue; + } + + int blockRow = mcu / w; + int blockCol = mcu % w; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); + + if (this.spectralStart == 0) + { + this.DecodeBlockProgressiveDC(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable); + } + else + { + this.DecodeBlockProgressiveAC(ref Unsafe.Add(ref blockDataRef, offset), ref acHuffmanTable, fastAC); + } + + mcu++; + + // Every data block is an MCU, so countdown the restart interval + if (--this.todo <= 0) + { + if (this.codeBits < 24) + { + this.GrowBufferUnsafe(); + } + + // If it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!this.IsRestartMarker(this.marker)) + { + return 1; + } + + this.Reset(); + } + } + } + } + else + { + // Interleaved + int mcu = 0; + int mcusPerColumn = frame.McusPerColumn; + int mcusPerLine = frame.McusPerLine; + for (int j = 0; j < mcusPerColumn; j++) + { + for (int i = 0; i < mcusPerLine; i++) + { + // Scan an interleaved mcu... process components in order + for (int k = 0; k < this.componentsLength; k++) + { + PdfJsFrameComponent component = this.components[k]; + ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; + ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + int h = component.HorizontalSamplingFactor; + int v = component.VerticalSamplingFactor; + + // Scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (int y = 0; y < v; y++) + { + for (int x = 0; x < h; x++) + { + if (this.eof) + { + continue; + } + + int mcuRow = mcu / mcusPerLine; + int mcuCol = mcu % mcusPerLine; + int blockRow = (mcuRow * v) + y; + int blockCol = (mcuCol * h) + x; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlockProgressiveDC(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable); + } + } + } + + // After all interleaved components, that's an interleaved MCU, + // so now count down the restart interval + mcu++; + if (--this.todo <= 0) + { + if (this.codeBits < 24) + { + this.GrowBufferUnsafe(); + } + + // If it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!this.IsRestartMarker(this.marker)) + { + return 1; + } + + this.Reset(); + } + } + } + } + } + + if (this.badMarker) + { + this.stream.Position = this.markerPosition; + } return 1; } @@ -206,7 +352,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref short blockDataRef, ref PdfJsHuffmanTable dcTable, ref PdfJsHuffmanTable acTable, - Span fastAc) + ReadOnlySpan fastAc) { this.CheckBits(); int t = this.DecodeHuffman(ref dcTable); @@ -295,7 +441,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { // First scan for DC coefficient, must be first int t = this.DecodeHuffman(ref dcTable); - int diff = t > 0 ? this.ExtendReceive(t) : 0; + int diff = t != 0 ? this.ExtendReceive(t) : 0; int dc = component.DcPredictor + diff; component.DcPredictor = dc; @@ -305,7 +451,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components else { // Refinement scan for DC coefficient - if (this.GetBit() > 0) + if (this.GetBit() != 0) { blockDataRef += (short)(1 << this.successiveLow); } @@ -315,10 +461,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } private int DecodeBlockProgressiveAC( - PdfJsFrameComponent component, ref short blockDataRef, ref PdfJsHuffmanTable acTable, - Span fac) + ReadOnlySpan fastAc) { int k; @@ -331,7 +476,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { int shift = this.successiveLow; - if (this.eobrun > 0) + if (this.eobrun != 0) { this.eobrun--; return 1; @@ -345,9 +490,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components this.CheckBits(); int c = this.PeekBits(); - int r = fac[c]; + int r = fastAc[c]; - if (r > 0) + if (r != 0) { // Fast AC path k += (r >> 4) & 15; // Run @@ -376,7 +521,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components if (r < 15) { this.eobrun = 1 << r; - if (r > 0) + if (r != 0) { this.eobrun += this.GetBits(r); } @@ -402,15 +547,15 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components // Refinement scan for these AC coefficients short bit = (short)(1 << this.successiveLow); - if (this.eobrun > 0) + if (this.eobrun != 0) { this.eobrun--; - for (k = this.spectralStart; k < this.spectralEnd; k++) + for (k = this.spectralStart; k <= this.spectralEnd; k++) { ref short p = ref Unsafe.Add(ref blockDataRef, this.dctZigZag[k]); if (p != 0) { - if (this.GetBit() > 0) + if (this.GetBit() != 0) { if ((p & bit) == 0) { @@ -450,7 +595,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { this.eobrun = (1 << r) - 1; - if (r > 0) + if (r != 0) { this.eobrun += this.GetBits(r); } @@ -466,13 +611,13 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } // Sign bit - if (this.GetBit() > 0) + if (this.GetBit() != 0) { s = bit; } else { - s -= bit; + s = -bit; } } @@ -482,7 +627,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref short p = ref Unsafe.Add(ref blockDataRef, this.dctZigZag[k++]); if (p != 0) { - if (this.GetBit() > 0) + if (this.GetBit() != 0) { if ((p & bit) == 0) { @@ -553,18 +698,38 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { // TODO: EOF int b = this.nomore ? 0 : this.stream.ReadByte(); + + if (b == -1) + { + this.eof = true; + b = 0; + } + if (b == JpegConstants.Markers.XFF) { + this.markerPosition = this.stream.Position - 1; int c = this.stream.ReadByte(); while (c == JpegConstants.Markers.XFF) { c = this.stream.ReadByte(); + + if (c == -1) + { + this.eof = true; + c = 0; + break; + } } if (c != 0) { this.marker = (byte)c; this.nomore = true; + if (!this.IsRestartMarker(this.marker)) + { + this.badMarker = true; + } + return; } } @@ -688,7 +853,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { this.codeBits = 0; this.codeBuffer = 0; - this.nomore = false; for (int i = 0; i < this.components.Length; i++) { @@ -696,11 +860,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components c.DcPredictor = 0; } + this.nomore = false; this.marker = JpegConstants.Markers.XFF; + this.markerPosition = 0; + this.badMarker = false; this.eobrun = 0; // No more than 1<<31 MCUs if no restartInterval? that's plenty safe since we don't even allow 1<<30 pixels - this.todo = this.restartInterval > 0 ? this.restartInterval : 0x7FFFFFFF; + this.todo = this.restartInterval > 0 ? this.restartInterval : int.MaxValue; } } } \ No newline at end of file From c69c3aca1338c6bdf5873a0ce85d93698b3a2d02 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sun, 1 Jul 2018 16:11:31 +1000 Subject: [PATCH 10/36] Split decode method. --- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 426 +++++++++--------- 1 file changed, 223 insertions(+), 203 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 6c781dc8d..8b5ed0c05 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -84,8 +84,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// The DC Huffman tables. /// The AC Huffman tables. /// The fast AC decoding tables. - /// The - public int ParseEntropyCodedData( + public void ParseEntropyCodedData( PdfJsFrame frame, PdfJsHuffmanTables dcHuffmanTables, PdfJsHuffmanTables acHuffmanTables, @@ -95,256 +94,272 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components if (!frame.Progressive) { - if (this.componentsLength == 1) + this.ParseBaselineData(frame, dcHuffmanTables, acHuffmanTables, fastACTables); + } + else + { + this.ParseProgressiveData(frame, dcHuffmanTables, acHuffmanTables, fastACTables); + } + + if (this.badMarker) + { + this.stream.Position = this.markerPosition; + } + } + + private void ParseBaselineData( + PdfJsFrame frame, + PdfJsHuffmanTables dcHuffmanTables, + PdfJsHuffmanTables acHuffmanTables, + FastACTables fastACTables) + { + if (this.componentsLength == 1) + { + PdfJsFrameComponent component = this.components[this.componentIndex]; + + // Non-interleaved data, we just need to process one block at a time, + // in trivial scanline order + // number of blocks to do just depends on how many actual "pixels" this + // component has, independent of interleaved MCU blocking and such + int w = component.WidthInBlocks; + int h = component.HeightInBlocks; + ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; + ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + + int mcu = 0; + for (int j = 0; j < h; j++) { - PdfJsFrameComponent component = this.components[this.componentIndex]; - - // Non-interleaved data, we just need to process one block at a time, - // in trivial scanline order - // number of blocks to do just depends on how many actual "pixels" this - // component has, independent of interleaved MCU blocking and such - int w = component.WidthInBlocks; - int h = component.HeightInBlocks; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); - - int mcu = 0; - for (int j = 0; j < h; j++) + for (int i = 0; i < w; i++) { - for (int i = 0; i < w; i++) + if (this.eof) { - if (this.eof) - { - continue; - } + return; + } - int blockRow = mcu / w; - int blockCol = mcu % w; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, fastAC); - mcu++; + int blockRow = mcu / w; + int blockCol = mcu % w; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, fastAC); + mcu++; - // Every data block is an MCU, so countdown the restart interval - if (--this.todo <= 0) + // Every data block is an MCU, so countdown the restart interval + if (--this.todo <= 0) + { + if (this.codeBits < 24) { - if (this.codeBits < 24) - { - this.GrowBufferUnsafe(); - } - - // If it's NOT a restart, then just bail, so we get corrupt data - // rather than no data - if (!this.IsRestartMarker(this.marker)) - { - return 1; - } + this.GrowBufferUnsafe(); + } - this.Reset(); + // If it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!this.ContinueOnRestart()) + { + return; } + + this.Reset(); } } } - else + } + else + { + // Interleaved + int mcu = 0; + int mcusPerColumn = frame.McusPerColumn; + int mcusPerLine = frame.McusPerLine; + for (int j = 0; j < mcusPerColumn; j++) { - // Interleaved - int mcu = 0; - int mcusPerColumn = frame.McusPerColumn; - int mcusPerLine = frame.McusPerLine; - for (int j = 0; j < mcusPerColumn; j++) + for (int i = 0; i < mcusPerLine; i++) { - for (int i = 0; i < mcusPerLine; i++) + // Scan an interleaved mcu... process components in order + for (int k = 0; k < this.componentsLength; k++) { - // Scan an interleaved mcu... process components in order - for (int k = 0; k < this.componentsLength; k++) + PdfJsFrameComponent component = this.components[k]; + ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; + ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + int h = component.HorizontalSamplingFactor; + int v = component.VerticalSamplingFactor; + + // Scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (int y = 0; y < v; y++) { - PdfJsFrameComponent component = this.components[k]; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); - int h = component.HorizontalSamplingFactor; - int v = component.VerticalSamplingFactor; - - // Scan out an mcu's worth of this component; that's just determined - // by the basic H and V specified for the component - for (int y = 0; y < v; y++) + for (int x = 0; x < h; x++) { - for (int x = 0; x < h; x++) + if (this.eof) { - if (this.eof) - { - continue; - } - - int mcuRow = mcu / mcusPerLine; - int mcuCol = mcu % mcusPerLine; - int blockRow = (mcuRow * v) + y; - int blockCol = (mcuCol * h) + x; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, fastAC); + return; } + + int mcuRow = mcu / mcusPerLine; + int mcuCol = mcu % mcusPerLine; + int blockRow = (mcuRow * v) + y; + int blockCol = (mcuCol * h) + x; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, fastAC); } } + } - // After all interleaved components, that's an interleaved MCU, - // so now count down the restart interval - mcu++; - if (--this.todo <= 0) + // After all interleaved components, that's an interleaved MCU, + // so now count down the restart interval + mcu++; + if (--this.todo <= 0) + { + if (this.codeBits < 24) { - if (this.codeBits < 24) - { - this.GrowBufferUnsafe(); - } - - // If it's NOT a restart, then just bail, so we get corrupt data - // rather than no data - if (!this.IsRestartMarker(this.marker)) - { - return 1; - } + this.GrowBufferUnsafe(); + } - this.Reset(); + // If it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!this.ContinueOnRestart()) + { + return; } + + this.Reset(); } } } } - else + } + + private void ParseProgressiveData( + PdfJsFrame frame, + PdfJsHuffmanTables dcHuffmanTables, + PdfJsHuffmanTables acHuffmanTables, + FastACTables fastACTables) + { + if (this.componentsLength == 1) { - if (this.componentsLength == 1) + PdfJsFrameComponent component = this.components[this.componentIndex]; + + // Non-interleaved data, we just need to process one block at a time, + // in trivial scanline order + // number of blocks to do just depends on how many actual "pixels" this + // component has, independent of interleaved MCU blocking and such + int w = component.WidthInBlocks; + int h = component.HeightInBlocks; + ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; + ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + + int mcu = 0; + for (int j = 0; j < h; j++) { - PdfJsFrameComponent component = this.components[this.componentIndex]; - - // Non-interleaved data, we just need to process one block at a time, - // in trivial scanline order - // number of blocks to do just depends on how many actual "pixels" this - // component has, independent of interleaved MCU blocking and such - int w = component.WidthInBlocks; - int h = component.HeightInBlocks; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); - - int mcu = 0; - for (int j = 0; j < h; j++) + for (int i = 0; i < w; i++) { - for (int i = 0; i < w; i++) + if (this.eof) { - if (this.eof) - { - continue; - } + return; + } - int blockRow = mcu / w; - int blockCol = mcu % w; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); + int blockRow = mcu / w; + int blockCol = mcu % w; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); - if (this.spectralStart == 0) - { - this.DecodeBlockProgressiveDC(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable); - } - else - { - this.DecodeBlockProgressiveAC(ref Unsafe.Add(ref blockDataRef, offset), ref acHuffmanTable, fastAC); - } + if (this.spectralStart == 0) + { + this.DecodeBlockProgressiveDC(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable); + } + else + { + this.DecodeBlockProgressiveAC(ref Unsafe.Add(ref blockDataRef, offset), ref acHuffmanTable, fastAC); + } - mcu++; + mcu++; - // Every data block is an MCU, so countdown the restart interval - if (--this.todo <= 0) + // Every data block is an MCU, so countdown the restart interval + if (--this.todo <= 0) + { + if (this.codeBits < 24) { - if (this.codeBits < 24) - { - this.GrowBufferUnsafe(); - } - - // If it's NOT a restart, then just bail, so we get corrupt data - // rather than no data - if (!this.IsRestartMarker(this.marker)) - { - return 1; - } + this.GrowBufferUnsafe(); + } - this.Reset(); + // If it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!this.ContinueOnRestart()) + { + return; } + + this.Reset(); } } } - else + } + else + { + // Interleaved + int mcu = 0; + int mcusPerColumn = frame.McusPerColumn; + int mcusPerLine = frame.McusPerLine; + for (int j = 0; j < mcusPerColumn; j++) { - // Interleaved - int mcu = 0; - int mcusPerColumn = frame.McusPerColumn; - int mcusPerLine = frame.McusPerLine; - for (int j = 0; j < mcusPerColumn; j++) + for (int i = 0; i < mcusPerLine; i++) { - for (int i = 0; i < mcusPerLine; i++) + // Scan an interleaved mcu... process components in order + for (int k = 0; k < this.componentsLength; k++) { - // Scan an interleaved mcu... process components in order - for (int k = 0; k < this.componentsLength; k++) + PdfJsFrameComponent component = this.components[k]; + ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; + ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + int h = component.HorizontalSamplingFactor; + int v = component.VerticalSamplingFactor; + + // Scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (int y = 0; y < v; y++) { - PdfJsFrameComponent component = this.components[k]; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); - int h = component.HorizontalSamplingFactor; - int v = component.VerticalSamplingFactor; - - // Scan out an mcu's worth of this component; that's just determined - // by the basic H and V specified for the component - for (int y = 0; y < v; y++) + for (int x = 0; x < h; x++) { - for (int x = 0; x < h; x++) + if (this.eof) { - if (this.eof) - { - continue; - } - - int mcuRow = mcu / mcusPerLine; - int mcuCol = mcu % mcusPerLine; - int blockRow = (mcuRow * v) + y; - int blockCol = (mcuCol * h) + x; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeBlockProgressiveDC(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable); + return; } + + int mcuRow = mcu / mcusPerLine; + int mcuCol = mcu % mcusPerLine; + int blockRow = (mcuRow * v) + y; + int blockCol = (mcuCol * h) + x; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlockProgressiveDC(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable); } } + } - // After all interleaved components, that's an interleaved MCU, - // so now count down the restart interval - mcu++; - if (--this.todo <= 0) + // After all interleaved components, that's an interleaved MCU, + // so now count down the restart interval + mcu++; + if (--this.todo <= 0) + { + if (this.codeBits < 24) { - if (this.codeBits < 24) - { - this.GrowBufferUnsafe(); - } - - // If it's NOT a restart, then just bail, so we get corrupt data - // rather than no data - if (!this.IsRestartMarker(this.marker)) - { - return 1; - } + this.GrowBufferUnsafe(); + } - this.Reset(); + // If it's NOT a restart, then just bail, so we get corrupt data + // rather than no data + if (!this.ContinueOnRestart()) + { + return; } + + this.Reset(); } } } } - - if (this.badMarker) - { - this.stream.Position = this.markerPosition; - } - - return 1; } private int DecodeBlock( @@ -696,7 +711,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { do { - // TODO: EOF int b = this.nomore ? 0 : this.stream.ReadByte(); if (b == -1) @@ -725,7 +739,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { this.marker = (byte)c; this.nomore = true; - if (!this.IsRestartMarker(this.marker)) + if (!this.HasRestart()) { this.badMarker = true; } @@ -831,21 +845,27 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int PeekBits() - { - return (int)((this.codeBuffer >> (32 - FastBits)) & ((1 << FastBits) - 1)); - } + private int PeekBits() => (int)((this.codeBuffer >> (32 - FastBits)) & ((1 << FastBits) - 1)); [MethodImpl(MethodImplOptions.AggressiveInlining)] - private uint LRot(uint x, int y) + private uint LRot(uint x, int y) => (x << y) | (x >> (32 - y)); + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private bool ContinueOnRestart() { - return (x << y) | (x >> (32 - y)); + if (this.badMarker) + { + this.stream.Position = this.markerPosition; + } + + return this.HasRestart(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private bool IsRestartMarker(byte x) + private bool HasRestart() { - return x >= JpegConstants.Markers.RST0 && x <= JpegConstants.Markers.RST7; + byte m = this.marker; + return m >= JpegConstants.Markers.RST0 && m <= JpegConstants.Markers.RST7; } [MethodImpl(MethodImplOptions.AggressiveInlining)] From 1a79cfb0022544db3da6c645d396932b833a32ad Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sun, 1 Jul 2018 16:26:06 +1000 Subject: [PATCH 11/36] void methods --- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 8b5ed0c05..bdf87bac5 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -362,7 +362,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } - private int DecodeBlock( + private void DecodeBlock( PdfJsFrameComponent component, ref short blockDataRef, ref PdfJsHuffmanTable dcTable, @@ -436,11 +436,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } } while (k < 64); - - return 1; } - private int DecodeBlockProgressiveDC( + private void DecodeBlockProgressiveDC( PdfJsFrameComponent component, ref short blockDataRef, ref PdfJsHuffmanTable dcTable) @@ -471,11 +469,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components blockDataRef += (short)(1 << this.successiveLow); } } - - return 1; } - private int DecodeBlockProgressiveAC( + private void DecodeBlockProgressiveAC( ref short blockDataRef, ref PdfJsHuffmanTable acTable, ReadOnlySpan fastAc) @@ -494,7 +490,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components if (this.eobrun != 0) { this.eobrun--; - return 1; + return; } k = this.spectralStart; @@ -672,8 +668,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components while (k <= this.spectralEnd); } } - - return 1; } [MethodImpl(MethodImplOptions.AggressiveInlining)] From f2e05bfcbc6d50e7404f6cbf23d16be66af03e7d Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sun, 1 Jul 2018 16:44:35 +1000 Subject: [PATCH 12/36] Minor perf changes. --- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index bdf87bac5..8a39dab34 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -22,6 +22,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components private readonly DoubleBufferedStreamReader stream; private readonly PdfJsFrameComponent[] components; private readonly ZigZag dctZigZag; + private readonly int restartInterval; + private readonly int componentIndex; + private readonly int componentsLength; + private readonly int spectralStart; + private readonly int spectralEnd; + private readonly int successiveHigh; + private readonly int successiveLow; + private int codeBits; private uint codeBuffer; private bool nomore; @@ -29,16 +37,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components private byte marker; private bool badMarker; private long markerPosition; - private int todo; - private int restartInterval; - private int componentIndex; - private int componentsLength; private int eobrun; - private int spectralStart; - private int spectralEnd; - private int successiveHigh; - private int successiveLow; /// /// Initializes a new instance of the class. @@ -126,7 +126,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId)); int mcu = 0; for (int j = 0; j < h; j++) @@ -141,7 +141,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int blockRow = mcu / w; int blockCol = mcu % w; int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, fastAC); + this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, ref fastACRef); mcu++; // Every data block is an MCU, so countdown the restart interval @@ -181,7 +181,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId)); int h = component.HorizontalSamplingFactor; int v = component.VerticalSamplingFactor; @@ -201,7 +201,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int blockRow = (mcuRow * v) + y; int blockCol = (mcuCol * h) + x; int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, fastAC); + this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, ref fastACRef); } } } @@ -249,7 +249,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); + ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId)); int mcu = 0; for (int j = 0; j < h; j++) @@ -271,7 +271,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } else { - this.DecodeBlockProgressiveAC(ref Unsafe.Add(ref blockDataRef, offset), ref acHuffmanTable, fastAC); + this.DecodeBlockProgressiveAC(ref Unsafe.Add(ref blockDataRef, offset), ref acHuffmanTable, ref fastACRef); } mcu++; @@ -367,7 +367,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref short blockDataRef, ref PdfJsHuffmanTable dcTable, ref PdfJsHuffmanTable acTable, - ReadOnlySpan fastAc) + ref short fastACRef) { this.CheckBits(); int t = this.DecodeHuffman(ref dcTable); @@ -391,7 +391,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components this.CheckBits(); int c = this.PeekBits(); - int r = fastAc[c]; + int r = Unsafe.Add(ref fastACRef, c); if (r != 0) { @@ -474,7 +474,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components private void DecodeBlockProgressiveAC( ref short blockDataRef, ref PdfJsHuffmanTable acTable, - ReadOnlySpan fastAc) + ref short fastACRef) { int k; @@ -501,7 +501,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components this.CheckBits(); int c = this.PeekBits(); - int r = fastAc[c]; + int r = Unsafe.Add(ref fastACRef, c); if (r != 0) { From d8f4b25c63152e38a4e6b353cded883f5679282a Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sun, 1 Jul 2018 17:39:47 +1000 Subject: [PATCH 13/36] Remove unused huffman table code. --- .../PdfJsPort/Components/PdfJsHuffmanTable.cs | 198 ++++-------------- 1 file changed, 41 insertions(+), 157 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs index 16a60d187..e843ebbac 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs @@ -50,55 +50,65 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components const int Length = 257; using (IBuffer huffcode = memoryAllocator.Allocate(Length)) { - Span codes = huffcode.GetSpan(); ref short huffcodeRef = ref MemoryMarshal.GetReference(huffcode.GetSpan()); - this.GenerateSizeTable(count); - int k = 0; - fixed (short* size = this.Sizes.Data) - fixed (int* delta = this.ValOffset.Data) - fixed (uint* maxcode = this.MaxCode.Data) + // Figure C.1: make table of Huffman code length for each symbol + fixed (short* sizesRef = this.Sizes.Data) { - uint code = 0; - int j; - for (j = 1; j <= 16; j++) + short x = 0; + for (short i = 1; i < 17; i++) { - // Compute delta to add to code to compute symbol id. - delta[j] = (int)(k - code); - if (size[k] == j) + byte l = count[i]; + for (short j = 0; j < l; j++) { - while (size[k] == j) - { - codes[k++] = (short)code++; + sizesRef[x] = i; + x++; + } + } - // Unsafe.Add(ref huffcodeRef, k++) = (short)code++; + sizesRef[x] = 0; - // TODO: Throw if invalid? + // Figure C.2: generate the codes themselves + int k = 0; + fixed (int* valOffsetRef = this.ValOffset.Data) + fixed (uint* maxcodeRef = this.MaxCode.Data) + { + uint code = 0; + int j; + for (j = 1; j < 17; j++) + { + // Compute delta to add to code to compute symbol id. + valOffsetRef[j] = (int)(k - code); + if (sizesRef[k] == j) + { + while (sizesRef[k] == j) + { + Unsafe.Add(ref huffcodeRef, k++) = (short)code++; + } } + + // Figure F.15: generate decoding tables for bit-sequential decoding. + // Compute largest code + 1 for this size. preshifted as neeed later. + maxcodeRef[j] = code << (16 - j); + code <<= 1; } - // Compute largest code + 1 for this size. preshifted as neeed later. - maxcode[j] = code << (16 - j); - code <<= 1; + maxcodeRef[j] = 0xFFFFFFFF; } - maxcode[j] = 0xFFFFFFFF; - } - - fixed (byte* lookaheadRef = this.Lookahead.Data) - { - const int FastBits = ScanDecoder.FastBits; - var fast = new Span(lookaheadRef, 1 << FastBits); - fast.Fill(0xFF); // Flag for non-accelerated - - fixed (short* sizesRef = this.Sizes.Data) + // Generate non-spec lookup tables to speed up decoding. + fixed (byte* lookaheadRef = this.Lookahead.Data) { + const int FastBits = ScanDecoder.FastBits; + var fast = new Span(lookaheadRef, 1 << FastBits); + fast.Fill(0xFF); // Flag for non-accelerated + for (int i = 0; i < k; i++) { int s = sizesRef[i]; if (s <= ScanDecoder.FastBits) { - int c = codes[i] << (FastBits - s); + int c = Unsafe.Add(ref huffcodeRef, i) << (FastBits - s); int m = 1 << (FastBits - s); for (int j = 0; j < m; j++) { @@ -108,139 +118,13 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } } - - // this.GenerateCodeTable(ref huffcodeRef, Length, out int k); - // this.GenerateDecoderTables(count, ref huffcodeRef); - // this.GenerateLookaheadTables(count, values, ref huffcodeRef, k); } fixed (byte* huffValRef = this.Values.Data) { var huffValSpan = new Span(huffValRef, 256); - values.CopyTo(huffValSpan); } } - - /// - /// Figure C.1: make table of Huffman code length for each symbol - /// - /// The code lengths - private void GenerateSizeTable(ReadOnlySpan lengths) - { - fixed (short* sizesRef = this.Sizes.Data) - { - short k = 0; - for (short i = 1; i < 17; i++) - { - byte l = lengths[i]; - for (short j = 0; j < l; j++) - { - sizesRef[k] = i; - k++; - } - } - - sizesRef[k] = 0; - } - } - - /// - /// Figure C.2: generate the codes themselves - /// - /// The huffman code span ref - /// The length of the huffsize span - /// The length of any valid codes - private void GenerateCodeTable(ref short huffcodeRef, int length, out int k) - { - fixed (short* sizesRef = this.Sizes.Data) - { - k = 0; - short si = sizesRef[0]; - short code = 0; - for (short i = 0; i < length; i++) - { - while (sizesRef[k] == si) - { - Unsafe.Add(ref huffcodeRef, k) = code; - code++; - k++; - } - - code <<= 1; - si++; - } - } - } - - /// - /// Figure F.15: generate decoding tables for bit-sequential decoding - /// - /// The code lengths - /// The huffman code span ref - private void GenerateDecoderTables(ReadOnlySpan lengths, ref short huffcodeRef) - { - fixed (int* valOffsetRef = this.ValOffset.Data) - fixed (uint* maxcodeRef = this.MaxCode.Data) - { - short bitcount = 0; - for (int i = 1; i <= 16; i++) - { - if (lengths[i] != 0) - { - // valOffsetRef[l] = huffcodeRef[] index of 1st symbol of code length i, minus the minimum code of length i - valOffsetRef[i] = (int)(bitcount - Unsafe.Add(ref huffcodeRef, bitcount)); - bitcount += lengths[i]; - maxcodeRef[i] = (uint)Unsafe.Add(ref huffcodeRef, bitcount - 1) << (16 - i); // maximum code of length i preshifted for faster reading later - } - else - { - // maxcodeRef[i] = -1; // -1 if no codes of this length - } - } - - valOffsetRef[17] = 0; - maxcodeRef[17] = 0xFFFFFFFF; - } - } - - /// - /// Generates non-spec lookup tables to speed up decoding - /// - /// The code lengths - /// The huffman value array - /// The huffman code span ref - /// The lengths of any valid codes - private void GenerateLookaheadTables(ReadOnlySpan lengths, ReadOnlySpan huffval, ref short huffcodeRef, int k) - { - // TODO: Rewrite this to match stb_Image - // TODO: This generation code matches the libJpeg code but the lookahead table is not actually used yet. - // To use it we need to implement fast lookup path in PdfJsScanDecoder.DecodeHuffman - // This should yield much faster scan decoding as usually, more than 95% of the Huffman codes - // will be 8 or fewer bits long and can be handled without looping. - fixed (byte* lookaheadRef = this.Lookahead.Data) - { - const int FastBits = ScanDecoder.FastBits; - var lookaheadSpan = new Span(lookaheadRef, 1 << ScanDecoder.FastBits); - - lookaheadSpan.Fill(byte.MaxValue); // Flag for non-accelerated - fixed (short* sizesRef = this.Sizes.Data) - { - for (int i = 0; i < k; ++i) - { - int s = sizesRef[i]; - if (s <= ScanDecoder.FastBits) - { - int c = Unsafe.Add(ref huffcodeRef, i) << (FastBits - s); - int m = 1 << (FastBits - s); - for (int j = 0; j < m; ++j) - { - lookaheadRef[c + j] = (byte)i; - } - } - } - } - } - } } } \ No newline at end of file From b5e240177a4cee4e2d87828fd299ee93e907696d Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sun, 1 Jul 2018 19:48:16 +1000 Subject: [PATCH 14/36] Delete unused code. --- .../Jpeg/PdfJsPort/Components/FastACTables.cs | 2 +- .../Components/FixedByteBuffer257.cs | 24 - .../Components/FixedInt16Buffer256.cs | 24 - .../Components/PdfJsFrameComponent.cs | 2 +- .../PdfJsPort/Components/PdfJsHuffmanTable.cs | 2 +- .../PdfJsPort/Components/PdfJsScanDecoder.cs | 866 ------------------ .../Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs | 16 - 7 files changed, 3 insertions(+), 933 deletions(-) delete mode 100644 src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedByteBuffer257.cs delete mode 100644 src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer256.cs delete mode 100644 src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs index 1e608cf7a..f936f7342 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs @@ -7,7 +7,7 @@ using SixLabors.Memory; namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { /// - /// The collection of tables used for fast AC entropy scan decoding. + /// The collection of lookup tables used for fast AC entropy scan decoding. /// internal sealed class FastACTables : IDisposable { diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedByteBuffer257.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedByteBuffer257.cs deleted file mode 100644 index 301524316..000000000 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedByteBuffer257.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Six Labors and contributors. -// Licensed under the Apache License, Version 2.0. - -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct FixedByteBuffer257 - { - public fixed byte Data[257]; - - public byte this[int idx] - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get - { - ref byte self = ref Unsafe.As(ref this); - return Unsafe.Add(ref self, idx); - } - } - } -} \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer256.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer256.cs deleted file mode 100644 index 2c16a918f..000000000 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer256.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Six Labors and contributors. -// Licensed under the Apache License, Version 2.0. - -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct FixedInt16Buffer256 - { - public fixed short Data[256]; - - public short this[int idx] - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get - { - ref short self = ref Unsafe.As(ref this); - return Unsafe.Add(ref self, idx); - } - } - } -} \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs index eefe8b97e..1a10adf88 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs @@ -129,7 +129,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components this.SubSamplingDivisors = c0.SamplingFactors.DivideBy(this.SamplingFactors); } - this.SpectralBlocks = this.memoryAllocator.Allocate2D(blocksPerColumnForMcu, blocksPerLineForMcu + 1, true); + this.SpectralBlocks = this.memoryAllocator.AllocateClean2D(blocksPerColumnForMcu, blocksPerLineForMcu + 1); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs index e843ebbac..3babb449a 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs @@ -88,7 +88,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } // Figure F.15: generate decoding tables for bit-sequential decoding. - // Compute largest code + 1 for this size. preshifted as neeed later. + // Compute largest code + 1 for this size. preshifted as need later. maxcodeRef[j] = code << (16 - j); code <<= 1; } diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs deleted file mode 100644 index d524fa5d8..000000000 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs +++ /dev/null @@ -1,866 +0,0 @@ -// Copyright (c) Six Labors and contributors. -// Licensed under the Apache License, Version 2.0. - -using System; - -#if DEBUG -using System.Diagnostics; -#endif -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using SixLabors.ImageSharp.Formats.Jpeg.Components; -using SixLabors.Memory; - -namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components -{ - /// - /// Provides the means to decode a spectral scan - /// - internal struct PdfJsScanDecoder - { - private ZigZag dctZigZag; - - private byte[] markerBuffer; - - private int mcuToRead; - - private int mcusPerLine; - - private int mcu; - - private int bitsData; - - private int bitsCount; - - private int specStart; - - private int specEnd; - - private int eobrun; - - private int compIndex; - - private int successiveState; - - private int successiveACState; - - private int successiveACNextValue; - - private bool endOfStreamReached; - - private bool unexpectedMarkerReached; - - /// - /// Decodes the spectral scan - /// - /// The image frame - /// The input stream - /// The DC Huffman tables - /// The AC Huffman tables - /// The scan components - /// The component index within the array - /// The length of the components. Different to the array length - /// The reset interval - /// The spectral selection start - /// The spectral selection end - /// The successive approximation bit high end - /// The successive approximation bit low end - public void DecodeScan( - PdfJsFrame frame, - DoubleBufferedStreamReader stream, - PdfJsHuffmanTables dcHuffmanTables, - PdfJsHuffmanTables acHuffmanTables, - PdfJsFrameComponent[] components, - int componentIndex, - int componentsLength, - ushort resetInterval, - int spectralStart, - int spectralEnd, - int successivePrev, - int successive) - { - this.dctZigZag = ZigZag.CreateUnzigTable(); - this.markerBuffer = new byte[2]; - this.compIndex = componentIndex; - this.specStart = spectralStart; - this.specEnd = spectralEnd; - this.successiveState = successive; - this.endOfStreamReached = false; - this.unexpectedMarkerReached = false; - - bool progressive = frame.Progressive; - this.mcusPerLine = frame.McusPerLine; - - this.mcu = 0; - int mcuExpected; - if (componentsLength == 1) - { - mcuExpected = components[this.compIndex].WidthInBlocks * components[this.compIndex].HeightInBlocks; - } - else - { - mcuExpected = this.mcusPerLine * frame.McusPerColumn; - } - - while (this.mcu < mcuExpected) - { - // Reset interval stuff - this.mcuToRead = resetInterval != 0 ? Math.Min(mcuExpected - this.mcu, resetInterval) : mcuExpected; - for (int i = 0; i < components.Length; i++) - { - PdfJsFrameComponent c = components[i]; - c.DcPredictor = 0; - } - - this.eobrun = 0; - - if (!progressive) - { - this.DecodeScanBaseline(dcHuffmanTables, acHuffmanTables, components, componentsLength, stream); - } - else - { - bool isAc = this.specStart != 0; - bool isFirst = successivePrev == 0; - PdfJsHuffmanTables huffmanTables = isAc ? acHuffmanTables : dcHuffmanTables; - this.DecodeScanProgressive(huffmanTables, isAc, isFirst, components, componentsLength, stream); - } - - // Reset - // TODO: I do not understand why these values are reset? We should surely be tracking the bits across mcu's? - this.bitsCount = 0; - this.bitsData = 0; - this.unexpectedMarkerReached = false; - - // Some images include more scan blocks than expected, skip past those and - // attempt to find the next valid marker - PdfJsFileMarker fileMarker = PdfJsJpegDecoderCore.FindNextFileMarker(this.markerBuffer, stream); - byte marker = fileMarker.Marker; - - // RSTn - We've already read the bytes and altered the position so no need to skip - if (marker >= JpegConstants.Markers.RST0 && marker <= JpegConstants.Markers.RST7) - { - continue; - } - - if (!fileMarker.Invalid) - { - // We've found a valid marker. - // Rewind the stream to the position of the marker and break - stream.Position = fileMarker.Position; - break; - } - -#if DEBUG - Debug.WriteLine($"DecodeScan - Unexpected MCU data at {stream.Position}, next marker is: {fileMarker.Marker:X}"); -#endif - } - } - - private void DecodeScanBaseline( - PdfJsHuffmanTables dcHuffmanTables, - PdfJsHuffmanTables acHuffmanTables, - PdfJsFrameComponent[] components, - int componentsLength, - DoubleBufferedStreamReader stream) - { - if (componentsLength == 1) - { - PdfJsFrameComponent component = components[this.compIndex]; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.GetSpan())); - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - - for (int n = 0; n < this.mcuToRead; n++) - { - if (this.endOfStreamReached || this.unexpectedMarkerReached) - { - continue; - } - - this.DecodeBlockBaseline(ref dcHuffmanTable, ref acHuffmanTable, component, ref blockDataRef, stream); - this.mcu++; - } - } - else - { - for (int n = 0; n < this.mcuToRead; n++) - { - for (int i = 0; i < componentsLength; i++) - { - PdfJsFrameComponent component = components[i]; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.GetSpan())); - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - int h = component.HorizontalSamplingFactor; - int v = component.VerticalSamplingFactor; - - for (int j = 0; j < v; j++) - { - for (int k = 0; k < h; k++) - { - if (this.endOfStreamReached || this.unexpectedMarkerReached) - { - continue; - } - - this.DecodeMcuBaseline(ref dcHuffmanTable, ref acHuffmanTable, component, ref blockDataRef, j, k, stream); - } - } - } - - this.mcu++; - } - } - } - - private void DecodeScanProgressive( - PdfJsHuffmanTables huffmanTables, - bool isAC, - bool isFirst, - PdfJsFrameComponent[] components, - int componentsLength, - DoubleBufferedStreamReader stream) - { - if (componentsLength == 1) - { - PdfJsFrameComponent component = components[this.compIndex]; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.GetSpan())); - ref PdfJsHuffmanTable huffmanTable = ref huffmanTables[isAC ? component.ACHuffmanTableId : component.DCHuffmanTableId]; - - for (int n = 0; n < this.mcuToRead; n++) - { - if (this.endOfStreamReached || this.unexpectedMarkerReached) - { - continue; - } - - if (isAC) - { - if (isFirst) - { - this.DecodeBlockACFirst(ref huffmanTable, component, ref blockDataRef, stream); - } - else - { - this.DecodeBlockACSuccessive(ref huffmanTable, component, ref blockDataRef, stream); - } - } - else - { - if (isFirst) - { - this.DecodeBlockDCFirst(ref huffmanTable, component, ref blockDataRef, stream); - } - else - { - this.DecodeBlockDCSuccessive(component, ref blockDataRef, stream); - } - } - - this.mcu++; - } - } - else - { - for (int n = 0; n < this.mcuToRead; n++) - { - for (int i = 0; i < componentsLength; i++) - { - PdfJsFrameComponent component = components[i]; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.GetSpan())); - ref PdfJsHuffmanTable huffmanTable = ref huffmanTables[isAC ? component.ACHuffmanTableId : component.DCHuffmanTableId]; - int h = component.HorizontalSamplingFactor; - int v = component.VerticalSamplingFactor; - - for (int j = 0; j < v; j++) - { - for (int k = 0; k < h; k++) - { - // No need to continue here. - if (this.endOfStreamReached || this.unexpectedMarkerReached) - { - break; - } - - if (isAC) - { - if (isFirst) - { - this.DecodeMcuACFirst(ref huffmanTable, component, ref blockDataRef, j, k, stream); - } - else - { - this.DecodeMcuACSuccessive(ref huffmanTable, component, ref blockDataRef, j, k, stream); - } - } - else - { - if (isFirst) - { - this.DecodeMcuDCFirst(ref huffmanTable, component, ref blockDataRef, j, k, stream); - } - else - { - this.DecodeMcuDCSuccessive(component, ref blockDataRef, j, k, stream); - } - } - } - } - } - - this.mcu++; - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DecodeBlockBaseline(ref PdfJsHuffmanTable dcHuffmanTable, ref PdfJsHuffmanTable acHuffmanTable, PdfJsFrameComponent component, ref short blockDataRef, DoubleBufferedStreamReader stream) - { - int blockRow = this.mcu / component.WidthInBlocks; - int blockCol = this.mcu % component.WidthInBlocks; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeBaseline(component, ref blockDataRef, offset, ref dcHuffmanTable, ref acHuffmanTable, stream); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DecodeMcuBaseline(ref PdfJsHuffmanTable dcHuffmanTable, ref PdfJsHuffmanTable acHuffmanTable, PdfJsFrameComponent component, ref short blockDataRef, int row, int col, DoubleBufferedStreamReader stream) - { - int mcuRow = this.mcu / this.mcusPerLine; - int mcuCol = this.mcu % this.mcusPerLine; - int blockRow = (mcuRow * component.VerticalSamplingFactor) + row; - int blockCol = (mcuCol * component.HorizontalSamplingFactor) + col; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeBaseline(component, ref blockDataRef, offset, ref dcHuffmanTable, ref acHuffmanTable, stream); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DecodeBlockDCFirst(ref PdfJsHuffmanTable dcHuffmanTable, PdfJsFrameComponent component, ref short blockDataRef, DoubleBufferedStreamReader stream) - { - int blockRow = this.mcu / component.WidthInBlocks; - int blockCol = this.mcu % component.WidthInBlocks; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeDCFirst(component, ref blockDataRef, offset, ref dcHuffmanTable, stream); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DecodeMcuDCFirst(ref PdfJsHuffmanTable dcHuffmanTable, PdfJsFrameComponent component, ref short blockDataRef, int row, int col, DoubleBufferedStreamReader stream) - { - int mcuRow = this.mcu / this.mcusPerLine; - int mcuCol = this.mcu % this.mcusPerLine; - int blockRow = (mcuRow * component.VerticalSamplingFactor) + row; - int blockCol = (mcuCol * component.HorizontalSamplingFactor) + col; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeDCFirst(component, ref blockDataRef, offset, ref dcHuffmanTable, stream); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DecodeBlockDCSuccessive(PdfJsFrameComponent component, ref short blockDataRef, DoubleBufferedStreamReader stream) - { - int blockRow = this.mcu / component.WidthInBlocks; - int blockCol = this.mcu % component.WidthInBlocks; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeDCSuccessive(component, ref blockDataRef, offset, stream); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DecodeMcuDCSuccessive(PdfJsFrameComponent component, ref short blockDataRef, int row, int col, DoubleBufferedStreamReader stream) - { - int mcuRow = this.mcu / this.mcusPerLine; - int mcuCol = this.mcu % this.mcusPerLine; - int blockRow = (mcuRow * component.VerticalSamplingFactor) + row; - int blockCol = (mcuCol * component.HorizontalSamplingFactor) + col; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeDCSuccessive(component, ref blockDataRef, offset, stream); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DecodeBlockACFirst(ref PdfJsHuffmanTable acHuffmanTable, PdfJsFrameComponent component, ref short blockDataRef, DoubleBufferedStreamReader stream) - { - int blockRow = this.mcu / component.WidthInBlocks; - int blockCol = this.mcu % component.WidthInBlocks; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeACFirst(ref blockDataRef, offset, ref acHuffmanTable, stream); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DecodeMcuACFirst(ref PdfJsHuffmanTable acHuffmanTable, PdfJsFrameComponent component, ref short blockDataRef, int row, int col, DoubleBufferedStreamReader stream) - { - int mcuRow = this.mcu / this.mcusPerLine; - int mcuCol = this.mcu % this.mcusPerLine; - int blockRow = (mcuRow * component.VerticalSamplingFactor) + row; - int blockCol = (mcuCol * component.HorizontalSamplingFactor) + col; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeACFirst(ref blockDataRef, offset, ref acHuffmanTable, stream); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DecodeBlockACSuccessive(ref PdfJsHuffmanTable acHuffmanTable, PdfJsFrameComponent component, ref short blockDataRef, DoubleBufferedStreamReader stream) - { - int blockRow = this.mcu / component.WidthInBlocks; - int blockCol = this.mcu % component.WidthInBlocks; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeACSuccessive(ref blockDataRef, offset, ref acHuffmanTable, stream); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DecodeMcuACSuccessive(ref PdfJsHuffmanTable acHuffmanTable, PdfJsFrameComponent component, ref short blockDataRef, int row, int col, DoubleBufferedStreamReader stream) - { - int mcuRow = this.mcu / this.mcusPerLine; - int mcuCol = this.mcu % this.mcusPerLine; - int blockRow = (mcuRow * component.VerticalSamplingFactor) + row; - int blockCol = (mcuCol * component.HorizontalSamplingFactor) + col; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeACSuccessive(ref blockDataRef, offset, ref acHuffmanTable, stream); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private bool TryReadBit(DoubleBufferedStreamReader stream, out int bit) - { - if (this.bitsCount == 0) - { - if (!this.TryFillBits(stream)) - { - bit = 0; - return false; - } - } - - this.bitsCount--; - bit = (this.bitsData >> this.bitsCount) & 1; - return true; - } - - [MethodImpl(MethodImplOptions.NoInlining)] - private bool TryFillBits(DoubleBufferedStreamReader stream) - { - // TODO: Read more then 1 byte at a time. - // In LibJpegTurbo this is be 25 bits (32-7) but I cannot get this to work - // for some images, I'm assuming because I am crossing MCU boundaries and not maintining the correct buffer state. - const int MinGetBits = 7; - - if (!this.unexpectedMarkerReached) - { - // Attempt to load to the minimum bit count. - while (this.bitsCount < MinGetBits) - { - int c = stream.ReadByte(); - - switch (c) - { - case -0x1: - - // We've encountered the end of the file stream which means there's no EOI marker in the image. - this.endOfStreamReached = true; - return false; - - case JpegConstants.Markers.XFF: - int nextByte = stream.ReadByte(); - - if (nextByte == -0x1) - { - this.endOfStreamReached = true; - return false; - } - - if (nextByte != 0) - { -#if DEBUG - Debug.WriteLine($"DecodeScan - Unexpected marker {(c << 8) | nextByte:X} at {stream.Position}"); -#endif - - // We've encountered an unexpected marker. Reverse the stream and exit. - this.unexpectedMarkerReached = true; - stream.Position -= 2; - - // TODO: double check we need this. - // Fill buffer with zero bits. - if (this.bitsCount == 0) - { - this.bitsData <<= MinGetBits; - this.bitsCount = MinGetBits; - } - - return true; - } - - break; - } - - // OK, load the next byte into bitsData - this.bitsData = (this.bitsData << 8) | c; - this.bitsCount += 8; - } - } - - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int PeekBits(int count) - { - return this.bitsData >> (this.bitsCount - count) & ((1 << count) - 1); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DropBits(int count) - { - this.bitsCount -= count; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private bool TryDecodeHuffman(ref PdfJsHuffmanTable tree, DoubleBufferedStreamReader stream, out short value) - { - value = -1; - - // TODO: Implement fast Huffman decoding. - // In LibJpegTurbo a minimum of 25 bits (32-7) is collected from the stream - // Then a LUT is used to avoid the loop when decoding the Huffman value. - // using 3 methods: FillBits, PeekBits, and DropBits. - // The LUT has been ported from LibJpegTurbo as has this code but it doesn't work. - // this.TryFillBits(stream); - // - // const int LookAhead = 8; - // int look = this.PeekBits(LookAhead); - // look = tree.Lookahead[look]; - // int bits = look >> LookAhead; - // - // if (bits <= LookAhead) - // { - // this.DropBits(bits); - // value = (short)(look & ((1 << LookAhead) - 1)); - // return true; - // } - if (!this.TryReadBit(stream, out int bit)) - { - return false; - } - - short code = (short)bit; - - // "DECODE", section F.2.2.3, figure F.16, page 109 of T.81 - int i = 1; - - while (code > tree.MaxCode[i]) - { - if (!this.TryReadBit(stream, out bit)) - { - return false; - } - - code <<= 1; - code |= (short)bit; - i++; - } - - int j = tree.ValOffset[i]; - value = tree.Values[(j + code) & 0xFF]; - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private bool TryReceive(int length, DoubleBufferedStreamReader stream, out int value) - { - value = 0; - while (length > 0) - { - if (!this.TryReadBit(stream, out int bit)) - { - return false; - } - - value = (value << 1) | bit; - length--; - } - - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private bool TryReceiveAndExtend(int length, DoubleBufferedStreamReader stream, out int value) - { - if (length == 1) - { - if (!this.TryReadBit(stream, out value)) - { - return false; - } - - value = value == 1 ? 1 : -1; - } - else - { - if (!this.TryReceive(length, stream, out value)) - { - return false; - } - - if (value < 1 << (length - 1)) - { - value += (-1 << length) + 1; - } - } - - return true; - } - - private void DecodeBaseline(PdfJsFrameComponent component, ref short blockDataRef, int offset, ref PdfJsHuffmanTable dcHuffmanTable, ref PdfJsHuffmanTable acHuffmanTable, DoubleBufferedStreamReader stream) - { - if (!this.TryDecodeHuffman(ref dcHuffmanTable, stream, out short t)) - { - return; - } - - int diff = 0; - if (t != 0) - { - if (!this.TryReceiveAndExtend(t, stream, out diff)) - { - return; - } - } - - Unsafe.Add(ref blockDataRef, offset) = (short)(component.DcPredictor += diff); - - int k = 1; - while (k < 64) - { - if (!this.TryDecodeHuffman(ref acHuffmanTable, stream, out short rs)) - { - return; - } - - int s = rs & 15; - int r = rs >> 4; - - if (s == 0) - { - if (r < 15) - { - break; - } - - k += 16; - continue; - } - - k += r; - - byte z = this.dctZigZag[k]; - - if (!this.TryReceiveAndExtend(s, stream, out int re)) - { - return; - } - - Unsafe.Add(ref blockDataRef, offset + z) = (short)re; - k++; - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DecodeDCFirst(PdfJsFrameComponent component, ref short blockDataRef, int offset, ref PdfJsHuffmanTable dcHuffmanTable, DoubleBufferedStreamReader stream) - { - if (!this.TryDecodeHuffman(ref dcHuffmanTable, stream, out short t)) - { - return; - } - - int diff = 0; - if (t != 0) - { - if (!this.TryReceiveAndExtend(t, stream, out diff)) - { - return; - } - } - - Unsafe.Add(ref blockDataRef, offset) = (short)(component.DcPredictor += diff << this.successiveState); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void DecodeDCSuccessive(PdfJsFrameComponent component, ref short blockDataRef, int offset, DoubleBufferedStreamReader stream) - { - if (!this.TryReadBit(stream, out int bit)) - { - return; - } - - Unsafe.Add(ref blockDataRef, offset) |= (short)(bit << this.successiveState); - } - - private void DecodeACFirst(ref short blockDataRef, int offset, ref PdfJsHuffmanTable acHuffmanTable, DoubleBufferedStreamReader stream) - { - if (this.eobrun > 0) - { - this.eobrun--; - return; - } - - int k = this.specStart; - int e = this.specEnd; - while (k <= e) - { - if (!this.TryDecodeHuffman(ref acHuffmanTable, stream, out short rs)) - { - return; - } - - int s = rs & 15; - int r = rs >> 4; - - if (s == 0) - { - if (r < 15) - { - if (!this.TryReceive(r, stream, out int eob)) - { - return; - } - - this.eobrun = eob + (1 << r) - 1; - break; - } - - k += 16; - continue; - } - - k += r; - - byte z = this.dctZigZag[k]; - - if (!this.TryReceiveAndExtend(s, stream, out int v)) - { - return; - } - - Unsafe.Add(ref blockDataRef, offset + z) = (short)(v * (1 << this.successiveState)); - k++; - } - } - - private void DecodeACSuccessive(ref short blockDataRef, int offset, ref PdfJsHuffmanTable acHuffmanTable, DoubleBufferedStreamReader stream) - { - int k = this.specStart; - int e = this.specEnd; - int r = 0; - - while (k <= e) - { - int offsetZ = offset + this.dctZigZag[k]; - ref short blockOffsetZRef = ref Unsafe.Add(ref blockDataRef, offsetZ); - int sign = blockOffsetZRef < 0 ? -1 : 1; - - switch (this.successiveACState) - { - case 0: // Initial state - - if (!this.TryDecodeHuffman(ref acHuffmanTable, stream, out short rs)) - { - return; - } - - int s = rs & 15; - r = rs >> 4; - if (s == 0) - { - if (r < 15) - { - if (!this.TryReceive(r, stream, out int eob)) - { - return; - } - - this.eobrun = eob + (1 << r); - this.successiveACState = 4; - } - else - { - r = 16; - this.successiveACState = 1; - } - } - else - { - if (s != 1) - { - throw new ImageFormatException("Invalid ACn encoding"); - } - - if (!this.TryReceiveAndExtend(s, stream, out int v)) - { - return; - } - - this.successiveACNextValue = v; - this.successiveACState = r > 0 ? 2 : 3; - } - - continue; - case 1: // Skipping r zero items - case 2: - if (blockOffsetZRef != 0) - { - if (!this.TryReadBit(stream, out int bit)) - { - return; - } - - blockOffsetZRef += (short)(sign * (bit << this.successiveState)); - } - else - { - r--; - if (r == 0) - { - this.successiveACState = this.successiveACState == 2 ? 3 : 0; - } - } - - break; - case 3: // Set value for a zero item - if (blockOffsetZRef != 0) - { - if (!this.TryReadBit(stream, out int bit)) - { - return; - } - - blockOffsetZRef += (short)(sign * (bit << this.successiveState)); - } - else - { - blockOffsetZRef = (short)(this.successiveACNextValue << this.successiveState); - this.successiveACState = 0; - } - - break; - case 4: // Eob - if (blockOffsetZRef != 0) - { - if (!this.TryReadBit(stream, out int bit)) - { - return; - } - - blockOffsetZRef += (short)(sign * (bit << this.successiveState)); - } - - break; - } - - k++; - } - - if (this.successiveACState == 4) - { - this.eobrun--; - if (this.eobrun == 0) - { - this.successiveACState = 0; - } - } - } - } -} \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs index b71667300..86ac6b195 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs @@ -816,22 +816,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort successiveApproximation & 15); sd.ParseEntropyCodedData(this.Frame, this.dcHuffmanTables, this.acHuffmanTables, this.fastACTables); - - // PdfJsScanDecoder scanDecoder = default; - // - // scanDecoder.DecodeScan( - // this.Frame, - // this.InputStream, - // this.dcHuffmanTables, - // this.acHuffmanTables, - // this.Frame.Components, - // componentIndex, - // selectorsCount, - // this.resetInterval, - // spectralStart, - // spectralEnd, - // successiveApproximation >> 4, - // successiveApproximation & 15); } /// From cfe5b5cc8b4f10221136c388c7b688a9e05b6045 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sun, 1 Jul 2018 19:59:14 +1000 Subject: [PATCH 15/36] Update reference images from master --- tests/Images/External | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Images/External b/tests/Images/External index eb40b3c03..d9d93bbdd 160000 --- a/tests/Images/External +++ b/tests/Images/External @@ -1 +1 @@ -Subproject commit eb40b3c039dd8c8ca448cb8073a59ca178901e9f +Subproject commit d9d93bbdd18dd7b818c0d19cc8f967be98045d3c From 43c818fec2f1f294cb15b5d0bcac4f6b377bb7ca Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 2 Jul 2018 10:27:26 +1000 Subject: [PATCH 16/36] Add descriptive comments, remove unused, and make method static. --- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 43 ++++++++++++++----- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 8a39dab34..42cf38f2a 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -1,7 +1,6 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using SixLabors.ImageSharp.Formats.Jpeg.Components; @@ -11,12 +10,13 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { internal class ScanDecoder { + // The number of bits that can be read via a LUT. public const int FastBits = 9; - // bmask[n] = (1 << n) - 1 + // LUT Bmask[n] = (1 << n) - 1 private static readonly uint[] Bmask = { 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535 }; - // bias[n] = (-1 << n) + 1 + // LUT Bias[n] = (-1 << n) + 1 private static readonly int[] Bias = { 0, -1, -3, -7, -15, -31, -63, -127, -255, -511, -1023, -2047, -4095, -8191, -16383, -32767 }; private readonly DoubleBufferedStreamReader stream; @@ -25,19 +25,44 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components private readonly int restartInterval; private readonly int componentIndex; private readonly int componentsLength; + + // The spectral selection start. private readonly int spectralStart; + + // The spectral selection end. private readonly int spectralEnd; + + // The successive approximation high bit end. private readonly int successiveHigh; + + // The successive approximation low bit end. private readonly int successiveLow; + // The number of valid bits left to read in the buffer. private int codeBits; + + // The entropy encoded code buffer. private uint codeBuffer; + + // Whether there is more data to pull from the stream for the current mcu. private bool nomore; + + // Whether we have prematurely reached the end of the file. private bool eof; + + // The current, if any, marker in the input stream. private byte marker; + + // Whether we have a bad marker, ie. one that is not between RST0 and RST7 private bool badMarker; + + // The opening position of an identified marker. private long markerPosition; + + // How many mcu's are left to do. private int todo; + + // The End-Of-Block countdown for ending the sequence prematurely when the remaining coefficients are zero. private int eobrun; /// @@ -230,6 +255,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint LRot(uint x, int y) => (x << y) | (x >> (32 - y)); + private void ParseProgressiveData( PdfJsFrame frame, PdfJsHuffmanTables dcHuffmanTables, @@ -312,8 +340,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components PdfJsFrameComponent component = this.components[k]; ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ReadOnlySpan fastAC = fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId); int h = component.HorizontalSamplingFactor; int v = component.VerticalSamplingFactor; @@ -678,7 +704,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components this.GrowBufferUnsafe(); } - uint k = this.LRot(this.codeBuffer, n); + uint k = LRot(this.codeBuffer, n); this.codeBuffer = k & ~Bmask[n]; k &= Bmask[n]; this.codeBits -= n; @@ -822,7 +848,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } int sgn = (int)this.codeBuffer >> 31; - uint k = this.LRot(this.codeBuffer, n); + uint k = LRot(this.codeBuffer, n); this.codeBuffer = k & ~Bmask[n]; k &= Bmask[n]; this.codeBits -= n; @@ -841,9 +867,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components [MethodImpl(MethodImplOptions.AggressiveInlining)] private int PeekBits() => (int)((this.codeBuffer >> (32 - FastBits)) & ((1 << FastBits) - 1)); - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private uint LRot(uint x, int y) => (x << y) | (x >> (32 - y)); - [MethodImpl(MethodImplOptions.AggressiveInlining)] private bool ContinueOnRestart() { From 1e493ab80e63e562512e0ecce05fd73054205cd0 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 2 Jul 2018 11:44:50 +1000 Subject: [PATCH 17/36] Split progressive AC method and rename GrowBufferUnsafe --- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 215 ++++++++++-------- 1 file changed, 117 insertions(+), 98 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 42cf38f2a..4fdac5373 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -13,7 +13,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components // The number of bits that can be read via a LUT. public const int FastBits = 9; - // LUT Bmask[n] = (1 << n) - 1 + // LUT mask for n rightmost bits. Bmask[n] = (1 << n) - 1 private static readonly uint[] Bmask = { 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535 }; // LUT Bias[n] = (-1 << n) + 1 @@ -22,8 +22,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components private readonly DoubleBufferedStreamReader stream; private readonly PdfJsFrameComponent[] components; private readonly ZigZag dctZigZag; + + // The restart interval. private readonly int restartInterval; + + // The current component index. private readonly int componentIndex; + + // The number of interleaved components. private readonly int componentsLength; // The spectral selection start. @@ -53,7 +59,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components // The current, if any, marker in the input stream. private byte marker; - // Whether we have a bad marker, ie. one that is not between RST0 and RST7 + // Whether we have a bad marker, I.E. One that is not between RST0 and RST7 private bool badMarker; // The opening position of an identified marker. @@ -68,15 +74,15 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// /// Initializes a new instance of the class. /// - /// The input stream - /// The scan components - /// The component index within the array - /// The length of the components. Different to the array length - /// The reset interval - /// The spectral selection start - /// The spectral selection end - /// The successive approximation bit high end - /// The successive approximation bit low end + /// The input stream. + /// The scan components. + /// The component index within the array. + /// The length of the components. Different to the array length. + /// The reset interval. + /// The spectral selection start. + /// The spectral selection end. + /// The successive approximation bit high end. + /// The successive approximation bit low end. public ScanDecoder( DoubleBufferedStreamReader stream, PdfJsFrameComponent[] components, @@ -174,7 +180,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { if (this.codeBits < 24) { - this.GrowBufferUnsafe(); + this.FillBuffer(); } // If it's NOT a restart, then just bail, so we get corrupt data @@ -238,7 +244,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { if (this.codeBits < 24) { - this.GrowBufferUnsafe(); + this.FillBuffer(); } // If it's NOT a restart, then just bail, so we get corrupt data @@ -309,7 +315,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { if (this.codeBits < 24) { - this.GrowBufferUnsafe(); + this.FillBuffer(); } // If it's NOT a restart, then just bail, so we get corrupt data @@ -371,7 +377,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { if (this.codeBits < 24) { - this.GrowBufferUnsafe(); + this.FillBuffer(); } // If it's NOT a restart, then just bail, so we get corrupt data @@ -502,8 +508,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref PdfJsHuffmanTable acTable, ref short fastACRef) { - int k; - if (this.spectralStart == 0) { throw new ImageFormatException("Can't merge DC and AC."); @@ -511,6 +515,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components if (this.successiveHigh == 0) { + // MCU decoding for AC initial scan (either spectral selection, + // or first pass of successive approximation). int shift = this.successiveLow; if (this.eobrun != 0) @@ -519,7 +525,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components return; } - k = this.spectralStart; + int k = this.spectralStart; do { int zig; @@ -582,117 +588,125 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components else { // Refinement scan for these AC coefficients - short bit = (short)(1 << this.successiveLow); + this.DecodeBlockProgressiveACRefined(ref blockDataRef, ref acTable); + } + } - if (this.eobrun != 0) + private void DecodeBlockProgressiveACRefined(ref short blockDataRef, ref PdfJsHuffmanTable acTable) + { + int k; + + // Refinement scan for these AC coefficients + short bit = (short)(1 << this.successiveLow); + + if (this.eobrun != 0) + { + this.eobrun--; + for (k = this.spectralStart; k <= this.spectralEnd; k++) { - this.eobrun--; - for (k = this.spectralStart; k <= this.spectralEnd; k++) + ref short p = ref Unsafe.Add(ref blockDataRef, this.dctZigZag[k]); + if (p != 0) { - ref short p = ref Unsafe.Add(ref blockDataRef, this.dctZigZag[k]); - if (p != 0) + if (this.GetBit() != 0) { - if (this.GetBit() != 0) + if ((p & bit) == 0) { - if ((p & bit) == 0) + if (p > 0) { - if (p > 0) - { - p += bit; - } - else - { - p -= bit; - } + p += bit; + } + else + { + p -= bit; } } } } } - else + } + else + { + k = this.spectralStart; + do { - k = this.spectralStart; - do + int rs = this.DecodeHuffman(ref acTable); + if (rs < 0) { - int rs = this.DecodeHuffman(ref acTable); - if (rs < 0) - { - throw new ImageFormatException("Bad Huffman code."); - } + throw new ImageFormatException("Bad Huffman code."); + } - int s = rs & 15; - int r = rs >> 4; + int s = rs & 15; + int r = rs >> 4; - if (s == 0) + if (s == 0) + { + // r=15 s=0 should write 16 0s, so we just do + // a run of 15 0s and then write s (which is 0), + // so we don't have to do anything special here + if (r < 15) { - // r=15 s=0 should write 16 0s, so we just do - // a run of 15 0s and then write s (which is 0), - // so we don't have to do anything special here - if (r < 15) + this.eobrun = (1 << r) - 1; + + if (r != 0) { - this.eobrun = (1 << r) - 1; + this.eobrun += this.GetBits(r); + } - if (r != 0) - { - this.eobrun += this.GetBits(r); - } + r = 64; // Force end of block + } + } + else + { + if (s != 1) + { + throw new ImageFormatException("Bad Huffman code."); + } - r = 64; // Force end of block - } + // Sign bit + if (this.GetBit() != 0) + { + s = bit; } else { - if (s != 1) - { - throw new ImageFormatException("Bad Huffman code."); - } - - // Sign bit - if (this.GetBit() != 0) - { - s = bit; - } - else - { - s = -bit; - } + s = -bit; } + } - // Advance by r - while (k <= this.spectralEnd) + // Advance by r + while (k <= this.spectralEnd) + { + ref short p = ref Unsafe.Add(ref blockDataRef, this.dctZigZag[k++]); + if (p != 0) { - ref short p = ref Unsafe.Add(ref blockDataRef, this.dctZigZag[k++]); - if (p != 0) + if (this.GetBit() != 0) { - if (this.GetBit() != 0) + if ((p & bit) == 0) { - if ((p & bit) == 0) + if (p > 0) + { + p += bit; + } + else { - if (p > 0) - { - p += bit; - } - else - { - p -= bit; - } + p -= bit; } } } - else + } + else + { + if (r == 0) { - if (r == 0) - { - p = (short)s; - break; - } - - r--; + p = (short)s; + break; } + + r--; } } - while (k <= this.spectralEnd); } + while (k <= this.spectralEnd); } } @@ -701,7 +715,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { if (this.codeBits < n) { - this.GrowBufferUnsafe(); + this.FillBuffer(); } uint k = LRot(this.codeBuffer, n); @@ -716,7 +730,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { if (this.codeBits < 1) { - this.GrowBufferUnsafe(); + this.FillBuffer(); } uint k = this.codeBuffer; @@ -727,18 +741,23 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } [MethodImpl(MethodImplOptions.NoInlining)] - private void GrowBufferUnsafe() + private void FillBuffer() { + // Attempt to load at least the minimum nbumber of required bits into the buffer. + // We fail to do so only if we hit a marker or reach the end of the input stream. do { int b = this.nomore ? 0 : this.stream.ReadByte(); if (b == -1) { + // We've encountered the end of the file stream which means there's no EOI marker in the image + // or the SOS marker has the wrong dimensions set. this.eof = true; b = 0; } + // Found a marker. if (b == JpegConstants.Markers.XFF) { this.markerPosition = this.stream.Position - 1; @@ -844,7 +863,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { if (this.codeBits < n) { - this.GrowBufferUnsafe(); + this.FillBuffer(); } int sgn = (int)this.codeBuffer >> 31; @@ -860,7 +879,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { if (this.codeBits < 16) { - this.GrowBufferUnsafe(); + this.FillBuffer(); } } From 8370d4f8af77277caeb2aaae6406cadadf6f5701 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 2 Jul 2018 11:46:54 +1000 Subject: [PATCH 18/36] Fix updated struct name --- .../{FixedInt64Buffer18.cs => FixedUInt32Buffer18.cs} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/{FixedInt64Buffer18.cs => FixedUInt32Buffer18.cs} (80%) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt64Buffer18.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedUInt32Buffer18.cs similarity index 80% rename from src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt64Buffer18.cs rename to src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedUInt32Buffer18.cs index a9266bd6b..9b076d9da 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt64Buffer18.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedUInt32Buffer18.cs @@ -7,7 +7,7 @@ using System.Runtime.InteropServices; namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { [StructLayout(LayoutKind.Sequential)] - internal unsafe struct FixedInt64Buffer18 + internal unsafe struct FixedUInt32Buffer18 { public fixed uint Data[18]; @@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - ref uint self = ref Unsafe.As(ref this); + ref uint self = ref Unsafe.As(ref this); return Unsafe.Add(ref self, idx); } } From 6360a8a9a152c325c904781887cfe81d887c3105 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 2 Jul 2018 11:47:18 +1000 Subject: [PATCH 19/36] Update name reference --- .../Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs index 3babb449a..a895fd0a4 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs @@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// /// Gets the max code array /// - public FixedInt64Buffer18 MaxCode; + public FixedUInt32Buffer18 MaxCode; /// /// Gets the value offset array From fcabcdd5d5e132e2fbd9fcbe7747946b3bf8f8bf Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 2 Jul 2018 12:32:59 +1000 Subject: [PATCH 20/36] Refactor FastACTables and reduce trivial duplication. --- .../Jpeg/PdfJsPort/Components/FastACTables.cs | 18 ++- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 106 +++++++----------- .../Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs | 19 +++- 3 files changed, 68 insertions(+), 75 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs index f936f7342..6a11f2805 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. using System; +using System.Runtime.CompilerServices; using SixLabors.Memory; namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components @@ -11,24 +12,33 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// internal sealed class FastACTables : IDisposable { + private Buffer2D tables; + /// /// Initializes a new instance of the class. /// /// The memory allocator used to allocate memory for image processing operations. public FastACTables(MemoryAllocator memoryAllocator) { - this.Tables = memoryAllocator.AllocateClean2D(512, 4); + this.tables = memoryAllocator.AllocateClean2D(512, 4); } /// - /// Gets the collection of tables. + /// Gets the representing the table at the index in the collection. /// - public Buffer2D Tables { get; } + /// The table index. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public Span GetTableSpan(int index) + { + return this.tables.GetRowSpan(index); + } /// public void Dispose() { - this.Tables?.Dispose(); + this.tables?.Dispose(); + this.tables = null; } } } \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 4fdac5373..6c01deaa9 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -4,10 +4,14 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using SixLabors.ImageSharp.Formats.Jpeg.Components; -using SixLabors.Memory; namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { + /// + /// Decodes the Huffman encoded spectral scan. + /// Originally ported from + /// with additional fixes for both performance and common encoding errors. + /// internal class ScanDecoder { // The number of bits that can be read via a LUT. @@ -157,7 +161,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId)); + ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); int mcu = 0; for (int j = 0; j < h; j++) @@ -173,24 +177,12 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int blockCol = mcu % w; int offset = component.GetBlockBufferOffset(blockRow, blockCol); this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, ref fastACRef); - mcu++; // Every data block is an MCU, so countdown the restart interval - if (--this.todo <= 0) + mcu++; + if (!this.ContinueOnMcuComplete()) { - if (this.codeBits < 24) - { - this.FillBuffer(); - } - - // If it's NOT a restart, then just bail, so we get corrupt data - // rather than no data - if (!this.ContinueOnRestart()) - { - return; - } - - this.Reset(); + return; } } } @@ -212,7 +204,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId)); + ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); int h = component.HorizontalSamplingFactor; int v = component.VerticalSamplingFactor; @@ -240,21 +232,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components // After all interleaved components, that's an interleaved MCU, // so now count down the restart interval mcu++; - if (--this.todo <= 0) + if (!this.ContinueOnMcuComplete()) { - if (this.codeBits < 24) - { - this.FillBuffer(); - } - - // If it's NOT a restart, then just bail, so we get corrupt data - // rather than no data - if (!this.ContinueOnRestart()) - { - return; - } - - this.Reset(); + return; } } } @@ -283,7 +263,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.Tables.GetRowSpan(component.ACHuffmanTableId)); + ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); int mcu = 0; for (int j = 0; j < h; j++) @@ -308,24 +288,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components this.DecodeBlockProgressiveAC(ref Unsafe.Add(ref blockDataRef, offset), ref acHuffmanTable, ref fastACRef); } - mcu++; - // Every data block is an MCU, so countdown the restart interval - if (--this.todo <= 0) + mcu++; + if (!this.ContinueOnMcuComplete()) { - if (this.codeBits < 24) - { - this.FillBuffer(); - } - - // If it's NOT a restart, then just bail, so we get corrupt data - // rather than no data - if (!this.ContinueOnRestart()) - { - return; - } - - this.Reset(); + return; } } } @@ -373,21 +340,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components // After all interleaved components, that's an interleaved MCU, // so now count down the restart interval mcu++; - if (--this.todo <= 0) + if (!this.ContinueOnMcuComplete()) { - if (this.codeBits < 24) - { - this.FillBuffer(); - } - - // If it's NOT a restart, then just bail, so we get corrupt data - // rather than no data - if (!this.ContinueOnRestart()) - { - return; - } - - this.Reset(); + return; } } } @@ -887,14 +842,33 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components private int PeekBits() => (int)((this.codeBuffer >> (32 - FastBits)) & ((1 << FastBits) - 1)); [MethodImpl(MethodImplOptions.AggressiveInlining)] - private bool ContinueOnRestart() + private bool ContinueOnMcuComplete() { + if (--this.todo > 0) + { + return true; + } + + if (this.codeBits < 24) + { + this.FillBuffer(); + } + + // If it's NOT a restart, then just bail, so we get corrupt data rather than no data. + // Reset the stream to before any bad markers to ensure we can read sucessive segments. if (this.badMarker) { this.stream.Position = this.markerPosition; } - return this.HasRestart(); + if (!this.HasRestart()) + { + return false; + } + + this.Reset(); + + return true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -904,7 +878,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components return m >= JpegConstants.Markers.RST0 && m <= JpegConstants.Markers.RST7; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.NoInlining)] private void Reset() { this.codeBits = 0; diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs index 86ac6b195..fda98e437 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs @@ -842,6 +842,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort return BinaryPrimitives.ReadUInt16BigEndian(this.markerBuffer); } + /// + /// Post processes the pixels into the destination image. + /// + /// The pixel format. + /// The . private Image PostProcessIntoImage() where TPixel : struct, IPixel { @@ -853,18 +858,22 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort } } + /// + /// Builds a lookup table for fast AC entropy scan decoding. + /// + /// The table index. private void BuildFastACTable(int index) { const int FastBits = ScanDecoder.FastBits; - Span fastac = this.fastACTables.Tables.GetRowSpan(index); + Span fastAC = this.fastACTables.GetTableSpan(index); ref PdfJsHuffmanTable huffman = ref this.acHuffmanTables[index]; int i; for (i = 0; i < (1 << FastBits); i++) { byte fast = huffman.Lookahead[i]; - fastac[i] = 0; - if (fast < 255) + fastAC[i] = 0; + if (fast < byte.MaxValue) { int rs = huffman.Values[fast]; int run = (rs >> 4) & 15; @@ -881,10 +890,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort k += (int)((~0U << magbits) + 1); } - // if the result is small enough, we can fit it in fastac table + // if the result is small enough, we can fit it in fastAC table if (k >= -128 && k <= 127) { - fastac[i] = (short)((k * 256) + (run * 16) + (len + magbits)); + fastAC[i] = (short)((k * 256) + (run * 16) + (len + magbits)); } } } From 69f228bf2341bb1255637b0720fcee4d0013eebf Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 2 Jul 2018 12:38:23 +1000 Subject: [PATCH 21/36] private static ordering. --- .../Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 6c01deaa9..cc9d4d470 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -142,6 +142,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint LRot(uint x, int y) => (x << y) | (x >> (32 - y)); + private void ParseBaselineData( PdfJsFrame frame, PdfJsHuffmanTables dcHuffmanTables, @@ -241,9 +244,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static uint LRot(uint x, int y) => (x << y) | (x >> (32 - y)); - private void ParseProgressiveData( PdfJsFrame frame, PdfJsHuffmanTables dcHuffmanTables, From 9cb8c155fb6be9fea2c971c1139edbe03de71424 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 2 Jul 2018 22:22:26 +1000 Subject: [PATCH 22/36] Rename struct --- .../{FixedInt16Buffer18.cs => FixedInt32Buffer18.cs} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/{FixedInt16Buffer18.cs => FixedInt32Buffer18.cs} (83%) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer18.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt32Buffer18.cs similarity index 83% rename from src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer18.cs rename to src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt32Buffer18.cs index b193bf59e..f8507ec47 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt16Buffer18.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FixedInt32Buffer18.cs @@ -7,7 +7,7 @@ using System.Runtime.InteropServices; namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { [StructLayout(LayoutKind.Sequential)] - internal unsafe struct FixedInt16Buffer18 + internal unsafe struct FixedInt32Buffer18 { public fixed int Data[18]; @@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - ref int self = ref Unsafe.As(ref this); + ref int self = ref Unsafe.As(ref this); return Unsafe.Add(ref self, idx); } } From bd79c8471465b281ebc447d62300e6d8a555114c Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 2 Jul 2018 22:25:58 +1000 Subject: [PATCH 23/36] Update Huffman table property --- .../Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs index a895fd0a4..15ae56331 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsHuffmanTable.cs @@ -22,7 +22,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// /// Gets the value offset array /// - public FixedInt16Buffer18 ValOffset; + public FixedInt32Buffer18 ValOffset; /// /// Gets the huffman value array From d4fc8a03be221fdab018bf9592ea356f11aeca60 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 2 Jul 2018 22:45:19 +1000 Subject: [PATCH 24/36] Move method where it belongs. --- .../Jpeg/PdfJsPort/Components/FastACTables.cs | 45 ++++++++++++++++++- .../Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs | 44 +----------------- 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs index 6a11f2805..3e170a92c 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs @@ -29,11 +29,54 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// The table index. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Span GetTableSpan(int index) + public ReadOnlySpan GetTableSpan(int index) { return this.tables.GetRowSpan(index); } + /// + /// Builds a lookup table for fast AC entropy scan decoding. + /// + /// The table index. + /// The collection of AC Huffman tables. + public void BuildACTableLut(int index, PdfJsHuffmanTables acHuffmanTables) + { + const int FastBits = ScanDecoder.FastBits; + Span fastAC = this.tables.GetRowSpan(index); + ref PdfJsHuffmanTable huffman = ref acHuffmanTables[index]; + + int i; + for (i = 0; i < (1 << FastBits); i++) + { + byte fast = huffman.Lookahead[i]; + fastAC[i] = 0; + if (fast < byte.MaxValue) + { + int rs = huffman.Values[fast]; + int run = (rs >> 4) & 15; + int magbits = rs & 15; + int len = huffman.Sizes[fast]; + + if (magbits > 0 && len + magbits <= FastBits) + { + // Magnitude code followed by receive_extend code + int k = ((i << len) & ((1 << FastBits) - 1)) >> (FastBits - magbits); + int m = 1 << (magbits - 1); + if (k < m) + { + k += (int)((~0U << magbits) + 1); + } + + // if the result is small enough, we can fit it in fastAC table + if (k >= -128 && k <= 127) + { + fastAC[i] = (short)((k * 256) + (run * 16) + (len + magbits)); + } + } + } + } + } + /// public void Dispose() { diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs index fda98e437..cb52fb84b 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs @@ -743,7 +743,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort if (huffmanTableSpec >> 4 != 0) { // Build a table that decodes both magnitude and value of small ACs in one go. - this.BuildFastACTable(huffmanTableSpec & 15); + this.fastACTables.BuildACTableLut(huffmanTableSpec & 15, this.acHuffmanTables); } } } @@ -857,47 +857,5 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort return image; } } - - /// - /// Builds a lookup table for fast AC entropy scan decoding. - /// - /// The table index. - private void BuildFastACTable(int index) - { - const int FastBits = ScanDecoder.FastBits; - Span fastAC = this.fastACTables.GetTableSpan(index); - ref PdfJsHuffmanTable huffman = ref this.acHuffmanTables[index]; - - int i; - for (i = 0; i < (1 << FastBits); i++) - { - byte fast = huffman.Lookahead[i]; - fastAC[i] = 0; - if (fast < byte.MaxValue) - { - int rs = huffman.Values[fast]; - int run = (rs >> 4) & 15; - int magbits = rs & 15; - int len = huffman.Sizes[fast]; - - if (magbits > 0 && len + magbits <= FastBits) - { - // Magnitude code followed by receive_extend code - int k = ((i << len) & ((1 << FastBits) - 1)) >> (FastBits - magbits); - int m = 1 << (magbits - 1); - if (k < m) - { - k += (int)((~0U << magbits) + 1); - } - - // if the result is small enough, we can fit it in fastAC table - if (k >= -128 && k <= 127) - { - fastAC[i] = (short)((k * 256) + (run * 16) + (len + magbits)); - } - } - } - } - } } } \ No newline at end of file From 65a050495f25012a24b9c69d6ae4c9cfc9a75ffe Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 3 Jul 2018 00:25:05 +0200 Subject: [PATCH 25/36] add regression test for #624 --- .../Formats/Jpg/JpegDecoderTests.Images.cs | 1 + tests/ImageSharp.Tests/TestImages.cs | 1 + tests/Images/External | 2 +- ...Issue624-DhtHasWrongLength-Progressive-N.jpg | Bin 0 -> 30441 bytes 4 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 tests/Images/Input/Jpg/issues/Issue624-DhtHasWrongLength-Progressive-N.jpg diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Images.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Images.cs index 539ab7319..3c98d5be7 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Images.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Images.cs @@ -38,6 +38,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg TestImages.Jpeg.Issues.NoEoiProgressive517, TestImages.Jpeg.Issues.BadRstProgressive518, TestImages.Jpeg.Issues.MissingFF00ProgressiveBedroom159, + TestImages.Jpeg.Issues.DhtHasWrongLength624, }; /// diff --git a/tests/ImageSharp.Tests/TestImages.cs b/tests/ImageSharp.Tests/TestImages.cs index 6d3a76e75..b0bdad8e5 100644 --- a/tests/ImageSharp.Tests/TestImages.cs +++ b/tests/ImageSharp.Tests/TestImages.cs @@ -144,6 +144,7 @@ namespace SixLabors.ImageSharp.Tests public const string NoEoiProgressive517 = "Jpg/issues/Issue517-No-EOI-Progressive.jpg"; public const string BadRstProgressive518 = "Jpg/issues/Issue518-Bad-RST-Progressive.jpg"; public const string InvalidCast520 = "Jpg/issues/Issue520-InvalidCast.jpg"; + public const string DhtHasWrongLength624 = "Jpg/issues/Issue624-DhtHasWrongLength-Progressive-N.jpg"; } public static readonly string[] All = Baseline.All.Concat(Progressive.All).ToArray(); diff --git a/tests/Images/External b/tests/Images/External index d9d93bbdd..98fb7e2e4 160000 --- a/tests/Images/External +++ b/tests/Images/External @@ -1 +1 @@ -Subproject commit d9d93bbdd18dd7b818c0d19cc8f967be98045d3c +Subproject commit 98fb7e2e4d5935b1c733bd2b206b6145b71ef378 diff --git a/tests/Images/Input/Jpg/issues/Issue624-DhtHasWrongLength-Progressive-N.jpg b/tests/Images/Input/Jpg/issues/Issue624-DhtHasWrongLength-Progressive-N.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2077b75182ea8feff5e5232fa025f197cc8a483a GIT binary patch literal 30441 zcmeFZcRZJG^gn*vdqyEMWS1R6Qpnzf%*e{7B4lM{ud??F*&|tn?7cF|%7{?5MBn>m zzP#}M{C#00-DWcmzmOj|vhp90DRd3djTb z&;ocwWCS>*e?tH!0tmuIzy$#K;v?8GVak1F6N4nSPK(!Audhw(f;u&d`8%u9hTs^4 zf#AY#t^?&fl1r`^oui&ruKr!>TBW5cE22ul4m!4QE`>}j&aa&G%GSW~$!};SW%!H;8To&Hd zEl1Ws^G?w4!u(neyU+EQG4)UI4=O}G@-$hSXGsouaHD34KLuTUA`Tf)S5a#f|0owI z#%U5x0AA25%B<`QtO&)uPy6nDST1ax@4d)Un!D9ap_2kEz4#fAldLmpa7#7i_Z-*9 z#81fJzSnc~K0CoWyCPtJiI*b&LHiiASTC^(jQ9V!z?I5X+Q}_`9y?ZrM|l^gb6ou| zYH^%GculF;Wg@pi!KK>Wcu#DUx)e{bC>X?03d6Ki3atMcX)*}94i57LZZkwI)}XXja}D8h4yQc zKhy9w4+U^m=?}zN0ryjH>sEfzkc1OWb+)!4r;yP4{=ancBP%Pub{ zExs$dQ7c)ez6oWeOmV8k2!K;AmctS{wvF^T){3SEKyQmG5Q0($h;L|a>4R!W62f^X z0lBmS^kNynRvZ#V$Y7par$a>zY@G?+&&c7l8R$DVtfV+ajG z>FKDg09&&2tH``~++%c9v7AK>f|~UBF$*{+tWmTDzRa$Jvq79g%2oqBnH9AGCQu z4Jf=8wY?L3yk$a^5R}O?=L*59&!(pW)cP&)(+hIxWccxk1Hd#IO`3j8R|f^J=DF+D zu~?J<#X7s^Z5?iopwjK93a#J;hYUV0hME=l?EmN5qfd@P$8Zd$pnHAHb~VSGvxgFY zl{>Uj-;qXf9h%HX{L9*XW<;?NbOJjNrszY+h`EaGy^0WkdeCd6F;!e}mi z*F(0zW=U+U4gjDgyH!DW=Nm-6Pc|aJUjtD(C}%CEpqtrWz`(;n5nxK*Pq*ifB7%9Y z^Pw%s^^73bAAUL&42lQ^|I|QK{-b>W@xI2M+F3aR<2q6qD73Wg#^Tvm;`3d}tN>g@(Rq`qX^IGy&tT#Y#eUf6vk=%UP6Y>^nj@3v z=R@*Wh1rit3}X^qj+9|GRATP0Tlzv^pvwrqgVH&-<7lYcaQXlN%LUdNDD|?QcQkJR zIJH8Rd$>S>r3NTNL6N5Hae>k~cXBR~cy;0k!Cy&TMTdg|oLI_pU3Prjps~-UhL}cB zM&TwC6ni`#0YqKZBCTI!Ash8U5r2@7E(9o=%e_1dUWfpyq4<_TZ$OT9OgL6l4McWW z&TA;#h(8aBkDnqA;DiKXiTTnpGpcyoFtN=#Ud9B3YGWlZ;$}h?OA;Xa~E}ZX?-&&N8fRm7jjrW#_abRtV6eka=)DXAa=H9DHBztKjxf&lnRO z;SQRH;Qltq7-}r{bgrrX&*a7LSV0a7P%(4B?g`=_6kZh{6^26VtgSsR9nTJ6C1<6 zf`IwV+UMPI?FEE^h`3QsW=G3?KCosN5O+X=r&@*N8B-+3!}<;LN%Fsk73iygy{Plw zu^`Ey112r+wdtB81vp>37PXZPZOS9ge-Sv&W({J{i@pWw&Cox8&3Czj0-fBlwdTWfuNxpns<`sem2@Li)2v*&WD&-!01i6 z!ru@J7ap0N)C0s6cilfJXxPE9kE>=Iemz|tH(da@r6{)fw$?@oP?krsaICRUp>VNp zWhC6(gykRB`8N{%dU_BaL6&Go?hTvU*MxwMEaNu5LxrO&N>pWrNDNE_XDGq-@vG9!IK>IL zoFP17@%}+FzqsQ*^U8x4dt>Z~y-$$MAV2P&Qn!|Z;h(PB`-KzUZ<*a1S|L^L{)@tM zq=8cSNmMA;q3j+Zns`^oe{|*u0R~8x2QM$e>o=S_5GGs^AD??}_Du&DNDa1tPaEM6 zA07e-pp*($1FRzeE&DgcK`2~z(b3a&e}5+*L||A0a~!z(7ViBq%~>nRq`tePt*JWT26t5wLwZ7#S#toC|mp{$CIwPzX=AFn3bt zL=DCZq6;YXs@jA;Pziyo6Xitr_X1Ie)_HqO=tv0;9)OAA6A;L%LUiE*AvH%3kbqg# zCm=51)B*qu1Q9kspdt96MKJteAfOj$mnQ-SF=1Z>3xQ3A&|W}<9QY3w!tb(g>hSv* zf()_+H;`w6#60120erSO|Df5rP))R}pKVc`#nUHh`UlDqsQu z0D36KsfM{g&GMcem>vL>6A0Lbfe;usAOmDVmy-?KizC?OkN=;LF^Dx>O33$dNjN6= zs1sfgUG{iEd*A1Noq!ySj1aW;shK*_eS|~RBMe9!(T73+scJjvuyVN39KG)b3E1HR zb&=Lr4(%LEp&H|IXb8qVf-@ z+McdC!P>82oeWPX4Y<*&?WH>)1G3+oCc=a4iJ(7yLIo$gs)K+qgqZ)NBeoLJu<>v3**TBNOUgo8wMhKuIABLEjOId;efGlX0?Uj2)@!m z4@I9a1;g(-GSzmd){dxn#5^L}nO9^F6prV*{(y6KIMwp6_`@pvIyABpct#K|A4$Ow ztvkRTMelOp0SCGZp&d}nmIL~zQ)fbKpdknJ@w}e}fgV`U1@oT$|Ad^JzLgIChoGbO zVLpS#Sv)bC|LGd3JYoi?a{9+z4!^Z=y@P;!rS-4 z?KB9}<{Z$tEEorSEk6x9*VBa~WB)%uU~fYAac6+eZeA-X2s#j*0Rn|bpW`9-IvhGs zdIspg+#d7@1ew#Lusj2#c$Oy)Fww{!w%{}f=s5#KxzYg@UZ+9)&|Abo^B_x~=ePx@ zL9B(RJ%N!8y&;_j@gJvRupfbten4UYviuG|XMmu$qodJV#yLcQ&{H5tC?9|JKr|3% zP|VYywu2_^LytTa{wE0R$KkF5;vgW%21~kc_dj>>tAJlWw{V7lT78MV*_CR~dvf3|M-;F|Bxbgcd~Cf%Sij@nytj zbZtutymjvgaY-!q)qBe*av|59lLU3QUQ&s3GjJ0DZ-Rmp!bmOeBh@Z_r!DA-=fl^< zZ>1cH=)TpkN@AEvm89T0q&g=2$FDoE<56c^A}2PD2MM+Ut*&Xeliv=-wH zBZ29EfP};2ap77?)lcTDe81T^3ra^+b0~w%a6kD*nu*N?+4W&4+~r5LdbmZBYW?#U z$%cYX$(G!E&DEBIbS())S}KNn+om0PUO{rXTNm&H^0H7Dx3|>|8k7fx&DiL!M%rRL z@3jyVQV@RmlG|HAP+qiq1Ur^t+tM@WOFl#1i^pK5r~|kmF$<511doV>1bOxeKFfqh z1j84Zl3nhhRX!dq84_JS7tFD#ItZNE&Cf78*WjJfZJ z0D6_?>_oZ>DsFRcYtStp#4aOs0)?Wm;9d$n!H=0-dKWy<+*2I9D4K77^8r0kpbx4f zNRi~UA_7xr6R0~i&Ym8)&q$r9eLai9gzqw#-lchtD!v(n${F|RF7bz6>IC0xr%OFK zv<eEoA1+x`q*I8j&Wl@3EqJPP=ilERUSeqIa^mZLVEy*r3MrHH(ctk>&G(4+4Z}y{j1`r#&ua9U&3H@w z6FpfSvGR6ust{3(}Z9G;d4^^dtkn)qLoh(QcjGG#_n*<#{9c{n&pU+#TR zfas#JOZDe%z*_@t1z55#fVL(j&*`o{Qf$FU>&J*O5b;WZ>=&h zA|rlW91#-mAufEqT~^*#ZjCRf<0M2A?P=J@js2{+>@IX%TGZcy-%4y zixYwD626LqI~qKto1Eh68szaJNH5 zLPo&@s94zw@Gr0n-IkNLwk5cDg@a32LDwq3kdTs^Mn}&z_!BNI_Z_wcvFwP%=FywB z>r1cCXeNYjn&aiMKj|MTefGpNeN)_0zx=CNJDIw5Wx++K8QS)kD$>%v1uL;{*4Oy# z%91xjgL#pd;oQ85uS$hcAm7PcXZ8zLd7JF25E1{dg?utpC91o4V!n^_Iql6*mAOH# znj((sOX%wbdTUE?vC8$=-?fOXPLXe$)jr@rTKqt_I)%NPg=H9g$9qY>uXG8cnQ*te zjD0qwYu>=f#weZsb(?O=vmXj?1Tb`B{ri>XtsbU%ED>%Rh$#@v3jYIW^@j#Ebd9YT z5g##7?%sFGid9ePks}mLBxmH)w4@#l7vB6Sg+s{j!*^CUxu}9YLwh6+iO(gX_|@Srf6`{&n_8(P@hiNp%-z1^x-Ghr!#WgWSC_~@6wY!V;FIB1UQ(!6g#VaH zZ2kvNbUR#q_famML^9{Voe&k(-QFqX3JqiBx?Ac_sH;RDWBnphSxl@<7}WzkQVnTV zLu}%7D9P*+maof7W%tKgXxc zP4Qo&h+(Nvm|Zc}WFQ z8QUDhRH0Qj4!?}jEVIm;L5u?Zox4iaI6HrtGoJnseP&^IAE#EEDaVP)UcoesujO{L zow!#giU)3)R4S(`?4tsGpNimqz`WAJqmh!9H z4{|POl()j~bpmL2D;BWf6C~F|KBX zVtg0dK&Z-;K|z=}qLiUy^;XSa(k8D#r?9e~40QrFiI9Yp;2!VoD-)eP5?1vdRFok~ zmI(dgz3fFd8Xg(noU~MW>%N1z8N6V_blZNtr1XQuhnoSsyHXYiE82YWX0%T{7Pq7_ zDk%hMfr*#T<*bO+hF8WowB4RdS@ip55;oJCP&!A;>k0EOd~6qxkSW^n55CHOf8IgL zbI<^Rux!FjE_j{}GlylZTi3!*?hA(&MTfRa%}t5sPW5dOqnNAda#o*z*Rk>=d*ze< z#@8=Xz`H{8`o2B?B@%gIuPnUqsH(YE$_S>%XxVeusS)|v3rpU0s9(egYj!th##9+> zofF8orKfHGW`SiU?v7asermQyDy1n+Opd^s!kGD&#GP-ad>)VN%mr1q%AoW3ze%$2aP#IZF;B=4QN z{mlhou`ZgBURym9i=Rry>{srY+%=5oX^ZV9GZSGHU&9Ocsq$bhM(!FLTDxjFMqVXd zKAclBDT9KWfU0nhfpVr!w*!Z-_eqT10ImlWO{NJC4O~o!Oagn!z-O6l__nnNabh2v z8c6LLNUiEw>N7G;&#WOMm5rAI~ zTPpM6>OVK=lu{XH`nG5VeMJ)ln`}v~^Hj_JO3y_aJ-Ege$|1mn`x?9V+^|pPAYa6WVj{&O=G1rDYQ_^%m)Ojnp-g7gm$Mi27lfJ^H-;nW zFc6^(su+@}-kxqM)D!al`CgVPLQUpJ!$nH~GZ%iDc1Tqf{o;bJx=fD5i-g>teb^tA z5_;9+rGwP%DTa!c6CZ|=W{Z@k4mI14;MRS18J&zx><(>HmWW}LLYa|qWUm$f%3#v` zb$Dz2t;)Jf2}2vx#fQ74g6)bX96v(eL?a7F1~up3@!4?r*u1o`ilIitzKE$5Db~Z* z=)CRNrSevBws&Jji2{qYv;OWsAORr^>|mi}mC^YXli&e-m-B;Xzbz6@Vp^D@hJM2Ml4 zu$na2%jq9Z&hbMM0$NTa$>fP}6Fon(aP0|r6|%E6^V5c+glY5ODIUAh2B-|Q-pG2U z%}}v`9k$dvtb(s4{(F9vFWxx2EjdH2ypW5?uyJBl#!>>uN<1?Rrnrl0x?bW%XTfj^`x|K zUBuplDkY~>W#M=Ini^;Nk`_ek| zYAWyZ(m0h|E;N#$IF~p!`nVW0|jO$TW{z$n<#NV8rc@Bv;w|+HylaPp^apiIT zC#TKD)Qxg>@czjs!t6Lc#VPqI4nA@h}`TEt^+-{mCo2zMnY% z8k*7a#*mBJXRLPp`2C#9~5672!>FK+k_N0%e;2kCWhzj*8NOjjgb*8M6Uw>9o zpT%-lF^3?sz{;EvdvJ}8j?`*^)T%GjoJ9hhLLY^2aH}bhy;S!0vW1cfS9@x>qA# zOSjmcB}zX8JL^$g4D{A+$}FRGyca>}oR*ryiT#jh596ma`<_s`2aE z)exV&bfrb=OVAQip_Z20E|D+`7u)x()v>?@s|Vw@+?YbTTz^8f)$AygAI}>X&aAyo ztSW1KG+ds?Z!44pA}VR@GcKMN6TG%Jcg@Nx3z`#e$2zJGcD4>_)W@ zZPteuDP(_r!Xh3cA!q57KU4Hfyg8nmU{?N7z1_8O&y-s`ZG0D8St?5>vokQ~$(}Niugmz;G>1k!jco^vo#ll~`PVI?vz0?$ zn`BAXni8=3U1Hc39d0n1l1{&yCag!J;x5Jh<&F`li&1XRW?SHo?1fyvk=T6ZdzvwC zW?a^<-MMKr@ifx(`DD>GeO|Cwn7zKyQlwQ^S!I@{_^8kD zvnyKCj+D2$63PW?l;4^NOfDzP9mfCT_4W@UqOGiE$g8r&uHtK#FZsU1<8BCgV zJk(4VOp=E*ZeC1am8?J+CV!ZGf8xe_lU0z8R!lWyg>SzR8 zA8FY);CpJ^)_BG1rV#TzG(4}!d`R*(dy*Aa#v*mXmR|tQ<@W_QKl%@i4tHuVy*8@! zdG0u9dl9ExQzS8yYxN$_CyQ=5!5fm!@t+^RkTx`PG-Yf4$ztKiZ49?z6^-esZ=2hx zHgCN2w&y7lL)2xAk6Yg^{{!qi;s+Y8Jr4Nw@JZ?V>ZR?eq3e2Dqg-FVdOhjwvwDUn zaHiXnDd<$RO5)=$yafR--fjtd2HB0L)&Y(pTS7`bUp4e6~ zb6zHBCKcI{MAALCY9&Gm4zuK0Xbb*^Y2Ls4&FvrH_(9~SujwX3j9$aCd$n&Rq6Cz};&rH}KTDGR%*VG04m=Ma!1^#Lp|c%>C`A7^9sa88_xL zxk0SFPw=?GjVO54vXk7m(h5te_`+GxB|4MBY1~3Ma78U|{~*5qK`8ppBZfYB(alNS z>wjWo46v|D-}xd%WGV^gJ)?fEV_Q+t)N+eKa3zrZ)I7CGr?tJ6^@qP8(u4!9YVu`! zfTUf8yIHuP*E6BmEtcn+~4=lcgd;>8S5FKD0+ z|MP-GY%kHR)eQml!ijh7oH1rc2j`Q$600Sq7ZYU?i?X{q^{WT85dueG6N|yd zT?B#J?3Gl3_;1$o8UFyPs=G$HqF*=OBa~6`ZZ|93x_FsyAbjA%KcJJ7)h^<7i8Ujj zC!;+7IiZ_CO)_=kbJ2~kmeE|6j<=$I9=3ew>-QS97Qlpwvt{xR7-basC8~y+QK$IA ziJvsH*u+VOPuq(Mhg($74f{bl)9NnA!#@vinojnje<+gZ<4f!3`Rv3*X-eN)^bhdi zWuM0A}QgBES9t!>yNK!$0!cV%<#>ld=i|hAwY*)gP;z>;|51 z3`&N~=*@~es2GTVuxar3CfBgv3mkwE0*9{}&8Se#}hlU29ye)bkFyXy0;hh~T zT^i7}6JmB{T(dGhjkSU-=+lP2DVCR@Q*aS>XBP84^qbv{cWP4%oUlBc4G8>TNTZojC~Oj@U1 zSRso`kS!uKTKyvaM+}=$ZLG*O$E4Zyj;rAhwjX)&?$Um9{InVK>gD2HS~-I;!wbB1Twm%l7p4+j#ph}Nl!|CpJ5n&b9_566hDxLQZo$(LrZm9Z>39A1CaL{gX zug=3q>Y3=%qtL<;=Kce6G2WQN?on)-NFGw$@=UsjP=}MU5QA}L~HI=CteT8znaeGeAx?;(oj;`|DJ4{MSXHc{1dn0kE!c-eyg@# zbVxHM9MZglk7$2S{m+}R>NZ{^cs7!}t=GZITPj2S-w+A7{{c41Um8bjuud;hjLZ6I zLvLFwBkM8KYs3Bl)Y9AeDoV3#3_;X2o{c6qQBj3aggVP7r8rA9)#Zkb8P&rq(Ijj_ z#J>}3ag~8v{8LQ&v{>T1qGD>;+ ze76=hi|j5ecB+(dRy8^^Zh1~Hx(*4Lyh)Dr>Rc8GbRPZ|NBKp~NBq}RqY3NqP11VU zP~F_=yH6`e^*5O}n~`09GjB98sglW>`6u?6NA)*_Ag63@yZ6B~A>uTlo0B~&!@rH@ z=)NZ8SQmbR+GroDi# zQ$A1nlt2I7OM5Y^<(Flo*;}x_FS$pT`VtvWrlH#qa&Z=ufRL+D zO1`v*-(^$vKr~bE)-b73@)=X8G$TS;jc+y9L&e3}=#vvc*wL$awO07?%mc%3hCB84 zDpMOs$hkM={n0kW)KD3ls1aRHkBNUlOGiZyb4hCXM2H6!HTWcM3_wr=gWAWWS)u9; zk`gVDDf2v9R#oJA$uFURawOi-?25pgGOnVo6~30P(!)H_y-l^5HO=H2`QeqOn;qvi z_}f8I=(j{wvpC*o6PgJG7Ofxn7)$tBi7+soQ^8($Rz`3g!e?%&Kh$oQXJiEIxZe4Xf*3Q&&RME^UirMmb> zt)P<{%R)(hw~pz}B5Z0TDW69-UD=h78Caan8jGJP=WoyGQpxIM-eH%Pu+B41nMU9P zGZZSZ`pw&dT`DxaX<4;4?07jW++0+AqJP!-d^U`j9*}73-y(FZw=29E@~w+7gT2v8d^{9+H=vQKig2~7ur=Ci{L|=AMz;w|nT`{84 z!_Yn^V9Ghy-Bc%!i%VK;y7W@(Q`nW@r}$%qQ8D?GXP4DR7_P^Z-p?>57EzN6_ZcSL zQg1cSM=^aXeZHNmHe^#R>emxXZiP~B3=?e^t}&!X+3|H2Wjt4~BG$ez)$&47j9OYu zY`RmM?bN}L&5rv*<>r-4fe=P^yc)hQ7QrM;ouzv1igl>hoR`A_fxz#j&C_?m6cZw2 zlRep!2D1q~4O!nYU%>xEi}*qh{)}OLo|va+x}Z8Iy`!1>5UW~RXS0nkw^;6HJ=tLH zSn)3+)9?oD#Bha7?i{&LLDN+5fSg(X+=bM|7$%vK6+Cq+UiW{o+bu`o?qNfAYCoA6 zc&?{itgJwW#JM?jRWWY5E0meF7K^>b*etCZcL<*q+&ch1ptIMoKK)KGw_;+(&xD)? zv|dOGku2s4-%B9`A`d$)$dcq(y8a0xPBY}v~LQKj%XUQeO?YC9~D&XrJQi-r+ADY!T8kjZEL=$>?(0sl+ zc`Ug-%aFDJ4}^1k@wWD{nuO++@a|Hf@-fv(2D~9$nPLhTx@A;CIy;J#eYhAZZg6nB zSV@}s-y@ZV$uVWDRu2>JzBr>Fv=4u#%qyy!BakDA|N36tIIOckni)20`_|S7cj((> zf&V95&THj8W@Rhy5UCiz7drqg_1=4n$zd-R5k)JqyNVC#y=PbdX!6U$IBgNXn~Aon zDfbtQ9oTj3-7_Yc(H4kKEzv&Yu z-DBp$FR%HDoRhN?kmtXcuPBzxwz?}xeL52G%Ck_GF|UWy6~7df;6c&AA_LFZFUv2Q z!?~h$d{YP>d(mjo(+F9&;yj@-likmC!q!TPU-%28UAyYja0aUh6E_~27 zuaq~P`i~L`kxH}JyM^| zSc-<=af866D+))QfQ7l0Z`>Il%l5sb7FD6YFas{UxVVQ!*}!_F9xu8ck7yMyplbr= z$Q7{u=9>j_>Bh#(-N)&tM)6yeyKubr+s|pAM6Z?GWc-o?Z(n8+n7D*oAN|1l(b@SF z%QC{QyfDWEa{I#dJ}ne(^y}}DU;VMN2005C&NX`S9c@r$Jrsv zcs6IJNUynDsYvI2$AotdS=C$XV5%(z@}O;Ba2cyi^x9-fw2KSS`N13^7-^j6augoU zkEV-RZ1-OX-~EK_b0_RpIF}iCqHxRYI=u+Q?fMDSNxYu6Taf50{{nCM$R7#8CB9SD z>141rQ4D`?9JXwz&}&CUUKpNQq_{w)Cn8}2E^?|o$BWV63l>h8H1ckl&TiNN;nteQ z%of8n14m2A5@hSG`@v*O8)t0@U0=4DxO@B6T`34kSRZ&5dq$x!YH|}YA{yZigO7Y} zpvt^#ATb8tbAHkgg1oN;Fu%vkHUC~HUl5VI0WN#J5bETfAGW_sV20f~A7OnQ+nNn) zhFd=t=>tcpuit(RzbRWBt~4%=7d4D(7qtwBL+4|KbwO$xKys$$^Gb8W@B5gXHGO9Y4% z<)91KFvw8`1c@RVuwNOM4##u6N?{dlJMoerP7n4(=fISi_kyyPP~DwJNuRFfHaS%e z;jBimA;Z^Ntd4KiV8&>&2ygWPH+q^-AKrGlus9yr84x83)Yl4aVYGQgUIzpY+6Ucb zveOcy4)kist_qqt-E*w&`?m$}*v-AtRyBB`_;}9lwc%hN< zvR^h393a4FH!kAtF-xSRMFX&fP<~dUt2sBtI6f5&HtyZd+(-_D zS)iA*(;O4cje&H6Je5B?{(-}fGq2?6n+9!AnOa|dS@pr0}D<- zr}dUzEJ{VaN0TW5{spRj8C5IY=z`vy5tmRwIb?|)xNOc?!bOd7SwG0VMh<^qb{SVe zcSU=_mg~ulk#$7i=Db~bA}L}?tzqtX?zFmteDV-u{Vf}}`wtZ5#?zOhsVj)S z=Im4=?QT7J_2qTx$~)(eo*{k7;QN5A4y5F1%74HO5eu^{@P^}o=#))-JsZhQC;2cR zoTi{vudj*$<&ayBSjbb6AN(~iacb@xx$NZaQ5b1M_8>f<6lGf5iRr!BUA3k$=~waZ z8eCg%!0y-6Uthjl@=cKiKbqjSUy4aVt&YwxW@1W! zM}m%^!FpHEwI&WOQXYJ{!rrGfs;sa_^Xf?b$3?^P>L&4|VK*YJ$-f&XhF^_D50!oe ze_3M~6O6LXig~kC^BiLdT=cM1T=4FYW)6X=p%kN-P?U4ifOG6nPgd~UBVs|k18y`&kt zy-uzJn^9hrU=rJ*<&W3tmv7Ibnjxssji4~_x-{3Tp++e9c^gq#tGb88ua4B}8|6Ov zX3^r%-lO>o-!f))lX`9C^2yy(rz}e7QMghTvtiJt!MkK_zV(bzS`FhV>e;k$2J!(O z$5YSo{sCsaUoPD7X6(C|mmwGkhxp91NHx*CJ|-QNHD+gumK;TrW%+$DBjou=i1>g{ zzxXuw$p!r47G>Qsmf?j)_JT0|F6O=~F^c0Hq!w|dgt3M*+Oaq<5^A!j$Vur+vHt-> zFStipVIL7x586gt`0)KowVWwYD>IRQtV}uoKR}ODrK-2KkkgQ^sr?xyJI5tbz7Y1e zeRRrm>~Akr5JA~OW z{o>_s=^C~33R0MtVZf#Y--|~IZR1eDPK^Ei%S1bGvpo9=yfJkQ%DMTPn{P6U=w|#L zmNesZ@$3wCQwZ||$P*LexoHJ2tQhb`yfHx6c*W;JtYNCn-lw9<(kf3}A&(az+SSv~ z-+Xd;1&(N5vQO*H!p2;FfXUHodfQRyf<$q9voPzUB$t0c{#O~R?W5Jb)HyT2;vbVH zBzo-wo^u_|beabMCxyvYQ?%`csVvmI2XhKtk>I(^#+k%WGx2=bS zuGgqJ+Hvvl9K9oOm7k1^9jr)p{^qVxCFdeh%Cn3qSM*m@15jGAjmG$Ca0n5OViqXqYE3V2DeE*tlWqVXLHhPQiEfW|}sj zF5z|u6mw?J-tv__dLJ~wy*t=Y5N17L`C#VvUD1HS?TqHTUQ_oR?s_RrwrA(mXUsr; z9l*)49j4!!EPw)Y^tG}einyvDHW|+lM4X>k%qFP55d*xJ9m+eOtsUGAkK*PG=yYa= zm~cE8DeAW8k&y58zzziuS2hc@;Ni;n*XxO46oR7BD=3^NPw0~+d@g2KDd|0h5n+`h z?w!pXS(F}$R15$O01y{jV-cDJlH`lU!^>RuVe1{uiH zVUL2)aP**ik*DXLMgTKy5qxTP5WG-_PlFt>mdJa}^tTrBVIu78jkD<=+2`v^jv6J_G1K}n zbmfAmHywLV4qJfS4}4SQXPk|@?2;eJ zz1^ZVnB+i9Hdd9BHolH#tZLSP0ac%vKE?064P{=I=`_Ylf8v^Jj}b<2U1r+LHv{cebx*B2}4^3cYVX=?w&&FBYRyAS+@W$(fW)^Spi4kzsv#4+uQ+6 zYB3)ps}mi~4<}LFp?_s6^HHD-c&@SAVf>u_4MmrK=;S>5tC{leB)zLm#7kdT7MjWtJJiXXm)uJWC zYjr=t7b7LiNbLBMnjAV8dmiz#`->)W%6lZPUa}l>N=!Pwu%JT&UHz$XuLDswOpRn5T z>-D8MEH@fm+m7#w+nfFYk&b%&Pro-lx{39g+`h)MlPgoA6|U^RgZX9(5tH2Q3!oklfIPH?-i(Ri46(JN}u)3G~dk zDM6@|(>3mm))g8=Q?GM^nsF>8Xswi&EQSKEOJz!>DqT^cdS4by);Vdi=C8Br-ppR` zBq`cBV?ow8`%>g}b{R(FcBS}O`}Ln{Z(mq_vUE&`oJUY0nIcJC9z2imHSsm^Pm)da zxGa-4P~HaISa0zuZV#c~{?*I6j!-`-8hq^zUUJa``vLgN!gi1eYOWom?^pNiWphh; z?>5E9zZP7;Q=eX#$3jb@%qIshn@3qx;-i*WmLJxm8r|e-iUG_MO7`vi;hdH{ zVXOLHxcRA1-5>(Mq+w z8D0G1i}Ye;1bhequ#%c@{DkwHFA0eGjF~;jn=2GL>D;HL!N%94LhO3^qb$}&v1fF1 zxcE!awEFZ1rfej?sPtW`p2*J1;O8@<(17|hHJLY=ayiJNV!6NpJi>+I)2Kkm0OHF zOCh13p*wTs4R(Y5vX?; zFQqzj%79!xDwupErqoED=Bfc4Cy26GYywq3HHqvkqeC!u~KCi zF#iCh_Z-TlO`S`e{29^K#D-OajjvefAnG8EM16&Xj1X1QbY&od4ogW&)SiQelI?EC z~*$N&HU00y8vT?3kJ-G-*x*j^S4PGuxBAZ#zC2P(}Lr9`N` z0;3&FzTY9#p~$43P=3NPoy$lbtt7Abh5JGO08J4i1C`ueUirM$>&$o@IPjOY_cmJl zA4RnE-sG5qmrx01@xy6HD@|qUwrZeZ&u3mGmy?NYxP(ULd`(o6pUh;#fp z6d`Uc4Yq|XYfuP6K_x_-003ts<#$(Die~dwuCy03gv4((j<-try1hfASE-Ibp1^gr z=Lb@fq30y)1Z8dP1y;$*DpoJk*1Q>%HXP_z*d`UaX$RG$mHz+`=i%nA6b6JH3 zI^U4#!40Q5JtXu2%1%}a?I78tB5cB!>SSkMn9tp7oFzq#Er(-CWe+mqN?dJVDJln$ zgO%XjG^#0jqeepCfvv_hxWMj?Wg^SN-eIG5`oQ1iFUB}|&feV=YOeiJprs5=;Vw3&p8o*RSxbv19G9a? zVQjqGuv<$7DoN-#^ZO2OZUu5`IRXx&qL}vOJJ>nSzn@{Q!lP)nxwCh1X_~_IIR5}s zDqSLF;9JnL($Ee_Ph0$Y33qzoFC*c;+H0qM%sSlZQ>m%Pqv z7FI}RQZX$#&+#PgaBXKdCWZHs(h23{9XTyUY9#9?=EjX8WQL>0VaHx^SRte&sY*Qn z46HrR$A!I5vVQBsK~=GiL^ zUA0mGgwEnPRt`#V9l~<5b|Qym<6#Y*@=C@JN^^$3o~Y-$V|KJFPL;_6xhL{TZ_hmr z46P-Su34!Y%|9&) znF&q+KwH|HZ?3$ot%CEkiOUl&U z#ip}+x1EpOFvh7&0-y&<#tr=Qt zwY64zcI&YWn2FEbG5j=v(y^^M0uMaV=v9i`p68}OdP|vs+ziR<9KktRtB_@|AG8wp z)oboXI3C5XDs3{KOpch)Vl^F<>TR^{Q}!~`U5%2j?~f`ei6s93J&ypB)zqx54bR%j zNn4Q_`AR<_U|{e0SuH9;)`g&@X(TBs1Q15BLDYHHfn#kYp&-+#t}U)v3-B5K^<`%+ zMwJjD>fDu0ca?_mZGd)_lt@tFM?`p$nqia=1-6h7k?aHPg`u)GYPyUnG{&8G3~y`I&%wN?S4U*20WP}1p8o)+Cptd{@(4;25&#Jp z00wL@)Cbu|8)@VzryE0vQgBjK0+M~8>ls%rhR0P(*BzC>ccwmMekjVfa<;Ay(m*X# z8vDOQ@8Xr^It1!-<%!VWjPIcG3J>J0IjdO%l$$DFQ;KW$&zUkE4NGnnH1cGv;T^+co5LE#XoAl)`?6r8G84@7w- zRO-B_-lvitK-kKqa(2=tCMb(FKXJ{%zxi^hSxZez1kR#OWg}Y4Dk%Q+f-(vRQR7&Q zp+KKKdx%h^NnSh_T2qSrla5r|sJC?w{?Xj%K756xzs)=>sdotZ@Tzsh4wObgSNq(` zope?jo46~0xsDGyONDtwg$f%*xN#Va(A0*T4Wxbv1MNjl&(JEQnUr{PPb%DH3O|84 zPP!WlFf6xDdOEsTeSfbh_XAAV4!RjNjKv#IY7SzAXbcT;cT>!K;t z^tAJ9%1x8CQE@NODou`)8O_h;22Ql|Dk*iPp`9`8v<^KS~Qf9x7t?7lY zWE`Sh#k-f{tn9J>0CXjvic^$3lD85(XoDZrn6~a(h`IOqzu3S0QLdS-~ZYB04N&( literal 0 HcmV?d00001 From c21e9712107fa4d806c45f7801ceead28ec0fa24 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 3 Jul 2018 00:41:14 +0200 Subject: [PATCH 26/36] ParseStream -only benchmark --- .../Codecs/Jpeg/DecodeJpegParseStreamOnly.cs | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs new file mode 100644 index 000000000..059f312b3 --- /dev/null +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/DecodeJpegParseStreamOnly.cs @@ -0,0 +1,52 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using BenchmarkDotNet.Attributes; +using System.Drawing; +using System.IO; +using SixLabors.ImageSharp.Formats.Jpeg; +using SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort; +using SixLabors.ImageSharp.Tests; + +namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg +{ + [Config(typeof(Config.ShortClr))] + public class DecodeJpegParseStreamOnly + { + [Params(TestImages.Jpeg.Baseline.Jpeg420Exif)] + public string TestImage { get; set; } + + private string TestImageFullPath => Path.Combine(TestEnvironment.InputImagesDirectoryFullPath, this.TestImage); + + private byte[] jpegBytes; + + [GlobalSetup] + public void Setup() + { + this.jpegBytes = File.ReadAllBytes(this.TestImageFullPath); + } + + [Benchmark(Baseline = true, Description = "System.Drawing FULL")] + public Size JpegSystemDrawing() + { + using (var memoryStream = new MemoryStream(this.jpegBytes)) + { + using (var image = System.Drawing.Image.FromStream(memoryStream)) + { + return image.Size; + } + } + } + + [Benchmark(Description = "PdfJsJpegDecoderCore.ParseStream")] + public void ParseStreamPdfJs() + { + using (var memoryStream = new MemoryStream(this.jpegBytes)) + { + var decoder = new PdfJsJpegDecoderCore(Configuration.Default, new JpegDecoder() { IgnoreMetadata = true }); + decoder.ParseStream(memoryStream); + decoder.Dispose(); + } + } + } +} \ No newline at end of file From d04611ead160777011bbb0232a633640dbec5c01 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 3 Jul 2018 00:52:44 +0200 Subject: [PATCH 27/36] Introduce InliningOptions --- .../Common/Helpers/InliningOptions.cs | 22 ++++++++++++++++ .../Formats/Jpeg/JpegThrowHelper.cs | 26 +++++++++++++++++++ .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 21 +++++++-------- 3 files changed, 58 insertions(+), 11 deletions(-) create mode 100644 src/ImageSharp/Common/Helpers/InliningOptions.cs create mode 100644 src/ImageSharp/Formats/Jpeg/JpegThrowHelper.cs diff --git a/src/ImageSharp/Common/Helpers/InliningOptions.cs b/src/ImageSharp/Common/Helpers/InliningOptions.cs new file mode 100644 index 000000000..d218acdba --- /dev/null +++ b/src/ImageSharp/Common/Helpers/InliningOptions.cs @@ -0,0 +1,22 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +// Uncomment this for verbose profiler results: +// #define PROFILING +using System.Runtime.CompilerServices; + +namespace SixLabors.ImageSharp +{ + /// + /// Global inlining options. Helps temporally disable inling for better profiler output. + /// + internal static class InliningOptions + { +#if PROFILING + public const MethodImplOptions ShortMethod = 0; +#else + public const MethodImplOptions ShortMethod = MethodImplOptions.AggressiveInlining; +#endif + public const MethodImplOptions ColdPath = MethodImplOptions.NoInlining; + } +} \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/JpegThrowHelper.cs b/src/ImageSharp/Formats/Jpeg/JpegThrowHelper.cs new file mode 100644 index 000000000..c7f366660 --- /dev/null +++ b/src/ImageSharp/Formats/Jpeg/JpegThrowHelper.cs @@ -0,0 +1,26 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using System.Runtime.CompilerServices; + +namespace SixLabors.ImageSharp.Formats.Jpeg +{ + internal static class JpegThrowHelper + { + /// + /// Cold path optimization for throwing -s + /// + /// The error message for the exception + [MethodImpl(MethodImplOptions.NoInlining)] + public static void ThrowImageFormatException(string errorMessage) + { + throw new ImageFormatException(errorMessage); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static void ThrowBadHuffmanCode() + { + throw new ImageFormatException("Bad Huffman code."); + } + } +} \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index cc9d4d470..74772ec61 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -665,7 +665,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(InliningOptions.ShortMethod)] private int GetBits(int n) { if (this.codeBits < n) @@ -680,7 +680,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components return (int)k; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(InliningOptions.ShortMethod)] private int GetBit() { if (this.codeBits < 1) @@ -695,7 +695,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components return (int)(k & 0x80000000); } - [MethodImpl(MethodImplOptions.NoInlining)] + [MethodImpl(InliningOptions.ColdPath)] private void FillBuffer() { // Attempt to load at least the minimum nbumber of required bits into the buffer. @@ -748,7 +748,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components while (this.codeBits <= 24); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(InliningOptions.ShortMethod)] private int DecodeHuffman(ref PdfJsHuffmanTable table) { this.CheckBits(); @@ -773,7 +773,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components return this.DecodeHuffmanSlow(ref table); } - [MethodImpl(MethodImplOptions.NoInlining)] + [MethodImpl(InliningOptions.ColdPath)] private int DecodeHuffmanSlow(ref PdfJsHuffmanTable table) { // Naive test is to shift the code_buffer down so k bits are @@ -813,7 +813,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components return table.Values[c]; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(InliningOptions.ShortMethod)] private int ExtendReceive(int n) { if (this.codeBits < n) @@ -829,7 +829,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components return (int)(k + (Bias[n] & ~sgn)); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(InliningOptions.ShortMethod)] private void CheckBits() { if (this.codeBits < 16) @@ -838,10 +838,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(InliningOptions.ShortMethod)] private int PeekBits() => (int)((this.codeBuffer >> (32 - FastBits)) & ((1 << FastBits) - 1)); - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(InliningOptions.ShortMethod)] private bool ContinueOnMcuComplete() { if (--this.todo > 0) @@ -871,14 +871,13 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components return true; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(InliningOptions.ShortMethod)] private bool HasRestart() { byte m = this.marker; return m >= JpegConstants.Markers.RST0 && m <= JpegConstants.Markers.RST7; } - [MethodImpl(MethodImplOptions.NoInlining)] private void Reset() { this.codeBits = 0; From 468797f4fa38dd91bd3e118ab23236860d8a216d Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 3 Jul 2018 00:55:55 +0200 Subject: [PATCH 28/36] use JpegThrowHelper --- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 74772ec61..d0b6cc909 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -361,7 +361,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components if (t < 0) { - throw new ImageFormatException("Bad Huffman code"); + JpegThrowHelper.ThrowBadHuffmanCode(); } int diff = t != 0 ? this.ExtendReceive(t) : 0; @@ -398,7 +398,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components if (rs < 0) { - throw new ImageFormatException("Bad Huffman code"); + JpegThrowHelper.ThrowBadHuffmanCode(); } s = rs & 15; @@ -432,7 +432,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { if (this.spectralEnd != 0) { - throw new ImageFormatException("Can't merge DC and AC."); + JpegThrowHelper.ThrowImageFormatException("Can't merge DC and AC."); } this.CheckBits(); @@ -465,7 +465,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { if (this.spectralStart == 0) { - throw new ImageFormatException("Can't merge DC and AC."); + JpegThrowHelper.ThrowImageFormatException("Can't merge DC and AC."); } if (this.successiveHigh == 0) @@ -508,7 +508,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components if (rs < 0) { - throw new ImageFormatException("Bad Huffman code."); + JpegThrowHelper.ThrowBadHuffmanCode(); } s = rs & 15; @@ -587,7 +587,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int rs = this.DecodeHuffman(ref acTable); if (rs < 0) { - throw new ImageFormatException("Bad Huffman code."); + JpegThrowHelper.ThrowBadHuffmanCode(); } int s = rs & 15; @@ -614,7 +614,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { if (s != 1) { - throw new ImageFormatException("Bad Huffman code."); + JpegThrowHelper.ThrowBadHuffmanCode(); } // Sign bit From b9a6804fbfff0cbd5c5e39d8cb11c311e6de666b Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 3 Jul 2018 01:03:51 +0200 Subject: [PATCH 29/36] separate Interleaved / Non-Interleaved code path --- .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 361 ++++++++++-------- 1 file changed, 208 insertions(+), 153 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index d0b6cc909..6f88b6e1f 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -153,203 +153,258 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { if (this.componentsLength == 1) { - PdfJsFrameComponent component = this.components[this.componentIndex]; - - // Non-interleaved data, we just need to process one block at a time, - // in trivial scanline order - // number of blocks to do just depends on how many actual "pixels" this - // component has, independent of interleaved MCU blocking and such - int w = component.WidthInBlocks; - int h = component.HeightInBlocks; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); - - int mcu = 0; - for (int j = 0; j < h; j++) - { - for (int i = 0; i < w; i++) - { - if (this.eof) - { - return; - } - - int blockRow = mcu / w; - int blockCol = mcu % w; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, ref fastACRef); - - // Every data block is an MCU, so countdown the restart interval - mcu++; - if (!this.ContinueOnMcuComplete()) - { - return; - } - } - } + this.ParseBaselineDataNonInterleaved(dcHuffmanTables, acHuffmanTables, fastACTables); } else { - // Interleaved - int mcu = 0; - int mcusPerColumn = frame.McusPerColumn; - int mcusPerLine = frame.McusPerLine; - for (int j = 0; j < mcusPerColumn; j++) + this.ParseBaselineDataInterleaved(frame, dcHuffmanTables, acHuffmanTables, fastACTables); + } + } + + private void ParseBaselineDataInterleaved( + PdfJsFrame frame, + PdfJsHuffmanTables dcHuffmanTables, + PdfJsHuffmanTables acHuffmanTables, + FastACTables fastACTables) + { + // Interleaved + int mcu = 0; + int mcusPerColumn = frame.McusPerColumn; + int mcusPerLine = frame.McusPerLine; + for (int j = 0; j < mcusPerColumn; j++) + { + for (int i = 0; i < mcusPerLine; i++) { - for (int i = 0; i < mcusPerLine; i++) + // Scan an interleaved mcu... process components in order + for (int k = 0; k < this.componentsLength; k++) { - // Scan an interleaved mcu... process components in order - for (int k = 0; k < this.componentsLength; k++) + PdfJsFrameComponent component = this.components[k]; + ref short blockDataRef = ref MemoryMarshal.GetReference( + MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; + ref short fastACRef = + ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); + int h = component.HorizontalSamplingFactor; + int v = component.VerticalSamplingFactor; + + // Scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (int y = 0; y < v; y++) { - PdfJsFrameComponent component = this.components[k]; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); - int h = component.HorizontalSamplingFactor; - int v = component.VerticalSamplingFactor; - - // Scan out an mcu's worth of this component; that's just determined - // by the basic H and V specified for the component - for (int y = 0; y < v; y++) + for (int x = 0; x < h; x++) { - for (int x = 0; x < h; x++) + if (this.eof) { - if (this.eof) - { - return; - } - - int mcuRow = mcu / mcusPerLine; - int mcuCol = mcu % mcusPerLine; - int blockRow = (mcuRow * v) + y; - int blockCol = (mcuCol * h) + x; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeBlock(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable, ref acHuffmanTable, ref fastACRef); + return; } + + int mcuRow = mcu / mcusPerLine; + int mcuCol = mcu % mcusPerLine; + int blockRow = (mcuRow * v) + y; + int blockCol = (mcuCol * h) + x; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlockBaseline( + component, + ref Unsafe.Add(ref blockDataRef, offset), + ref dcHuffmanTable, + ref acHuffmanTable, + ref fastACRef); } } + } - // After all interleaved components, that's an interleaved MCU, - // so now count down the restart interval - mcu++; - if (!this.ContinueOnMcuComplete()) - { - return; - } + // After all interleaved components, that's an interleaved MCU, + // so now count down the restart interval + mcu++; + if (!this.ContinueOnMcuComplete()) + { + return; } } } } - private void ParseProgressiveData( - PdfJsFrame frame, + /// + /// Non-interleaved data, we just need to process one block at a ti + /// in trivial scanline order + /// number of blocks to do just depends on how many actual "pixels" + /// component has, independent of interleaved MCU blocking and such + /// + private void ParseBaselineDataNonInterleaved( PdfJsHuffmanTables dcHuffmanTables, PdfJsHuffmanTables acHuffmanTables, FastACTables fastACTables) { - if (this.componentsLength == 1) + PdfJsFrameComponent component = this.components[this.componentIndex]; + + int w = component.WidthInBlocks; + int h = component.HeightInBlocks; + ref short blockDataRef = + ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; + ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); + + int mcu = 0; + for (int j = 0; j < h; j++) { - PdfJsFrameComponent component = this.components[this.componentIndex]; - - // Non-interleaved data, we just need to process one block at a time, - // in trivial scanline order - // number of blocks to do just depends on how many actual "pixels" this - // component has, independent of interleaved MCU blocking and such - int w = component.WidthInBlocks; - int h = component.HeightInBlocks; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); - - int mcu = 0; - for (int j = 0; j < h; j++) + for (int i = 0; i < w; i++) { - for (int i = 0; i < w; i++) + if (this.eof) { - if (this.eof) - { - return; - } - - int blockRow = mcu / w; - int blockCol = mcu % w; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - - if (this.spectralStart == 0) - { - this.DecodeBlockProgressiveDC(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable); - } - else - { - this.DecodeBlockProgressiveAC(ref Unsafe.Add(ref blockDataRef, offset), ref acHuffmanTable, ref fastACRef); - } + return; + } - // Every data block is an MCU, so countdown the restart interval - mcu++; - if (!this.ContinueOnMcuComplete()) - { - return; - } + int blockRow = mcu / w; + int blockCol = mcu % w; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlockBaseline( + component, + ref Unsafe.Add(ref blockDataRef, offset), + ref dcHuffmanTable, + ref acHuffmanTable, + ref fastACRef); + + // Every data block is an MCU, so countdown the restart interval + mcu++; + if (!this.ContinueOnMcuComplete()) + { + return; } } } + } + + private void ParseProgressiveData( + PdfJsFrame frame, + PdfJsHuffmanTables dcHuffmanTables, + PdfJsHuffmanTables acHuffmanTables, + FastACTables fastACTables) + { + if (this.componentsLength == 1) + { + this.ParseProgressiveDataNonInterleaved(dcHuffmanTables, acHuffmanTables, fastACTables); + } else { - // Interleaved - int mcu = 0; - int mcusPerColumn = frame.McusPerColumn; - int mcusPerLine = frame.McusPerLine; - for (int j = 0; j < mcusPerColumn; j++) + this.ParseProgressiveDataInterleaved(frame, dcHuffmanTables); + } + } + + private void ParseProgressiveDataInterleaved(PdfJsFrame frame, PdfJsHuffmanTables dcHuffmanTables) + { + // Interleaved + int mcu = 0; + int mcusPerColumn = frame.McusPerColumn; + int mcusPerLine = frame.McusPerLine; + for (int j = 0; j < mcusPerColumn; j++) + { + for (int i = 0; i < mcusPerLine; i++) { - for (int i = 0; i < mcusPerLine; i++) + // Scan an interleaved mcu... process components in order + for (int k = 0; k < this.componentsLength; k++) { - // Scan an interleaved mcu... process components in order - for (int k = 0; k < this.componentsLength; k++) + PdfJsFrameComponent component = this.components[k]; + ref short blockDataRef = ref MemoryMarshal.GetReference( + MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + int h = component.HorizontalSamplingFactor; + int v = component.VerticalSamplingFactor; + + // Scan out an mcu's worth of this component; that's just determined + // by the basic H and V specified for the component + for (int y = 0; y < v; y++) { - PdfJsFrameComponent component = this.components[k]; - ref short blockDataRef = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - int h = component.HorizontalSamplingFactor; - int v = component.VerticalSamplingFactor; - - // Scan out an mcu's worth of this component; that's just determined - // by the basic H and V specified for the component - for (int y = 0; y < v; y++) + for (int x = 0; x < h; x++) { - for (int x = 0; x < h; x++) + if (this.eof) { - if (this.eof) - { - return; - } - - int mcuRow = mcu / mcusPerLine; - int mcuCol = mcu % mcusPerLine; - int blockRow = (mcuRow * v) + y; - int blockCol = (mcuCol * h) + x; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); - this.DecodeBlockProgressiveDC(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable); + return; } + + int mcuRow = mcu / mcusPerLine; + int mcuCol = mcu % mcusPerLine; + int blockRow = (mcuRow * v) + y; + int blockCol = (mcuCol * h) + x; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlockProgressiveDC( + component, + ref Unsafe.Add(ref blockDataRef, offset), + ref dcHuffmanTable); } } + } - // After all interleaved components, that's an interleaved MCU, - // so now count down the restart interval - mcu++; - if (!this.ContinueOnMcuComplete()) - { - return; - } + // After all interleaved components, that's an interleaved MCU, + // so now count down the restart interval + mcu++; + if (!this.ContinueOnMcuComplete()) + { + return; + } + } + } + } + + /// + /// Non-interleaved data, we just need to process one block at a time, + /// in trivial scanline order + /// number of blocks to do just depends on how many actual "pixels" this + /// component has, independent of interleaved MCU blocking and such + /// + private void ParseProgressiveDataNonInterleaved( + PdfJsHuffmanTables dcHuffmanTables, + PdfJsHuffmanTables acHuffmanTables, + FastACTables fastACTables) + { + PdfJsFrameComponent component = this.components[this.componentIndex]; + + int w = component.WidthInBlocks; + int h = component.HeightInBlocks; + ref short blockDataRef = + ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; + ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); + + int mcu = 0; + for (int j = 0; j < h; j++) + { + for (int i = 0; i < w; i++) + { + if (this.eof) + { + return; + } + + int blockRow = mcu / w; + int blockCol = mcu % w; + int offset = component.GetBlockBufferOffset(blockRow, blockCol); + + if (this.spectralStart == 0) + { + this.DecodeBlockProgressiveDC(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable); + } + else + { + this.DecodeBlockProgressiveAC( + ref Unsafe.Add(ref blockDataRef, offset), + ref acHuffmanTable, + ref fastACRef); + } + + // Every data block is an MCU, so countdown the restart interval + mcu++; + if (!this.ContinueOnMcuComplete()) + { + return; } } } } - private void DecodeBlock( + private void DecodeBlockBaseline( PdfJsFrameComponent component, ref short blockDataRef, ref PdfJsHuffmanTable dcTable, From ff1a24c02a5f258497dac5d5d7d4c605210836c6 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 3 Jul 2018 01:14:33 +0200 Subject: [PATCH 30/36] simplify + uniformize blockDataRef retrieval --- .../Components/PdfJsFrameComponent.cs | 8 +++ .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 49 ++++++++++++------- 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs index 1a10adf88..7501b0d83 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs @@ -144,5 +144,13 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { return 64 * (((this.WidthInBlocks + 1) * row) + col); } + + // TODO: we need consistence in (row, col) VS (col, row) ordering + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public ref short GetBlockDataReference(int row, int col) + { + ref Block8x8 blockRef = ref this.GetBlockReference(col, row); + return ref Unsafe.As(ref blockRef); + } } } \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 6f88b6e1f..18cfc6c3f 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -179,8 +179,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components for (int k = 0; k < this.componentsLength; k++) { PdfJsFrameComponent component = this.components[k]; - ref short blockDataRef = ref MemoryMarshal.GetReference( - MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; ref short fastACRef = @@ -203,10 +202,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int mcuCol = mcu % mcusPerLine; int blockRow = (mcuRow * v) + y; int blockCol = (mcuCol * h) + x; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlockBaseline( component, - ref Unsafe.Add(ref blockDataRef, offset), + blockRow, + blockCol, ref dcHuffmanTable, ref acHuffmanTable, ref fastACRef); @@ -240,8 +240,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int w = component.WidthInBlocks; int h = component.HeightInBlocks; - ref short blockDataRef = - ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); @@ -258,10 +257,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int blockRow = mcu / w; int blockCol = mcu % w; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlockBaseline( component, - ref Unsafe.Add(ref blockDataRef, offset), + blockRow, + blockCol, ref dcHuffmanTable, ref acHuffmanTable, ref fastACRef); @@ -330,7 +330,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int offset = component.GetBlockBufferOffset(blockRow, blockCol); this.DecodeBlockProgressiveDC( component, - ref Unsafe.Add(ref blockDataRef, offset), + blockRow, + blockCol, ref dcHuffmanTable); } } @@ -362,8 +363,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int w = component.WidthInBlocks; int h = component.HeightInBlocks; - ref short blockDataRef = - ref MemoryMarshal.GetReference(MemoryMarshal.Cast(component.SpectralBlocks.Span)); + ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); @@ -380,16 +380,21 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int blockRow = mcu / w; int blockCol = mcu % w; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); if (this.spectralStart == 0) { - this.DecodeBlockProgressiveDC(component, ref Unsafe.Add(ref blockDataRef, offset), ref dcHuffmanTable); + this.DecodeBlockProgressiveDC( + component, + blockRow, + blockCol, + ref dcHuffmanTable); } else { this.DecodeBlockProgressiveAC( - ref Unsafe.Add(ref blockDataRef, offset), + component, + blockRow, + blockCol, ref acHuffmanTable, ref fastACRef); } @@ -406,7 +411,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components private void DecodeBlockBaseline( PdfJsFrameComponent component, - ref short blockDataRef, + int row, + int col, ref PdfJsHuffmanTable dcTable, ref PdfJsHuffmanTable acTable, ref short fastACRef) @@ -419,6 +425,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components JpegThrowHelper.ThrowBadHuffmanCode(); } + ref short blockDataRef = ref component.GetBlockDataReference(row, col); + int diff = t != 0 ? this.ExtendReceive(t) : 0; int dc = component.DcPredictor + diff; component.DcPredictor = dc; @@ -482,7 +490,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components private void DecodeBlockProgressiveDC( PdfJsFrameComponent component, - ref short blockDataRef, + int row, + int col, ref PdfJsHuffmanTable dcTable) { if (this.spectralEnd != 0) @@ -492,6 +501,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components this.CheckBits(); + ref short blockDataRef = ref component.GetBlockDataReference(row, col); + if (this.successiveHigh == 0) { // First scan for DC coefficient, must be first @@ -514,7 +525,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } private void DecodeBlockProgressiveAC( - ref short blockDataRef, + PdfJsFrameComponent component, + int row, + int col, ref PdfJsHuffmanTable acTable, ref short fastACRef) { @@ -523,6 +536,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components JpegThrowHelper.ThrowImageFormatException("Can't merge DC and AC."); } + ref short blockDataRef = ref component.GetBlockDataReference(row, col); + if (this.successiveHigh == 0) { // MCU decoding for AC initial scan (either spectral selection, From df557c9312b219112fe6cf1294abf524ba000762 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 3 Jul 2018 01:29:04 +0200 Subject: [PATCH 31/36] ScanDecoder: refactor parameters to members --- .../Jpeg/PdfJsPort/Components/FastACTables.cs | 9 ++ .../Jpeg/PdfJsPort/Components/ScanDecoder.cs | 108 ++++++++---------- .../Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs | 7 +- 3 files changed, 61 insertions(+), 63 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs index 3e170a92c..6cb0d6dfe 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/FastACTables.cs @@ -34,6 +34,15 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components return this.tables.GetRowSpan(index); } + /// + /// Gets a reference to the first element of the AC table indexed by + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public ref short GetAcTableReference(PdfJsFrameComponent component) + { + return ref this.tables.GetRowSpan(component.ACHuffmanTableId)[0]; + } + /// /// Builds a lookup table for fast AC entropy scan decoding. /// diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs index 18cfc6c3f..8575bac69 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/ScanDecoder.cs @@ -23,6 +23,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components // LUT Bias[n] = (-1 << n) + 1 private static readonly int[] Bias = { 0, -1, -3, -7, -15, -31, -63, -127, -255, -511, -1023, -2047, -4095, -8191, -16383, -32767 }; + private readonly PdfJsFrame frame; + private readonly PdfJsHuffmanTables dcHuffmanTables; + private readonly PdfJsHuffmanTables acHuffmanTables; + private readonly FastACTables fastACTables; + private readonly DoubleBufferedStreamReader stream; private readonly PdfJsFrameComponent[] components; private readonly ZigZag dctZigZag; @@ -79,7 +84,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// Initializes a new instance of the class. /// /// The input stream. - /// The scan components. + /// The image frame. + /// The DC Huffman tables. + /// The AC Huffman tables. + /// The fast AC decoding tables. /// The component index within the array. /// The length of the components. Different to the array length. /// The reset interval. @@ -89,7 +97,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// The successive approximation bit low end. public ScanDecoder( DoubleBufferedStreamReader stream, - PdfJsFrameComponent[] components, + PdfJsFrame frame, + PdfJsHuffmanTables dcHuffmanTables, + PdfJsHuffmanTables acHuffmanTables, + FastACTables fastACTables, int componentIndex, int componentsLength, int restartInterval, @@ -100,7 +111,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { this.dctZigZag = ZigZag.CreateUnzigTable(); this.stream = stream; - this.components = components; + this.frame = frame; + this.dcHuffmanTables = dcHuffmanTables; + this.acHuffmanTables = acHuffmanTables; + this.fastACTables = fastACTables; + this.components = frame.Components; this.marker = JpegConstants.Markers.XFF; this.markerPosition = 0; this.componentIndex = componentIndex; @@ -115,25 +130,17 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// /// Decodes the entropy coded data. /// - /// The image frame. - /// The DC Huffman tables. - /// The AC Huffman tables. - /// The fast AC decoding tables. - public void ParseEntropyCodedData( - PdfJsFrame frame, - PdfJsHuffmanTables dcHuffmanTables, - PdfJsHuffmanTables acHuffmanTables, - FastACTables fastACTables) + public void ParseEntropyCodedData() { this.Reset(); - if (!frame.Progressive) + if (!this.frame.Progressive) { - this.ParseBaselineData(frame, dcHuffmanTables, acHuffmanTables, fastACTables); + this.ParseBaselineData(); } else { - this.ParseProgressiveData(frame, dcHuffmanTables, acHuffmanTables, fastACTables); + this.ParseProgressiveData(); } if (this.badMarker) @@ -145,32 +152,24 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components [MethodImpl(MethodImplOptions.AggressiveInlining)] private static uint LRot(uint x, int y) => (x << y) | (x >> (32 - y)); - private void ParseBaselineData( - PdfJsFrame frame, - PdfJsHuffmanTables dcHuffmanTables, - PdfJsHuffmanTables acHuffmanTables, - FastACTables fastACTables) + private void ParseBaselineData() { if (this.componentsLength == 1) { - this.ParseBaselineDataNonInterleaved(dcHuffmanTables, acHuffmanTables, fastACTables); + this.ParseBaselineDataNonInterleaved(); } else { - this.ParseBaselineDataInterleaved(frame, dcHuffmanTables, acHuffmanTables, fastACTables); + this.ParseBaselineDataInterleaved(); } } - private void ParseBaselineDataInterleaved( - PdfJsFrame frame, - PdfJsHuffmanTables dcHuffmanTables, - PdfJsHuffmanTables acHuffmanTables, - FastACTables fastACTables) + private void ParseBaselineDataInterleaved() { // Interleaved int mcu = 0; - int mcusPerColumn = frame.McusPerColumn; - int mcusPerLine = frame.McusPerLine; + int mcusPerColumn = this.frame.McusPerColumn; + int mcusPerLine = this.frame.McusPerLine; for (int j = 0; j < mcusPerColumn; j++) { for (int i = 0; i < mcusPerLine; i++) @@ -180,10 +179,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { PdfJsFrameComponent component = this.components[k]; - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ref short fastACRef = - ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); + ref PdfJsHuffmanTable dcHuffmanTable = ref this.dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref this.acHuffmanTables[component.ACHuffmanTableId]; + ref short fastACRef = ref this.fastACTables.GetAcTableReference(component); int h = component.HorizontalSamplingFactor; int v = component.VerticalSamplingFactor; @@ -231,19 +229,16 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// number of blocks to do just depends on how many actual "pixels" /// component has, independent of interleaved MCU blocking and such /// - private void ParseBaselineDataNonInterleaved( - PdfJsHuffmanTables dcHuffmanTables, - PdfJsHuffmanTables acHuffmanTables, - FastACTables fastACTables) + private void ParseBaselineDataNonInterleaved() { PdfJsFrameComponent component = this.components[this.componentIndex]; int w = component.WidthInBlocks; int h = component.HeightInBlocks; - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); + ref PdfJsHuffmanTable dcHuffmanTable = ref this.dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref this.acHuffmanTables[component.ACHuffmanTableId]; + ref short fastACRef = ref this.fastACTables.GetAcTableReference(component); int mcu = 0; for (int j = 0; j < h; j++) @@ -276,28 +271,24 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components } } - private void ParseProgressiveData( - PdfJsFrame frame, - PdfJsHuffmanTables dcHuffmanTables, - PdfJsHuffmanTables acHuffmanTables, - FastACTables fastACTables) + private void ParseProgressiveData() { if (this.componentsLength == 1) { - this.ParseProgressiveDataNonInterleaved(dcHuffmanTables, acHuffmanTables, fastACTables); + this.ParseProgressiveDataNonInterleaved(); } else { - this.ParseProgressiveDataInterleaved(frame, dcHuffmanTables); + this.ParseProgressiveDataInterleaved(); } } - private void ParseProgressiveDataInterleaved(PdfJsFrame frame, PdfJsHuffmanTables dcHuffmanTables) + private void ParseProgressiveDataInterleaved() { // Interleaved int mcu = 0; - int mcusPerColumn = frame.McusPerColumn; - int mcusPerLine = frame.McusPerLine; + int mcusPerColumn = this.frame.McusPerColumn; + int mcusPerLine = this.frame.McusPerLine; for (int j = 0; j < mcusPerColumn; j++) { for (int i = 0; i < mcusPerLine; i++) @@ -306,9 +297,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components for (int k = 0; k < this.componentsLength; k++) { PdfJsFrameComponent component = this.components[k]; - ref short blockDataRef = ref MemoryMarshal.GetReference( - MemoryMarshal.Cast(component.SpectralBlocks.Span)); - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable dcHuffmanTable = ref this.dcHuffmanTables[component.DCHuffmanTableId]; int h = component.HorizontalSamplingFactor; int v = component.VerticalSamplingFactor; @@ -327,7 +316,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components int mcuCol = mcu % mcusPerLine; int blockRow = (mcuRow * v) + y; int blockCol = (mcuCol * h) + x; - int offset = component.GetBlockBufferOffset(blockRow, blockCol); + this.DecodeBlockProgressiveDC( component, blockRow, @@ -354,19 +343,16 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components /// number of blocks to do just depends on how many actual "pixels" this /// component has, independent of interleaved MCU blocking and such /// - private void ParseProgressiveDataNonInterleaved( - PdfJsHuffmanTables dcHuffmanTables, - PdfJsHuffmanTables acHuffmanTables, - FastACTables fastACTables) + private void ParseProgressiveDataNonInterleaved() { PdfJsFrameComponent component = this.components[this.componentIndex]; int w = component.WidthInBlocks; int h = component.HeightInBlocks; - ref PdfJsHuffmanTable dcHuffmanTable = ref dcHuffmanTables[component.DCHuffmanTableId]; - ref PdfJsHuffmanTable acHuffmanTable = ref acHuffmanTables[component.ACHuffmanTableId]; - ref short fastACRef = ref MemoryMarshal.GetReference(fastACTables.GetTableSpan(component.ACHuffmanTableId)); + ref PdfJsHuffmanTable dcHuffmanTable = ref this.dcHuffmanTables[component.DCHuffmanTableId]; + ref PdfJsHuffmanTable acHuffmanTable = ref this.acHuffmanTables[component.ACHuffmanTableId]; + ref short fastACRef = ref this.fastACTables.GetAcTableReference(component); int mcu = 0; for (int j = 0; j < h; j++) diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs index cb52fb84b..a360d5477 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs @@ -806,7 +806,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort var sd = new ScanDecoder( this.InputStream, - this.Frame.Components, + this.Frame, + this.dcHuffmanTables, + this.acHuffmanTables, + this.fastACTables, componentIndex, selectorsCount, this.resetInterval, @@ -815,7 +818,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort successiveApproximation >> 4, successiveApproximation & 15); - sd.ParseEntropyCodedData(this.Frame, this.dcHuffmanTables, this.acHuffmanTables, this.fastACTables); + sd.ParseEntropyCodedData(); } /// From 227789628b61b7c3f4c25dcb846f75485de1dac4 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 3 Jul 2018 01:34:15 +0200 Subject: [PATCH 32/36] temporal vortex attacked again --- src/ImageSharp/Common/Helpers/InliningOptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ImageSharp/Common/Helpers/InliningOptions.cs b/src/ImageSharp/Common/Helpers/InliningOptions.cs index d218acdba..e1d51da8d 100644 --- a/src/ImageSharp/Common/Helpers/InliningOptions.cs +++ b/src/ImageSharp/Common/Helpers/InliningOptions.cs @@ -8,7 +8,7 @@ using System.Runtime.CompilerServices; namespace SixLabors.ImageSharp { /// - /// Global inlining options. Helps temporally disable inling for better profiler output. + /// Global inlining options. Helps temporarily disable inling for better profiler output. /// internal static class InliningOptions { From fc2dc1b69d84958ecf82497a754456ccecaa5160 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Tue, 3 Jul 2018 14:48:59 +1000 Subject: [PATCH 33/36] Update ImageSharp Namespaces. --- src/ImageSharp/Formats/Gif/GifEncoder.cs | 2 +- src/ImageSharp/Formats/Gif/GifEncoderCore.cs | 2 +- src/ImageSharp/Formats/Gif/IGifEncoderOptions.cs | 2 +- src/ImageSharp/Formats/Png/IPngEncoderOptions.cs | 2 +- src/ImageSharp/Formats/Png/PngEncoder.cs | 2 +- src/ImageSharp/Formats/Png/PngEncoderCore.cs | 2 +- .../{Transforms => }/AnchorPositionMode.cs | 2 +- .../{Transforms => }/AutoOrientExtensions.cs | 4 ++-- .../{Overlays => }/BackgroundColorExtensions.cs | 4 ++-- .../{Binarization => }/BinaryDiffuseExtensions.cs | 6 +++--- .../{Binarization => }/BinaryDitherExtensions.cs | 6 +++--- .../BinaryThresholdExtensions.cs | 4 ++-- .../{Filters => }/BlackWhiteExtensions.cs | 4 ++-- .../{Convolution => }/BoxBlurExtensions.cs | 4 ++-- .../{Filters => }/BrightnessExtensions.cs | 4 ++-- .../{Filters => }/ColorBlindnessExtensions.cs | 4 ++-- .../Processing/{Filters => }/ColorBlindnessMode.cs | 2 +- .../Processing/{Filters => }/ContrastExtensions.cs | 4 ++-- .../Processing/{Transforms => }/CropExtensions.cs | 4 ++-- .../{Convolution => }/DetectEdgesExtensions.cs | 4 ++-- .../{Dithering => }/DiffuseExtensions.cs | 3 +-- .../Processing/{Dithering => }/DitherExtensions.cs | 5 ++--- .../{Convolution => }/EdgeDetectionOperators.cs | 2 +- .../{Transforms => }/EntropyCropExtensions.cs | 4 ++-- .../Processing/{Filters => }/FilterExtensions.cs | 4 ++-- .../Processing/{Transforms => }/FlipExtensions.cs | 4 ++-- .../Processing/{Transforms => }/FlipMode.cs | 2 +- .../{Convolution => }/GaussianBlurExtensions.cs | 4 ++-- .../{Convolution => }/GaussianSharpenExtensions.cs | 4 ++-- .../Processing/{Overlays => }/GlowExtensions.cs | 4 ++-- .../{Filters => }/GrayscaleExtensions.cs | 4 ++-- .../Processing/{Filters => }/GrayscaleMode.cs | 2 +- .../Processing/{Filters => }/HueExtensions.cs | 4 ++-- .../Processing/{Filters => }/InvertExtensions.cs | 4 ++-- .../Processing/{Dithering => }/KnownDiffusers.cs | 4 ++-- .../Processing/{Dithering => }/KnownDitherers.cs | 6 +++--- .../{Filters => }/KnownFilterMatrices.cs | 4 ++-- .../{Quantization => }/KnownQuantizers.cs | 4 +++- .../Processing/{Transforms => }/KnownResamplers.cs | 4 ++-- .../{Filters => }/KodachromeExtensions.cs | 4 ++-- .../{Filters => }/LomographExtensions.cs | 4 ++-- .../Processing/{Effects => }/OilPaintExtensions.cs | 4 ++-- .../Processing/{Filters => }/OpacityExtensions.cs | 4 ++-- .../Processing/{Transforms => }/OrientationMode.cs | 2 +- .../Processing/{Transforms => }/PadExtensions.cs | 2 +- .../Processing/{Effects => }/PixelateExtensions.cs | 4 ++-- .../Processing/{Filters => }/PolaroidExtensions.cs | 4 ++-- .../Binarization}/BinaryErrorDiffusionProcessor.cs | 5 ++--- .../Binarization}/BinaryOrderedDitherProcessor.cs | 5 ++--- .../Binarization}/BinaryThresholdProcessor.cs | 2 +- .../Convolution}/BoxBlurProcessor.cs | 3 +-- .../Convolution}/Convolution2DProcessor.cs | 3 +-- .../Convolution}/Convolution2PassProcessor.cs | 2 +- .../Convolution}/ConvolutionProcessor.cs | 2 +- .../Convolution}/EdgeDetector2DProcessor.cs | 5 ++--- .../Convolution}/EdgeDetectorCompassProcessor.cs | 5 ++--- .../Convolution}/EdgeDetectorProcessor.cs | 5 ++--- .../Convolution}/GaussianBlurProcessor.cs | 2 +- .../Convolution}/GaussianSharpenProcessor.cs | 7 +++---- .../Convolution}/IEdgeDetectorProcessor.cs | 2 +- .../Convolution}/KayyaliKernels.cs | 2 +- .../Convolution}/KayyaliProcessor.cs | 2 +- .../Convolution}/KirschProcessor.cs | 2 +- .../Convolution}/KirshKernels.cs | 2 +- .../Convolution}/Laplacian3x3Processor.cs | 2 +- .../Convolution}/Laplacian5x5Processor.cs | 2 +- .../Convolution}/LaplacianKernelFactory.cs | 2 +- .../Convolution}/LaplacianKernels.cs | 2 +- .../Convolution}/LaplacianOfGaussianProcessor.cs | 2 +- .../Convolution}/PrewittKernels.cs | 2 +- .../Convolution}/PrewittProcessor.cs | 2 +- .../Convolution}/RobertsCrossKernels.cs | 2 +- .../Convolution}/RobertsCrossProcessor.cs | 2 +- .../Convolution}/RobinsonKernels.cs | 2 +- .../Convolution}/RobinsonProcessor.cs | 2 +- .../Convolution}/ScharrKernels.cs | 2 +- .../Convolution}/ScharrProcessor.cs | 2 +- .../Convolution}/SobelKernels.cs | 2 +- .../Convolution}/SobelProcessor.cs | 2 +- .../Processing/Processors/DelegateProcessor.cs | 8 +++----- .../Dithering}/AtkinsonDiffuser.cs | 2 +- .../Dithering}/BayerDither2x2.cs | 2 +- .../Dithering}/BayerDither4x4.cs | 2 +- .../Dithering}/BayerDither8x8.cs | 2 +- .../Dithering}/BurksDiffuser.cs | 2 +- .../{ => Processors}/Dithering/DHALF.TXT | 0 .../{ => Processors}/Dithering/DITHER.TXT | 0 .../Dithering}/ErrorDiffuserBase.cs | 2 +- .../Dithering}/ErrorDiffusionPaletteProcessor.cs | 5 ++--- .../Dithering}/FloydSteinbergDiffuser.cs | 2 +- .../Dithering}/IErrorDiffuser.cs | 2 +- .../Dithering}/IOrderedDither.cs | 2 +- .../Dithering}/JarvisJudiceNinkeDiffuser.cs | 2 +- .../Dithering}/OrderedDither.cs | 2 +- .../Dithering}/OrderedDither3x3.cs | 2 +- .../Dithering}/OrderedDitherFactory.cs | 2 +- .../Dithering}/OrderedDitherPaletteProcessor.cs | 5 ++--- .../Dithering}/PaletteDitherProcessorBase.cs | 3 +-- .../Dithering}/PixelPair.cs | 2 +- .../Dithering}/Sierra2Diffuser.cs | 2 +- .../Dithering}/Sierra3Diffuser.cs | 2 +- .../Dithering}/SierraLiteDiffuser.cs | 2 +- .../Dithering}/StevensonArceDiffuser.cs | 2 +- .../Dithering}/StuckiDiffuser.cs | 2 +- .../{ => Processors}/Dithering/error_diffusion.txt | 0 .../Effects}/OilPaintingProcessor.cs | 5 ++--- .../Effects}/PixelateProcessor.cs | 3 +-- .../Filters}/AchromatomalyProcessor.cs | 2 +- .../Filters}/AchromatopsiaProcessor.cs | 2 +- .../Filters}/BlackWhiteProcessor.cs | 2 +- .../Filters}/BrightnessProcessor.cs | 2 +- .../Filters}/ContrastProcessor.cs | 2 +- .../Filters}/DeuteranomalyProcessor.cs | 2 +- .../Filters}/DeuteranopiaProcessor.cs | 2 +- .../Filters}/FilterProcessor.cs | 3 +-- .../Filters}/GrayscaleBt601Processor.cs | 2 +- .../Filters}/GrayscaleBt709Processor.cs | 2 +- .../Filters}/HueProcessor.cs | 2 +- .../Filters}/InvertProcessor.cs | 2 +- .../Filters}/KodachromeProcessor.cs | 2 +- .../Filters}/LomographProcessor.cs | 4 ++-- .../Filters}/OpacityProcessor.cs | 2 +- .../Filters}/PolaroidProcessor.cs | 4 ++-- .../Filters}/ProtanomalyProcessor.cs | 2 +- .../Filters}/ProtanopiaProcessor.cs | 2 +- .../Processors => Processors/Filters}/README.md | 0 .../Filters}/SaturateProcessor.cs | 2 +- .../Filters}/SepiaProcessor.cs | 2 +- .../Filters}/TritanomalyProcessor.cs | 2 +- .../Filters}/TritanopiaProcessor.cs | 2 +- .../Overlays}/BackgroundColorProcessor.cs | 3 +-- .../Overlays}/GlowProcessor.cs | 3 +-- .../Overlays}/VignetteProcessor.cs | 3 +-- .../Quantization}/FrameQuantizerBase{TPixel}.cs | 4 ++-- .../Quantization}/IFrameQuantizer{TPixel}.cs | 4 ++-- .../{ => Processors}/Quantization/IQuantizer.cs | 5 ++--- .../Quantization}/OctreeFrameQuantizer{TPixel}.cs | 2 +- .../Quantization/OctreeQuantizer.cs | 6 ++---- .../Quantization}/PaletteFrameQuantizer{TPixel}.cs | 2 +- .../Quantization/PaletteQuantizer.cs | 6 ++---- .../Quantization}/QuantizeProcessor.cs | 4 +--- .../Quantization/QuantizedFrame{TPixel}.cs | 2 +- .../Quantization}/WuFrameQuantizer{TPixel}.cs | 2 +- .../{ => Processors}/Quantization/WuQuantizer.cs | 6 ++---- .../Transforms}/AffineTransformProcessor.cs | 3 +-- .../Transforms}/AutoOrientProcessor.cs | 2 +- .../Transforms}/BicubicResampler.cs | 2 +- .../Transforms}/BoxResampler.cs | 2 +- .../Transforms}/CatmullRomResampler.cs | 2 +- .../CenteredAffineTransformProcessor.cs | 3 +-- .../CenteredProjectiveTransformProcessor.cs | 3 +-- .../Transforms}/CropProcessor.cs | 2 +- .../Transforms}/EntropyCropProcessor.cs | 9 ++++----- .../Transforms}/FlipProcessor.cs | 7 +++---- .../Transforms}/HermiteResampler.cs | 2 +- .../Transforms}/IResampler.cs | 2 +- .../InterpolatedTransformProcessorBase.cs | 3 +-- .../Transforms}/Lanczos2Resampler.cs | 2 +- .../Transforms}/Lanczos3Resampler.cs | 2 +- .../Transforms}/Lanczos5Resampler.cs | 2 +- .../Transforms}/Lanczos8Resampler.cs | 2 +- .../Transforms}/MitchellNetravaliResampler.cs | 2 +- .../Transforms}/NearestNeighborResampler.cs | 2 +- .../Transforms}/ProjectiveTransformProcessor.cs | 4 +--- .../Transforms}/ResizeProcessor.cs | 5 ++--- .../Transforms}/RobidouxResampler.cs | 2 +- .../Transforms}/RobidouxSharpResampler.cs | 2 +- .../Transforms}/RotateProcessor.cs | 4 ++-- .../Transforms}/SkewProcessor.cs | 4 ++-- .../Transforms}/SplineResampler.cs | 2 +- .../Transforms/TransformHelpers.cs | 2 +- .../Transforms}/TransformProcessorBase.cs | 2 +- .../Transforms}/TriangleResampler.cs | 2 +- .../Transforms}/WeightsBuffer.cs | 2 +- .../Transforms}/WeightsWindow.cs | 2 +- .../Transforms}/WelchResampler.cs | 2 +- .../{Transforms => }/ProjectiveTransformHelper.cs | 2 +- .../{Quantization => }/QuantizeExtensions.cs | 4 ++-- .../{Transforms => }/ResizeExtensions.cs | 5 ++--- .../Processing/{Transforms => }/ResizeHelper.cs | 2 +- .../Processing/{Transforms => }/ResizeMode.cs | 2 +- .../Processing/{Transforms => }/ResizeOptions.cs | 4 ++-- .../{Transforms => }/RotateExtensions.cs | 5 ++--- .../{Transforms => }/RotateFlipExtensions.cs | 2 +- .../Processing/{Transforms => }/RotateMode.cs | 2 +- .../Processing/{Filters => }/SaturateExtensions.cs | 4 ++-- .../Processing/{Filters => }/SepiaExtensions.cs | 4 ++-- .../Processing/{Transforms => }/SkewExtensions.cs | 5 ++--- .../{Transforms => }/TransformExtensions.cs | 5 ++--- .../{Overlays => }/VignetteExtensions.cs | 4 ++-- tests/ImageSharp.Benchmarks/Codecs/EncodeGif.cs | 2 +- .../Codecs/EncodeGifMultiple.cs | 2 +- .../Codecs/EncodeIndexedPng.cs | 3 ++- tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs | 3 --- tests/ImageSharp.Benchmarks/Drawing/DrawText.cs | 7 ++----- .../Drawing/DrawTextOutline.cs | 4 ---- tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs | 1 - .../ImageSharp.Benchmarks/Drawing/FillRectangle.cs | 1 - tests/ImageSharp.Benchmarks/Samplers/Crop.cs | 1 - .../ImageSharp.Benchmarks/Samplers/DetectEdges.cs | 1 - tests/ImageSharp.Benchmarks/Samplers/Glow.cs | 2 +- tests/ImageSharp.Benchmarks/Samplers/Resize.cs | 1 - tests/ImageSharp.Tests/ComplexIntegrationTests.cs | 2 +- tests/ImageSharp.Tests/Drawing/BeziersTests.cs | 1 - tests/ImageSharp.Tests/Drawing/DrawImageTest.cs | 4 ++-- tests/ImageSharp.Tests/Drawing/DrawPathTests.cs | 1 - tests/ImageSharp.Tests/Drawing/FillPatternTests.cs | 1 - .../Drawing/LineComplexPolygonTests.cs | 1 - tests/ImageSharp.Tests/Drawing/LineTests.cs | 1 - tests/ImageSharp.Tests/Drawing/PolygonTests.cs | 1 - tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs | 1 - .../Drawing/SolidComplexPolygonTests.cs | 1 - .../ImageSharp.Tests/Drawing/SolidPolygonTests.cs | 1 - .../ImageSharp.Tests/Formats/GeneralFormatTests.cs | 2 +- .../Formats/Gif/GifEncoderTests.cs | 2 +- .../Formats/Png/PngEncoderTests.cs | 2 +- .../ImageSharp.Tests/Formats/Png/PngSmokeTests.cs | 4 +--- .../Image/ImageProcessingContextTests.cs | 6 +----- tests/ImageSharp.Tests/Image/ImageRotationTests.cs | 4 +--- .../Processing/Binarization/BinaryDitherTest.cs | 9 +++------ .../Processing/Binarization/BinaryThresholdTest.cs | 4 ++-- .../Binarization/OrderedDitherFactoryTests.cs | 2 +- .../Processing/Convolution/BoxBlurTest.cs | 7 ++----- .../Processing/Convolution/DetectEdgesTest.cs | 4 +--- .../Processing/Convolution/GaussianBlurTest.cs | 7 ++----- .../Processing/Convolution/GaussianSharpenTest.cs | 7 ++----- .../Processors/LaplacianKernelFactoryTests.cs | 4 ++-- .../Processing/Dithering/DitherTest.cs | 5 ++--- .../Processing/Effects/BackgroundColorTest.cs | 4 ++-- .../Processing/Effects/OilPaintTest.cs | 4 ++-- .../Processing/Effects/PixelateTest.cs | 4 ++-- .../Processing/Filters/BlackWhiteTest.cs | 4 ++-- .../Processing/Filters/BrightnessTest.cs | 4 ++-- .../Processing/Filters/ColorBlindnessTest.cs | 4 ++-- .../Processing/Filters/ContrastTest.cs | 4 ++-- .../Processing/Filters/FilterTest.cs | 4 ++-- .../Processing/Filters/GrayscaleTest.cs | 4 ++-- .../ImageSharp.Tests/Processing/Filters/HueTest.cs | 4 ++-- .../Processing/Filters/InvertTest.cs | 4 ++-- .../Processing/Filters/KodachromeTest.cs | 4 ++-- .../Processing/Filters/LomographTest.cs | 4 ++-- .../Processing/Filters/OpacityTest.cs | 4 ++-- .../Processing/Filters/PolaroidTest.cs | 4 ++-- .../Processing/Filters/SaturateTest.cs | 4 ++-- .../Processing/Filters/SepiaTest.cs | 4 ++-- .../Processing/Overlays/GlowTest.cs | 4 ++-- .../Processing/Overlays/VignetteTest.cs | 4 ++-- .../Processors/Binarization/BinaryDitherTests.cs | 5 +---- .../Processors/Binarization/BinaryThresholdTest.cs | 1 - .../Processors/Convolution/BoxBlurTest.cs | 4 +--- .../Processors/Convolution/DetectEdgesTest.cs | 1 - .../Processors/Convolution/GaussianBlurTest.cs | 1 - .../Processors/Convolution/GaussianSharpenTest.cs | 1 - .../Processing/Processors/Dithering/DitherTests.cs | 3 +-- .../Processors/Effects/BackgroundColorTest.cs | 4 +--- .../Processing/Processors/Effects/OilPaintTest.cs | 4 +--- .../Processing/Processors/Effects/PixelateTest.cs | 4 +--- .../Processors/Filters/BlackWhiteTest.cs | 2 +- .../Processors/Filters/BrightnessTest.cs | 2 +- .../Processors/Filters/ColorBlindnessTest.cs | 2 +- .../Processing/Processors/Filters/ContrastTest.cs | 2 +- .../Processing/Processors/Filters/FilterTest.cs | 2 +- .../Processing/Processors/Filters/GrayscaleTest.cs | 2 +- .../Processing/Processors/Filters/HueTest.cs | 2 +- .../Processing/Processors/Filters/InvertTest.cs | 2 +- .../Processors/Filters/KodachromeTest.cs | 2 +- .../Processing/Processors/Filters/LomographTest.cs | 2 +- .../Processing/Processors/Filters/OpacityTest.cs | 2 +- .../Processing/Processors/Filters/PolaroidTest.cs | 2 +- .../Processing/Processors/Filters/SaturateTest.cs | 2 +- .../Processing/Processors/Filters/SepiaTest.cs | 2 +- .../Processing/Processors/Overlays/GlowTest.cs | 4 +--- .../Processing/Processors/Overlays/VignetteTest.cs | 4 +--- .../Processors/Transforms/AutoOrientTests.cs | 2 +- .../Processing/Processors/Transforms/CropTest.cs | 2 -- .../Processors/Transforms/EntropyCropTest.cs | 2 -- .../Processing/Processors/Transforms/FlipTests.cs | 2 +- .../Processing/Processors/Transforms/PadTest.cs | 4 +--- .../Transforms/ResizeProfilingBenchmarks.cs | 4 +--- .../Processors/Transforms/ResizeTests.cs | 3 +-- .../Processors/Transforms/RotateFlipTests.cs | 2 +- .../Processors/Transforms/RotateTests.cs | 6 ++---- .../Processing/Processors/Transforms/SkewTest.cs | 14 ++++++-------- .../Processing/Transforms/AffineTransformTests.cs | 4 +--- .../Processing/Transforms/AutoOrientTests.cs | 4 ++-- .../Processing/Transforms/CropTest.cs | 4 ++-- .../Processing/Transforms/EntropyCropTest.cs | 4 ++-- .../Processing/Transforms/FlipTests.cs | 4 ++-- .../Processing/Transforms/PadTest.cs | 6 +++--- .../Transforms/ProjectiveTransformTests.cs | 6 ++---- .../Processing/Transforms/ResizeTests.cs | 5 ++--- .../Processing/Transforms/RotateFlipTests.cs | 4 ++-- .../Processing/Transforms/RotateTests.cs | 4 +--- .../Processing/Transforms/SkewTest.cs | 4 ++-- .../Processing/Transforms/TransformsHelpersTest.cs | 3 +-- .../Quantization/QuantizedImageTests.cs | 2 +- .../TestUtilities/Tests/ImageComparerTests.cs | 1 - .../Tests/TestUtilityExtensionsTests.cs | 7 +++---- 298 files changed, 393 insertions(+), 523 deletions(-) rename src/ImageSharp/Processing/{Transforms => }/AnchorPositionMode.cs (96%) rename src/ImageSharp/Processing/{Transforms => }/AutoOrientExtensions.cs (89%) rename src/ImageSharp/Processing/{Overlays => }/BackgroundColorExtensions.cs (97%) rename src/ImageSharp/Processing/{Binarization => }/BinaryDiffuseExtensions.cs (96%) rename src/ImageSharp/Processing/{Binarization => }/BinaryDitherExtensions.cs (95%) rename src/ImageSharp/Processing/{Binarization => }/BinaryThresholdExtensions.cs (97%) rename src/ImageSharp/Processing/{Filters => }/BlackWhiteExtensions.cs (93%) rename src/ImageSharp/Processing/{Convolution => }/BoxBlurExtensions.cs (95%) rename src/ImageSharp/Processing/{Filters => }/BrightnessExtensions.cs (95%) rename src/ImageSharp/Processing/{Filters => }/ColorBlindnessExtensions.cs (96%) rename src/ImageSharp/Processing/{Filters => }/ColorBlindnessMode.cs (95%) rename src/ImageSharp/Processing/{Filters => }/ContrastExtensions.cs (95%) rename src/ImageSharp/Processing/{Transforms => }/CropExtensions.cs (93%) rename src/ImageSharp/Processing/{Convolution => }/DetectEdgesExtensions.cs (98%) rename src/ImageSharp/Processing/{Dithering => }/DiffuseExtensions.cs (97%) rename src/ImageSharp/Processing/{Dithering => }/DitherExtensions.cs (96%) rename src/ImageSharp/Processing/{Convolution => }/EdgeDetectionOperators.cs (96%) rename src/ImageSharp/Processing/{Transforms => }/EntropyCropExtensions.cs (93%) rename src/ImageSharp/Processing/{Filters => }/FilterExtensions.cs (94%) rename src/ImageSharp/Processing/{Transforms => }/FlipExtensions.cs (89%) rename src/ImageSharp/Processing/{Transforms => }/FlipMode.cs (90%) rename src/ImageSharp/Processing/{Convolution => }/GaussianBlurExtensions.cs (95%) rename src/ImageSharp/Processing/{Convolution => }/GaussianSharpenExtensions.cs (95%) rename src/ImageSharp/Processing/{Overlays => }/GlowExtensions.cs (98%) rename src/ImageSharp/Processing/{Filters => }/GrayscaleExtensions.cs (98%) rename src/ImageSharp/Processing/{Filters => }/GrayscaleMode.cs (89%) rename src/ImageSharp/Processing/{Filters => }/HueExtensions.cs (94%) rename src/ImageSharp/Processing/{Filters => }/InvertExtensions.cs (93%) rename src/ImageSharp/Processing/{Dithering => }/KnownDiffusers.cs (94%) rename src/ImageSharp/Processing/{Dithering => }/KnownDitherers.cs (88%) rename src/ImageSharp/Processing/{Filters => }/KnownFilterMatrices.cs (99%) rename src/ImageSharp/Processing/{Quantization => }/KnownQuantizers.cs (90%) rename src/ImageSharp/Processing/{Transforms => }/KnownResamplers.cs (97%) rename src/ImageSharp/Processing/{Filters => }/KodachromeExtensions.cs (94%) rename src/ImageSharp/Processing/{Filters => }/LomographExtensions.cs (94%) rename src/ImageSharp/Processing/{Effects => }/OilPaintExtensions.cs (97%) rename src/ImageSharp/Processing/{Filters => }/OpacityExtensions.cs (94%) rename src/ImageSharp/Processing/{Transforms => }/OrientationMode.cs (96%) rename src/ImageSharp/Processing/{Transforms => }/PadExtensions.cs (95%) rename src/ImageSharp/Processing/{Effects => }/PixelateExtensions.cs (95%) rename src/ImageSharp/Processing/{Filters => }/PolaroidExtensions.cs (94%) rename src/ImageSharp/Processing/{Binarization/Processors => Processors/Binarization}/BinaryErrorDiffusionProcessor.cs (96%) rename src/ImageSharp/Processing/{Binarization/Processors => Processors/Binarization}/BinaryOrderedDitherProcessor.cs (95%) rename src/ImageSharp/Processing/{Binarization/Processors => Processors/Binarization}/BinaryThresholdProcessor.cs (98%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/BoxBlurProcessor.cs (96%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/Convolution2DProcessor.cs (97%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/Convolution2PassProcessor.cs (98%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/ConvolutionProcessor.cs (98%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/EdgeDetector2DProcessor.cs (92%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/EdgeDetectorCompassProcessor.cs (97%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/EdgeDetectorProcessor.cs (91%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/GaussianBlurProcessor.cs (98%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/GaussianSharpenProcessor.cs (96%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/IEdgeDetectorProcessor.cs (93%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/KayyaliKernels.cs (93%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/KayyaliProcessor.cs (93%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/KirschProcessor.cs (96%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/KirshKernels.cs (97%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/Laplacian3x3Processor.cs (93%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/Laplacian5x5Processor.cs (93%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/LaplacianKernelFactory.cs (94%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/LaplacianKernels.cs (94%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/LaplacianOfGaussianProcessor.cs (93%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/PrewittKernels.cs (93%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/PrewittProcessor.cs (93%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/RobertsCrossKernels.cs (92%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/RobertsCrossProcessor.cs (93%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/RobinsonKernels.cs (97%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/RobinsonProcessor.cs (96%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/ScharrKernels.cs (93%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/ScharrProcessor.cs (93%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/SobelKernels.cs (93%) rename src/ImageSharp/Processing/{Convolution/Processors => Processors/Convolution}/SobelProcessor.cs (93%) rename src/ImageSharp/Processing/{Dithering/ErrorDiffusion => Processors/Dithering}/AtkinsonDiffuser.cs (93%) rename src/ImageSharp/Processing/{Dithering/Ordered => Processors/Dithering}/BayerDither2x2.cs (88%) rename src/ImageSharp/Processing/{Dithering/Ordered => Processors/Dithering}/BayerDither4x4.cs (88%) rename src/ImageSharp/Processing/{Dithering/Ordered => Processors/Dithering}/BayerDither8x8.cs (88%) rename src/ImageSharp/Processing/{Dithering/ErrorDiffusion => Processors/Dithering}/BurksDiffuser.cs (92%) rename src/ImageSharp/Processing/{ => Processors}/Dithering/DHALF.TXT (100%) rename src/ImageSharp/Processing/{ => Processors}/Dithering/DITHER.TXT (100%) rename src/ImageSharp/Processing/{Dithering/ErrorDiffusion => Processors/Dithering}/ErrorDiffuserBase.cs (98%) rename src/ImageSharp/Processing/{Dithering/Processors => Processors/Dithering}/ErrorDiffusionPaletteProcessor.cs (96%) rename src/ImageSharp/Processing/{Dithering/ErrorDiffusion => Processors/Dithering}/FloydSteinbergDiffuser.cs (93%) rename src/ImageSharp/Processing/{Dithering/ErrorDiffusion => Processors/Dithering}/IErrorDiffuser.cs (94%) rename src/ImageSharp/Processing/{Dithering/Ordered => Processors/Dithering}/IOrderedDither.cs (95%) rename src/ImageSharp/Processing/{Dithering/ErrorDiffusion => Processors/Dithering}/JarvisJudiceNinkeDiffuser.cs (93%) rename src/ImageSharp/Processing/{Dithering/Ordered => Processors/Dithering}/OrderedDither.cs (96%) rename src/ImageSharp/Processing/{Dithering/Ordered => Processors/Dithering}/OrderedDither3x3.cs (88%) rename src/ImageSharp/Processing/{Dithering/Ordered => Processors/Dithering}/OrderedDitherFactory.cs (98%) rename src/ImageSharp/Processing/{Dithering/Processors => Processors/Dithering}/OrderedDitherPaletteProcessor.cs (95%) rename src/ImageSharp/Processing/{Dithering/Processors => Processors/Dithering}/PaletteDitherProcessorBase.cs (96%) rename src/ImageSharp/Processing/{Dithering/Processors => Processors/Dithering}/PixelPair.cs (96%) rename src/ImageSharp/Processing/{Dithering/ErrorDiffusion => Processors/Dithering}/Sierra2Diffuser.cs (93%) rename src/ImageSharp/Processing/{Dithering/ErrorDiffusion => Processors/Dithering}/Sierra3Diffuser.cs (93%) rename src/ImageSharp/Processing/{Dithering/ErrorDiffusion => Processors/Dithering}/SierraLiteDiffuser.cs (93%) rename src/ImageSharp/Processing/{Dithering/ErrorDiffusion => Processors/Dithering}/StevensonArceDiffuser.cs (93%) rename src/ImageSharp/Processing/{Dithering/ErrorDiffusion => Processors/Dithering}/StuckiDiffuser.cs (93%) rename src/ImageSharp/Processing/{ => Processors}/Dithering/error_diffusion.txt (100%) rename src/ImageSharp/Processing/{Effects/Processors => Processors/Effects}/OilPaintingProcessor.cs (97%) rename src/ImageSharp/Processing/{Effects/Processors => Processors/Effects}/PixelateProcessor.cs (97%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/AchromatomalyProcessor.cs (92%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/AchromatopsiaProcessor.cs (92%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/BlackWhiteProcessor.cs (91%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/BrightnessProcessor.cs (95%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/ContrastProcessor.cs (95%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/DeuteranomalyProcessor.cs (92%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/DeuteranopiaProcessor.cs (92%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/FilterProcessor.cs (94%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/GrayscaleBt601Processor.cs (94%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/GrayscaleBt709Processor.cs (94%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/HueProcessor.cs (93%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/InvertProcessor.cs (94%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/KodachromeProcessor.cs (92%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/LomographProcessor.cs (90%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/OpacityProcessor.cs (94%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/PolaroidProcessor.cs (91%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/ProtanomalyProcessor.cs (92%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/ProtanopiaProcessor.cs (92%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/README.md (100%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/SaturateProcessor.cs (95%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/SepiaProcessor.cs (93%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/TritanomalyProcessor.cs (92%) rename src/ImageSharp/Processing/{Filters/Processors => Processors/Filters}/TritanopiaProcessor.cs (92%) rename src/ImageSharp/Processing/{Overlays/Processors => Processors/Overlays}/BackgroundColorProcessor.cs (96%) rename src/ImageSharp/Processing/{Overlays/Processors => Processors/Overlays}/GlowProcessor.cs (98%) rename src/ImageSharp/Processing/{Overlays/Processors => Processors/Overlays}/VignetteProcessor.cs (98%) rename src/ImageSharp/Processing/{Quantization/FrameQuantizers => Processors/Quantization}/FrameQuantizerBase{TPixel}.cs (98%) rename src/ImageSharp/Processing/{Quantization/FrameQuantizers => Processors/Quantization}/IFrameQuantizer{TPixel}.cs (89%) rename src/ImageSharp/Processing/{ => Processors}/Quantization/IQuantizer.cs (81%) rename src/ImageSharp/Processing/{Quantization/FrameQuantizers => Processors/Quantization}/OctreeFrameQuantizer{TPixel}.cs (99%) rename src/ImageSharp/Processing/{ => Processors}/Quantization/OctreeQuantizer.cs (92%) rename src/ImageSharp/Processing/{Quantization/FrameQuantizers => Processors/Quantization}/PaletteFrameQuantizer{TPixel}.cs (98%) rename src/ImageSharp/Processing/{ => Processors}/Quantization/PaletteQuantizer.cs (91%) rename src/ImageSharp/Processing/{Quantization/Processors => Processors/Quantization}/QuantizeProcessor.cs (92%) rename src/ImageSharp/Processing/{ => Processors}/Quantization/QuantizedFrame{TPixel}.cs (97%) rename src/ImageSharp/Processing/{Quantization/FrameQuantizers => Processors/Quantization}/WuFrameQuantizer{TPixel}.cs (99%) rename src/ImageSharp/Processing/{ => Processors}/Quantization/WuQuantizer.cs (92%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/AffineTransformProcessor.cs (98%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/AutoOrientProcessor.cs (98%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/BicubicResampler.cs (95%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/BoxResampler.cs (90%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/CatmullRomResampler.cs (92%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/CenteredAffineTransformProcessor.cs (93%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/CenteredProjectiveTransformProcessor.cs (93%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/CropProcessor.cs (97%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/EntropyCropProcessor.cs (89%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/FlipProcessor.cs (93%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/HermiteResampler.cs (91%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/IResampler.cs (91%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/InterpolatedTransformProcessorBase.cs (97%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/Lanczos2Resampler.cs (92%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/Lanczos3Resampler.cs (92%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/Lanczos5Resampler.cs (92%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/Lanczos8Resampler.cs (92%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/MitchellNetravaliResampler.cs (90%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/NearestNeighborResampler.cs (89%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/ProjectiveTransformProcessor.cs (97%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/ResizeProcessor.cs (98%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/RobidouxResampler.cs (90%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/RobidouxSharpResampler.cs (90%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/RotateProcessor.cs (98%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/SkewProcessor.cs (94%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/SplineResampler.cs (90%) rename src/ImageSharp/Processing/{ => Processors}/Transforms/TransformHelpers.cs (99%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/TransformProcessorBase.cs (92%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/TriangleResampler.cs (92%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/WeightsBuffer.cs (96%) rename src/ImageSharp/Processing/{Transforms/Processors => Processors/Transforms}/WeightsWindow.cs (98%) rename src/ImageSharp/Processing/{Transforms/Resamplers => Processors/Transforms}/WelchResampler.cs (91%) rename src/ImageSharp/Processing/{Transforms => }/ProjectiveTransformHelper.cs (99%) rename src/ImageSharp/Processing/{Quantization => }/QuantizeExtensions.cs (92%) rename src/ImageSharp/Processing/{Transforms => }/ResizeExtensions.cs (98%) rename src/ImageSharp/Processing/{Transforms => }/ResizeHelper.cs (99%) rename src/ImageSharp/Processing/{Transforms => }/ResizeMode.cs (96%) rename src/ImageSharp/Processing/{Transforms => }/ResizeOptions.cs (92%) rename src/ImageSharp/Processing/{Transforms => }/RotateExtensions.cs (93%) rename src/ImageSharp/Processing/{Transforms => }/RotateFlipExtensions.cs (95%) rename src/ImageSharp/Processing/{Transforms => }/RotateMode.cs (92%) rename src/ImageSharp/Processing/{Filters => }/SaturateExtensions.cs (95%) rename src/ImageSharp/Processing/{Filters => }/SepiaExtensions.cs (96%) rename src/ImageSharp/Processing/{Transforms => }/SkewExtensions.cs (92%) rename src/ImageSharp/Processing/{Transforms => }/TransformExtensions.cs (97%) rename src/ImageSharp/Processing/{Overlays => }/VignetteExtensions.cs (98%) diff --git a/src/ImageSharp/Formats/Gif/GifEncoder.cs b/src/ImageSharp/Formats/Gif/GifEncoder.cs index 07a70ad96..e8e28ccdd 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoder.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoder.cs @@ -5,7 +5,7 @@ using System.IO; using System.Text; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Quantization; +using SixLabors.ImageSharp.Processing.Processors.Quantization; namespace SixLabors.ImageSharp.Formats.Gif { diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs index 8a6415c3b..e4737f3bc 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs @@ -9,7 +9,7 @@ using System.Runtime.InteropServices; using System.Text; using SixLabors.ImageSharp.MetaData; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Quantization; +using SixLabors.ImageSharp.Processing.Processors.Quantization; using SixLabors.Memory; namespace SixLabors.ImageSharp.Formats.Gif diff --git a/src/ImageSharp/Formats/Gif/IGifEncoderOptions.cs b/src/ImageSharp/Formats/Gif/IGifEncoderOptions.cs index 30e476e7e..bad6e0031 100644 --- a/src/ImageSharp/Formats/Gif/IGifEncoderOptions.cs +++ b/src/ImageSharp/Formats/Gif/IGifEncoderOptions.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. using System.Text; -using SixLabors.ImageSharp.Processing.Quantization; +using SixLabors.ImageSharp.Processing.Processors.Quantization; namespace SixLabors.ImageSharp.Formats.Gif { diff --git a/src/ImageSharp/Formats/Png/IPngEncoderOptions.cs b/src/ImageSharp/Formats/Png/IPngEncoderOptions.cs index 3b8aea669..f3231fa22 100644 --- a/src/ImageSharp/Formats/Png/IPngEncoderOptions.cs +++ b/src/ImageSharp/Formats/Png/IPngEncoderOptions.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using SixLabors.ImageSharp.Processing.Quantization; +using SixLabors.ImageSharp.Processing.Processors.Quantization; namespace SixLabors.ImageSharp.Formats.Png { diff --git a/src/ImageSharp/Formats/Png/PngEncoder.cs b/src/ImageSharp/Formats/Png/PngEncoder.cs index babda2eff..109e6ad77 100644 --- a/src/ImageSharp/Formats/Png/PngEncoder.cs +++ b/src/ImageSharp/Formats/Png/PngEncoder.cs @@ -4,7 +4,7 @@ using System.IO; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Quantization; +using SixLabors.ImageSharp.Processing.Processors.Quantization; namespace SixLabors.ImageSharp.Formats.Png { diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index 1b3e84b85..69f04979c 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -9,7 +9,7 @@ using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.Formats.Png.Filters; using SixLabors.ImageSharp.Formats.Png.Zlib; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Quantization; +using SixLabors.ImageSharp.Processing.Processors.Quantization; using SixLabors.Memory; namespace SixLabors.ImageSharp.Formats.Png diff --git a/src/ImageSharp/Processing/Transforms/AnchorPositionMode.cs b/src/ImageSharp/Processing/AnchorPositionMode.cs similarity index 96% rename from src/ImageSharp/Processing/Transforms/AnchorPositionMode.cs rename to src/ImageSharp/Processing/AnchorPositionMode.cs index 793fc0dfc..ef9c0fdaf 100644 --- a/src/ImageSharp/Processing/Transforms/AnchorPositionMode.cs +++ b/src/ImageSharp/Processing/AnchorPositionMode.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Enumerated anchor positions to apply to resized images. diff --git a/src/ImageSharp/Processing/Transforms/AutoOrientExtensions.cs b/src/ImageSharp/Processing/AutoOrientExtensions.cs similarity index 89% rename from src/ImageSharp/Processing/Transforms/AutoOrientExtensions.cs rename to src/ImageSharp/Processing/AutoOrientExtensions.cs index d3ac16708..d11fc9623 100644 --- a/src/ImageSharp/Processing/Transforms/AutoOrientExtensions.cs +++ b/src/ImageSharp/Processing/AutoOrientExtensions.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Processors; +using SixLabors.ImageSharp.Processing.Processors.Transforms; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of auto-orientation operations to the type. diff --git a/src/ImageSharp/Processing/Overlays/BackgroundColorExtensions.cs b/src/ImageSharp/Processing/BackgroundColorExtensions.cs similarity index 97% rename from src/ImageSharp/Processing/Overlays/BackgroundColorExtensions.cs rename to src/ImageSharp/Processing/BackgroundColorExtensions.cs index 1a8224769..1ad2c9237 100644 --- a/src/ImageSharp/Processing/Overlays/BackgroundColorExtensions.cs +++ b/src/ImageSharp/Processing/BackgroundColorExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Overlays.Processors; +using SixLabors.ImageSharp.Processing.Processors.Overlays; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Overlays +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of a background color to the type. diff --git a/src/ImageSharp/Processing/Binarization/BinaryDiffuseExtensions.cs b/src/ImageSharp/Processing/BinaryDiffuseExtensions.cs similarity index 96% rename from src/ImageSharp/Processing/Binarization/BinaryDiffuseExtensions.cs rename to src/ImageSharp/Processing/BinaryDiffuseExtensions.cs index a2859b011..788942dde 100644 --- a/src/ImageSharp/Processing/Binarization/BinaryDiffuseExtensions.cs +++ b/src/ImageSharp/Processing/BinaryDiffuseExtensions.cs @@ -2,11 +2,11 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Binarization.Processors; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; +using SixLabors.ImageSharp.Processing.Processors.Binarization; +using SixLabors.ImageSharp.Processing.Processors.Dithering; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Binarization +namespace SixLabors.ImageSharp.Processing { /// /// Adds binary diffusion extensions to the type. diff --git a/src/ImageSharp/Processing/Binarization/BinaryDitherExtensions.cs b/src/ImageSharp/Processing/BinaryDitherExtensions.cs similarity index 95% rename from src/ImageSharp/Processing/Binarization/BinaryDitherExtensions.cs rename to src/ImageSharp/Processing/BinaryDitherExtensions.cs index e66be55de..617770196 100644 --- a/src/ImageSharp/Processing/Binarization/BinaryDitherExtensions.cs +++ b/src/ImageSharp/Processing/BinaryDitherExtensions.cs @@ -2,11 +2,11 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Binarization.Processors; -using SixLabors.ImageSharp.Processing.Dithering.Ordered; +using SixLabors.ImageSharp.Processing.Processors.Binarization; +using SixLabors.ImageSharp.Processing.Processors.Dithering; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Binarization +namespace SixLabors.ImageSharp.Processing { /// /// Adds binary dithering extensions to the type. diff --git a/src/ImageSharp/Processing/Binarization/BinaryThresholdExtensions.cs b/src/ImageSharp/Processing/BinaryThresholdExtensions.cs similarity index 97% rename from src/ImageSharp/Processing/Binarization/BinaryThresholdExtensions.cs rename to src/ImageSharp/Processing/BinaryThresholdExtensions.cs index 005061394..31f81ba4b 100644 --- a/src/ImageSharp/Processing/Binarization/BinaryThresholdExtensions.cs +++ b/src/ImageSharp/Processing/BinaryThresholdExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Binarization.Processors; +using SixLabors.ImageSharp.Processing.Processors.Binarization; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Binarization +namespace SixLabors.ImageSharp.Processing { /// /// Adds binary thresholding extensions to the type. diff --git a/src/ImageSharp/Processing/Filters/BlackWhiteExtensions.cs b/src/ImageSharp/Processing/BlackWhiteExtensions.cs similarity index 93% rename from src/ImageSharp/Processing/Filters/BlackWhiteExtensions.cs rename to src/ImageSharp/Processing/BlackWhiteExtensions.cs index f30cefb86..0484fa84e 100644 --- a/src/ImageSharp/Processing/Filters/BlackWhiteExtensions.cs +++ b/src/ImageSharp/Processing/BlackWhiteExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of black and white toning to the type. diff --git a/src/ImageSharp/Processing/Convolution/BoxBlurExtensions.cs b/src/ImageSharp/Processing/BoxBlurExtensions.cs similarity index 95% rename from src/ImageSharp/Processing/Convolution/BoxBlurExtensions.cs rename to src/ImageSharp/Processing/BoxBlurExtensions.cs index edb798fb4..624da239b 100644 --- a/src/ImageSharp/Processing/Convolution/BoxBlurExtensions.cs +++ b/src/ImageSharp/Processing/BoxBlurExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Convolution.Processors; +using SixLabors.ImageSharp.Processing.Processors.Convolution; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution +namespace SixLabors.ImageSharp.Processing { /// /// Adds box blurring extensions to the type. diff --git a/src/ImageSharp/Processing/Filters/BrightnessExtensions.cs b/src/ImageSharp/Processing/BrightnessExtensions.cs similarity index 95% rename from src/ImageSharp/Processing/Filters/BrightnessExtensions.cs rename to src/ImageSharp/Processing/BrightnessExtensions.cs index a36d588d5..2f252ad30 100644 --- a/src/ImageSharp/Processing/Filters/BrightnessExtensions.cs +++ b/src/ImageSharp/Processing/BrightnessExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the alteration of the brightness component to the type. diff --git a/src/ImageSharp/Processing/Filters/ColorBlindnessExtensions.cs b/src/ImageSharp/Processing/ColorBlindnessExtensions.cs similarity index 96% rename from src/ImageSharp/Processing/Filters/ColorBlindnessExtensions.cs rename to src/ImageSharp/Processing/ColorBlindnessExtensions.cs index d70064097..331635895 100644 --- a/src/ImageSharp/Processing/Filters/ColorBlindnessExtensions.cs +++ b/src/ImageSharp/Processing/ColorBlindnessExtensions.cs @@ -2,11 +2,11 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; using SixLabors.ImageSharp.Processing.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that simulate the effects of various color blindness disorders to the type. diff --git a/src/ImageSharp/Processing/Filters/ColorBlindnessMode.cs b/src/ImageSharp/Processing/ColorBlindnessMode.cs similarity index 95% rename from src/ImageSharp/Processing/Filters/ColorBlindnessMode.cs rename to src/ImageSharp/Processing/ColorBlindnessMode.cs index 584c9fa08..2ff19e77e 100644 --- a/src/ImageSharp/Processing/Filters/ColorBlindnessMode.cs +++ b/src/ImageSharp/Processing/ColorBlindnessMode.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Enumerates the various types of defined color blindness filters. diff --git a/src/ImageSharp/Processing/Filters/ContrastExtensions.cs b/src/ImageSharp/Processing/ContrastExtensions.cs similarity index 95% rename from src/ImageSharp/Processing/Filters/ContrastExtensions.cs rename to src/ImageSharp/Processing/ContrastExtensions.cs index 16225039c..776aa6751 100644 --- a/src/ImageSharp/Processing/Filters/ContrastExtensions.cs +++ b/src/ImageSharp/Processing/ContrastExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the alteration of the contrast component to the type. diff --git a/src/ImageSharp/Processing/Transforms/CropExtensions.cs b/src/ImageSharp/Processing/CropExtensions.cs similarity index 93% rename from src/ImageSharp/Processing/Transforms/CropExtensions.cs rename to src/ImageSharp/Processing/CropExtensions.cs index 9e347f51c..34c754a08 100644 --- a/src/ImageSharp/Processing/Transforms/CropExtensions.cs +++ b/src/ImageSharp/Processing/CropExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Processors; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of cropping operations to the type. diff --git a/src/ImageSharp/Processing/Convolution/DetectEdgesExtensions.cs b/src/ImageSharp/Processing/DetectEdgesExtensions.cs similarity index 98% rename from src/ImageSharp/Processing/Convolution/DetectEdgesExtensions.cs rename to src/ImageSharp/Processing/DetectEdgesExtensions.cs index a2b2b244b..5ac89df29 100644 --- a/src/ImageSharp/Processing/Convolution/DetectEdgesExtensions.cs +++ b/src/ImageSharp/Processing/DetectEdgesExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Convolution.Processors; +using SixLabors.ImageSharp.Processing.Processors.Convolution; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution +namespace SixLabors.ImageSharp.Processing { /// /// Adds edge detection extensions to the type. diff --git a/src/ImageSharp/Processing/Dithering/DiffuseExtensions.cs b/src/ImageSharp/Processing/DiffuseExtensions.cs similarity index 97% rename from src/ImageSharp/Processing/Dithering/DiffuseExtensions.cs rename to src/ImageSharp/Processing/DiffuseExtensions.cs index adb678ee4..768d28116 100644 --- a/src/ImageSharp/Processing/Dithering/DiffuseExtensions.cs +++ b/src/ImageSharp/Processing/DiffuseExtensions.cs @@ -2,8 +2,7 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; -using SixLabors.ImageSharp.Processing.Dithering.Processors; +using SixLabors.ImageSharp.Processing.Processors.Dithering; using SixLabors.Primitives; namespace SixLabors.ImageSharp.Processing.Dithering diff --git a/src/ImageSharp/Processing/Dithering/DitherExtensions.cs b/src/ImageSharp/Processing/DitherExtensions.cs similarity index 96% rename from src/ImageSharp/Processing/Dithering/DitherExtensions.cs rename to src/ImageSharp/Processing/DitherExtensions.cs index 48dd87a3b..795561e70 100644 --- a/src/ImageSharp/Processing/Dithering/DitherExtensions.cs +++ b/src/ImageSharp/Processing/DitherExtensions.cs @@ -2,11 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Dithering.Ordered; -using SixLabors.ImageSharp.Processing.Dithering.Processors; +using SixLabors.ImageSharp.Processing.Processors.Dithering; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering +namespace SixLabors.ImageSharp.Processing { /// /// Adds dithering extensions to the type. diff --git a/src/ImageSharp/Processing/Convolution/EdgeDetectionOperators.cs b/src/ImageSharp/Processing/EdgeDetectionOperators.cs similarity index 96% rename from src/ImageSharp/Processing/Convolution/EdgeDetectionOperators.cs rename to src/ImageSharp/Processing/EdgeDetectionOperators.cs index 55cbbeaf7..1f3526760 100644 --- a/src/ImageSharp/Processing/Convolution/EdgeDetectionOperators.cs +++ b/src/ImageSharp/Processing/EdgeDetectionOperators.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Convolution +namespace SixLabors.ImageSharp.Processing { /// /// Enumerates the various types of defined edge detection filters. diff --git a/src/ImageSharp/Processing/Transforms/EntropyCropExtensions.cs b/src/ImageSharp/Processing/EntropyCropExtensions.cs similarity index 93% rename from src/ImageSharp/Processing/Transforms/EntropyCropExtensions.cs rename to src/ImageSharp/Processing/EntropyCropExtensions.cs index 3ca4c72bc..157e69ef2 100644 --- a/src/ImageSharp/Processing/Transforms/EntropyCropExtensions.cs +++ b/src/ImageSharp/Processing/EntropyCropExtensions.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Processors; +using SixLabors.ImageSharp.Processing.Processors.Transforms; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of entropy cropping operations to the type. diff --git a/src/ImageSharp/Processing/Filters/FilterExtensions.cs b/src/ImageSharp/Processing/FilterExtensions.cs similarity index 94% rename from src/ImageSharp/Processing/Filters/FilterExtensions.cs rename to src/ImageSharp/Processing/FilterExtensions.cs index ae8bbda03..bfae4ae65 100644 --- a/src/ImageSharp/Processing/Filters/FilterExtensions.cs +++ b/src/ImageSharp/Processing/FilterExtensions.cs @@ -3,10 +3,10 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of composable filters to the type. diff --git a/src/ImageSharp/Processing/Transforms/FlipExtensions.cs b/src/ImageSharp/Processing/FlipExtensions.cs similarity index 89% rename from src/ImageSharp/Processing/Transforms/FlipExtensions.cs rename to src/ImageSharp/Processing/FlipExtensions.cs index 0cbbdd95f..dfbff7e4d 100644 --- a/src/ImageSharp/Processing/Transforms/FlipExtensions.cs +++ b/src/ImageSharp/Processing/FlipExtensions.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Processors; +using SixLabors.ImageSharp.Processing.Processors.Transforms; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of flipping operations to the type. diff --git a/src/ImageSharp/Processing/Transforms/FlipMode.cs b/src/ImageSharp/Processing/FlipMode.cs similarity index 90% rename from src/ImageSharp/Processing/Transforms/FlipMode.cs rename to src/ImageSharp/Processing/FlipMode.cs index 32c910c80..96cd38de4 100644 --- a/src/ImageSharp/Processing/Transforms/FlipMode.cs +++ b/src/ImageSharp/Processing/FlipMode.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Provides enumeration over how a image should be flipped. diff --git a/src/ImageSharp/Processing/Convolution/GaussianBlurExtensions.cs b/src/ImageSharp/Processing/GaussianBlurExtensions.cs similarity index 95% rename from src/ImageSharp/Processing/Convolution/GaussianBlurExtensions.cs rename to src/ImageSharp/Processing/GaussianBlurExtensions.cs index ae3eace64..165c4ce1a 100644 --- a/src/ImageSharp/Processing/Convolution/GaussianBlurExtensions.cs +++ b/src/ImageSharp/Processing/GaussianBlurExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Convolution.Processors; +using SixLabors.ImageSharp.Processing.Processors.Convolution; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution +namespace SixLabors.ImageSharp.Processing { /// /// Adds Gaussian blurring extensions to the type. diff --git a/src/ImageSharp/Processing/Convolution/GaussianSharpenExtensions.cs b/src/ImageSharp/Processing/GaussianSharpenExtensions.cs similarity index 95% rename from src/ImageSharp/Processing/Convolution/GaussianSharpenExtensions.cs rename to src/ImageSharp/Processing/GaussianSharpenExtensions.cs index 334a02b79..675bbc142 100644 --- a/src/ImageSharp/Processing/Convolution/GaussianSharpenExtensions.cs +++ b/src/ImageSharp/Processing/GaussianSharpenExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Convolution.Processors; +using SixLabors.ImageSharp.Processing.Processors.Convolution; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution +namespace SixLabors.ImageSharp.Processing { /// /// Adds Gaussian sharpening extensions to the type. diff --git a/src/ImageSharp/Processing/Overlays/GlowExtensions.cs b/src/ImageSharp/Processing/GlowExtensions.cs similarity index 98% rename from src/ImageSharp/Processing/Overlays/GlowExtensions.cs rename to src/ImageSharp/Processing/GlowExtensions.cs index 54af9f274..8b6e8ffc2 100644 --- a/src/ImageSharp/Processing/Overlays/GlowExtensions.cs +++ b/src/ImageSharp/Processing/GlowExtensions.cs @@ -3,10 +3,10 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Overlays.Processors; +using SixLabors.ImageSharp.Processing.Processors.Overlays; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Overlays +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of a radial glow to the type. diff --git a/src/ImageSharp/Processing/Filters/GrayscaleExtensions.cs b/src/ImageSharp/Processing/GrayscaleExtensions.cs similarity index 98% rename from src/ImageSharp/Processing/Filters/GrayscaleExtensions.cs rename to src/ImageSharp/Processing/GrayscaleExtensions.cs index 34ee4d0f3..9ab664056 100644 --- a/src/ImageSharp/Processing/Filters/GrayscaleExtensions.cs +++ b/src/ImageSharp/Processing/GrayscaleExtensions.cs @@ -2,11 +2,11 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; using SixLabors.ImageSharp.Processing.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of grayscale toning to the type. diff --git a/src/ImageSharp/Processing/Filters/GrayscaleMode.cs b/src/ImageSharp/Processing/GrayscaleMode.cs similarity index 89% rename from src/ImageSharp/Processing/Filters/GrayscaleMode.cs rename to src/ImageSharp/Processing/GrayscaleMode.cs index db30e67ff..e42a2e633 100644 --- a/src/ImageSharp/Processing/Filters/GrayscaleMode.cs +++ b/src/ImageSharp/Processing/GrayscaleMode.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Enumerates the various types of defined grayscale filters. diff --git a/src/ImageSharp/Processing/Filters/HueExtensions.cs b/src/ImageSharp/Processing/HueExtensions.cs similarity index 94% rename from src/ImageSharp/Processing/Filters/HueExtensions.cs rename to src/ImageSharp/Processing/HueExtensions.cs index 1b730d7f0..246d4bf2b 100644 --- a/src/ImageSharp/Processing/Filters/HueExtensions.cs +++ b/src/ImageSharp/Processing/HueExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the alteration of the hue component to the type. diff --git a/src/ImageSharp/Processing/Filters/InvertExtensions.cs b/src/ImageSharp/Processing/InvertExtensions.cs similarity index 93% rename from src/ImageSharp/Processing/Filters/InvertExtensions.cs rename to src/ImageSharp/Processing/InvertExtensions.cs index 784b37c56..9e031bc95 100644 --- a/src/ImageSharp/Processing/Filters/InvertExtensions.cs +++ b/src/ImageSharp/Processing/InvertExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the inversion of colors to the type. diff --git a/src/ImageSharp/Processing/Dithering/KnownDiffusers.cs b/src/ImageSharp/Processing/KnownDiffusers.cs similarity index 94% rename from src/ImageSharp/Processing/Dithering/KnownDiffusers.cs rename to src/ImageSharp/Processing/KnownDiffusers.cs index 250a543ec..2b10312fe 100644 --- a/src/ImageSharp/Processing/Dithering/KnownDiffusers.cs +++ b/src/ImageSharp/Processing/KnownDiffusers.cs @@ -1,9 +1,9 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; +using SixLabors.ImageSharp.Processing.Processors.Dithering; -namespace SixLabors.ImageSharp.Processing.Dithering +namespace SixLabors.ImageSharp.Processing { /// /// Contains reusable static instances of known error diffusion algorithms diff --git a/src/ImageSharp/Processing/Dithering/KnownDitherers.cs b/src/ImageSharp/Processing/KnownDitherers.cs similarity index 88% rename from src/ImageSharp/Processing/Dithering/KnownDitherers.cs rename to src/ImageSharp/Processing/KnownDitherers.cs index b268ae12c..dad5bb38c 100644 --- a/src/ImageSharp/Processing/Dithering/KnownDitherers.cs +++ b/src/ImageSharp/Processing/KnownDitherers.cs @@ -1,14 +1,14 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using SixLabors.ImageSharp.Processing.Dithering.Ordered; +using SixLabors.ImageSharp.Processing.Processors.Dithering; -namespace SixLabors.ImageSharp.Processing.Dithering +namespace SixLabors.ImageSharp.Processing { /// /// Contains reusable static instances of known ordered dither matrices /// - public class KnownDitherers + public static class KnownDitherers { /// /// Gets the order ditherer using the 2x2 Bayer dithering matrix diff --git a/src/ImageSharp/Processing/Filters/KnownFilterMatrices.cs b/src/ImageSharp/Processing/KnownFilterMatrices.cs similarity index 99% rename from src/ImageSharp/Processing/Filters/KnownFilterMatrices.cs rename to src/ImageSharp/Processing/KnownFilterMatrices.cs index 9da4aaa65..4f5e3c869 100644 --- a/src/ImageSharp/Processing/Filters/KnownFilterMatrices.cs +++ b/src/ImageSharp/Processing/KnownFilterMatrices.cs @@ -4,7 +4,7 @@ using System; using System.Numerics; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// A collection of known values for composing filters @@ -314,7 +314,7 @@ namespace SixLabors.ImageSharp.Processing.Filters public static Matrix4x4 CreateHueFilter(float degrees) { // Wrap the angle round at 360. - degrees = degrees % 360; + degrees %= 360; // Make sure it's not negative. while (degrees < 0) diff --git a/src/ImageSharp/Processing/Quantization/KnownQuantizers.cs b/src/ImageSharp/Processing/KnownQuantizers.cs similarity index 90% rename from src/ImageSharp/Processing/Quantization/KnownQuantizers.cs rename to src/ImageSharp/Processing/KnownQuantizers.cs index 357cd5676..fe9806310 100644 --- a/src/ImageSharp/Processing/Quantization/KnownQuantizers.cs +++ b/src/ImageSharp/Processing/KnownQuantizers.cs @@ -1,7 +1,9 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Quantization +using SixLabors.ImageSharp.Processing.Processors.Quantization; + +namespace SixLabors.ImageSharp.Processing { /// /// Contains reusable static instances of known quantizing algorithms diff --git a/src/ImageSharp/Processing/Transforms/KnownResamplers.cs b/src/ImageSharp/Processing/KnownResamplers.cs similarity index 97% rename from src/ImageSharp/Processing/Transforms/KnownResamplers.cs rename to src/ImageSharp/Processing/KnownResamplers.cs index 2b589d461..70a413ec0 100644 --- a/src/ImageSharp/Processing/Transforms/KnownResamplers.cs +++ b/src/ImageSharp/Processing/KnownResamplers.cs @@ -1,9 +1,9 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; +using SixLabors.ImageSharp.Processing.Processors.Transforms; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Contains reusable static instances of known resampling algorithms diff --git a/src/ImageSharp/Processing/Filters/KodachromeExtensions.cs b/src/ImageSharp/Processing/KodachromeExtensions.cs similarity index 94% rename from src/ImageSharp/Processing/Filters/KodachromeExtensions.cs rename to src/ImageSharp/Processing/KodachromeExtensions.cs index 94f1acc0c..e438b131e 100644 --- a/src/ImageSharp/Processing/Filters/KodachromeExtensions.cs +++ b/src/ImageSharp/Processing/KodachromeExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the recreation of an old Kodachrome camera effect to the type. diff --git a/src/ImageSharp/Processing/Filters/LomographExtensions.cs b/src/ImageSharp/Processing/LomographExtensions.cs similarity index 94% rename from src/ImageSharp/Processing/Filters/LomographExtensions.cs rename to src/ImageSharp/Processing/LomographExtensions.cs index ed9e1cc29..7dff16402 100644 --- a/src/ImageSharp/Processing/Filters/LomographExtensions.cs +++ b/src/ImageSharp/Processing/LomographExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the recreation of an old Lomograph camera effect to the type. diff --git a/src/ImageSharp/Processing/Effects/OilPaintExtensions.cs b/src/ImageSharp/Processing/OilPaintExtensions.cs similarity index 97% rename from src/ImageSharp/Processing/Effects/OilPaintExtensions.cs rename to src/ImageSharp/Processing/OilPaintExtensions.cs index a04bbec4e..b6fa4149a 100644 --- a/src/ImageSharp/Processing/Effects/OilPaintExtensions.cs +++ b/src/ImageSharp/Processing/OilPaintExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Effects.Processors; +using SixLabors.ImageSharp.Processing.Processors.Effects; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Effects +namespace SixLabors.ImageSharp.Processing { /// /// Adds oil painting effect extensions to the type. diff --git a/src/ImageSharp/Processing/Filters/OpacityExtensions.cs b/src/ImageSharp/Processing/OpacityExtensions.cs similarity index 94% rename from src/ImageSharp/Processing/Filters/OpacityExtensions.cs rename to src/ImageSharp/Processing/OpacityExtensions.cs index e263fef4e..fc3fd331d 100644 --- a/src/ImageSharp/Processing/Filters/OpacityExtensions.cs +++ b/src/ImageSharp/Processing/OpacityExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the alteration of the opacity component to the type. diff --git a/src/ImageSharp/Processing/Transforms/OrientationMode.cs b/src/ImageSharp/Processing/OrientationMode.cs similarity index 96% rename from src/ImageSharp/Processing/Transforms/OrientationMode.cs rename to src/ImageSharp/Processing/OrientationMode.cs index c6f05380b..ba55425b8 100644 --- a/src/ImageSharp/Processing/Transforms/OrientationMode.cs +++ b/src/ImageSharp/Processing/OrientationMode.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Enumerates the available orientation values supplied by EXIF metadata. diff --git a/src/ImageSharp/Processing/Transforms/PadExtensions.cs b/src/ImageSharp/Processing/PadExtensions.cs similarity index 95% rename from src/ImageSharp/Processing/Transforms/PadExtensions.cs rename to src/ImageSharp/Processing/PadExtensions.cs index a231088dd..f73033968 100644 --- a/src/ImageSharp/Processing/Transforms/PadExtensions.cs +++ b/src/ImageSharp/Processing/PadExtensions.cs @@ -4,7 +4,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of padding operations to the type. diff --git a/src/ImageSharp/Processing/Effects/PixelateExtensions.cs b/src/ImageSharp/Processing/PixelateExtensions.cs similarity index 95% rename from src/ImageSharp/Processing/Effects/PixelateExtensions.cs rename to src/ImageSharp/Processing/PixelateExtensions.cs index d6fcfe6f1..4507f6392 100644 --- a/src/ImageSharp/Processing/Effects/PixelateExtensions.cs +++ b/src/ImageSharp/Processing/PixelateExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Effects.Processors; +using SixLabors.ImageSharp.Processing.Processors.Effects; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Effects +namespace SixLabors.ImageSharp.Processing { /// /// Adds pixelation effect extensions to the type. diff --git a/src/ImageSharp/Processing/Filters/PolaroidExtensions.cs b/src/ImageSharp/Processing/PolaroidExtensions.cs similarity index 94% rename from src/ImageSharp/Processing/Filters/PolaroidExtensions.cs rename to src/ImageSharp/Processing/PolaroidExtensions.cs index 37f06f9cf..5d4beee22 100644 --- a/src/ImageSharp/Processing/Filters/PolaroidExtensions.cs +++ b/src/ImageSharp/Processing/PolaroidExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the recreation of an old Polaroid camera effect to the type. diff --git a/src/ImageSharp/Processing/Binarization/Processors/BinaryErrorDiffusionProcessor.cs b/src/ImageSharp/Processing/Processors/Binarization/BinaryErrorDiffusionProcessor.cs similarity index 96% rename from src/ImageSharp/Processing/Binarization/Processors/BinaryErrorDiffusionProcessor.cs rename to src/ImageSharp/Processing/Processors/Binarization/BinaryErrorDiffusionProcessor.cs index 64763b657..5041dcf5a 100644 --- a/src/ImageSharp/Processing/Binarization/Processors/BinaryErrorDiffusionProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Binarization/BinaryErrorDiffusionProcessor.cs @@ -4,11 +4,10 @@ using System; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; -using SixLabors.ImageSharp.Processing.Processors; +using SixLabors.ImageSharp.Processing.Processors.Dithering; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Binarization.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Binarization { /// /// Performs binary threshold filtering against an image using error diffusion. diff --git a/src/ImageSharp/Processing/Binarization/Processors/BinaryOrderedDitherProcessor.cs b/src/ImageSharp/Processing/Processors/Binarization/BinaryOrderedDitherProcessor.cs similarity index 95% rename from src/ImageSharp/Processing/Binarization/Processors/BinaryOrderedDitherProcessor.cs rename to src/ImageSharp/Processing/Processors/Binarization/BinaryOrderedDitherProcessor.cs index 3fe56ff44..95f4ef472 100644 --- a/src/ImageSharp/Processing/Binarization/Processors/BinaryOrderedDitherProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Binarization/BinaryOrderedDitherProcessor.cs @@ -4,11 +4,10 @@ using System; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Dithering.Ordered; -using SixLabors.ImageSharp.Processing.Processors; +using SixLabors.ImageSharp.Processing.Processors.Dithering; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Binarization.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Binarization { /// /// Performs binary threshold filtering against an image using ordered dithering. diff --git a/src/ImageSharp/Processing/Binarization/Processors/BinaryThresholdProcessor.cs b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs similarity index 98% rename from src/ImageSharp/Processing/Binarization/Processors/BinaryThresholdProcessor.cs rename to src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs index dc1297d6f..57d4e00ae 100644 --- a/src/ImageSharp/Processing/Binarization/Processors/BinaryThresholdProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Binarization/BinaryThresholdProcessor.cs @@ -8,7 +8,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Binarization.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Binarization { /// /// Performs simple binary threshold filtering against an image. diff --git a/src/ImageSharp/Processing/Convolution/Processors/BoxBlurProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs similarity index 96% rename from src/ImageSharp/Processing/Convolution/Processors/BoxBlurProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs index 886fb5d75..0ec62ac3d 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/BoxBlurProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/BoxBlurProcessor.cs @@ -3,10 +3,9 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Applies box blur processing to the image. diff --git a/src/ImageSharp/Processing/Convolution/Processors/Convolution2DProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs similarity index 97% rename from src/ImageSharp/Processing/Convolution/Processors/Convolution2DProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs index 48503e999..57f71a9ce 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/Convolution2DProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DProcessor.cs @@ -7,11 +7,10 @@ using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Defines a processor that uses two one-dimensional matrices to perform convolution against an image. diff --git a/src/ImageSharp/Processing/Convolution/Processors/Convolution2PassProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor.cs similarity index 98% rename from src/ImageSharp/Processing/Convolution/Processors/Convolution2PassProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor.cs index 4e14882ff..6d7147cf7 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/Convolution2PassProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor.cs @@ -10,7 +10,7 @@ using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Defines a processor that uses two one-dimensional matrices to perform two-pass convolution against an image. diff --git a/src/ImageSharp/Processing/Convolution/Processors/ConvolutionProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs similarity index 98% rename from src/ImageSharp/Processing/Convolution/Processors/ConvolutionProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs index 221cf19ec..84a166545 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/ConvolutionProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor.cs @@ -11,7 +11,7 @@ using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Defines a processor that uses a 2 dimensional matrix to perform convolution against an image. diff --git a/src/ImageSharp/Processing/Convolution/Processors/EdgeDetector2DProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor.cs similarity index 92% rename from src/ImageSharp/Processing/Convolution/Processors/EdgeDetector2DProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor.cs index c3530647a..dd43d3e15 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/EdgeDetector2DProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor.cs @@ -3,11 +3,10 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Filters.Processors; -using SixLabors.ImageSharp.Processing.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Defines a processor that detects edges within an image using two one-dimensional matrices. diff --git a/src/ImageSharp/Processing/Convolution/Processors/EdgeDetectorCompassProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorCompassProcessor.cs similarity index 97% rename from src/ImageSharp/Processing/Convolution/Processors/EdgeDetectorCompassProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorCompassProcessor.cs index b78145089..22297b8f2 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/EdgeDetectorCompassProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorCompassProcessor.cs @@ -8,12 +8,11 @@ using System.Runtime.InteropServices; using System.Threading.Tasks; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Filters.Processors; -using SixLabors.ImageSharp.Processing.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Defines a processor that detects edges within an image using a eight two dimensional matrices. diff --git a/src/ImageSharp/Processing/Convolution/Processors/EdgeDetectorProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorProcessor.cs similarity index 91% rename from src/ImageSharp/Processing/Convolution/Processors/EdgeDetectorProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorProcessor.cs index e0ca83828..9173bc229 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/EdgeDetectorProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorProcessor.cs @@ -3,11 +3,10 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Filters.Processors; -using SixLabors.ImageSharp.Processing.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Defines a processor that detects edges within an image using a single two dimensional matrix. diff --git a/src/ImageSharp/Processing/Convolution/Processors/GaussianBlurProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs similarity index 98% rename from src/ImageSharp/Processing/Convolution/Processors/GaussianBlurProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs index 6f33e23ec..3045b9993 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/GaussianBlurProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/GaussianBlurProcessor.cs @@ -7,7 +7,7 @@ using SixLabors.ImageSharp.Primitives; using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Applies Gaussian blur processing to the image. diff --git a/src/ImageSharp/Processing/Convolution/Processors/GaussianSharpenProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs similarity index 96% rename from src/ImageSharp/Processing/Convolution/Processors/GaussianSharpenProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs index 5f296e29e..18963c73c 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/GaussianSharpenProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/GaussianSharpenProcessor.cs @@ -4,10 +4,9 @@ using System; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Applies Gaussian sharpening processing to the image. @@ -160,14 +159,14 @@ namespace SixLabors.ImageSharp.Processing.Convolution.Processors { for (int i = 0; i < size; i++) { - kernel[0, i] = kernel[0, i] / sum; + kernel[0, i] /= sum; } } else { for (int i = 0; i < size; i++) { - kernel[i, 0] = kernel[i, 0] / sum; + kernel[i, 0] /= sum; } } diff --git a/src/ImageSharp/Processing/Convolution/Processors/IEdgeDetectorProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/IEdgeDetectorProcessor.cs similarity index 93% rename from src/ImageSharp/Processing/Convolution/Processors/IEdgeDetectorProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/IEdgeDetectorProcessor.cs index 486929e02..b2ecbf115 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/IEdgeDetectorProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/IEdgeDetectorProcessor.cs @@ -4,7 +4,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing.Processors; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Provides properties and methods allowing the detection of edges within an image. diff --git a/src/ImageSharp/Processing/Convolution/Processors/KayyaliKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/KayyaliKernels.cs similarity index 93% rename from src/ImageSharp/Processing/Convolution/Processors/KayyaliKernels.cs rename to src/ImageSharp/Processing/Processors/Convolution/KayyaliKernels.cs index e131cac38..dd4d02302 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/KayyaliKernels.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/KayyaliKernels.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Contains the kernels used for Kayyali edge detection diff --git a/src/ImageSharp/Processing/Convolution/Processors/KayyaliProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/KayyaliProcessor.cs similarity index 93% rename from src/ImageSharp/Processing/Convolution/Processors/KayyaliProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/KayyaliProcessor.cs index 357c6c397..8652efa12 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/KayyaliProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/KayyaliProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Applies edge detection processing to the image using the Kayyali operator filter. diff --git a/src/ImageSharp/Processing/Convolution/Processors/KirschProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/KirschProcessor.cs similarity index 96% rename from src/ImageSharp/Processing/Convolution/Processors/KirschProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/KirschProcessor.cs index c9a21da0b..46cf00c22 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/KirschProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/KirschProcessor.cs @@ -4,7 +4,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Applies edge detection processing to the image using the Kirsch operator filter. diff --git a/src/ImageSharp/Processing/Convolution/Processors/KirshKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/KirshKernels.cs similarity index 97% rename from src/ImageSharp/Processing/Convolution/Processors/KirshKernels.cs rename to src/ImageSharp/Processing/Processors/Convolution/KirshKernels.cs index 8e52f8df4..d31587508 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/KirshKernels.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/KirshKernels.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Contains the eight matrices used for Kirsh edge detection diff --git a/src/ImageSharp/Processing/Convolution/Processors/Laplacian3x3Processor.cs b/src/ImageSharp/Processing/Processors/Convolution/Laplacian3x3Processor.cs similarity index 93% rename from src/ImageSharp/Processing/Convolution/Processors/Laplacian3x3Processor.cs rename to src/ImageSharp/Processing/Processors/Convolution/Laplacian3x3Processor.cs index 657a93c81..f498d374c 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/Laplacian3x3Processor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Laplacian3x3Processor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Applies edge detection processing to the image using the Laplacian 3x3 operator filter. diff --git a/src/ImageSharp/Processing/Convolution/Processors/Laplacian5x5Processor.cs b/src/ImageSharp/Processing/Processors/Convolution/Laplacian5x5Processor.cs similarity index 93% rename from src/ImageSharp/Processing/Convolution/Processors/Laplacian5x5Processor.cs rename to src/ImageSharp/Processing/Processors/Convolution/Laplacian5x5Processor.cs index 5b44773ad..558acf7b3 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/Laplacian5x5Processor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Laplacian5x5Processor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Applies edge detection processing to the image using the Laplacian 5x5 operator filter. diff --git a/src/ImageSharp/Processing/Convolution/Processors/LaplacianKernelFactory.cs b/src/ImageSharp/Processing/Processors/Convolution/LaplacianKernelFactory.cs similarity index 94% rename from src/ImageSharp/Processing/Convolution/Processors/LaplacianKernelFactory.cs rename to src/ImageSharp/Processing/Processors/Convolution/LaplacianKernelFactory.cs index 053033432..19f2d1161 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/LaplacianKernelFactory.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/LaplacianKernelFactory.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// A factory for creating Laplacian kernel matrices. diff --git a/src/ImageSharp/Processing/Convolution/Processors/LaplacianKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/LaplacianKernels.cs similarity index 94% rename from src/ImageSharp/Processing/Convolution/Processors/LaplacianKernels.cs rename to src/ImageSharp/Processing/Processors/Convolution/LaplacianKernels.cs index 407736980..e7b7f965b 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/LaplacianKernels.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/LaplacianKernels.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Contains Laplacian kernels of different sizes diff --git a/src/ImageSharp/Processing/Convolution/Processors/LaplacianOfGaussianProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/LaplacianOfGaussianProcessor.cs similarity index 93% rename from src/ImageSharp/Processing/Convolution/Processors/LaplacianOfGaussianProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/LaplacianOfGaussianProcessor.cs index e65e0d215..6cc65dc58 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/LaplacianOfGaussianProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/LaplacianOfGaussianProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Applies edge detection processing to the image using the Laplacian of Gaussian operator filter. diff --git a/src/ImageSharp/Processing/Convolution/Processors/PrewittKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/PrewittKernels.cs similarity index 93% rename from src/ImageSharp/Processing/Convolution/Processors/PrewittKernels.cs rename to src/ImageSharp/Processing/Processors/Convolution/PrewittKernels.cs index aba4d52c3..381e028d4 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/PrewittKernels.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/PrewittKernels.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Contains the kernels used for Prewitt edge detection diff --git a/src/ImageSharp/Processing/Convolution/Processors/PrewittProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/PrewittProcessor.cs similarity index 93% rename from src/ImageSharp/Processing/Convolution/Processors/PrewittProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/PrewittProcessor.cs index 5683d6f60..75ef4dac6 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/PrewittProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/PrewittProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Applies edge detection processing to the image using the Prewitt operator filter. diff --git a/src/ImageSharp/Processing/Convolution/Processors/RobertsCrossKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/RobertsCrossKernels.cs similarity index 92% rename from src/ImageSharp/Processing/Convolution/Processors/RobertsCrossKernels.cs rename to src/ImageSharp/Processing/Processors/Convolution/RobertsCrossKernels.cs index 64d1fcea5..f61220e1e 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/RobertsCrossKernels.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/RobertsCrossKernels.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Contains the kernels used for RobertsCross edge detection diff --git a/src/ImageSharp/Processing/Convolution/Processors/RobertsCrossProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/RobertsCrossProcessor.cs similarity index 93% rename from src/ImageSharp/Processing/Convolution/Processors/RobertsCrossProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/RobertsCrossProcessor.cs index 38d1fffc9..d685860f6 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/RobertsCrossProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/RobertsCrossProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Applies edge detection processing to the image using the Roberts Cross operator filter. diff --git a/src/ImageSharp/Processing/Convolution/Processors/RobinsonKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/RobinsonKernels.cs similarity index 97% rename from src/ImageSharp/Processing/Convolution/Processors/RobinsonKernels.cs rename to src/ImageSharp/Processing/Processors/Convolution/RobinsonKernels.cs index 9d440fcc0..4f47184e3 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/RobinsonKernels.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/RobinsonKernels.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Contains the kernels used for Robinson edge detection diff --git a/src/ImageSharp/Processing/Convolution/Processors/RobinsonProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/RobinsonProcessor.cs similarity index 96% rename from src/ImageSharp/Processing/Convolution/Processors/RobinsonProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/RobinsonProcessor.cs index f129b1daa..193c1008d 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/RobinsonProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/RobinsonProcessor.cs @@ -4,7 +4,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Applies edge detection processing to the image using the Robinson operator filter. diff --git a/src/ImageSharp/Processing/Convolution/Processors/ScharrKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/ScharrKernels.cs similarity index 93% rename from src/ImageSharp/Processing/Convolution/Processors/ScharrKernels.cs rename to src/ImageSharp/Processing/Processors/Convolution/ScharrKernels.cs index c309e4cec..f0662c667 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/ScharrKernels.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/ScharrKernels.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Contains the kernels used for Scharr edge detection diff --git a/src/ImageSharp/Processing/Convolution/Processors/ScharrProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/ScharrProcessor.cs similarity index 93% rename from src/ImageSharp/Processing/Convolution/Processors/ScharrProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/ScharrProcessor.cs index c101d092d..79fc0e79f 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/ScharrProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/ScharrProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Applies edge detection processing to the image using the Scharr operator filter. diff --git a/src/ImageSharp/Processing/Convolution/Processors/SobelKernels.cs b/src/ImageSharp/Processing/Processors/Convolution/SobelKernels.cs similarity index 93% rename from src/ImageSharp/Processing/Convolution/Processors/SobelKernels.cs rename to src/ImageSharp/Processing/Processors/Convolution/SobelKernels.cs index 626226c66..113957c83 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/SobelKernels.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/SobelKernels.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// Contains the kernels used for Sobel edge detection diff --git a/src/ImageSharp/Processing/Convolution/Processors/SobelProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/SobelProcessor.cs similarity index 93% rename from src/ImageSharp/Processing/Convolution/Processors/SobelProcessor.cs rename to src/ImageSharp/Processing/Processors/Convolution/SobelProcessor.cs index 9fb9c56c4..3ca53f6f0 100644 --- a/src/ImageSharp/Processing/Convolution/Processors/SobelProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/SobelProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Convolution { /// /// The Sobel operator filter. diff --git a/src/ImageSharp/Processing/Processors/DelegateProcessor.cs b/src/ImageSharp/Processing/Processors/DelegateProcessor.cs index 2ff00d583..7a9753d1a 100644 --- a/src/ImageSharp/Processing/Processors/DelegateProcessor.cs +++ b/src/ImageSharp/Processing/Processors/DelegateProcessor.cs @@ -14,26 +14,24 @@ namespace SixLabors.ImageSharp.Processing.Processors internal class DelegateProcessor : ImageProcessor where TPixel : struct, IPixel { - private readonly Action> action; - /// /// Initializes a new instance of the class. /// /// The action. public DelegateProcessor(Action> action) { - this.action = action; + this.Action = action; } /// /// Gets the action that will be applied to the image. /// - internal Action> Action => this.action; + internal Action> Action { get; } /// protected override void BeforeImageApply(Image source, Rectangle sourceRectangle) { - this.action?.Invoke(source); + this.Action?.Invoke(source); } /// diff --git a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/AtkinsonDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/AtkinsonDiffuser.cs similarity index 93% rename from src/ImageSharp/Processing/Dithering/ErrorDiffusion/AtkinsonDiffuser.cs rename to src/ImageSharp/Processing/Processors/Dithering/AtkinsonDiffuser.cs index 2b13980fc..17c97ddc9 100644 --- a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/AtkinsonDiffuser.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/AtkinsonDiffuser.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Applies error diffusion based dithering using the Atkinson image dithering algorithm. diff --git a/src/ImageSharp/Processing/Dithering/Ordered/BayerDither2x2.cs b/src/ImageSharp/Processing/Processors/Dithering/BayerDither2x2.cs similarity index 88% rename from src/ImageSharp/Processing/Dithering/Ordered/BayerDither2x2.cs rename to src/ImageSharp/Processing/Processors/Dithering/BayerDither2x2.cs index 2d674787a..b7fdfbfe5 100644 --- a/src/ImageSharp/Processing/Dithering/Ordered/BayerDither2x2.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/BayerDither2x2.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Dithering.Ordered +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Applies order dithering using the 2x2 Bayer dithering matrix. diff --git a/src/ImageSharp/Processing/Dithering/Ordered/BayerDither4x4.cs b/src/ImageSharp/Processing/Processors/Dithering/BayerDither4x4.cs similarity index 88% rename from src/ImageSharp/Processing/Dithering/Ordered/BayerDither4x4.cs rename to src/ImageSharp/Processing/Processors/Dithering/BayerDither4x4.cs index edc57441a..4f6d5dd07 100644 --- a/src/ImageSharp/Processing/Dithering/Ordered/BayerDither4x4.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/BayerDither4x4.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Dithering.Ordered +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Applies order dithering using the 4x4 Bayer dithering matrix. diff --git a/src/ImageSharp/Processing/Dithering/Ordered/BayerDither8x8.cs b/src/ImageSharp/Processing/Processors/Dithering/BayerDither8x8.cs similarity index 88% rename from src/ImageSharp/Processing/Dithering/Ordered/BayerDither8x8.cs rename to src/ImageSharp/Processing/Processors/Dithering/BayerDither8x8.cs index b79216208..8d0c23aa3 100644 --- a/src/ImageSharp/Processing/Dithering/Ordered/BayerDither8x8.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/BayerDither8x8.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Dithering.Ordered +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Applies order dithering using the 8x8 Bayer dithering matrix. diff --git a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/BurksDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/BurksDiffuser.cs similarity index 92% rename from src/ImageSharp/Processing/Dithering/ErrorDiffusion/BurksDiffuser.cs rename to src/ImageSharp/Processing/Processors/Dithering/BurksDiffuser.cs index b4b439c9a..84455b24a 100644 --- a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/BurksDiffuser.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/BurksDiffuser.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Applies error diffusion based dithering using the Burks image dithering algorithm. diff --git a/src/ImageSharp/Processing/Dithering/DHALF.TXT b/src/ImageSharp/Processing/Processors/Dithering/DHALF.TXT similarity index 100% rename from src/ImageSharp/Processing/Dithering/DHALF.TXT rename to src/ImageSharp/Processing/Processors/Dithering/DHALF.TXT diff --git a/src/ImageSharp/Processing/Dithering/DITHER.TXT b/src/ImageSharp/Processing/Processors/Dithering/DITHER.TXT similarity index 100% rename from src/ImageSharp/Processing/Dithering/DITHER.TXT rename to src/ImageSharp/Processing/Processors/Dithering/DITHER.TXT diff --git a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/ErrorDiffuserBase.cs b/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffuserBase.cs similarity index 98% rename from src/ImageSharp/Processing/Dithering/ErrorDiffusion/ErrorDiffuserBase.cs rename to src/ImageSharp/Processing/Processors/Dithering/ErrorDiffuserBase.cs index 80b3698a6..b407841f2 100644 --- a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/ErrorDiffuserBase.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffuserBase.cs @@ -8,7 +8,7 @@ using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// The base class for performing error diffusion based dithering. diff --git a/src/ImageSharp/Processing/Dithering/Processors/ErrorDiffusionPaletteProcessor.cs b/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffusionPaletteProcessor.cs similarity index 96% rename from src/ImageSharp/Processing/Dithering/Processors/ErrorDiffusionPaletteProcessor.cs rename to src/ImageSharp/Processing/Processors/Dithering/ErrorDiffusionPaletteProcessor.cs index 19fde8487..8e2b2a5a8 100644 --- a/src/ImageSharp/Processing/Dithering/Processors/ErrorDiffusionPaletteProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/ErrorDiffusionPaletteProcessor.cs @@ -4,11 +4,10 @@ using System; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; -using SixLabors.ImageSharp.Processing.Processors; +using SixLabors.ImageSharp.Processing.Processors.Dithering; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// An that dithers an image using error diffusion. diff --git a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/FloydSteinbergDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/FloydSteinbergDiffuser.cs similarity index 93% rename from src/ImageSharp/Processing/Dithering/ErrorDiffusion/FloydSteinbergDiffuser.cs rename to src/ImageSharp/Processing/Processors/Dithering/FloydSteinbergDiffuser.cs index 290d77864..6a7655b59 100644 --- a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/FloydSteinbergDiffuser.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/FloydSteinbergDiffuser.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Applies error diffusion based dithering using the Floyd–Steinberg image dithering algorithm. diff --git a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/IErrorDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/IErrorDiffuser.cs similarity index 94% rename from src/ImageSharp/Processing/Dithering/ErrorDiffusion/IErrorDiffuser.cs rename to src/ImageSharp/Processing/Processors/Dithering/IErrorDiffuser.cs index 795aa6506..5b30c0dc4 100644 --- a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/IErrorDiffuser.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/IErrorDiffuser.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Encapsulates properties and methods required to perform diffused error dithering on an image. diff --git a/src/ImageSharp/Processing/Dithering/Ordered/IOrderedDither.cs b/src/ImageSharp/Processing/Processors/Dithering/IOrderedDither.cs similarity index 95% rename from src/ImageSharp/Processing/Dithering/Ordered/IOrderedDither.cs rename to src/ImageSharp/Processing/Processors/Dithering/IOrderedDither.cs index 29b96ab45..571929b99 100644 --- a/src/ImageSharp/Processing/Dithering/Ordered/IOrderedDither.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/IOrderedDither.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Dithering.Ordered +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Encapsulates properties and methods required to perform ordered dithering on an image. diff --git a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/JarvisJudiceNinkeDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/JarvisJudiceNinkeDiffuser.cs similarity index 93% rename from src/ImageSharp/Processing/Dithering/ErrorDiffusion/JarvisJudiceNinkeDiffuser.cs rename to src/ImageSharp/Processing/Processors/Dithering/JarvisJudiceNinkeDiffuser.cs index 816447ec9..a69557d6d 100644 --- a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/JarvisJudiceNinkeDiffuser.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/JarvisJudiceNinkeDiffuser.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Applies error diffusion based dithering using the JarvisJudiceNinke image dithering algorithm. diff --git a/src/ImageSharp/Processing/Dithering/Ordered/OrderedDither.cs b/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs similarity index 96% rename from src/ImageSharp/Processing/Dithering/Ordered/OrderedDither.cs rename to src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs index 9fd274ab7..174732f80 100644 --- a/src/ImageSharp/Processing/Dithering/Ordered/OrderedDither.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/OrderedDither.cs @@ -4,7 +4,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.Ordered +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// An ordered dithering matrix with equal sides of arbitrary length diff --git a/src/ImageSharp/Processing/Dithering/Ordered/OrderedDither3x3.cs b/src/ImageSharp/Processing/Processors/Dithering/OrderedDither3x3.cs similarity index 88% rename from src/ImageSharp/Processing/Dithering/Ordered/OrderedDither3x3.cs rename to src/ImageSharp/Processing/Processors/Dithering/OrderedDither3x3.cs index dd20817cf..93bce0578 100644 --- a/src/ImageSharp/Processing/Dithering/Ordered/OrderedDither3x3.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/OrderedDither3x3.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Dithering.Ordered +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Applies order dithering using the 3x3 dithering matrix. diff --git a/src/ImageSharp/Processing/Dithering/Ordered/OrderedDitherFactory.cs b/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherFactory.cs similarity index 98% rename from src/ImageSharp/Processing/Dithering/Ordered/OrderedDitherFactory.cs rename to src/ImageSharp/Processing/Processors/Dithering/OrderedDitherFactory.cs index 7538aa50e..4b93c4259 100644 --- a/src/ImageSharp/Processing/Dithering/Ordered/OrderedDitherFactory.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherFactory.cs @@ -4,7 +4,7 @@ using System.Runtime.CompilerServices; using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.Ordered +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// A factory for creating ordered dither matrices. diff --git a/src/ImageSharp/Processing/Dithering/Processors/OrderedDitherPaletteProcessor.cs b/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherPaletteProcessor.cs similarity index 95% rename from src/ImageSharp/Processing/Dithering/Processors/OrderedDitherPaletteProcessor.cs rename to src/ImageSharp/Processing/Processors/Dithering/OrderedDitherPaletteProcessor.cs index 32a3d290e..4100fef8c 100644 --- a/src/ImageSharp/Processing/Dithering/Processors/OrderedDitherPaletteProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/OrderedDitherPaletteProcessor.cs @@ -4,11 +4,10 @@ using System; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Dithering.Ordered; -using SixLabors.ImageSharp.Processing.Processors; +using SixLabors.ImageSharp.Processing.Processors.Dithering; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// An that dithers an image using error diffusion. diff --git a/src/ImageSharp/Processing/Dithering/Processors/PaletteDitherProcessorBase.cs b/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessorBase.cs similarity index 96% rename from src/ImageSharp/Processing/Dithering/Processors/PaletteDitherProcessorBase.cs rename to src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessorBase.cs index 0e801e583..e70c8acd2 100644 --- a/src/ImageSharp/Processing/Dithering/Processors/PaletteDitherProcessorBase.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/PaletteDitherProcessorBase.cs @@ -5,9 +5,8 @@ using System.Collections.Generic; using System.Numerics; using System.Runtime.CompilerServices; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Processors; -namespace SixLabors.ImageSharp.Processing.Dithering.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// The base class for dither and diffusion processors that consume a palette. diff --git a/src/ImageSharp/Processing/Dithering/Processors/PixelPair.cs b/src/ImageSharp/Processing/Processors/Dithering/PixelPair.cs similarity index 96% rename from src/ImageSharp/Processing/Dithering/Processors/PixelPair.cs rename to src/ImageSharp/Processing/Processors/Dithering/PixelPair.cs index 127c0be6d..b7bea2c74 100644 --- a/src/ImageSharp/Processing/Dithering/Processors/PixelPair.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/PixelPair.cs @@ -4,7 +4,7 @@ using System; using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Dithering.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Represents a composite pair of pixels. Used for caching color distance lookups. diff --git a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/Sierra2Diffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/Sierra2Diffuser.cs similarity index 93% rename from src/ImageSharp/Processing/Dithering/ErrorDiffusion/Sierra2Diffuser.cs rename to src/ImageSharp/Processing/Processors/Dithering/Sierra2Diffuser.cs index 0b7e13c84..ebde2ceaf 100644 --- a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/Sierra2Diffuser.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/Sierra2Diffuser.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Applies error diffusion based dithering using the Sierra2 image dithering algorithm. diff --git a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/Sierra3Diffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/Sierra3Diffuser.cs similarity index 93% rename from src/ImageSharp/Processing/Dithering/ErrorDiffusion/Sierra3Diffuser.cs rename to src/ImageSharp/Processing/Processors/Dithering/Sierra3Diffuser.cs index 937b3a8cb..144a83a82 100644 --- a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/Sierra3Diffuser.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/Sierra3Diffuser.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Applies error diffusion based dithering using the Sierra3 image dithering algorithm. diff --git a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/SierraLiteDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/SierraLiteDiffuser.cs similarity index 93% rename from src/ImageSharp/Processing/Dithering/ErrorDiffusion/SierraLiteDiffuser.cs rename to src/ImageSharp/Processing/Processors/Dithering/SierraLiteDiffuser.cs index c9594e9e2..d71fba9f2 100644 --- a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/SierraLiteDiffuser.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/SierraLiteDiffuser.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Applies error diffusion based dithering using the SierraLite image dithering algorithm. diff --git a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/StevensonArceDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/StevensonArceDiffuser.cs similarity index 93% rename from src/ImageSharp/Processing/Dithering/ErrorDiffusion/StevensonArceDiffuser.cs rename to src/ImageSharp/Processing/Processors/Dithering/StevensonArceDiffuser.cs index 749502a03..4b1323065 100644 --- a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/StevensonArceDiffuser.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/StevensonArceDiffuser.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Applies error diffusion based dithering using the Stevenson-Arce image dithering algorithm. diff --git a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/StuckiDiffuser.cs b/src/ImageSharp/Processing/Processors/Dithering/StuckiDiffuser.cs similarity index 93% rename from src/ImageSharp/Processing/Dithering/ErrorDiffusion/StuckiDiffuser.cs rename to src/ImageSharp/Processing/Processors/Dithering/StuckiDiffuser.cs index 077c02cbd..1dd510a5e 100644 --- a/src/ImageSharp/Processing/Dithering/ErrorDiffusion/StuckiDiffuser.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/StuckiDiffuser.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.Primitives; -namespace SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion +namespace SixLabors.ImageSharp.Processing.Processors.Dithering { /// /// Applies error diffusion based dithering using the Stucki image dithering algorithm. diff --git a/src/ImageSharp/Processing/Dithering/error_diffusion.txt b/src/ImageSharp/Processing/Processors/Dithering/error_diffusion.txt similarity index 100% rename from src/ImageSharp/Processing/Dithering/error_diffusion.txt rename to src/ImageSharp/Processing/Processors/Dithering/error_diffusion.txt diff --git a/src/ImageSharp/Processing/Effects/Processors/OilPaintingProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs similarity index 97% rename from src/ImageSharp/Processing/Effects/Processors/OilPaintingProcessor.cs rename to src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs index cdaa6113f..b9329f4df 100644 --- a/src/ImageSharp/Processing/Effects/Processors/OilPaintingProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor.cs @@ -6,11 +6,10 @@ using System.Numerics; using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Effects.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Effects { /// /// Applies oil painting effect processing to the image. @@ -112,7 +111,7 @@ namespace SixLabors.ImageSharp.Processing.Effects.Processors int currentIntensity = (int)MathF.Round((sourceBlue + sourceGreen + sourceRed) / 3F * (levels - 1)); - intensityBin[currentIntensity] += 1; + intensityBin[currentIntensity]++; blueBin[currentIntensity] += sourceBlue; greenBin[currentIntensity] += sourceGreen; redBin[currentIntensity] += sourceRed; diff --git a/src/ImageSharp/Processing/Effects/Processors/PixelateProcessor.cs b/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs similarity index 97% rename from src/ImageSharp/Processing/Effects/Processors/PixelateProcessor.cs rename to src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs index d45d2093f..56085e76c 100644 --- a/src/ImageSharp/Processing/Effects/Processors/PixelateProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Effects/PixelateProcessor.cs @@ -7,10 +7,9 @@ using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.Common; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Effects.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Effects { /// /// Applies a pixelation effect processing to the image. diff --git a/src/ImageSharp/Processing/Filters/Processors/AchromatomalyProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/AchromatomalyProcessor.cs similarity index 92% rename from src/ImageSharp/Processing/Filters/Processors/AchromatomalyProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/AchromatomalyProcessor.cs index e7238c68c..57c1bad39 100644 --- a/src/ImageSharp/Processing/Filters/Processors/AchromatomalyProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/AchromatomalyProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Converts the colors of the image recreating Achromatomaly (Color desensitivity) color blindness. diff --git a/src/ImageSharp/Processing/Filters/Processors/AchromatopsiaProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/AchromatopsiaProcessor.cs similarity index 92% rename from src/ImageSharp/Processing/Filters/Processors/AchromatopsiaProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/AchromatopsiaProcessor.cs index b581f8925..696a854ab 100644 --- a/src/ImageSharp/Processing/Filters/Processors/AchromatopsiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/AchromatopsiaProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Converts the colors of the image recreating Achromatopsia (Monochrome) color blindness. diff --git a/src/ImageSharp/Processing/Filters/Processors/BlackWhiteProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/BlackWhiteProcessor.cs similarity index 91% rename from src/ImageSharp/Processing/Filters/Processors/BlackWhiteProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/BlackWhiteProcessor.cs index 428b9d4dd..9925ce5c2 100644 --- a/src/ImageSharp/Processing/Filters/Processors/BlackWhiteProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/BlackWhiteProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Applies a black and white filter matrix to the image diff --git a/src/ImageSharp/Processing/Filters/Processors/BrightnessProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/BrightnessProcessor.cs similarity index 95% rename from src/ImageSharp/Processing/Filters/Processors/BrightnessProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/BrightnessProcessor.cs index e5c43bd8a..b1b8ad747 100644 --- a/src/ImageSharp/Processing/Filters/Processors/BrightnessProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/BrightnessProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Applies a brightness filter matrix using the given amount. diff --git a/src/ImageSharp/Processing/Filters/Processors/ContrastProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/ContrastProcessor.cs similarity index 95% rename from src/ImageSharp/Processing/Filters/Processors/ContrastProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/ContrastProcessor.cs index 51f8ba6b1..ebec464d5 100644 --- a/src/ImageSharp/Processing/Filters/Processors/ContrastProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/ContrastProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Applies a contrast filter matrix using the given amount. diff --git a/src/ImageSharp/Processing/Filters/Processors/DeuteranomalyProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/DeuteranomalyProcessor.cs similarity index 92% rename from src/ImageSharp/Processing/Filters/Processors/DeuteranomalyProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/DeuteranomalyProcessor.cs index d93068c8c..0d1b1da90 100644 --- a/src/ImageSharp/Processing/Filters/Processors/DeuteranomalyProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/DeuteranomalyProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Converts the colors of the image recreating Deuteranomaly (Green-Weak) color blindness. diff --git a/src/ImageSharp/Processing/Filters/Processors/DeuteranopiaProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/DeuteranopiaProcessor.cs similarity index 92% rename from src/ImageSharp/Processing/Filters/Processors/DeuteranopiaProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/DeuteranopiaProcessor.cs index 4b57a1fa4..ae0727048 100644 --- a/src/ImageSharp/Processing/Filters/Processors/DeuteranopiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/DeuteranopiaProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Converts the colors of the image recreating Deuteranopia (Green-Blind) color blindness. diff --git a/src/ImageSharp/Processing/Filters/Processors/FilterProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/FilterProcessor.cs similarity index 94% rename from src/ImageSharp/Processing/Filters/Processors/FilterProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/FilterProcessor.cs index 18163b754..e8a1fc9cb 100644 --- a/src/ImageSharp/Processing/Filters/Processors/FilterProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/FilterProcessor.cs @@ -6,10 +6,9 @@ using System.Numerics; using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Provides methods that accept a matrix to apply free-form filters to images. diff --git a/src/ImageSharp/Processing/Filters/Processors/GrayscaleBt601Processor.cs b/src/ImageSharp/Processing/Processors/Filters/GrayscaleBt601Processor.cs similarity index 94% rename from src/ImageSharp/Processing/Filters/Processors/GrayscaleBt601Processor.cs rename to src/ImageSharp/Processing/Processors/Filters/GrayscaleBt601Processor.cs index b4ea8ac6b..c933d4858 100644 --- a/src/ImageSharp/Processing/Filters/Processors/GrayscaleBt601Processor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/GrayscaleBt601Processor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Applies a grayscale filter matrix using the given amount and the formula as specified by ITU-R Recommendation BT.601 diff --git a/src/ImageSharp/Processing/Filters/Processors/GrayscaleBt709Processor.cs b/src/ImageSharp/Processing/Processors/Filters/GrayscaleBt709Processor.cs similarity index 94% rename from src/ImageSharp/Processing/Filters/Processors/GrayscaleBt709Processor.cs rename to src/ImageSharp/Processing/Processors/Filters/GrayscaleBt709Processor.cs index 480b134d3..1716773b4 100644 --- a/src/ImageSharp/Processing/Filters/Processors/GrayscaleBt709Processor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/GrayscaleBt709Processor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Applies a grayscale filter matrix using the given amount and the formula as specified by ITU-R Recommendation BT.709 diff --git a/src/ImageSharp/Processing/Filters/Processors/HueProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/HueProcessor.cs similarity index 93% rename from src/ImageSharp/Processing/Filters/Processors/HueProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/HueProcessor.cs index 95ae98e78..4c3a0c73e 100644 --- a/src/ImageSharp/Processing/Filters/Processors/HueProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/HueProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Applies a hue filter matrix using the given angle of rotation in degrees diff --git a/src/ImageSharp/Processing/Filters/Processors/InvertProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/InvertProcessor.cs similarity index 94% rename from src/ImageSharp/Processing/Filters/Processors/InvertProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/InvertProcessor.cs index 7b8ed2a03..462c42070 100644 --- a/src/ImageSharp/Processing/Filters/Processors/InvertProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/InvertProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Applies a filter matrix that inverts the colors of an image diff --git a/src/ImageSharp/Processing/Filters/Processors/KodachromeProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/KodachromeProcessor.cs similarity index 92% rename from src/ImageSharp/Processing/Filters/Processors/KodachromeProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/KodachromeProcessor.cs index cc3fa42f6..003766e8a 100644 --- a/src/ImageSharp/Processing/Filters/Processors/KodachromeProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/KodachromeProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Applies a filter matrix recreating an old Kodachrome camera effect matrix to the image diff --git a/src/ImageSharp/Processing/Filters/Processors/LomographProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/LomographProcessor.cs similarity index 90% rename from src/ImageSharp/Processing/Filters/Processors/LomographProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/LomographProcessor.cs index d97bf57dd..737ebf618 100644 --- a/src/ImageSharp/Processing/Filters/Processors/LomographProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/LomographProcessor.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Overlays.Processors; +using SixLabors.ImageSharp.Processing.Processors.Overlays; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Converts the colors of the image recreating an old Lomograph effect. diff --git a/src/ImageSharp/Processing/Filters/Processors/OpacityProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/OpacityProcessor.cs similarity index 94% rename from src/ImageSharp/Processing/Filters/Processors/OpacityProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/OpacityProcessor.cs index f50d27ae0..0fea61cad 100644 --- a/src/ImageSharp/Processing/Filters/Processors/OpacityProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/OpacityProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Applies an opacity filter matrix using the given amount. diff --git a/src/ImageSharp/Processing/Filters/Processors/PolaroidProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor.cs similarity index 91% rename from src/ImageSharp/Processing/Filters/Processors/PolaroidProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor.cs index b6aa56223..fb065ac17 100644 --- a/src/ImageSharp/Processing/Filters/Processors/PolaroidProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/PolaroidProcessor.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Overlays.Processors; +using SixLabors.ImageSharp.Processing.Processors.Overlays; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Converts the colors of the image recreating an old Polaroid effect. diff --git a/src/ImageSharp/Processing/Filters/Processors/ProtanomalyProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/ProtanomalyProcessor.cs similarity index 92% rename from src/ImageSharp/Processing/Filters/Processors/ProtanomalyProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/ProtanomalyProcessor.cs index 88e2ee3c3..79eb70851 100644 --- a/src/ImageSharp/Processing/Filters/Processors/ProtanomalyProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/ProtanomalyProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Converts the colors of the image recreating Protanomaly (Red-Weak) color blindness. diff --git a/src/ImageSharp/Processing/Filters/Processors/ProtanopiaProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/ProtanopiaProcessor.cs similarity index 92% rename from src/ImageSharp/Processing/Filters/Processors/ProtanopiaProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/ProtanopiaProcessor.cs index 17020bbe2..c6a01439a 100644 --- a/src/ImageSharp/Processing/Filters/Processors/ProtanopiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/ProtanopiaProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Converts the colors of the image recreating Protanopia (Red-Blind) color blindness. diff --git a/src/ImageSharp/Processing/Filters/Processors/README.md b/src/ImageSharp/Processing/Processors/Filters/README.md similarity index 100% rename from src/ImageSharp/Processing/Filters/Processors/README.md rename to src/ImageSharp/Processing/Processors/Filters/README.md diff --git a/src/ImageSharp/Processing/Filters/Processors/SaturateProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/SaturateProcessor.cs similarity index 95% rename from src/ImageSharp/Processing/Filters/Processors/SaturateProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/SaturateProcessor.cs index d4b28a894..75e956071 100644 --- a/src/ImageSharp/Processing/Filters/Processors/SaturateProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/SaturateProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Applies a saturation filter matrix using the given amount. diff --git a/src/ImageSharp/Processing/Filters/Processors/SepiaProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/SepiaProcessor.cs similarity index 93% rename from src/ImageSharp/Processing/Filters/Processors/SepiaProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/SepiaProcessor.cs index 7295cee99..2009dccd5 100644 --- a/src/ImageSharp/Processing/Filters/Processors/SepiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/SepiaProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Applies a sepia filter matrix using the given amount. diff --git a/src/ImageSharp/Processing/Filters/Processors/TritanomalyProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/TritanomalyProcessor.cs similarity index 92% rename from src/ImageSharp/Processing/Filters/Processors/TritanomalyProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/TritanomalyProcessor.cs index 6991506e6..593f7f5b0 100644 --- a/src/ImageSharp/Processing/Filters/Processors/TritanomalyProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/TritanomalyProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Converts the colors of the image recreating Tritanomaly (Blue-Weak) color blindness. diff --git a/src/ImageSharp/Processing/Filters/Processors/TritanopiaProcessor.cs b/src/ImageSharp/Processing/Processors/Filters/TritanopiaProcessor.cs similarity index 92% rename from src/ImageSharp/Processing/Filters/Processors/TritanopiaProcessor.cs rename to src/ImageSharp/Processing/Processors/Filters/TritanopiaProcessor.cs index 95c6cb542..153ad5559 100644 --- a/src/ImageSharp/Processing/Filters/Processors/TritanopiaProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Filters/TritanopiaProcessor.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Filters.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Filters { /// /// Converts the colors of the image recreating Tritanopia (Blue-Blind) color blindness. diff --git a/src/ImageSharp/Processing/Overlays/Processors/BackgroundColorProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs similarity index 96% rename from src/ImageSharp/Processing/Overlays/Processors/BackgroundColorProcessor.cs rename to src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs index cc7e2ad8b..797d388c0 100644 --- a/src/ImageSharp/Processing/Overlays/Processors/BackgroundColorProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Overlays/BackgroundColorProcessor.cs @@ -5,11 +5,10 @@ using System; using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Overlays.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Overlays { /// /// Sets the background color of the image. diff --git a/src/ImageSharp/Processing/Overlays/Processors/GlowProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs similarity index 98% rename from src/ImageSharp/Processing/Overlays/Processors/GlowProcessor.cs rename to src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs index 51634ea2c..023643520 100644 --- a/src/ImageSharp/Processing/Overlays/Processors/GlowProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Overlays/GlowProcessor.cs @@ -7,11 +7,10 @@ using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Overlays.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Overlays { /// /// An that applies a radial glow effect an . diff --git a/src/ImageSharp/Processing/Overlays/Processors/VignetteProcessor.cs b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs similarity index 98% rename from src/ImageSharp/Processing/Overlays/Processors/VignetteProcessor.cs rename to src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs index b73fab179..3789e6bf8 100644 --- a/src/ImageSharp/Processing/Overlays/Processors/VignetteProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Overlays/VignetteProcessor.cs @@ -7,11 +7,10 @@ using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Overlays.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Overlays { /// /// An that applies a radial vignette effect to an . diff --git a/src/ImageSharp/Processing/Quantization/FrameQuantizers/FrameQuantizerBase{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/FrameQuantizerBase{TPixel}.cs similarity index 98% rename from src/ImageSharp/Processing/Quantization/FrameQuantizers/FrameQuantizerBase{TPixel}.cs rename to src/ImageSharp/Processing/Processors/Quantization/FrameQuantizerBase{TPixel}.cs index 6637d54e0..6e594f223 100644 --- a/src/ImageSharp/Processing/Quantization/FrameQuantizers/FrameQuantizerBase{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/FrameQuantizerBase{TPixel}.cs @@ -6,9 +6,9 @@ using System.Collections.Generic; using System.Numerics; using System.Runtime.CompilerServices; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; +using SixLabors.ImageSharp.Processing.Processors.Dithering; -namespace SixLabors.ImageSharp.Processing.Quantization.FrameQuantizers +namespace SixLabors.ImageSharp.Processing.Processors.Quantization { /// /// The base class for all implementations diff --git a/src/ImageSharp/Processing/Quantization/FrameQuantizers/IFrameQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/IFrameQuantizer{TPixel}.cs similarity index 89% rename from src/ImageSharp/Processing/Quantization/FrameQuantizers/IFrameQuantizer{TPixel}.cs rename to src/ImageSharp/Processing/Processors/Quantization/IFrameQuantizer{TPixel}.cs index 435302bd3..50fdb5b58 100644 --- a/src/ImageSharp/Processing/Quantization/FrameQuantizers/IFrameQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/IFrameQuantizer{TPixel}.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; +using SixLabors.ImageSharp.Processing.Processors.Dithering; -namespace SixLabors.ImageSharp.Processing.Quantization.FrameQuantizers +namespace SixLabors.ImageSharp.Processing.Processors.Quantization { /// /// Provides methods to allow the execution of the quantization process on an image frame. diff --git a/src/ImageSharp/Processing/Quantization/IQuantizer.cs b/src/ImageSharp/Processing/Processors/Quantization/IQuantizer.cs similarity index 81% rename from src/ImageSharp/Processing/Quantization/IQuantizer.cs rename to src/ImageSharp/Processing/Processors/Quantization/IQuantizer.cs index e00b865ac..0f6846d1b 100644 --- a/src/ImageSharp/Processing/Quantization/IQuantizer.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/IQuantizer.cs @@ -2,10 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; -using SixLabors.ImageSharp.Processing.Quantization.FrameQuantizers; +using SixLabors.ImageSharp.Processing.Processors.Dithering; -namespace SixLabors.ImageSharp.Processing.Quantization +namespace SixLabors.ImageSharp.Processing.Processors.Quantization { /// /// Provides methods for allowing quantization of images pixels with configurable dithering. diff --git a/src/ImageSharp/Processing/Quantization/FrameQuantizers/OctreeFrameQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/OctreeFrameQuantizer{TPixel}.cs similarity index 99% rename from src/ImageSharp/Processing/Quantization/FrameQuantizers/OctreeFrameQuantizer{TPixel}.cs rename to src/ImageSharp/Processing/Processors/Quantization/OctreeFrameQuantizer{TPixel}.cs index d73373395..0eb3db864 100644 --- a/src/ImageSharp/Processing/Quantization/FrameQuantizers/OctreeFrameQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/OctreeFrameQuantizer{TPixel}.cs @@ -9,7 +9,7 @@ using System.Runtime.InteropServices; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Quantization.FrameQuantizers +namespace SixLabors.ImageSharp.Processing.Processors.Quantization { /// /// Encapsulates methods to calculate the color palette if an image using an Octree pattern. diff --git a/src/ImageSharp/Processing/Quantization/OctreeQuantizer.cs b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer.cs similarity index 92% rename from src/ImageSharp/Processing/Quantization/OctreeQuantizer.cs rename to src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer.cs index 385ddceec..385f6246f 100644 --- a/src/ImageSharp/Processing/Quantization/OctreeQuantizer.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer.cs @@ -2,11 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Dithering; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; -using SixLabors.ImageSharp.Processing.Quantization.FrameQuantizers; +using SixLabors.ImageSharp.Processing.Processors.Dithering; -namespace SixLabors.ImageSharp.Processing.Quantization +namespace SixLabors.ImageSharp.Processing.Processors.Quantization { /// /// Allows the quantization of images pixels using Octrees. diff --git a/src/ImageSharp/Processing/Quantization/FrameQuantizers/PaletteFrameQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/PaletteFrameQuantizer{TPixel}.cs similarity index 98% rename from src/ImageSharp/Processing/Quantization/FrameQuantizers/PaletteFrameQuantizer{TPixel}.cs rename to src/ImageSharp/Processing/Processors/Quantization/PaletteFrameQuantizer{TPixel}.cs index cb72626d5..8df81b426 100644 --- a/src/ImageSharp/Processing/Quantization/FrameQuantizers/PaletteFrameQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/PaletteFrameQuantizer{TPixel}.cs @@ -8,7 +8,7 @@ using System.Runtime.InteropServices; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Quantization.FrameQuantizers +namespace SixLabors.ImageSharp.Processing.Processors.Quantization { /// /// Encapsulates methods to create a quantized image based upon the given palette. diff --git a/src/ImageSharp/Processing/Quantization/PaletteQuantizer.cs b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer.cs similarity index 91% rename from src/ImageSharp/Processing/Quantization/PaletteQuantizer.cs rename to src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer.cs index dd10a040a..8ae917718 100644 --- a/src/ImageSharp/Processing/Quantization/PaletteQuantizer.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer.cs @@ -3,11 +3,9 @@ using System; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Dithering; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; -using SixLabors.ImageSharp.Processing.Quantization.FrameQuantizers; +using SixLabors.ImageSharp.Processing.Processors.Dithering; -namespace SixLabors.ImageSharp.Processing.Quantization +namespace SixLabors.ImageSharp.Processing.Processors.Quantization { /// /// Allows the quantization of images pixels using web safe colors defined in the CSS Color Module Level 4. diff --git a/src/ImageSharp/Processing/Quantization/Processors/QuantizeProcessor.cs b/src/ImageSharp/Processing/Processors/Quantization/QuantizeProcessor.cs similarity index 92% rename from src/ImageSharp/Processing/Quantization/Processors/QuantizeProcessor.cs rename to src/ImageSharp/Processing/Processors/Quantization/QuantizeProcessor.cs index 5b20805b0..bd5a6e9ec 100644 --- a/src/ImageSharp/Processing/Quantization/Processors/QuantizeProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/QuantizeProcessor.cs @@ -4,11 +4,9 @@ using System; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Processors; -using SixLabors.ImageSharp.Processing.Quantization.FrameQuantizers; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Quantization.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Quantization { /// /// Enables the quantization of images to reduce the number of colors used in the image palette. diff --git a/src/ImageSharp/Processing/Quantization/QuantizedFrame{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/QuantizedFrame{TPixel}.cs similarity index 97% rename from src/ImageSharp/Processing/Quantization/QuantizedFrame{TPixel}.cs rename to src/ImageSharp/Processing/Processors/Quantization/QuantizedFrame{TPixel}.cs index 6699c76f4..977b939a1 100644 --- a/src/ImageSharp/Processing/Quantization/QuantizedFrame{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/QuantizedFrame{TPixel}.cs @@ -6,7 +6,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.Memory; // TODO: Consider pooling the TPixel palette also. For Rgba48+ this would end up on th LOH if 256 colors. -namespace SixLabors.ImageSharp.Processing.Quantization +namespace SixLabors.ImageSharp.Processing.Processors.Quantization { /// /// Represents a quantized image frame where the pixels indexed by a color palette. diff --git a/src/ImageSharp/Processing/Quantization/FrameQuantizers/WuFrameQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs similarity index 99% rename from src/ImageSharp/Processing/Quantization/FrameQuantizers/WuFrameQuantizer{TPixel}.cs rename to src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs index cb8721d06..7c2ff77e3 100644 --- a/src/ImageSharp/Processing/Quantization/FrameQuantizers/WuFrameQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/WuFrameQuantizer{TPixel}.cs @@ -10,7 +10,7 @@ using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; using SixLabors.Memory; -namespace SixLabors.ImageSharp.Processing.Quantization.FrameQuantizers +namespace SixLabors.ImageSharp.Processing.Processors.Quantization { /// /// An implementation of Wu's color quantizer with alpha channel. diff --git a/src/ImageSharp/Processing/Quantization/WuQuantizer.cs b/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer.cs similarity index 92% rename from src/ImageSharp/Processing/Quantization/WuQuantizer.cs rename to src/ImageSharp/Processing/Processors/Quantization/WuQuantizer.cs index f46cddfe6..3aa1f4c5e 100644 --- a/src/ImageSharp/Processing/Quantization/WuQuantizer.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer.cs @@ -2,11 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Dithering; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; -using SixLabors.ImageSharp.Processing.Quantization.FrameQuantizers; +using SixLabors.ImageSharp.Processing.Processors.Dithering; -namespace SixLabors.ImageSharp.Processing.Quantization +namespace SixLabors.ImageSharp.Processing.Processors.Quantization { /// /// Allows the quantization of images pixels using Xiaolin Wu's Color Quantizer diff --git a/src/ImageSharp/Processing/Transforms/Processors/AffineTransformProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor.cs similarity index 98% rename from src/ImageSharp/Processing/Transforms/Processors/AffineTransformProcessor.cs rename to src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor.cs index 2e1a88983..d9f35c892 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/AffineTransformProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/AffineTransformProcessor.cs @@ -10,11 +10,10 @@ using System.Runtime.InteropServices; using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// Provides the base methods to perform affine transforms on an image. diff --git a/src/ImageSharp/Processing/Transforms/Processors/AutoOrientProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor.cs similarity index 98% rename from src/ImageSharp/Processing/Transforms/Processors/AutoOrientProcessor.cs rename to src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor.cs index 68dc7f0ad..c077914ff 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/AutoOrientProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/AutoOrientProcessor.cs @@ -7,7 +7,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// Adjusts an image so that its orientation is suitable for viewing. Adjustments are based on EXIF metadata embedded in the image. diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/BicubicResampler.cs b/src/ImageSharp/Processing/Processors/Transforms/BicubicResampler.cs similarity index 95% rename from src/ImageSharp/Processing/Transforms/Resamplers/BicubicResampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/BicubicResampler.cs index dd655a8a3..199563bc7 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/BicubicResampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/BicubicResampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The function implements the bicubic kernel algorithm W(x) as described on diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/BoxResampler.cs b/src/ImageSharp/Processing/Processors/Transforms/BoxResampler.cs similarity index 90% rename from src/ImageSharp/Processing/Transforms/Resamplers/BoxResampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/BoxResampler.cs index d6f79721c..0667226d9 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/BoxResampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/BoxResampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The function implements the box algorithm. Similar to nearest neighbor when upscaling. diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/CatmullRomResampler.cs b/src/ImageSharp/Processing/Processors/Transforms/CatmullRomResampler.cs similarity index 92% rename from src/ImageSharp/Processing/Transforms/Resamplers/CatmullRomResampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/CatmullRomResampler.cs index 7284bf715..8995d2d8a 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/CatmullRomResampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/CatmullRomResampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The Catmull-Rom filter is a well known standard Cubic Filter often used as a interpolation function. diff --git a/src/ImageSharp/Processing/Transforms/Processors/CenteredAffineTransformProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/CenteredAffineTransformProcessor.cs similarity index 93% rename from src/ImageSharp/Processing/Transforms/Processors/CenteredAffineTransformProcessor.cs rename to src/ImageSharp/Processing/Processors/Transforms/CenteredAffineTransformProcessor.cs index adeed55ef..adaee1766 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/CenteredAffineTransformProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/CenteredAffineTransformProcessor.cs @@ -3,10 +3,9 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// A base class that provides methods to allow the automatic centering of affine transforms diff --git a/src/ImageSharp/Processing/Transforms/Processors/CenteredProjectiveTransformProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/CenteredProjectiveTransformProcessor.cs similarity index 93% rename from src/ImageSharp/Processing/Transforms/Processors/CenteredProjectiveTransformProcessor.cs rename to src/ImageSharp/Processing/Processors/Transforms/CenteredProjectiveTransformProcessor.cs index 5cdcde483..962b9e4c9 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/CenteredProjectiveTransformProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/CenteredProjectiveTransformProcessor.cs @@ -3,10 +3,9 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// A base class that provides methods to allow the automatic centering of non-affine transforms diff --git a/src/ImageSharp/Processing/Transforms/Processors/CropProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs similarity index 97% rename from src/ImageSharp/Processing/Transforms/Processors/CropProcessor.cs rename to src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs index 2228c69fa..5d714eef5 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/CropProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/CropProcessor.cs @@ -9,7 +9,7 @@ using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// Provides methods to allow the cropping of an image. diff --git a/src/ImageSharp/Processing/Transforms/Processors/EntropyCropProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs similarity index 89% rename from src/ImageSharp/Processing/Transforms/Processors/EntropyCropProcessor.cs rename to src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs index 66b781517..8eeae5d1f 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/EntropyCropProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/EntropyCropProcessor.cs @@ -3,12 +3,11 @@ using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Binarization.Processors; -using SixLabors.ImageSharp.Processing.Convolution.Processors; -using SixLabors.ImageSharp.Processing.Processors; +using SixLabors.ImageSharp.Processing.Processors.Binarization; +using SixLabors.ImageSharp.Processing.Processors.Convolution; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// Provides methods to allow the cropping of an image to preserve areas of highest entropy. @@ -67,7 +66,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms.Processors } /// - protected override void OnFrameApply(ImageFrame sourceBase, Rectangle sourceRectangle, Configuration config) + protected override void OnFrameApply(ImageFrame source, Rectangle sourceRectangle, Configuration configuration) { // All processing happens at the image level within BeforeImageApply(); } diff --git a/src/ImageSharp/Processing/Transforms/Processors/FlipProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs similarity index 93% rename from src/ImageSharp/Processing/Transforms/Processors/FlipProcessor.cs rename to src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs index 5d4961f57..4ab4971b8 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/FlipProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/FlipProcessor.cs @@ -5,11 +5,10 @@ using System; using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// Provides methods that allow the flipping of an image around its center point. @@ -21,14 +20,14 @@ namespace SixLabors.ImageSharp.Processing.Transforms.Processors /// /// Initializes a new instance of the class. /// - /// The used to perform flipping. + /// The used to perform flipping. public FlipProcessor(FlipMode flipMode) { this.FlipMode = flipMode; } /// - /// Gets the used to perform flipping. + /// Gets the used to perform flipping. /// public FlipMode FlipMode { get; } diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/HermiteResampler.cs b/src/ImageSharp/Processing/Processors/Transforms/HermiteResampler.cs similarity index 91% rename from src/ImageSharp/Processing/Transforms/Resamplers/HermiteResampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/HermiteResampler.cs index 2017a1cb5..18c3fda7c 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/HermiteResampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/HermiteResampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The Hermite filter is type of smoothed triangular interpolation Filter, diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/IResampler.cs b/src/ImageSharp/Processing/Processors/Transforms/IResampler.cs similarity index 91% rename from src/ImageSharp/Processing/Transforms/Resamplers/IResampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/IResampler.cs index 6bc4feaf0..6db03d5b4 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/IResampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/IResampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// Encapsulates an interpolation algorithm for resampling images. diff --git a/src/ImageSharp/Processing/Transforms/Processors/InterpolatedTransformProcessorBase.cs b/src/ImageSharp/Processing/Processors/Transforms/InterpolatedTransformProcessorBase.cs similarity index 97% rename from src/ImageSharp/Processing/Transforms/Processors/InterpolatedTransformProcessorBase.cs rename to src/ImageSharp/Processing/Processors/Transforms/InterpolatedTransformProcessorBase.cs index 8f57f3ba3..c1abb4a5e 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/InterpolatedTransformProcessorBase.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/InterpolatedTransformProcessorBase.cs @@ -4,9 +4,8 @@ using System; using System.Runtime.CompilerServices; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The base class for performing interpolated affine and non-affine transforms. diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos2Resampler.cs b/src/ImageSharp/Processing/Processors/Transforms/Lanczos2Resampler.cs similarity index 92% rename from src/ImageSharp/Processing/Transforms/Resamplers/Lanczos2Resampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/Lanczos2Resampler.cs index 35735189a..2294696de 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos2Resampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Lanczos2Resampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The function implements the Lanczos kernel algorithm as described on diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos3Resampler.cs b/src/ImageSharp/Processing/Processors/Transforms/Lanczos3Resampler.cs similarity index 92% rename from src/ImageSharp/Processing/Transforms/Resamplers/Lanczos3Resampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/Lanczos3Resampler.cs index fa85767a6..95fb206a9 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos3Resampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Lanczos3Resampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The function implements the Lanczos kernel algorithm as described on diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos5Resampler.cs b/src/ImageSharp/Processing/Processors/Transforms/Lanczos5Resampler.cs similarity index 92% rename from src/ImageSharp/Processing/Transforms/Resamplers/Lanczos5Resampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/Lanczos5Resampler.cs index ec6b7181a..c99ed1e85 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos5Resampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Lanczos5Resampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The function implements the Lanczos kernel algorithm as described on diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos8Resampler.cs b/src/ImageSharp/Processing/Processors/Transforms/Lanczos8Resampler.cs similarity index 92% rename from src/ImageSharp/Processing/Transforms/Resamplers/Lanczos8Resampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/Lanczos8Resampler.cs index c1f6aecf1..4efdb882b 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/Lanczos8Resampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Lanczos8Resampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The function implements the Lanczos kernel algorithm as described on diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/MitchellNetravaliResampler.cs b/src/ImageSharp/Processing/Processors/Transforms/MitchellNetravaliResampler.cs similarity index 90% rename from src/ImageSharp/Processing/Transforms/Resamplers/MitchellNetravaliResampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/MitchellNetravaliResampler.cs index b7817400b..d4ba954f2 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/MitchellNetravaliResampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/MitchellNetravaliResampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The function implements the mitchell algorithm as described on diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/NearestNeighborResampler.cs b/src/ImageSharp/Processing/Processors/Transforms/NearestNeighborResampler.cs similarity index 89% rename from src/ImageSharp/Processing/Transforms/Resamplers/NearestNeighborResampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/NearestNeighborResampler.cs index 61155132e..1f12334f4 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/NearestNeighborResampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/NearestNeighborResampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The function implements the nearest neighbor algorithm. This uses an unscaled filter diff --git a/src/ImageSharp/Processing/Transforms/Processors/ProjectiveTransformProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs similarity index 97% rename from src/ImageSharp/Processing/Transforms/Processors/ProjectiveTransformProcessor.cs rename to src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs index 24a72fefb..716133fb7 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/ProjectiveTransformProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/ProjectiveTransformProcessor.cs @@ -10,12 +10,10 @@ using System.Runtime.InteropServices; using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; using SixLabors.Memory; using SixLabors.Primitives; -// TODO: Doesn't work yet! Implement tests + Finish implementation + Document Matrix4x4 behavior -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// Provides the base methods to perform non-affine transforms on an image. diff --git a/src/ImageSharp/Processing/Transforms/Processors/ResizeProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs similarity index 98% rename from src/ImageSharp/Processing/Transforms/Processors/ResizeProcessor.cs rename to src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs index dfb3a82ff..8c9ab9a23 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/ResizeProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs @@ -10,11 +10,10 @@ using System.Runtime.InteropServices; using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// Provides methods that allow the resizing of images using various algorithms. @@ -202,7 +201,7 @@ namespace SixLabors.ImageSharp.Processing.Transforms.Processors { // weights[w] = weights[w] / sum: ref float wRef = ref Unsafe.Add(ref weightsBaseRef, w); - wRef = wRef / sum; + wRef /= sum; } } } diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/RobidouxResampler.cs b/src/ImageSharp/Processing/Processors/Transforms/RobidouxResampler.cs similarity index 90% rename from src/ImageSharp/Processing/Transforms/Resamplers/RobidouxResampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/RobidouxResampler.cs index 03a6e8677..51938566c 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/RobidouxResampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/RobidouxResampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The function implements the Robidoux algorithm. diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/RobidouxSharpResampler.cs b/src/ImageSharp/Processing/Processors/Transforms/RobidouxSharpResampler.cs similarity index 90% rename from src/ImageSharp/Processing/Transforms/Resamplers/RobidouxSharpResampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/RobidouxSharpResampler.cs index 83213c3f4..015b7f0af 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/RobidouxSharpResampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/RobidouxSharpResampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The function implements the Robidoux Sharp algorithm. diff --git a/src/ImageSharp/Processing/Transforms/Processors/RotateProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs similarity index 98% rename from src/ImageSharp/Processing/Transforms/Processors/RotateProcessor.cs rename to src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs index 62c3e476b..d57e9cbd9 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/RotateProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/RotateProcessor.cs @@ -6,10 +6,10 @@ using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.MetaData.Profiles.Exif; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// Provides methods that allow the rotating of images. diff --git a/src/ImageSharp/Processing/Transforms/Processors/SkewProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs similarity index 94% rename from src/ImageSharp/Processing/Transforms/Processors/SkewProcessor.cs rename to src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs index 61e8b1268..a0cfa6379 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/SkewProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/SkewProcessor.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// Provides methods that allow the skewing of images. diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/SplineResampler.cs b/src/ImageSharp/Processing/Processors/Transforms/SplineResampler.cs similarity index 90% rename from src/ImageSharp/Processing/Transforms/Resamplers/SplineResampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/SplineResampler.cs index 45f18a4a0..df6c2a338 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/SplineResampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/SplineResampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The function implements the spline algorithm. diff --git a/src/ImageSharp/Processing/Transforms/TransformHelpers.cs b/src/ImageSharp/Processing/Processors/Transforms/TransformHelpers.cs similarity index 99% rename from src/ImageSharp/Processing/Transforms/TransformHelpers.cs rename to src/ImageSharp/Processing/Processors/Transforms/TransformHelpers.cs index 71d3b35c1..1b676139b 100644 --- a/src/ImageSharp/Processing/Transforms/TransformHelpers.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/TransformHelpers.cs @@ -7,7 +7,7 @@ using SixLabors.ImageSharp.MetaData.Profiles.Exif; using SixLabors.ImageSharp.PixelFormats; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// Contains helper methods for working with affine and non-affine transforms diff --git a/src/ImageSharp/Processing/Transforms/Processors/TransformProcessorBase.cs b/src/ImageSharp/Processing/Processors/Transforms/TransformProcessorBase.cs similarity index 92% rename from src/ImageSharp/Processing/Transforms/Processors/TransformProcessorBase.cs rename to src/ImageSharp/Processing/Processors/Transforms/TransformProcessorBase.cs index 0ca5ee191..13ee90a06 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/TransformProcessorBase.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/TransformProcessorBase.cs @@ -5,7 +5,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The base class for all transform processors. Any processor that changes the dimensions of the image should inherit from this. diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/TriangleResampler.cs b/src/ImageSharp/Processing/Processors/Transforms/TriangleResampler.cs similarity index 92% rename from src/ImageSharp/Processing/Transforms/Resamplers/TriangleResampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/TriangleResampler.cs index 0fde54486..57d1fa11d 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/TriangleResampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/TriangleResampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The function implements the triangle (bilinear) algorithm. diff --git a/src/ImageSharp/Processing/Transforms/Processors/WeightsBuffer.cs b/src/ImageSharp/Processing/Processors/Transforms/WeightsBuffer.cs similarity index 96% rename from src/ImageSharp/Processing/Transforms/Processors/WeightsBuffer.cs rename to src/ImageSharp/Processing/Processors/Transforms/WeightsBuffer.cs index 8c479992e..581a3353a 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/WeightsBuffer.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/WeightsBuffer.cs @@ -4,7 +4,7 @@ using System; using SixLabors.Memory; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// Holds the values in an optimized contigous memory region. diff --git a/src/ImageSharp/Processing/Transforms/Processors/WeightsWindow.cs b/src/ImageSharp/Processing/Processors/Transforms/WeightsWindow.cs similarity index 98% rename from src/ImageSharp/Processing/Transforms/Processors/WeightsWindow.cs rename to src/ImageSharp/Processing/Processors/Transforms/WeightsWindow.cs index 440b19ecc..ebf2db4bf 100644 --- a/src/ImageSharp/Processing/Transforms/Processors/WeightsWindow.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/WeightsWindow.cs @@ -7,7 +7,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using SixLabors.Memory; -namespace SixLabors.ImageSharp.Processing.Transforms.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// Points to a collection of of weights allocated in . diff --git a/src/ImageSharp/Processing/Transforms/Resamplers/WelchResampler.cs b/src/ImageSharp/Processing/Processors/Transforms/WelchResampler.cs similarity index 91% rename from src/ImageSharp/Processing/Transforms/Resamplers/WelchResampler.cs rename to src/ImageSharp/Processing/Processors/Transforms/WelchResampler.cs index 01a07fed5..edce5fcf9 100644 --- a/src/ImageSharp/Processing/Transforms/Resamplers/WelchResampler.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/WelchResampler.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms.Resamplers +namespace SixLabors.ImageSharp.Processing.Processors.Transforms { /// /// The function implements the welch algorithm. diff --git a/src/ImageSharp/Processing/Transforms/ProjectiveTransformHelper.cs b/src/ImageSharp/Processing/ProjectiveTransformHelper.cs similarity index 99% rename from src/ImageSharp/Processing/Transforms/ProjectiveTransformHelper.cs rename to src/ImageSharp/Processing/ProjectiveTransformHelper.cs index 7c79776d9..4057ec586 100644 --- a/src/ImageSharp/Processing/Transforms/ProjectiveTransformHelper.cs +++ b/src/ImageSharp/Processing/ProjectiveTransformHelper.cs @@ -4,7 +4,7 @@ using System.Numerics; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Enumerates the various options which determine which side to taper diff --git a/src/ImageSharp/Processing/Quantization/QuantizeExtensions.cs b/src/ImageSharp/Processing/QuantizeExtensions.cs similarity index 92% rename from src/ImageSharp/Processing/Quantization/QuantizeExtensions.cs rename to src/ImageSharp/Processing/QuantizeExtensions.cs index bf49c765a..5bd2f49bd 100644 --- a/src/ImageSharp/Processing/Quantization/QuantizeExtensions.cs +++ b/src/ImageSharp/Processing/QuantizeExtensions.cs @@ -2,9 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Quantization.Processors; +using SixLabors.ImageSharp.Processing.Processors.Quantization; -namespace SixLabors.ImageSharp.Processing.Quantization +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of quantizing algorithms to the type. diff --git a/src/ImageSharp/Processing/Transforms/ResizeExtensions.cs b/src/ImageSharp/Processing/ResizeExtensions.cs similarity index 98% rename from src/ImageSharp/Processing/Transforms/ResizeExtensions.cs rename to src/ImageSharp/Processing/ResizeExtensions.cs index 4317c1fc1..8a370db69 100644 --- a/src/ImageSharp/Processing/Transforms/ResizeExtensions.cs +++ b/src/ImageSharp/Processing/ResizeExtensions.cs @@ -2,11 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Processors; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of resize operations to the type. diff --git a/src/ImageSharp/Processing/Transforms/ResizeHelper.cs b/src/ImageSharp/Processing/ResizeHelper.cs similarity index 99% rename from src/ImageSharp/Processing/Transforms/ResizeHelper.cs rename to src/ImageSharp/Processing/ResizeHelper.cs index aca9d97d3..b9233937b 100644 --- a/src/ImageSharp/Processing/Transforms/ResizeHelper.cs +++ b/src/ImageSharp/Processing/ResizeHelper.cs @@ -5,7 +5,7 @@ using System; using System.Linq; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Provides methods to help calculate the target rectangle when resizing using the diff --git a/src/ImageSharp/Processing/Transforms/ResizeMode.cs b/src/ImageSharp/Processing/ResizeMode.cs similarity index 96% rename from src/ImageSharp/Processing/Transforms/ResizeMode.cs rename to src/ImageSharp/Processing/ResizeMode.cs index 2707b11b3..6adeac66d 100644 --- a/src/ImageSharp/Processing/Transforms/ResizeMode.cs +++ b/src/ImageSharp/Processing/ResizeMode.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Provides enumeration over how the image should be resized. diff --git a/src/ImageSharp/Processing/Transforms/ResizeOptions.cs b/src/ImageSharp/Processing/ResizeOptions.cs similarity index 92% rename from src/ImageSharp/Processing/Transforms/ResizeOptions.cs rename to src/ImageSharp/Processing/ResizeOptions.cs index c14abe2a8..0d5bfe38b 100644 --- a/src/ImageSharp/Processing/Transforms/ResizeOptions.cs +++ b/src/ImageSharp/Processing/ResizeOptions.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Linq; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// The resize options for resizing images against certain modes. diff --git a/src/ImageSharp/Processing/Transforms/RotateExtensions.cs b/src/ImageSharp/Processing/RotateExtensions.cs similarity index 93% rename from src/ImageSharp/Processing/Transforms/RotateExtensions.cs rename to src/ImageSharp/Processing/RotateExtensions.cs index 28819099e..398a634d1 100644 --- a/src/ImageSharp/Processing/Transforms/RotateExtensions.cs +++ b/src/ImageSharp/Processing/RotateExtensions.cs @@ -2,10 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Processors; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; +using SixLabors.ImageSharp.Processing.Processors.Transforms; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of rotate operations to the type. diff --git a/src/ImageSharp/Processing/Transforms/RotateFlipExtensions.cs b/src/ImageSharp/Processing/RotateFlipExtensions.cs similarity index 95% rename from src/ImageSharp/Processing/Transforms/RotateFlipExtensions.cs rename to src/ImageSharp/Processing/RotateFlipExtensions.cs index 66bb27b36..27ddc8de9 100644 --- a/src/ImageSharp/Processing/Transforms/RotateFlipExtensions.cs +++ b/src/ImageSharp/Processing/RotateFlipExtensions.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of rotate-flip operations to the type. diff --git a/src/ImageSharp/Processing/Transforms/RotateMode.cs b/src/ImageSharp/Processing/RotateMode.cs similarity index 92% rename from src/ImageSharp/Processing/Transforms/RotateMode.cs rename to src/ImageSharp/Processing/RotateMode.cs index 6f66d0c09..c890f2bd6 100644 --- a/src/ImageSharp/Processing/Transforms/RotateMode.cs +++ b/src/ImageSharp/Processing/RotateMode.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Provides enumeration over how the image should be rotated. diff --git a/src/ImageSharp/Processing/Filters/SaturateExtensions.cs b/src/ImageSharp/Processing/SaturateExtensions.cs similarity index 95% rename from src/ImageSharp/Processing/Filters/SaturateExtensions.cs rename to src/ImageSharp/Processing/SaturateExtensions.cs index 282bdef64..ba45ae12c 100644 --- a/src/ImageSharp/Processing/Filters/SaturateExtensions.cs +++ b/src/ImageSharp/Processing/SaturateExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the alteration of the saturation component to the type. diff --git a/src/ImageSharp/Processing/Filters/SepiaExtensions.cs b/src/ImageSharp/Processing/SepiaExtensions.cs similarity index 96% rename from src/ImageSharp/Processing/Filters/SepiaExtensions.cs rename to src/ImageSharp/Processing/SepiaExtensions.cs index 09d8c3684..08676ee62 100644 --- a/src/ImageSharp/Processing/Filters/SepiaExtensions.cs +++ b/src/ImageSharp/Processing/SepiaExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Filters +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of sepia toning to the type. diff --git a/src/ImageSharp/Processing/Transforms/SkewExtensions.cs b/src/ImageSharp/Processing/SkewExtensions.cs similarity index 92% rename from src/ImageSharp/Processing/Transforms/SkewExtensions.cs rename to src/ImageSharp/Processing/SkewExtensions.cs index cbb414888..07e3c6087 100644 --- a/src/ImageSharp/Processing/Transforms/SkewExtensions.cs +++ b/src/ImageSharp/Processing/SkewExtensions.cs @@ -2,10 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Processors; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; +using SixLabors.ImageSharp.Processing.Processors.Transforms; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of skew operations to the type. diff --git a/src/ImageSharp/Processing/Transforms/TransformExtensions.cs b/src/ImageSharp/Processing/TransformExtensions.cs similarity index 97% rename from src/ImageSharp/Processing/Transforms/TransformExtensions.cs rename to src/ImageSharp/Processing/TransformExtensions.cs index 2607c102b..0ec1e295d 100644 --- a/src/ImageSharp/Processing/Transforms/TransformExtensions.cs +++ b/src/ImageSharp/Processing/TransformExtensions.cs @@ -3,11 +3,10 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Processors; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Transforms +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of composable transform operations to the type. diff --git a/src/ImageSharp/Processing/Overlays/VignetteExtensions.cs b/src/ImageSharp/Processing/VignetteExtensions.cs similarity index 98% rename from src/ImageSharp/Processing/Overlays/VignetteExtensions.cs rename to src/ImageSharp/Processing/VignetteExtensions.cs index 25b067d7f..18dd8064c 100644 --- a/src/ImageSharp/Processing/Overlays/VignetteExtensions.cs +++ b/src/ImageSharp/Processing/VignetteExtensions.cs @@ -3,10 +3,10 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Overlays.Processors; +using SixLabors.ImageSharp.Processing.Processors.Overlays; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Overlays +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the application of a radial glow to the type. diff --git a/tests/ImageSharp.Benchmarks/Codecs/EncodeGif.cs b/tests/ImageSharp.Benchmarks/Codecs/EncodeGif.cs index 4f5bcdf0a..12e74ccdb 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/EncodeGif.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/EncodeGif.cs @@ -6,7 +6,7 @@ using System.IO; using BenchmarkDotNet.Attributes; using SixLabors.ImageSharp.Formats.Gif; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Quantization; +using SixLabors.ImageSharp.Processing.Processors.Quantization; using SixLabors.ImageSharp.Tests; using SDImage = System.Drawing.Image; diff --git a/tests/ImageSharp.Benchmarks/Codecs/EncodeGifMultiple.cs b/tests/ImageSharp.Benchmarks/Codecs/EncodeGifMultiple.cs index cf94a1ec3..9b94347f3 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/EncodeGifMultiple.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/EncodeGifMultiple.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Drawing.Imaging; using BenchmarkDotNet.Attributes; using SixLabors.ImageSharp.Formats.Gif; -using SixLabors.ImageSharp.Processing.Quantization; +using SixLabors.ImageSharp.Processing.Processors.Quantization; namespace SixLabors.ImageSharp.Benchmarks.Codecs { diff --git a/tests/ImageSharp.Benchmarks/Codecs/EncodeIndexedPng.cs b/tests/ImageSharp.Benchmarks/Codecs/EncodeIndexedPng.cs index db415d3c2..962b34eb7 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/EncodeIndexedPng.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/EncodeIndexedPng.cs @@ -5,7 +5,8 @@ using System.IO; using BenchmarkDotNet.Attributes; using SixLabors.ImageSharp.Formats.Png; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Quantization; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Quantization; using SixLabors.ImageSharp.Tests; using CoreImage = SixLabors.ImageSharp.Image; diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs index ab690f645..112c4a1a8 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs @@ -12,12 +12,9 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Overlays; namespace SixLabors.ImageSharp.Benchmarks { - - public class DrawPolygon : BenchmarkBase { [Benchmark(Baseline = true, Description = "System.Drawing Draw Polygon")] diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawText.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawText.cs index 96912a6df..01846708a 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawText.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawText.cs @@ -6,13 +6,10 @@ using System.Drawing; using System.Drawing.Drawing2D; using BenchmarkDotNet.Attributes; -using System.IO; -using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Text; -using SixLabors.ImageSharp.Processing.Overlays; using SixLabors.ImageSharp.Processing.Drawing; using System.Linq; @@ -26,7 +23,7 @@ namespace SixLabors.ImageSharp.Benchmarks [Params(10, 100)] public int TextIterations{ get; set; } public string TextPhrase { get; set; } = "Hello World"; - public string TextToRender => string.Join(" ", Enumerable.Repeat(TextPhrase, TextIterations)); + public string TextToRender => string.Join(" ", Enumerable.Repeat(this.TextPhrase, this.TextIterations)); [Benchmark(Baseline = true, Description = "System.Drawing Draw Text")] @@ -53,7 +50,7 @@ namespace SixLabors.ImageSharp.Benchmarks using (Image image = new Image(800, 800)) { var font = SixLabors.Fonts.SystemFonts.CreateFont("Arial", 12); - image.Mutate(x => x.ApplyProcessor(new SixLabors.ImageSharp.Processing.Text.Processors.DrawTextProcessor(new TextGraphicsOptions(true) { WrapTextWidth = 780 }, TextToRender, font, SixLabors.ImageSharp.Processing.Drawing.Brushes.Brushes.Solid(Rgba32.HotPink), null, new SixLabors.Primitives.PointF(10, 10)))); + image.Mutate(x => x.ApplyProcessor(new Processing.Text.Processors.DrawTextProcessor(new TextGraphicsOptions(true) { WrapTextWidth = 780 }, TextToRender, font, SixLabors.ImageSharp.Processing.Drawing.Brushes.Brushes.Solid(Rgba32.HotPink), null, new SixLabors.Primitives.PointF(10, 10)))); } } diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawTextOutline.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawTextOutline.cs index e85e33235..d03e69f38 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawTextOutline.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawTextOutline.cs @@ -6,13 +6,9 @@ using System.Drawing; using System.Drawing.Drawing2D; using BenchmarkDotNet.Attributes; -using System.IO; -using System.Numerics; - using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Text; -using SixLabors.ImageSharp.Processing.Overlays; using SixLabors.ImageSharp.Processing.Drawing; using System.Linq; diff --git a/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs b/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs index c53a97515..d78379fc0 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs @@ -13,7 +13,6 @@ using BenchmarkDotNet.Attributes; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Overlays; namespace SixLabors.ImageSharp.Benchmarks { diff --git a/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs b/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs index 7bd55e905..ac56caa46 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs @@ -11,7 +11,6 @@ using BenchmarkDotNet.Attributes; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Overlays; using CoreRectangle = SixLabors.Primitives.Rectangle; using CoreSize = SixLabors.Primitives.Size; diff --git a/tests/ImageSharp.Benchmarks/Samplers/Crop.cs b/tests/ImageSharp.Benchmarks/Samplers/Crop.cs index d5ac6a6f1..240a277cf 100644 --- a/tests/ImageSharp.Benchmarks/Samplers/Crop.cs +++ b/tests/ImageSharp.Benchmarks/Samplers/Crop.cs @@ -12,7 +12,6 @@ namespace SixLabors.ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Transforms; using CoreSize = SixLabors.Primitives.Size; diff --git a/tests/ImageSharp.Benchmarks/Samplers/DetectEdges.cs b/tests/ImageSharp.Benchmarks/Samplers/DetectEdges.cs index 569b5bc44..006d1b639 100644 --- a/tests/ImageSharp.Benchmarks/Samplers/DetectEdges.cs +++ b/tests/ImageSharp.Benchmarks/Samplers/DetectEdges.cs @@ -12,7 +12,6 @@ namespace SixLabors.ImageSharp.Benchmarks using BenchmarkDotNet.Attributes; using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Convolution; using CoreImage = ImageSharp.Image; diff --git a/tests/ImageSharp.Benchmarks/Samplers/Glow.cs b/tests/ImageSharp.Benchmarks/Samplers/Glow.cs index ce17481c4..85c4fdd7c 100644 --- a/tests/ImageSharp.Benchmarks/Samplers/Glow.cs +++ b/tests/ImageSharp.Benchmarks/Samplers/Glow.cs @@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Benchmarks using SixLabors.Memory; using SixLabors.Primitives; - using SixLabors.ImageSharp.Processing.Overlays.Processors; + using SixLabors.ImageSharp.Processing.Processors.Overlays; using SixLabors.ImageSharp.Processing.Processors; public class Glow : BenchmarkBase diff --git a/tests/ImageSharp.Benchmarks/Samplers/Resize.cs b/tests/ImageSharp.Benchmarks/Samplers/Resize.cs index 0a4730686..8bba227c5 100644 --- a/tests/ImageSharp.Benchmarks/Samplers/Resize.cs +++ b/tests/ImageSharp.Benchmarks/Samplers/Resize.cs @@ -12,7 +12,6 @@ namespace SixLabors.ImageSharp.Benchmarks using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Transforms; using CoreSize = SixLabors.Primitives.Size; diff --git a/tests/ImageSharp.Tests/ComplexIntegrationTests.cs b/tests/ImageSharp.Tests/ComplexIntegrationTests.cs index ed4bb6104..a260ec33c 100644 --- a/tests/ImageSharp.Tests/ComplexIntegrationTests.cs +++ b/tests/ImageSharp.Tests/ComplexIntegrationTests.cs @@ -1,6 +1,6 @@ using SixLabors.ImageSharp.Formats.Jpeg; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms; +using SixLabors.ImageSharp.Processing; using SixLabors.Primitives; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/BeziersTests.cs b/tests/ImageSharp.Tests/Drawing/BeziersTests.cs index a5fda7958..1790d1a20 100644 --- a/tests/ImageSharp.Tests/Drawing/BeziersTests.cs +++ b/tests/ImageSharp.Tests/Drawing/BeziersTests.cs @@ -6,7 +6,6 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Overlays; using SixLabors.Memory; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs b/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs index d0087b1d2..4c681fb89 100644 --- a/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs +++ b/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs @@ -4,14 +4,14 @@ using System; using System.Numerics; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Drawing; using SixLabors.Primitives; using Xunit; namespace SixLabors.ImageSharp.Tests { - using SixLabors.ImageSharp.Processing.Transforms; + using SixLabors.ImageSharp.Processing; + using SixLabors.ImageSharp.Processing.Processors.Transforms; public class DrawImageTest : FileTestBase { diff --git a/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs b/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs index c1865e930..424b875e0 100644 --- a/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs +++ b/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs @@ -6,7 +6,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Drawing; using SixLabors.ImageSharp.Processing.Drawing.Pens; -using SixLabors.ImageSharp.Processing.Overlays; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs b/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs index 29b78220d..c65d04d9d 100644 --- a/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs @@ -7,7 +7,6 @@ using SixLabors.ImageSharp.Primitives; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Drawing; using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Transforms; using Xunit; namespace SixLabors.ImageSharp.Tests.Drawing diff --git a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs index ecd1c06e8..b664d1a14 100644 --- a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs @@ -6,7 +6,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Drawing; using SixLabors.ImageSharp.Processing.Drawing.Pens; -using SixLabors.ImageSharp.Processing.Overlays; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/LineTests.cs b/tests/ImageSharp.Tests/Drawing/LineTests.cs index 28b59746f..6be81e0aa 100644 --- a/tests/ImageSharp.Tests/Drawing/LineTests.cs +++ b/tests/ImageSharp.Tests/Drawing/LineTests.cs @@ -7,7 +7,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Drawing; using SixLabors.ImageSharp.Processing.Drawing.Pens; -using SixLabors.ImageSharp.Processing.Overlays; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/PolygonTests.cs b/tests/ImageSharp.Tests/Drawing/PolygonTests.cs index c7a0531c9..a0b958860 100644 --- a/tests/ImageSharp.Tests/Drawing/PolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/PolygonTests.cs @@ -7,7 +7,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.Primitives; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Overlays; using Xunit; namespace SixLabors.ImageSharp.Tests.Drawing diff --git a/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs b/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs index 7175e7a65..e8a6eef1d 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs @@ -5,7 +5,6 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Overlays; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs index 42b0dc1e6..8dcce8167 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs @@ -6,7 +6,6 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Overlays; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs index b39cc4632..ed46f323a 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs @@ -8,7 +8,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Drawing; using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Overlays; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs b/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs index cd3b72e27..23b806767 100644 --- a/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs +++ b/tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs @@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Tests using SixLabors.Memory; using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Quantization; + using SixLabors.ImageSharp.Processing.Processors.Quantization; public class GeneralFormatTests : FileTestBase { diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs index 93cfaff7f..2b9c11fb0 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs @@ -5,7 +5,7 @@ using System.IO; using SixLabors.ImageSharp.Formats.Gif; using SixLabors.ImageSharp.MetaData; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Quantization; +using SixLabors.ImageSharp.Processing.Processors.Quantization; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using Xunit; // ReSharper disable InconsistentNaming diff --git a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs index 3bcecedec..540fc0716 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs @@ -9,7 +9,7 @@ using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.Formats.Png; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Quantization; +using SixLabors.ImageSharp.Processing.Processors.Quantization; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using Xunit; diff --git a/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs index e7fd21d96..81a31e42d 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs @@ -5,14 +5,12 @@ using System.IO; using Xunit; using SixLabors.ImageSharp.Formats; using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.ImageSharp.Formats.Png; namespace SixLabors.ImageSharp.Tests.Formats.Png { - using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Transforms; - public class PngSmokeTests { [Theory] diff --git a/tests/ImageSharp.Tests/Image/ImageProcessingContextTests.cs b/tests/ImageSharp.Tests/Image/ImageProcessingContextTests.cs index 4e149da50..041b6c846 100644 --- a/tests/ImageSharp.Tests/Image/ImageProcessingContextTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageProcessingContextTests.cs @@ -1,17 +1,13 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -//using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; using SixLabors.Primitives; using Xunit; namespace SixLabors.ImageSharp.Tests { - using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Transforms; - public class ImageProcessingContextTests { [Fact] diff --git a/tests/ImageSharp.Tests/Image/ImageRotationTests.cs b/tests/ImageSharp.Tests/Image/ImageRotationTests.cs index 8310d67e8..e1c4a419e 100644 --- a/tests/ImageSharp.Tests/Image/ImageRotationTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageRotationTests.cs @@ -2,14 +2,12 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; using SixLabors.Primitives; using Xunit; namespace SixLabors.ImageSharp.Tests { - using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Transforms; - public class ImageRotationTests { [Fact] diff --git a/tests/ImageSharp.Tests/Processing/Binarization/BinaryDitherTest.cs b/tests/ImageSharp.Tests/Processing/Binarization/BinaryDitherTest.cs index 46198991a..5f6e825f6 100644 --- a/tests/ImageSharp.Tests/Processing/Binarization/BinaryDitherTest.cs +++ b/tests/ImageSharp.Tests/Processing/Binarization/BinaryDitherTest.cs @@ -2,12 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; - -using SixLabors.ImageSharp.Processing.Binarization; -using SixLabors.ImageSharp.Processing.Binarization.Processors; -using SixLabors.ImageSharp.Processing.Dithering; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; -using SixLabors.ImageSharp.Processing.Dithering.Ordered; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Binarization; +using SixLabors.ImageSharp.Processing.Processors.Dithering; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Binarization/BinaryThresholdTest.cs b/tests/ImageSharp.Tests/Processing/Binarization/BinaryThresholdTest.cs index bf15db366..569c4ba21 100644 --- a/tests/ImageSharp.Tests/Processing/Binarization/BinaryThresholdTest.cs +++ b/tests/ImageSharp.Tests/Processing/Binarization/BinaryThresholdTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Binarization; -using SixLabors.ImageSharp.Processing.Binarization.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Binarization; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs b/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs index 3e1a7acc0..c98f91046 100644 --- a/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs +++ b/tests/ImageSharp.Tests/Processing/Binarization/OrderedDitherFactoryTests.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Dithering.Ordered; +using SixLabors.ImageSharp.Processing.Processors.Dithering; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Convolution/BoxBlurTest.cs b/tests/ImageSharp.Tests/Processing/Convolution/BoxBlurTest.cs index 07c69a94c..e425b6315 100644 --- a/tests/ImageSharp.Tests/Processing/Convolution/BoxBlurTest.cs +++ b/tests/ImageSharp.Tests/Processing/Convolution/BoxBlurTest.cs @@ -2,15 +2,12 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Processors; -using SixLabors.Primitives; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Convolution; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Convolution { - using SixLabors.ImageSharp.Processing.Convolution; - using SixLabors.ImageSharp.Processing.Convolution.Processors; - public class BoxBlurTest : BaseImageOperationsExtensionTest { [Fact] diff --git a/tests/ImageSharp.Tests/Processing/Convolution/DetectEdgesTest.cs b/tests/ImageSharp.Tests/Processing/Convolution/DetectEdgesTest.cs index 45a5b0313..60fa19b49 100644 --- a/tests/ImageSharp.Tests/Processing/Convolution/DetectEdgesTest.cs +++ b/tests/ImageSharp.Tests/Processing/Convolution/DetectEdgesTest.cs @@ -5,15 +5,13 @@ using System.Collections.Generic; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Processors; +using SixLabors.ImageSharp.Processing.Processors.Convolution; using SixLabors.ImageSharp.Tests.TestUtilities; using SixLabors.Primitives; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Convolution { - using SixLabors.ImageSharp.Processing.Convolution; - using SixLabors.ImageSharp.Processing.Convolution.Processors; - public class DetectEdgesTest : BaseImageOperationsExtensionTest { diff --git a/tests/ImageSharp.Tests/Processing/Convolution/GaussianBlurTest.cs b/tests/ImageSharp.Tests/Processing/Convolution/GaussianBlurTest.cs index 5399a7ec8..c87a834eb 100644 --- a/tests/ImageSharp.Tests/Processing/Convolution/GaussianBlurTest.cs +++ b/tests/ImageSharp.Tests/Processing/Convolution/GaussianBlurTest.cs @@ -2,15 +2,12 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Processors; -using SixLabors.Primitives; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Convolution; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Convolution { - using SixLabors.ImageSharp.Processing.Convolution; - using SixLabors.ImageSharp.Processing.Convolution.Processors; - public class GaussianBlurTest : BaseImageOperationsExtensionTest { [Fact] diff --git a/tests/ImageSharp.Tests/Processing/Convolution/GaussianSharpenTest.cs b/tests/ImageSharp.Tests/Processing/Convolution/GaussianSharpenTest.cs index 518c2960f..675498745 100644 --- a/tests/ImageSharp.Tests/Processing/Convolution/GaussianSharpenTest.cs +++ b/tests/ImageSharp.Tests/Processing/Convolution/GaussianSharpenTest.cs @@ -2,15 +2,12 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Processors; -using SixLabors.Primitives; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Convolution; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Convolution { - using SixLabors.ImageSharp.Processing.Convolution; - using SixLabors.ImageSharp.Processing.Convolution.Processors; - public class GaussianSharpenTest : BaseImageOperationsExtensionTest { [Fact] diff --git a/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs b/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs index 439632210..8b3524fe6 100644 --- a/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs +++ b/tests/ImageSharp.Tests/Processing/Convolution/Processors/LaplacianKernelFactoryTests.cs @@ -3,10 +3,10 @@ using System; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Convolution.Processors; +using SixLabors.ImageSharp.Processing.Processors.Convolution; using Xunit; -namespace SixLabors.ImageSharp.Tests.Processing.Convolution.Processors +namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution { public class LaplacianKernelFactoryTests { diff --git a/tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs b/tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs index e53de85fe..f393d5923 100644 --- a/tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs +++ b/tests/ImageSharp.Tests/Processing/Dithering/DitherTest.cs @@ -2,10 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Dithering; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; -using SixLabors.ImageSharp.Processing.Dithering.Ordered; -using SixLabors.ImageSharp.Processing.Dithering.Processors; +using SixLabors.ImageSharp.Processing.Processors.Dithering; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs b/tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs index 6aa8fbba6..7775de2d2 100644 --- a/tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs +++ b/tests/ImageSharp.Tests/Processing/Effects/BackgroundColorTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Overlays; -using SixLabors.ImageSharp.Processing.Overlays.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Overlays; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Effects/OilPaintTest.cs b/tests/ImageSharp.Tests/Processing/Effects/OilPaintTest.cs index 2f4ba0516..9cd24fc6d 100644 --- a/tests/ImageSharp.Tests/Processing/Effects/OilPaintTest.cs +++ b/tests/ImageSharp.Tests/Processing/Effects/OilPaintTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Effects; -using SixLabors.ImageSharp.Processing.Effects.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Effects; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Effects diff --git a/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs b/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs index 245e104f9..a93eaf0bc 100644 --- a/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs +++ b/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Effects; -using SixLabors.ImageSharp.Processing.Effects.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Effects; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Effects diff --git a/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs b/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs index 7e06e67d7..d651f2f04 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/BlackWhiteTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Filters; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Filters diff --git a/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs b/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs index e47430efa..e210450a8 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/BrightnessTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Filters; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Effects diff --git a/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs b/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs index ee99938bb..aeafe5fe1 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/ColorBlindnessTest.cs @@ -4,8 +4,8 @@ using System.Collections.Generic; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.ImageSharp.Processing.Processors; using SixLabors.ImageSharp.Tests.TestUtilities; diff --git a/tests/ImageSharp.Tests/Processing/Filters/ContrastTest.cs b/tests/ImageSharp.Tests/Processing/Filters/ContrastTest.cs index 2f9a8331d..21a552e6a 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/ContrastTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/ContrastTest.cs @@ -7,8 +7,8 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Effects { - using SixLabors.ImageSharp.Processing.Filters; - using SixLabors.ImageSharp.Processing.Filters.Processors; + using SixLabors.ImageSharp.Processing; + using SixLabors.ImageSharp.Processing.Processors.Filters; public class ContrastTest : BaseImageOperationsExtensionTest { diff --git a/tests/ImageSharp.Tests/Processing/Filters/FilterTest.cs b/tests/ImageSharp.Tests/Processing/Filters/FilterTest.cs index cac1d7057..414a0d74e 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/FilterTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/FilterTest.cs @@ -8,8 +8,8 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Filters { - using SixLabors.ImageSharp.Processing.Filters; - using SixLabors.ImageSharp.Processing.Filters.Processors; + using SixLabors.ImageSharp.Processing; + using SixLabors.ImageSharp.Processing.Processors.Filters; public class FilterTest : BaseImageOperationsExtensionTest { diff --git a/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs b/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs index 667354b28..d63d97820 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/GrayscaleTest.cs @@ -4,8 +4,8 @@ using System.Collections.Generic; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Filters; using SixLabors.ImageSharp.Processing.Processors; using SixLabors.ImageSharp.Tests.TestUtilities; diff --git a/tests/ImageSharp.Tests/Processing/Filters/HueTest.cs b/tests/ImageSharp.Tests/Processing/Filters/HueTest.cs index 61220d59f..f56578dd6 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/HueTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/HueTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Filters; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Filters/InvertTest.cs b/tests/ImageSharp.Tests/Processing/Filters/InvertTest.cs index 61fd206db..c93afc942 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/InvertTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/InvertTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Filters; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Effects diff --git a/tests/ImageSharp.Tests/Processing/Filters/KodachromeTest.cs b/tests/ImageSharp.Tests/Processing/Filters/KodachromeTest.cs index a0a551d09..a98252140 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/KodachromeTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/KodachromeTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Filters; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Filters diff --git a/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs b/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs index 5bd4394ab..c104f8c25 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/LomographTest.cs @@ -9,8 +9,8 @@ using Xunit; namespace SixLabors.ImageSharp.Tests { - using SixLabors.ImageSharp.Processing.Filters; - using SixLabors.ImageSharp.Processing.Filters.Processors; + using SixLabors.ImageSharp.Processing; + using SixLabors.ImageSharp.Processing.Processors.Filters; public class LomographTest : BaseImageOperationsExtensionTest { diff --git a/tests/ImageSharp.Tests/Processing/Filters/OpacityTest.cs b/tests/ImageSharp.Tests/Processing/Filters/OpacityTest.cs index 96811544c..adbb8cf29 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/OpacityTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/OpacityTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Filters; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Effects diff --git a/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs b/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs index 4f7c410f0..f28827b71 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/PolaroidTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Filters; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Filters/SaturateTest.cs b/tests/ImageSharp.Tests/Processing/Filters/SaturateTest.cs index 830580fc2..4b8e80881 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/SaturateTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/SaturateTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Filters; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Filters diff --git a/tests/ImageSharp.Tests/Processing/Filters/SepiaTest.cs b/tests/ImageSharp.Tests/Processing/Filters/SepiaTest.cs index 5e01e26f4..9351c8443 100644 --- a/tests/ImageSharp.Tests/Processing/Filters/SepiaTest.cs +++ b/tests/ImageSharp.Tests/Processing/Filters/SepiaTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Filters; -using SixLabors.ImageSharp.Processing.Filters.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Filters; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Filters diff --git a/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs b/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs index 4165ea24e..899082e36 100644 --- a/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs +++ b/tests/ImageSharp.Tests/Processing/Overlays/GlowTest.cs @@ -5,8 +5,8 @@ using System; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Overlays; -using SixLabors.ImageSharp.Processing.Overlays.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Overlays; using SixLabors.Primitives; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs b/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs index bd42cf14e..f47bffe26 100644 --- a/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs +++ b/tests/ImageSharp.Tests/Processing/Overlays/VignetteTest.cs @@ -3,8 +3,8 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Overlays; -using SixLabors.ImageSharp.Processing.Overlays.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Overlays; using SixLabors.Primitives; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs index eb5785919..44fdfc703 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryDitherTests.cs @@ -3,10 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Binarization; -using SixLabors.ImageSharp.Processing.Dithering; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; -using SixLabors.ImageSharp.Processing.Dithering.Ordered; +using SixLabors.ImageSharp.Processing.Processors.Dithering; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; diff --git a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs index b1092782c..988c9125b 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Binarization/BinaryThresholdTest.cs @@ -10,7 +10,6 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization { using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Binarization; public class BinaryThresholdTest : FileTestBase { diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs index b49fbf435..0c40debad 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; @@ -9,9 +10,6 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution { - using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Convolution; - public class BoxBlurTest : FileTestBase { public static readonly TheoryData BoxBlurValues diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs index ae172a0bf..a32239d96 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs @@ -3,7 +3,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Convolution; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs index 3b6a52bb1..6bd3b34bb 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs @@ -3,7 +3,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Convolution; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs index 3d97cf0d0..8eb1f85eb 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs @@ -3,7 +3,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Convolution; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs index ba31e35a2..9774cb50c 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs @@ -5,8 +5,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Processing.Dithering; -using SixLabors.ImageSharp.Processing.Dithering.ErrorDiffusion; -using SixLabors.ImageSharp.Processing.Dithering.Ordered; +using SixLabors.ImageSharp.Processing.Processors.Dithering; using SixLabors.Primitives; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Processors/Effects/BackgroundColorTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Effects/BackgroundColorTest.cs index 1e234e81e..792c7b080 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Effects/BackgroundColorTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Effects/BackgroundColorTest.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; @@ -9,9 +10,6 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects { - using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Overlays; - public class BackgroundColorTest : FileTestBase { [Theory] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs index 715e997bf..d4429aaf3 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Effects/OilPaintTest.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; @@ -9,9 +10,6 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects { - using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Effects; - public class OilPaintTest : FileTestBase { public static readonly TheoryData OilPaintValues = new TheoryData diff --git a/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs index 84831e415..cb9a0ba0c 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Effects/PixelateTest.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; @@ -9,9 +10,6 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects { - using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Effects; - public class PixelateTest : FileTestBase { public static readonly TheoryData PixelateValues diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/BlackWhiteTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/BlackWhiteTest.cs index f360faff4..64aeae053 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/BlackWhiteTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/BlackWhiteTest.cs @@ -7,7 +7,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; [GroupOutput("Filters")] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs index 14f5fa080..ed790cbac 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/BrightnessTest.cs @@ -7,7 +7,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; [GroupOutput("Filters")] public class BrightnessTest diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs index fd7724531..3d48e16ec 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/ColorBlindnessTest.cs @@ -8,7 +8,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; [GroupOutput("Filters")] public class ColorBlindnessTest diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs index c6afc5e11..e5e4fa4a9 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/ContrastTest.cs @@ -7,7 +7,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; [GroupOutput("Filters")] public class ContrastTest diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs index d275c1b1a..479a3c33a 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs @@ -11,7 +11,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; [GroupOutput("Filters")] public class FilterTest diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs index 192034fbb..f08ec147e 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/GrayscaleTest.cs @@ -9,7 +9,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; [GroupOutput("Filters")] public class GrayscaleTest diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs index 6e3fd5fef..4ce700bad 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/HueTest.cs @@ -7,7 +7,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; [GroupOutput("Filters")] public class HueTest diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/InvertTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/InvertTest.cs index de105437b..1b4c70646 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/InvertTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/InvertTest.cs @@ -7,7 +7,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; [GroupOutput("Filters")] public class InvertTest diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/KodachromeTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/KodachromeTest.cs index 2265e0b0b..b7b635c2d 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/KodachromeTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/KodachromeTest.cs @@ -7,7 +7,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; [GroupOutput("Filters")] public class KodachromeTest diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/LomographTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/LomographTest.cs index 92c5b788c..013ec3874 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/LomographTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/LomographTest.cs @@ -7,7 +7,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; [GroupOutput("Filters")] public class LomographTest diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs index c76bf3b1d..35e405f4c 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/OpacityTest.cs @@ -7,7 +7,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; [GroupOutput("Filters")] public class OpacityTest diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/PolaroidTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/PolaroidTest.cs index 19fcc6788..3b39542a5 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/PolaroidTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/PolaroidTest.cs @@ -7,7 +7,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; [GroupOutput("Filters")] public class PolaroidTest diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs index 18d77660e..31fab8b65 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/SaturateTest.cs @@ -7,7 +7,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; [GroupOutput("Filters")] public class SaturateTest diff --git a/tests/ImageSharp.Tests/Processing/Processors/Filters/SepiaTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Filters/SepiaTest.cs index 50bf0e3a1..b7d381f5f 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Filters/SepiaTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Filters/SepiaTest.cs @@ -7,7 +7,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters { - using SixLabors.ImageSharp.Processing.Filters; + using SixLabors.ImageSharp.Processing; [GroupOutput("Filters")] public class SepiaTest diff --git a/tests/ImageSharp.Tests/Processing/Processors/Overlays/GlowTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Overlays/GlowTest.cs index 5c610fb31..479ee346a 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Overlays/GlowTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Overlays/GlowTest.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; @@ -9,9 +10,6 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Overlays { - using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Overlays; - public class GlowTest : FileTestBase { [Theory] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Overlays/VignetteTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Overlays/VignetteTest.cs index 1c69b531c..3a378a095 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Overlays/VignetteTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Overlays/VignetteTest.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; @@ -9,9 +10,6 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Overlays { - using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Overlays; - public class VignetteTest : FileTestBase { [Theory] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs index bae22e7a9..d31f999d0 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/AutoOrientTests.cs @@ -9,7 +9,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms { - using SixLabors.ImageSharp.Processing.Transforms; + using SixLabors.ImageSharp.Processing; public class AutoOrientTests : FileTestBase { diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs index 0936bf477..c154c8ff3 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/CropTest.cs @@ -3,8 +3,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Transforms; - using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs index 86b37365d..728527021 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/EntropyCropTest.cs @@ -3,8 +3,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Transforms; - using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs index 0ac8a9459..d7e7a724c 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/FlipTests.cs @@ -9,7 +9,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms { - using SixLabors.ImageSharp.Processing.Transforms; + using SixLabors.ImageSharp.Processing; public class FlipTests { diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.cs index 3294ecc73..6cce62d14 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/PadTest.cs @@ -2,13 +2,11 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms { - using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Transforms; - public class PadTest : FileTestBase { [Theory] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeProfilingBenchmarks.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeProfilingBenchmarks.cs index ab19c21eb..d5f015404 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeProfilingBenchmarks.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeProfilingBenchmarks.cs @@ -7,9 +7,7 @@ using System.Text; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Processors; -using SixLabors.ImageSharp.Processing.Transforms; -using SixLabors.ImageSharp.Processing.Transforms.Processors; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.Primitives; using Xunit.Abstractions; diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs index 6a6dc45f7..c7efbb1e0 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs @@ -5,8 +5,7 @@ using System; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Transforms; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs index b2865d9da..d6376b179 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateFlipTests.cs @@ -7,7 +7,7 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms { - using SixLabors.ImageSharp.Processing.Transforms; + using SixLabors.ImageSharp.Processing; public class RotateFlipTests : FileTestBase { diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs index 2163f5fc9..c0db205f9 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/RotateTests.cs @@ -3,8 +3,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Transforms; - using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms @@ -25,7 +23,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms RotateMode.Rotate180, RotateMode.Rotate270 }; - + [Theory] [WithTestPatternImages(nameof(RotateAngles), 100, 50, DefaultPixelType)] [WithTestPatternImages(nameof(RotateAngles), 50, 100, DefaultPixelType)] @@ -38,7 +36,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms image.DebugSave(provider, value); } } - + [Theory] [WithTestPatternImages(nameof(RotateEnumValues), 100, 50, DefaultPixelType)] [WithTestPatternImages(nameof(RotateEnumValues), 50, 100, DefaultPixelType)] diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTest.cs index 30c9e682d..ae2b12e87 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTest.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/SkewTest.cs @@ -1,19 +1,17 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. +using System; +using System.Collections.Generic; +using System.Reflection; + +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.ImageSharp.PixelFormats; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms { - using System; - using System.Collections.Generic; - using System.Reflection; - - using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Transforms; - using SixLabors.ImageSharp.Processing.Transforms.Resamplers; - public class SkewTest : FileTestBase { public static readonly TheoryData SkewValues diff --git a/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformTests.cs index fae876aff..8ec8409ad 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/AffineTransformTests.cs @@ -4,8 +4,7 @@ using System.Reflection; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Transforms; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; @@ -14,7 +13,6 @@ using Xunit.Abstractions; namespace SixLabors.ImageSharp.Tests.Processing.Transforms { - public class AffineTransformTests { private readonly ITestOutputHelper Output; diff --git a/tests/ImageSharp.Tests/Processing/Transforms/AutoOrientTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/AutoOrientTests.cs index d01e84220..bba4661db 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/AutoOrientTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/AutoOrientTests.cs @@ -7,8 +7,8 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Transforms { - using SixLabors.ImageSharp.Processing.Transforms; - using SixLabors.ImageSharp.Processing.Transforms.Processors; + using SixLabors.ImageSharp.Processing; + using SixLabors.ImageSharp.Processing.Processors.Transforms; public class AutoOrientTests : BaseImageOperationsExtensionTest { diff --git a/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs b/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs index 78b6852e4..154167f15 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/CropTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms; -using SixLabors.ImageSharp.Processing.Transforms.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.Primitives; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Transforms/EntropyCropTest.cs b/tests/ImageSharp.Tests/Processing/Transforms/EntropyCropTest.cs index 9c2176b25..03a8628a5 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/EntropyCropTest.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/EntropyCropTest.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms; -using SixLabors.ImageSharp.Processing.Transforms.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Transforms diff --git a/tests/ImageSharp.Tests/Processing/Transforms/FlipTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/FlipTests.cs index 41aeb1ad5..39adcaa3f 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/FlipTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/FlipTests.cs @@ -9,8 +9,8 @@ using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Transforms { - using SixLabors.ImageSharp.Processing.Transforms; - using SixLabors.ImageSharp.Processing.Transforms.Processors; + using SixLabors.ImageSharp.Processing; + using SixLabors.ImageSharp.Processing.Processors.Transforms; public class FlipTests : BaseImageOperationsExtensionTest { diff --git a/tests/ImageSharp.Tests/Processing/Transforms/PadTest.cs b/tests/ImageSharp.Tests/Processing/Transforms/PadTest.cs index dd4c31458..82d768255 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/PadTest.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/PadTest.cs @@ -2,13 +2,13 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Transforms { - using SixLabors.ImageSharp.Processing.Transforms; - using SixLabors.ImageSharp.Processing.Transforms.Processors; + using SixLabors.ImageSharp.Processing; + using SixLabors.ImageSharp.Processing.Processors.Transforms; public class PadTest : BaseImageOperationsExtensionTest { diff --git a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs index ece3f1742..f0a924d27 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs @@ -6,16 +6,14 @@ using System.Numerics; using System.Reflection; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Transforms; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using Xunit; +using Xunit.Abstractions; // ReSharper disable InconsistentNaming namespace SixLabors.ImageSharp.Tests.Processing.Transforms { - using Xunit.Abstractions; - public class ProjectiveTransformTests { private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.03f, 3); diff --git a/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs index ee72f361b..948c79d8d 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs @@ -2,9 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms; -using SixLabors.ImageSharp.Processing.Transforms.Processors; -using SixLabors.ImageSharp.Processing.Transforms.Resamplers; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using SixLabors.Primitives; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Transforms/RotateFlipTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/RotateFlipTests.cs index 9a396e871..dccf7afa6 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/RotateFlipTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/RotateFlipTests.cs @@ -2,8 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms; -using SixLabors.ImageSharp.Processing.Transforms.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Transforms diff --git a/tests/ImageSharp.Tests/Processing/Transforms/RotateTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/RotateTests.cs index 2bf7cded8..ae312d723 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/RotateTests.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/RotateTests.cs @@ -3,9 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Processors; -using SixLabors.ImageSharp.Processing.Transforms; -using SixLabors.ImageSharp.Processing.Transforms.Processors; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Transforms/SkewTest.cs b/tests/ImageSharp.Tests/Processing/Transforms/SkewTest.cs index 9df8e267c..73754b971 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/SkewTest.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/SkewTest.cs @@ -3,8 +3,8 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing.Processors; -using SixLabors.ImageSharp.Processing.Transforms; -using SixLabors.ImageSharp.Processing.Transforms.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Transforms; using Xunit; diff --git a/tests/ImageSharp.Tests/Processing/Transforms/TransformsHelpersTest.cs b/tests/ImageSharp.Tests/Processing/Transforms/TransformsHelpersTest.cs index 5de92a40b..146ed6230 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/TransformsHelpersTest.cs +++ b/tests/ImageSharp.Tests/Processing/Transforms/TransformsHelpersTest.cs @@ -3,8 +3,7 @@ using SixLabors.ImageSharp.MetaData.Profiles.Exif; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Transforms; - +using SixLabors.ImageSharp.Processing.Processors.Transforms; using Xunit; namespace SixLabors.ImageSharp.Tests.Processing.Transforms diff --git a/tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs b/tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs index 91b331639..c2b1c26c5 100644 --- a/tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs +++ b/tests/ImageSharp.Tests/Quantization/QuantizedImageTests.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Quantization; +using SixLabors.ImageSharp.Processing.Processors.Quantization; using Xunit; diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs index b9fa70f22..c935a4b98 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/ImageComparerTests.cs @@ -5,7 +5,6 @@ using Moq; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Transforms; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; diff --git a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs index cab61bc59..6e8278276 100644 --- a/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs +++ b/tests/ImageSharp.Tests/TestUtilities/Tests/TestUtilityExtensionsTests.cs @@ -7,15 +7,14 @@ using System.Linq; using System.Numerics; using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; +using SixLabors.Memory; using Xunit; using Xunit.Abstractions; namespace SixLabors.ImageSharp.Tests { - using SixLabors.ImageSharp.Processing.Effects; - using SixLabors.Memory; - public class TestUtilityExtensionsTests { public TestUtilityExtensionsTests(ITestOutputHelper output) @@ -55,7 +54,7 @@ namespace SixLabors.ImageSharp.Tests where TPixel : struct, IPixel { Image a = provider.GetImage(); - Image b = provider.GetImage(x=>x.OilPaint(3, 2)); + Image b = provider.GetImage(x => x.OilPaint(3, 2)); Assert.False(a.IsEquivalentTo(b, compareAlpha)); } From d6944d5a6a2dc0e1725c514fa797d6da8a6d6ff8 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Tue, 3 Jul 2018 15:51:40 +1000 Subject: [PATCH 34/36] Simplify drawing namespaces. --- src/ImageSharp.Drawing/Primitives/ShapePath.cs | 2 +- .../{Drawing/Brushes => }/BrushApplicator.cs | 2 +- .../Processing/{Drawing/Brushes => }/Brushes.cs | 2 +- .../GradientBrushes => }/ColorStop{TPixel}.cs | 7 +++++-- .../{Drawing => }/DrawBezierExtensions.cs | 4 +--- .../Processing/{Drawing => }/DrawImageExtensions.cs | 4 ++-- .../Processing/{Drawing => }/DrawLineExtensions.cs | 4 +--- .../{Drawing => }/DrawPathCollectionExtensions.cs | 4 +--- .../Processing/{Drawing => }/DrawPathExtensions.cs | 4 +--- .../{Drawing => }/DrawPolygonExtensions.cs | 4 +--- .../{Drawing => }/DrawRectangleExtensions.cs | 4 +--- .../Processing/{Text => }/DrawTextExtensions.cs | 6 ++---- .../EllipticGradientBrush{TPixel}.cs | 7 +++++-- .../{Drawing => }/FillPathBuilderExtensions.cs | 3 +-- .../{Drawing => }/FillPathCollectionExtensions.cs | 3 +-- .../Processing/{Drawing => }/FillPathExtensions.cs | 3 +-- .../{Drawing => }/FillPolygonExtensions.cs | 3 +-- .../{Drawing => }/FillRectangleExtensions.cs | 3 +-- .../{Drawing => }/FillRegionExtensions.cs | 5 ++--- .../GradientBrushBase{TPixel}.cs | 7 +++++-- .../GradientBrushes => }/GradientRepetitionMode.cs | 5 ++++- .../Processing/{Drawing/Brushes => }/IBrush.cs | 2 +- .../Processing/{Drawing/Pens => }/IPen.cs | 3 +-- .../{Drawing/Brushes => }/ImageBrush{TPixel}.cs | 2 +- .../LinearGradientBrush{TPixel}.cs | 7 +++++-- .../{Drawing/Brushes => }/PatternBrush{TPixel}.cs | 2 +- .../Processing/{Drawing/Pens => }/Pens.cs | 3 +-- .../Processing/{Drawing/Pens => }/Pen{TPixel}.cs | 11 +++++------ .../Drawing}/DrawImageProcessor.cs | 3 +-- .../Drawing}/FillProcessor.cs | 5 ++--- .../Drawing}/FillRegionProcessor.cs | 4 +--- .../Text}/DrawTextProcessor.cs | 5 +---- .../RadialGradientBrush{TPixel}.cs | 7 +++++-- .../{Drawing/Brushes => }/RecolorBrush{TPixel}.cs | 2 +- .../{Drawing/Brushes => }/SolidBrush{TPixel}.cs | 2 +- .../Processing/{Text => }/TextGraphicsOptions.cs | 2 +- tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs | 1 - tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs | 2 -- tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs | 1 - tests/ImageSharp.Benchmarks/Drawing/DrawText.cs | 13 ++++++------- .../Drawing/DrawTextOutline.cs | 11 +++++------ tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs | 3 +-- .../ImageSharp.Benchmarks/Drawing/FillRectangle.cs | 3 +-- .../Drawing/FillWithPattern.cs | 8 ++------ tests/ImageSharp.Tests/Drawing/BeziersTests.cs | 1 - tests/ImageSharp.Tests/Drawing/DrawImageTest.cs | 2 +- tests/ImageSharp.Tests/Drawing/DrawPathTests.cs | 2 -- .../Drawing/FillEllipticGradientBrushTest.cs | 2 -- .../Drawing/FillLinearGradientBrushTests.cs | 2 -- tests/ImageSharp.Tests/Drawing/FillPatternTests.cs | 5 +---- .../Drawing/FillRadialGradientBrushTests.cs | 3 --- .../Drawing/FillRegionProcessorTests.cs | 8 ++------ .../ImageSharp.Tests/Drawing/FillSolidBrushTests.cs | 2 -- .../Drawing/LineComplexPolygonTests.cs | 2 -- tests/ImageSharp.Tests/Drawing/LineTests.cs | 2 -- .../Drawing/Paths/DrawPathCollection.cs | 6 ++---- tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs | 5 ++--- .../Drawing/Paths/FillPathCollection.cs | 5 ++--- tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs | 5 ++--- .../ImageSharp.Tests/Drawing/Paths/FillRectangle.cs | 5 ++--- tests/ImageSharp.Tests/Drawing/PolygonTests.cs | 1 - tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs | 2 -- tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs | 1 - .../Drawing/SolidComplexPolygonTests.cs | 1 - .../Drawing/SolidFillBlendedShapesTests.cs | 1 - tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs | 2 -- tests/ImageSharp.Tests/Drawing/Text/DrawText.cs | 7 ++----- .../Drawing/Text/DrawTextOnImageTests.cs | 2 -- .../Drawing/Text/TextGraphicsOptionsTests.cs | 2 +- tests/ImageSharp.Tests/Issues/Issue412.cs | 4 +--- .../PixelBlenders/PorterDuffCompositorTests.cs | 1 - .../TestUtilities/ImageProviders/SolidProvider.cs | 2 -- 72 files changed, 100 insertions(+), 171 deletions(-) rename src/ImageSharp.Drawing/Processing/{Drawing/Brushes => }/BrushApplicator.cs (98%) rename src/ImageSharp.Drawing/Processing/{Drawing/Brushes => }/Brushes.cs (99%) rename src/ImageSharp.Drawing/Processing/{Drawing/Brushes/GradientBrushes => }/ColorStop{TPixel}.cs (86%) rename src/ImageSharp.Drawing/Processing/{Drawing => }/DrawBezierExtensions.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing => }/DrawImageExtensions.cs (98%) rename src/ImageSharp.Drawing/Processing/{Drawing => }/DrawLineExtensions.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing => }/DrawPathCollectionExtensions.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing => }/DrawPathExtensions.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing => }/DrawPolygonExtensions.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing => }/DrawRectangleExtensions.cs (97%) rename src/ImageSharp.Drawing/Processing/{Text => }/DrawTextExtensions.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing/Brushes/GradientBrushes => }/EllipticGradientBrush{TPixel}.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing => }/FillPathBuilderExtensions.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing => }/FillPathCollectionExtensions.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing => }/FillPathExtensions.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing => }/FillPolygonExtensions.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing => }/FillRectangleExtensions.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing => }/FillRegionExtensions.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing/Brushes/GradientBrushes => }/GradientBrushBase{TPixel}.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing/Brushes/GradientBrushes => }/GradientRepetitionMode.cs (89%) rename src/ImageSharp.Drawing/Processing/{Drawing/Brushes => }/IBrush.cs (96%) rename src/ImageSharp.Drawing/Processing/{Drawing/Pens => }/IPen.cs (89%) rename src/ImageSharp.Drawing/Processing/{Drawing/Brushes => }/ImageBrush{TPixel}.cs (98%) rename src/ImageSharp.Drawing/Processing/{Drawing/Brushes/GradientBrushes => }/LinearGradientBrush{TPixel}.cs (97%) rename src/ImageSharp.Drawing/Processing/{Drawing/Brushes => }/PatternBrush{TPixel}.cs (99%) rename src/ImageSharp.Drawing/Processing/{Drawing/Pens => }/Pens.cs (98%) rename src/ImageSharp.Drawing/Processing/{Drawing/Pens => }/Pen{TPixel}.cs (84%) rename src/ImageSharp.Drawing/Processing/{Drawing/Processors => Processors/Drawing}/DrawImageProcessor.cs (98%) rename src/ImageSharp.Drawing/Processing/{Drawing/Processors => Processors/Drawing}/FillProcessor.cs (96%) rename src/ImageSharp.Drawing/Processing/{Drawing/Processors => Processors/Drawing}/FillRegionProcessor.cs (97%) rename src/ImageSharp.Drawing/Processing/{Text/Processors => Processors/Text}/DrawTextProcessor.cs (98%) rename src/ImageSharp.Drawing/Processing/{Drawing/Brushes/GradientBrushes => }/RadialGradientBrush{TPixel}.cs (96%) rename src/ImageSharp.Drawing/Processing/{Drawing/Brushes => }/RecolorBrush{TPixel}.cs (99%) rename src/ImageSharp.Drawing/Processing/{Drawing/Brushes => }/SolidBrush{TPixel}.cs (98%) rename src/ImageSharp.Drawing/Processing/{Text => }/TextGraphicsOptions.cs (99%) diff --git a/src/ImageSharp.Drawing/Primitives/ShapePath.cs b/src/ImageSharp.Drawing/Primitives/ShapePath.cs index 7a8c9e895..a4fef66a6 100644 --- a/src/ImageSharp.Drawing/Primitives/ShapePath.cs +++ b/src/ImageSharp.Drawing/Primitives/ShapePath.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using SixLabors.ImageSharp.Processing.Drawing.Pens; +using SixLabors.ImageSharp.Processing; using SixLabors.Shapes; namespace SixLabors.ImageSharp.Primitives diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/BrushApplicator.cs b/src/ImageSharp.Drawing/Processing/BrushApplicator.cs similarity index 98% rename from src/ImageSharp.Drawing/Processing/Drawing/Brushes/BrushApplicator.cs rename to src/ImageSharp.Drawing/Processing/BrushApplicator.cs index 7672681da..04e2d0b9d 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/BrushApplicator.cs +++ b/src/ImageSharp.Drawing/Processing/BrushApplicator.cs @@ -6,7 +6,7 @@ using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; using SixLabors.Memory; -namespace SixLabors.ImageSharp.Processing.Drawing.Brushes +namespace SixLabors.ImageSharp.Processing { /// /// primitive that converts a point in to a color for discovering the fill color based on an implementation diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/Brushes.cs b/src/ImageSharp.Drawing/Processing/Brushes.cs similarity index 99% rename from src/ImageSharp.Drawing/Processing/Drawing/Brushes/Brushes.cs rename to src/ImageSharp.Drawing/Processing/Brushes.cs index 141ca403b..c5e7a3e9f 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/Brushes.cs +++ b/src/ImageSharp.Drawing/Processing/Brushes.cs @@ -3,7 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Drawing.Brushes +namespace SixLabors.ImageSharp.Processing { /// /// A collection of methods for creating generic brushes. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/ColorStop{TPixel}.cs b/src/ImageSharp.Drawing/Processing/ColorStop{TPixel}.cs similarity index 86% rename from src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/ColorStop{TPixel}.cs rename to src/ImageSharp.Drawing/Processing/ColorStop{TPixel}.cs index 298af5cb5..7fd0ba7cd 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/ColorStop{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/ColorStop{TPixel}.cs @@ -1,8 +1,11 @@ -using System.Diagnostics; +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using System.Diagnostics; using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Drawing.Brushes.GradientBrushes +namespace SixLabors.ImageSharp.Processing { /// /// A struct that defines a single color stop. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawBezierExtensions.cs b/src/ImageSharp.Drawing/Processing/DrawBezierExtensions.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/DrawBezierExtensions.cs rename to src/ImageSharp.Drawing/Processing/DrawBezierExtensions.cs index 72bd76fa6..782f5d4d7 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawBezierExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/DrawBezierExtensions.cs @@ -2,12 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Pens; using SixLabors.Primitives; using SixLabors.Shapes; -namespace SixLabors.ImageSharp.Processing.Drawing +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the drawing of Bezier paths to the type. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs b/src/ImageSharp.Drawing/Processing/DrawImageExtensions.cs similarity index 98% rename from src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs rename to src/ImageSharp.Drawing/Processing/DrawImageExtensions.cs index 83e1b90f5..7c9d7c280 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawImageExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/DrawImageExtensions.cs @@ -2,10 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Processors; +using SixLabors.ImageSharp.Processing.Processors.Drawing; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Drawing +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the drawing of images to the type. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawLineExtensions.cs b/src/ImageSharp.Drawing/Processing/DrawLineExtensions.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/DrawLineExtensions.cs rename to src/ImageSharp.Drawing/Processing/DrawLineExtensions.cs index 981a07e13..9084b30ef 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawLineExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/DrawLineExtensions.cs @@ -2,12 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Pens; using SixLabors.Primitives; using SixLabors.Shapes; -namespace SixLabors.ImageSharp.Processing.Drawing +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the drawing of lines to the type. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawPathCollectionExtensions.cs b/src/ImageSharp.Drawing/Processing/DrawPathCollectionExtensions.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/DrawPathCollectionExtensions.cs rename to src/ImageSharp.Drawing/Processing/DrawPathCollectionExtensions.cs index eca3805bd..0d3abf297 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawPathCollectionExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/DrawPathCollectionExtensions.cs @@ -2,11 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Pens; using SixLabors.Shapes; -namespace SixLabors.ImageSharp.Processing.Drawing +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the drawing of collections of polygon outlines to the type. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawPathExtensions.cs b/src/ImageSharp.Drawing/Processing/DrawPathExtensions.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/DrawPathExtensions.cs rename to src/ImageSharp.Drawing/Processing/DrawPathExtensions.cs index a15412a45..4dbe942f2 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawPathExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/DrawPathExtensions.cs @@ -3,11 +3,9 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Pens; using SixLabors.Shapes; -namespace SixLabors.ImageSharp.Processing.Drawing +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the drawing of polygon outlines to the type. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawPolygonExtensions.cs b/src/ImageSharp.Drawing/Processing/DrawPolygonExtensions.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/DrawPolygonExtensions.cs rename to src/ImageSharp.Drawing/Processing/DrawPolygonExtensions.cs index 9f8d74f00..4dcfe00aa 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawPolygonExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/DrawPolygonExtensions.cs @@ -2,12 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Pens; using SixLabors.Primitives; using SixLabors.Shapes; -namespace SixLabors.ImageSharp.Processing.Drawing +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the drawing of closed linear polygons to the type. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/DrawRectangleExtensions.cs b/src/ImageSharp.Drawing/Processing/DrawRectangleExtensions.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/DrawRectangleExtensions.cs rename to src/ImageSharp.Drawing/Processing/DrawRectangleExtensions.cs index 1f4a38a27..918fb1e73 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/DrawRectangleExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/DrawRectangleExtensions.cs @@ -2,12 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Pens; using SixLabors.Primitives; using SixLabors.Shapes; -namespace SixLabors.ImageSharp.Processing.Drawing +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the drawing of rectangles to the type. diff --git a/src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.cs b/src/ImageSharp.Drawing/Processing/DrawTextExtensions.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.cs rename to src/ImageSharp.Drawing/Processing/DrawTextExtensions.cs index a20d7f730..114de7610 100644 --- a/src/ImageSharp.Drawing/Processing/Text/DrawTextExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/DrawTextExtensions.cs @@ -3,12 +3,10 @@ using SixLabors.Fonts; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Pens; -using SixLabors.ImageSharp.Processing.Text.Processors; +using SixLabors.ImageSharp.Processing.Processors.Text; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Text +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the drawing of text to the type. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/EllipticGradientBrush{TPixel}.cs b/src/ImageSharp.Drawing/Processing/EllipticGradientBrush{TPixel}.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/EllipticGradientBrush{TPixel}.cs rename to src/ImageSharp.Drawing/Processing/EllipticGradientBrush{TPixel}.cs index 43f7fe04e..8af01564c 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/EllipticGradientBrush{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/EllipticGradientBrush{TPixel}.cs @@ -1,9 +1,12 @@ -using System; +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using System; using SixLabors.ImageSharp.PixelFormats; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Drawing.Brushes.GradientBrushes +namespace SixLabors.ImageSharp.Processing { /// /// Gradient Brush with elliptic shape. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/FillPathBuilderExtensions.cs b/src/ImageSharp.Drawing/Processing/FillPathBuilderExtensions.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/FillPathBuilderExtensions.cs rename to src/ImageSharp.Drawing/Processing/FillPathBuilderExtensions.cs index 921209d2e..ff4de3ff8 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/FillPathBuilderExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/FillPathBuilderExtensions.cs @@ -3,10 +3,9 @@ using System; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; using SixLabors.Shapes; -namespace SixLabors.ImageSharp.Processing.Drawing +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the filling of polygons with various brushes to the type. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/FillPathCollectionExtensions.cs b/src/ImageSharp.Drawing/Processing/FillPathCollectionExtensions.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/FillPathCollectionExtensions.cs rename to src/ImageSharp.Drawing/Processing/FillPathCollectionExtensions.cs index 71474dceb..da2dd35b6 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/FillPathCollectionExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/FillPathCollectionExtensions.cs @@ -2,10 +2,9 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; using SixLabors.Shapes; -namespace SixLabors.ImageSharp.Processing.Drawing +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the filling of collections of polygon outlines to the type. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/FillPathExtensions.cs b/src/ImageSharp.Drawing/Processing/FillPathExtensions.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/FillPathExtensions.cs rename to src/ImageSharp.Drawing/Processing/FillPathExtensions.cs index 4273fd8be..da1062111 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/FillPathExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/FillPathExtensions.cs @@ -3,10 +3,9 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; using SixLabors.Shapes; -namespace SixLabors.ImageSharp.Processing.Drawing +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the filling of polygon outlines to the type. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/FillPolygonExtensions.cs b/src/ImageSharp.Drawing/Processing/FillPolygonExtensions.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/FillPolygonExtensions.cs rename to src/ImageSharp.Drawing/Processing/FillPolygonExtensions.cs index 3b80dd0f4..970ca2264 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/FillPolygonExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/FillPolygonExtensions.cs @@ -2,11 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; using SixLabors.Primitives; using SixLabors.Shapes; -namespace SixLabors.ImageSharp.Processing.Drawing +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the filling of closed linear polygons to the type. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/FillRectangleExtensions.cs b/src/ImageSharp.Drawing/Processing/FillRectangleExtensions.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/FillRectangleExtensions.cs rename to src/ImageSharp.Drawing/Processing/FillRectangleExtensions.cs index ae0afc5d5..26bf214f7 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/FillRectangleExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/FillRectangleExtensions.cs @@ -2,11 +2,10 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; using SixLabors.Primitives; using SixLabors.Shapes; -namespace SixLabors.ImageSharp.Processing.Drawing +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the filling of rectangles to the type. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/FillRegionExtensions.cs b/src/ImageSharp.Drawing/Processing/FillRegionExtensions.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/FillRegionExtensions.cs rename to src/ImageSharp.Drawing/Processing/FillRegionExtensions.cs index 997dba22e..e566d0323 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/FillRegionExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/FillRegionExtensions.cs @@ -3,10 +3,9 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Processors; +using SixLabors.ImageSharp.Processing.Processors.Drawing; -namespace SixLabors.ImageSharp.Processing.Drawing +namespace SixLabors.ImageSharp.Processing { /// /// Adds extensions that allow the filling of regions with various brushes to the type. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/GradientBrushBase{TPixel}.cs b/src/ImageSharp.Drawing/Processing/GradientBrushBase{TPixel}.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/GradientBrushBase{TPixel}.cs rename to src/ImageSharp.Drawing/Processing/GradientBrushBase{TPixel}.cs index d0a1ef1c2..a844457ac 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/GradientBrushBase{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/GradientBrushBase{TPixel}.cs @@ -1,11 +1,14 @@ -using System; +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using System; using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats.PixelBlenders; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Drawing.Brushes.GradientBrushes +namespace SixLabors.ImageSharp.Processing { /// /// Base class for Gradient brushes diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/GradientRepetitionMode.cs b/src/ImageSharp.Drawing/Processing/GradientRepetitionMode.cs similarity index 89% rename from src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/GradientRepetitionMode.cs rename to src/ImageSharp.Drawing/Processing/GradientRepetitionMode.cs index adbc26ed4..c156153be 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/GradientRepetitionMode.cs +++ b/src/ImageSharp.Drawing/Processing/GradientRepetitionMode.cs @@ -1,4 +1,7 @@ -namespace SixLabors.ImageSharp.Processing.Drawing.Brushes.GradientBrushes +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +namespace SixLabors.ImageSharp.Processing { /// /// Modes to repeat a gradient. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/IBrush.cs b/src/ImageSharp.Drawing/Processing/IBrush.cs similarity index 96% rename from src/ImageSharp.Drawing/Processing/Drawing/Brushes/IBrush.cs rename to src/ImageSharp.Drawing/Processing/IBrush.cs index 93ecb7788..a3c94a1b5 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/IBrush.cs +++ b/src/ImageSharp.Drawing/Processing/IBrush.cs @@ -4,7 +4,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Drawing.Brushes +namespace SixLabors.ImageSharp.Processing { /// /// Brush represents a logical configuration of a brush which can be used to source pixel colors diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Pens/IPen.cs b/src/ImageSharp.Drawing/Processing/IPen.cs similarity index 89% rename from src/ImageSharp.Drawing/Processing/Drawing/Pens/IPen.cs rename to src/ImageSharp.Drawing/Processing/IPen.cs index 387165e20..6f63dcfd0 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Pens/IPen.cs +++ b/src/ImageSharp.Drawing/Processing/IPen.cs @@ -3,9 +3,8 @@ using System; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -namespace SixLabors.ImageSharp.Processing.Drawing.Pens +namespace SixLabors.ImageSharp.Processing { /// /// Interface representing a Pen diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/ImageBrush{TPixel}.cs b/src/ImageSharp.Drawing/Processing/ImageBrush{TPixel}.cs similarity index 98% rename from src/ImageSharp.Drawing/Processing/Drawing/Brushes/ImageBrush{TPixel}.cs rename to src/ImageSharp.Drawing/Processing/ImageBrush{TPixel}.cs index 779848856..7e24dbbe2 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/ImageBrush{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/ImageBrush{TPixel}.cs @@ -7,7 +7,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Drawing.Brushes +namespace SixLabors.ImageSharp.Processing { /// /// Provides an implementation of an image brush for painting images within areas. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/LinearGradientBrush{TPixel}.cs b/src/ImageSharp.Drawing/Processing/LinearGradientBrush{TPixel}.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/LinearGradientBrush{TPixel}.cs rename to src/ImageSharp.Drawing/Processing/LinearGradientBrush{TPixel}.cs index 09f816dd9..765bf5499 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/LinearGradientBrush{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/LinearGradientBrush{TPixel}.cs @@ -1,9 +1,12 @@ -using System; +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using System; using SixLabors.ImageSharp.PixelFormats; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Drawing.Brushes.GradientBrushes +namespace SixLabors.ImageSharp.Processing { /// /// Provides an implementation of a brush for painting linear gradients within areas. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/PatternBrush{TPixel}.cs b/src/ImageSharp.Drawing/Processing/PatternBrush{TPixel}.cs similarity index 99% rename from src/ImageSharp.Drawing/Processing/Drawing/Brushes/PatternBrush{TPixel}.cs rename to src/ImageSharp.Drawing/Processing/PatternBrush{TPixel}.cs index 21f2066fb..30d78bc83 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/PatternBrush{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/PatternBrush{TPixel}.cs @@ -9,7 +9,7 @@ using SixLabors.ImageSharp.Primitives; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Drawing.Brushes +namespace SixLabors.ImageSharp.Processing { /// /// Provides an implementation of a pattern brush for painting patterns. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Pens/Pens.cs b/src/ImageSharp.Drawing/Processing/Pens.cs similarity index 98% rename from src/ImageSharp.Drawing/Processing/Drawing/Pens/Pens.cs rename to src/ImageSharp.Drawing/Processing/Pens.cs index b1883e322..90253a3cb 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Pens/Pens.cs +++ b/src/ImageSharp.Drawing/Processing/Pens.cs @@ -2,9 +2,8 @@ // Licensed under the Apache License, Version 2.0. using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -namespace SixLabors.ImageSharp.Processing.Drawing.Pens +namespace SixLabors.ImageSharp.Processing { /// /// Contains a collection of common Pen styles diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Pens/Pen{TPixel}.cs b/src/ImageSharp.Drawing/Processing/Pen{TPixel}.cs similarity index 84% rename from src/ImageSharp.Drawing/Processing/Drawing/Pens/Pen{TPixel}.cs rename to src/ImageSharp.Drawing/Processing/Pen{TPixel}.cs index 1dd6b6616..26c21a0e5 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Pens/Pen{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/Pen{TPixel}.cs @@ -3,9 +3,8 @@ using System; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -namespace SixLabors.ImageSharp.Processing.Drawing.Pens +namespace SixLabors.ImageSharp.Processing { /// /// Provides a pen that can apply a pattern to a line with a set brush and thickness @@ -25,7 +24,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing.Pens private readonly float[] pattern; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The color. /// The width. @@ -36,7 +35,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing.Pens } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The brush. /// The width. @@ -49,7 +48,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing.Pens } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The color. /// The width. @@ -59,7 +58,7 @@ namespace SixLabors.ImageSharp.Processing.Drawing.Pens } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The brush. /// The width. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Processors/DrawImageProcessor.cs b/src/ImageSharp.Drawing/Processing/Processors/Drawing/DrawImageProcessor.cs similarity index 98% rename from src/ImageSharp.Drawing/Processing/Drawing/Processors/DrawImageProcessor.cs rename to src/ImageSharp.Drawing/Processing/Processors/Drawing/DrawImageProcessor.cs index 506df3886..e4b2eadb4 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Processors/DrawImageProcessor.cs +++ b/src/ImageSharp.Drawing/Processing/Processors/Drawing/DrawImageProcessor.cs @@ -5,11 +5,10 @@ using System; using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Processors; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Drawing.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Drawing { /// /// Combines two images together by blending the pixels. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Processors/FillProcessor.cs b/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillProcessor.cs similarity index 96% rename from src/ImageSharp.Drawing/Processing/Drawing/Processors/FillProcessor.cs rename to src/ImageSharp.Drawing/Processing/Processors/Drawing/FillProcessor.cs index 4214041a7..595c94687 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Processors/FillProcessor.cs +++ b/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillProcessor.cs @@ -5,12 +5,11 @@ using System; using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Processors; +using SixLabors.ImageSharp.Processing; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Drawing.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Drawing { /// /// Using the brush as a source of pixels colors blends the brush color with source. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Processors/FillRegionProcessor.cs b/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor.cs similarity index 97% rename from src/ImageSharp.Drawing/Processing/Drawing/Processors/FillRegionProcessor.cs rename to src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor.cs index 1e968b97e..1cc954dd9 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Processors/FillRegionProcessor.cs +++ b/src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor.cs @@ -4,13 +4,11 @@ using System; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Processors; using SixLabors.ImageSharp.Utils; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Drawing.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Drawing { /// /// Using a brush and a shape fills shape with contents of brush the diff --git a/src/ImageSharp.Drawing/Processing/Text/Processors/DrawTextProcessor.cs b/src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor.cs similarity index 98% rename from src/ImageSharp.Drawing/Processing/Text/Processors/DrawTextProcessor.cs rename to src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor.cs index 9327f9449..9f1158154 100644 --- a/src/ImageSharp.Drawing/Processing/Text/Processors/DrawTextProcessor.cs +++ b/src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor.cs @@ -6,15 +6,12 @@ using System.Collections.Generic; using SixLabors.Fonts; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Pens; -using SixLabors.ImageSharp.Processing.Processors; using SixLabors.ImageSharp.Utils; using SixLabors.Memory; using SixLabors.Primitives; using SixLabors.Shapes; -namespace SixLabors.ImageSharp.Processing.Text.Processors +namespace SixLabors.ImageSharp.Processing.Processors.Text { /// /// Using the brush as a source of pixels colors blends the brush color with source. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/RadialGradientBrush{TPixel}.cs b/src/ImageSharp.Drawing/Processing/RadialGradientBrush{TPixel}.cs similarity index 96% rename from src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/RadialGradientBrush{TPixel}.cs rename to src/ImageSharp.Drawing/Processing/RadialGradientBrush{TPixel}.cs index 5c0d8051c..16380fc34 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/GradientBrushes/RadialGradientBrush{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/RadialGradientBrush{TPixel}.cs @@ -1,9 +1,12 @@ -using System; +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using System; using SixLabors.ImageSharp.PixelFormats; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Drawing.Brushes.GradientBrushes +namespace SixLabors.ImageSharp.Processing { /// /// A Circular Gradient Brush, defined by center point and radius. diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/RecolorBrush{TPixel}.cs b/src/ImageSharp.Drawing/Processing/RecolorBrush{TPixel}.cs similarity index 99% rename from src/ImageSharp.Drawing/Processing/Drawing/Brushes/RecolorBrush{TPixel}.cs rename to src/ImageSharp.Drawing/Processing/RecolorBrush{TPixel}.cs index a7da2cc5b..480c42ee0 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/RecolorBrush{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/RecolorBrush{TPixel}.cs @@ -8,7 +8,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Drawing.Brushes +namespace SixLabors.ImageSharp.Processing { /// /// Provides an implementation of a brush that can recolor an image diff --git a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/SolidBrush{TPixel}.cs b/src/ImageSharp.Drawing/Processing/SolidBrush{TPixel}.cs similarity index 98% rename from src/ImageSharp.Drawing/Processing/Drawing/Brushes/SolidBrush{TPixel}.cs rename to src/ImageSharp.Drawing/Processing/SolidBrush{TPixel}.cs index 791c307bf..8a2d47c6c 100644 --- a/src/ImageSharp.Drawing/Processing/Drawing/Brushes/SolidBrush{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/SolidBrush{TPixel}.cs @@ -7,7 +7,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Processing.Drawing.Brushes +namespace SixLabors.ImageSharp.Processing { /// /// Provides an implementation of a solid brush for painting solid color areas. diff --git a/src/ImageSharp.Drawing/Processing/Text/TextGraphicsOptions.cs b/src/ImageSharp.Drawing/Processing/TextGraphicsOptions.cs similarity index 99% rename from src/ImageSharp.Drawing/Processing/Text/TextGraphicsOptions.cs rename to src/ImageSharp.Drawing/Processing/TextGraphicsOptions.cs index aaa6dea56..dfad06768 100644 --- a/src/ImageSharp.Drawing/Processing/Text/TextGraphicsOptions.cs +++ b/src/ImageSharp.Drawing/Processing/TextGraphicsOptions.cs @@ -4,7 +4,7 @@ using SixLabors.Fonts; using SixLabors.ImageSharp.PixelFormats; -namespace SixLabors.ImageSharp.Processing.Text +namespace SixLabors.ImageSharp.Processing { /// /// Options for influencing the drawing functions. diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs index d2f54f140..edbbceb62 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawBeziers.cs @@ -11,7 +11,6 @@ using BenchmarkDotNet.Attributes; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; namespace SixLabors.ImageSharp.Benchmarks { diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs index a027108a1..894683599 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawLines.cs @@ -3,8 +3,6 @@ // Licensed under the Apache License, Version 2.0. // -using SixLabors.ImageSharp.Processing.Drawing; - namespace SixLabors.ImageSharp.Benchmarks { using System.Drawing; diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs index 112c4a1a8..5fbd9f112 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawPolygon.cs @@ -11,7 +11,6 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; namespace SixLabors.ImageSharp.Benchmarks { diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawText.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawText.cs index 01846708a..624b54278 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawText.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawText.cs @@ -9,9 +9,8 @@ using BenchmarkDotNet.Attributes; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Text; -using SixLabors.ImageSharp.Processing.Drawing; using System.Linq; +using SixLabors.ImageSharp.Processing.Processors.Text; namespace SixLabors.ImageSharp.Benchmarks { @@ -21,7 +20,7 @@ namespace SixLabors.ImageSharp.Benchmarks { [Params(10, 100)] - public int TextIterations{ get; set; } + public int TextIterations { get; set; } public string TextPhrase { get; set; } = "Hello World"; public string TextToRender => string.Join(" ", Enumerable.Repeat(this.TextPhrase, this.TextIterations)); @@ -38,7 +37,7 @@ namespace SixLabors.ImageSharp.Benchmarks graphics.SmoothingMode = SmoothingMode.AntiAlias; Pen pen = new Pen(System.Drawing.Color.HotPink, 10); var font = new Font("Arial", 12, GraphicsUnit.Point); - graphics.DrawString(TextToRender, font, Brushes.HotPink, new RectangleF(10, 10, 780, 780)); + graphics.DrawString(TextToRender, font, System.Drawing.Brushes.HotPink, new RectangleF(10, 10, 780, 780)); } } } @@ -50,7 +49,7 @@ namespace SixLabors.ImageSharp.Benchmarks using (Image image = new Image(800, 800)) { var font = SixLabors.Fonts.SystemFonts.CreateFont("Arial", 12); - image.Mutate(x => x.ApplyProcessor(new Processing.Text.Processors.DrawTextProcessor(new TextGraphicsOptions(true) { WrapTextWidth = 780 }, TextToRender, font, SixLabors.ImageSharp.Processing.Drawing.Brushes.Brushes.Solid(Rgba32.HotPink), null, new SixLabors.Primitives.PointF(10, 10)))); + image.Mutate(x => x.ApplyProcessor(new DrawTextProcessor(new TextGraphicsOptions(true) { WrapTextWidth = 780 }, TextToRender, font, Processing.Brushes.Solid(Rgba32.HotPink), null, new SixLabors.Primitives.PointF(10, 10)))); } } @@ -60,10 +59,10 @@ namespace SixLabors.ImageSharp.Benchmarks using (Image image = new Image(800, 800)) { var font = SixLabors.Fonts.SystemFonts.CreateFont("Arial", 12); - image.Mutate(x => DrawTextOldVersion(x, new TextGraphicsOptions(true) { WrapTextWidth = 780 }, TextToRender, font, SixLabors.ImageSharp.Processing.Drawing.Brushes.Brushes.Solid(Rgba32.HotPink), null, new SixLabors.Primitives.PointF(10, 10))); + image.Mutate(x => DrawTextOldVersion(x, new TextGraphicsOptions(true) { WrapTextWidth = 780 }, TextToRender, font, Processing.Brushes.Solid(Rgba32.HotPink), null, new SixLabors.Primitives.PointF(10, 10))); } - IImageProcessingContext DrawTextOldVersion(IImageProcessingContext source, TextGraphicsOptions options, string text, SixLabors.Fonts.Font font, SixLabors.ImageSharp.Processing.Drawing.Brushes.IBrush brush, SixLabors.ImageSharp.Processing.Drawing.Pens.IPen pen, SixLabors.Primitives.PointF location) + IImageProcessingContext DrawTextOldVersion(IImageProcessingContext source, TextGraphicsOptions options, string text, SixLabors.Fonts.Font font, IBrush brush, IPen pen, SixLabors.Primitives.PointF location) where TPixel : struct, IPixel { float dpiX = 72; diff --git a/tests/ImageSharp.Benchmarks/Drawing/DrawTextOutline.cs b/tests/ImageSharp.Benchmarks/Drawing/DrawTextOutline.cs index d03e69f38..ba6d055e3 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/DrawTextOutline.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/DrawTextOutline.cs @@ -8,9 +8,8 @@ using System.Drawing.Drawing2D; using BenchmarkDotNet.Attributes; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Text; -using SixLabors.ImageSharp.Processing.Drawing; using System.Linq; +using SixLabors.ImageSharp.Processing.Processors.Text; namespace SixLabors.ImageSharp.Benchmarks { @@ -20,7 +19,7 @@ namespace SixLabors.ImageSharp.Benchmarks { [Params(10, 100)] - public int TextIterations{ get; set; } + public int TextIterations { get; set; } public string TextPhrase { get; set; } = "Hello World"; public string TextToRender => string.Join(" ", Enumerable.Repeat(TextPhrase, TextIterations)); @@ -50,7 +49,7 @@ namespace SixLabors.ImageSharp.Benchmarks using (Image image = new Image(800, 800)) { var font = SixLabors.Fonts.SystemFonts.CreateFont("Arial", 12); - image.Mutate(x => x.ApplyProcessor(new SixLabors.ImageSharp.Processing.Text.Processors.DrawTextProcessor(new TextGraphicsOptions(true) { WrapTextWidth = 780 }, TextToRender, font, null, SixLabors.ImageSharp.Processing.Drawing.Pens.Pens.Solid(Rgba32.HotPink, 10), new SixLabors.Primitives.PointF(10, 10)))); + image.Mutate(x => x.ApplyProcessor(new DrawTextProcessor(new TextGraphicsOptions(true) { WrapTextWidth = 780 }, TextToRender, font, null, Processing.Pens.Solid(Rgba32.HotPink, 10), new SixLabors.Primitives.PointF(10, 10)))); } } @@ -60,10 +59,10 @@ namespace SixLabors.ImageSharp.Benchmarks using (Image image = new Image(800, 800)) { var font = SixLabors.Fonts.SystemFonts.CreateFont("Arial", 12); - image.Mutate(x => DrawTextOldVersion(x, new TextGraphicsOptions(true) { WrapTextWidth = 780 }, TextToRender, font, null, SixLabors.ImageSharp.Processing.Drawing.Pens.Pens.Solid(Rgba32.HotPink, 10), new SixLabors.Primitives.PointF(10, 10))); + image.Mutate(x => DrawTextOldVersion(x, new TextGraphicsOptions(true) { WrapTextWidth = 780 }, TextToRender, font, null, Processing.Pens.Solid(Rgba32.HotPink, 10), new SixLabors.Primitives.PointF(10, 10))); } - IImageProcessingContext DrawTextOldVersion(IImageProcessingContext source, TextGraphicsOptions options, string text, SixLabors.Fonts.Font font, SixLabors.ImageSharp.Processing.Drawing.Brushes.IBrush brush, SixLabors.ImageSharp.Processing.Drawing.Pens.IPen pen, SixLabors.Primitives.PointF location) + IImageProcessingContext DrawTextOldVersion(IImageProcessingContext source, TextGraphicsOptions options, string text, SixLabors.Fonts.Font font, IBrush brush, IPen pen, SixLabors.Primitives.PointF location) where TPixel : struct, IPixel { var style = new SixLabors.Fonts.RendererOptions(font, options.DpiX, options.DpiY, location) diff --git a/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs b/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs index d78379fc0..8aadb85bf 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/FillPolygon.cs @@ -12,7 +12,6 @@ using BenchmarkDotNet.Attributes; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; namespace SixLabors.ImageSharp.Benchmarks { @@ -36,7 +35,7 @@ namespace SixLabors.ImageSharp.Benchmarks using (Graphics graphics = Graphics.FromImage(destination)) { graphics.SmoothingMode = SmoothingMode.AntiAlias; - graphics.FillPolygon(Brushes.HotPink, + graphics.FillPolygon(System.Drawing.Brushes.HotPink, new[] { new Point(10, 10), diff --git a/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs b/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs index ac56caa46..643e4ac9a 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/FillRectangle.cs @@ -10,7 +10,6 @@ using BenchmarkDotNet.Attributes; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; using CoreRectangle = SixLabors.Primitives.Rectangle; using CoreSize = SixLabors.Primitives.Size; @@ -30,7 +29,7 @@ namespace SixLabors.ImageSharp.Benchmarks { graphics.InterpolationMode = InterpolationMode.Default; graphics.SmoothingMode = SmoothingMode.AntiAlias; - graphics.FillRectangle(Brushes.HotPink, new Rectangle(10, 10, 190, 140)); + graphics.FillRectangle(System.Drawing.Brushes.HotPink, new Rectangle(10, 10, 190, 140)); } return destination.Size; } diff --git a/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs b/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs index 059398c6c..5f8f2ff06 100644 --- a/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs +++ b/tests/ImageSharp.Benchmarks/Drawing/FillWithPattern.cs @@ -11,15 +11,11 @@ using BenchmarkDotNet.Attributes; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; - -using CoreBrushes = SixLabors.ImageSharp.Processing.Drawing.Brushes.Brushes; +using CoreBrushes = SixLabors.ImageSharp.Processing.Brushes; namespace SixLabors.ImageSharp.Benchmarks { - - public class FillWithPattern { [Benchmark(Baseline = true, Description = "System.Drawing Fill with Pattern")] @@ -30,7 +26,7 @@ namespace SixLabors.ImageSharp.Benchmarks using (Graphics graphics = Graphics.FromImage(destination)) { graphics.SmoothingMode = SmoothingMode.AntiAlias; - HatchBrush brush = new HatchBrush(HatchStyle.BackwardDiagonal, System.Drawing.Color.HotPink); + HatchBrush brush = new HatchBrush(HatchStyle.BackwardDiagonal, Color.HotPink); graphics.FillRectangle(brush, new Rectangle(0, 0, 800, 800)); // can't find a way to flood fill with a brush } using (MemoryStream ms = new MemoryStream()) diff --git a/tests/ImageSharp.Tests/Drawing/BeziersTests.cs b/tests/ImageSharp.Tests/Drawing/BeziersTests.cs index 1790d1a20..443b49c7c 100644 --- a/tests/ImageSharp.Tests/Drawing/BeziersTests.cs +++ b/tests/ImageSharp.Tests/Drawing/BeziersTests.cs @@ -5,7 +5,6 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; using SixLabors.Memory; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs b/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs index 4c681fb89..40ad92adc 100644 --- a/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs +++ b/tests/ImageSharp.Tests/Drawing/DrawImageTest.cs @@ -4,7 +4,7 @@ using System; using System.Numerics; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing; +using SixLabors.ImageSharp.Processing; using SixLabors.Primitives; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs b/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs index 424b875e0..96af63fd5 100644 --- a/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs +++ b/tests/ImageSharp.Tests/Drawing/DrawPathTests.cs @@ -4,8 +4,6 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Pens; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/FillEllipticGradientBrushTest.cs b/tests/ImageSharp.Tests/Drawing/FillEllipticGradientBrushTest.cs index 7c9fa2088..fa4d4a709 100644 --- a/tests/ImageSharp.Tests/Drawing/FillEllipticGradientBrushTest.cs +++ b/tests/ImageSharp.Tests/Drawing/FillEllipticGradientBrushTest.cs @@ -5,8 +5,6 @@ using System; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Brushes.GradientBrushes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/FillLinearGradientBrushTests.cs b/tests/ImageSharp.Tests/Drawing/FillLinearGradientBrushTests.cs index 9e7af1e57..3522ade7c 100644 --- a/tests/ImageSharp.Tests/Drawing/FillLinearGradientBrushTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillLinearGradientBrushTests.cs @@ -8,8 +8,6 @@ using System.Text; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Brushes.GradientBrushes; using Xunit; // ReSharper disable InconsistentNaming diff --git a/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs b/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs index c65d04d9d..f13f808b6 100644 --- a/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillPatternTests.cs @@ -5,14 +5,11 @@ using System; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; +using SixLabors.Memory; using Xunit; namespace SixLabors.ImageSharp.Tests.Drawing { - using SixLabors.Memory; - public class FillPatternBrushTests : FileTestBase { private void Test(string name, Rgba32 background, IBrush brush, Rgba32[,] expectedPattern) diff --git a/tests/ImageSharp.Tests/Drawing/FillRadialGradientBrushTests.cs b/tests/ImageSharp.Tests/Drawing/FillRadialGradientBrushTests.cs index eafbf3df1..7461347de 100644 --- a/tests/ImageSharp.Tests/Drawing/FillRadialGradientBrushTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillRadialGradientBrushTests.cs @@ -1,13 +1,10 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Brushes.GradientBrushes; using Xunit; namespace SixLabors.ImageSharp.Tests.Drawing { - using System; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; diff --git a/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs b/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs index c664bcf9c..dc7da3543 100644 --- a/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillRegionProcessorTests.cs @@ -5,20 +5,16 @@ using System.Numerics; using Moq; using System; -using SixLabors.Memory; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Pens; -using SixLabors.ImageSharp.Processing.Drawing.Processors; using SixLabors.Primitives; using Xunit; +using SixLabors.ImageSharp.Processing.Processors.Drawing; namespace SixLabors.ImageSharp.Tests.Drawing { - + public class FillRegionProcessorTests { diff --git a/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs b/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs index 58fd4c767..1f01d54f4 100644 --- a/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs +++ b/tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs @@ -3,9 +3,7 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; using SixLabors.Shapes; using Xunit; // ReSharper disable InconsistentNaming diff --git a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs index b664d1a14..d3b39709a 100644 --- a/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/LineComplexPolygonTests.cs @@ -4,8 +4,6 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Pens; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/LineTests.cs b/tests/ImageSharp.Tests/Drawing/LineTests.cs index 6be81e0aa..747c75cde 100644 --- a/tests/ImageSharp.Tests/Drawing/LineTests.cs +++ b/tests/ImageSharp.Tests/Drawing/LineTests.cs @@ -5,8 +5,6 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Pens; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/Paths/DrawPathCollection.cs b/tests/ImageSharp.Tests/Drawing/Paths/DrawPathCollection.cs index ecdfd03e5..326517a4e 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/DrawPathCollection.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/DrawPathCollection.cs @@ -4,10 +4,8 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Pens; -using SixLabors.ImageSharp.Processing.Drawing.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Drawing; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs index 1a402c5b7..e72fbbdf2 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPath.cs @@ -4,9 +4,8 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Drawing; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs index b728ea7bf..ec7a5a20c 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPathCollection.cs @@ -4,9 +4,8 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Drawing; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs index 0c0fb58fa..d8927a468 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillPolygon.cs @@ -4,9 +4,8 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Drawing; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs b/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs index 4c232b452..8f648e425 100644 --- a/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs +++ b/tests/ImageSharp.Tests/Drawing/Paths/FillRectangle.cs @@ -3,9 +3,8 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Primitives; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Drawing; using Xunit; namespace SixLabors.ImageSharp.Tests.Drawing.Paths diff --git a/tests/ImageSharp.Tests/Drawing/PolygonTests.cs b/tests/ImageSharp.Tests/Drawing/PolygonTests.cs index a0b958860..f9a41baba 100644 --- a/tests/ImageSharp.Tests/Drawing/PolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/PolygonTests.cs @@ -6,7 +6,6 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.Primitives; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; using Xunit; namespace SixLabors.ImageSharp.Tests.Drawing diff --git a/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs b/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs index 6ce1e2da3..2dcd8b3d3 100644 --- a/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs +++ b/tests/ImageSharp.Tests/Drawing/RecolorImageTest.cs @@ -3,8 +3,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; using SixLabors.Primitives; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs b/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs index e8a6eef1d..94d3d49ff 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidBezierTests.cs @@ -4,7 +4,6 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs index 8dcce8167..c8d3fe1bc 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidComplexPolygonTests.cs @@ -5,7 +5,6 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/SolidFillBlendedShapesTests.cs b/tests/ImageSharp.Tests/Drawing/SolidFillBlendedShapesTests.cs index 7d73d1b65..0c08f66c6 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidFillBlendedShapesTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidFillBlendedShapesTests.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs index ed46f323a..e42b4b481 100644 --- a/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs +++ b/tests/ImageSharp.Tests/Drawing/SolidPolygonTests.cs @@ -6,8 +6,6 @@ using System.Numerics; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs index 2a03eb415..76f40e0ac 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/DrawText.cs @@ -4,11 +4,8 @@ using System.Numerics; using SixLabors.Fonts; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing.Brushes; -using SixLabors.ImageSharp.Processing.Drawing.Pens; -using SixLabors.ImageSharp.Processing.Drawing.Processors; -using SixLabors.ImageSharp.Processing.Text; -using SixLabors.ImageSharp.Processing.Text.Processors; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Processing.Processors.Text; using SixLabors.Primitives; using SixLabors.Shapes; using Xunit; diff --git a/tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.cs b/tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.cs index 0885dd183..44bb160ce 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/DrawTextOnImageTests.cs @@ -7,8 +7,6 @@ using System.Text; using SixLabors.Fonts; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing.Pens; -using SixLabors.ImageSharp.Processing.Text; using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; using SixLabors.Primitives; diff --git a/tests/ImageSharp.Tests/Drawing/Text/TextGraphicsOptionsTests.cs b/tests/ImageSharp.Tests/Drawing/Text/TextGraphicsOptionsTests.cs index d710229ff..0885611c6 100644 --- a/tests/ImageSharp.Tests/Drawing/Text/TextGraphicsOptionsTests.cs +++ b/tests/ImageSharp.Tests/Drawing/Text/TextGraphicsOptionsTests.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using SixLabors.ImageSharp.Processing.Text; +using SixLabors.ImageSharp.Processing; using Xunit; diff --git a/tests/ImageSharp.Tests/Issues/Issue412.cs b/tests/ImageSharp.Tests/Issues/Issue412.cs index a1bf7f36a..6123c822b 100644 --- a/tests/ImageSharp.Tests/Issues/Issue412.cs +++ b/tests/ImageSharp.Tests/Issues/Issue412.cs @@ -2,12 +2,10 @@ using Xunit; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing.Drawing; +using SixLabors.ImageSharp.Processing; namespace SixLabors.ImageSharp.Tests.Issues { - using SixLabors.ImageSharp.Processing; - public class Issue412 { [Theory] diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs index 36473fa56..120619fb5 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelBlenders/PorterDuffCompositorTests.cs @@ -5,7 +5,6 @@ namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelBlenders { using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; - using SixLabors.ImageSharp.Processing.Drawing; using Xunit; diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs index 70e762585..97ed30b99 100644 --- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs +++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/SolidProvider.cs @@ -4,8 +4,6 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; -using SixLabors.ImageSharp.Processing.Drawing; - using Xunit.Abstractions; namespace SixLabors.ImageSharp.Tests From deb299036facdc4b3e2be4c0482f3beec0a77148 Mon Sep 17 00:00:00 2001 From: Johannes Bildstein Date: Tue, 3 Jul 2018 13:55:01 +0200 Subject: [PATCH 35/36] improve check for invalid ICC profiles and extend tests --- .../MetaData/Profiles/ICC/IccProfile.cs | 17 ++- .../TestDataIcc/IccTestDataProfiles.cs | 119 ++++++++++++++---- 2 files changed, 108 insertions(+), 28 deletions(-) diff --git a/src/ImageSharp/MetaData/Profiles/ICC/IccProfile.cs b/src/ImageSharp/MetaData/Profiles/ICC/IccProfile.cs index 52b8e43da..db1d96d7e 100644 --- a/src/ImageSharp/MetaData/Profiles/ICC/IccProfile.cs +++ b/src/ImageSharp/MetaData/Profiles/ICC/IccProfile.cs @@ -167,11 +167,22 @@ namespace SixLabors.ImageSharp.MetaData.Profiles.Icc /// True if the profile is valid; False otherwise public bool CheckIsValid() { - return Enum.IsDefined(typeof(IccColorSpaceType), this.Header.DataColorSpace) && + const int minSize = 128; + const int maxSize = 50_000_000; // it's unlikely there is a profile bigger than 50MB + + bool arrayValid = true; + if (this.data != null) + { + arrayValid = this.data.Length >= minSize && + this.data.Length >= this.Header.Size; + } + + return arrayValid && + Enum.IsDefined(typeof(IccColorSpaceType), this.Header.DataColorSpace) && Enum.IsDefined(typeof(IccColorSpaceType), this.Header.ProfileConnectionSpace) && Enum.IsDefined(typeof(IccRenderingIntent), this.Header.RenderingIntent) && - this.Header.Size >= 128 && - this.Header.Size < 50_000_000; // it's unlikely there is a profile bigger than 50MB + this.Header.Size >= minSize && + this.Header.Size < maxSize; } /// diff --git a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs index cf8cffb32..35ffa2bbb 100644 --- a/tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs +++ b/tests/ImageSharp.Tests/TestDataIcc/IccTestDataProfiles.cs @@ -99,12 +99,12 @@ namespace SixLabors.ImageSharp.Tests 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // Nr of tag table entries (0) + // Nr of tag table entries (byte)(nrOfEntries >> 24), (byte)(nrOfEntries >> 16), (byte)(nrOfEntries >> 8), (byte)nrOfEntries }); } - public static byte[] Profile_Random_Array = ArrayHelper.Concat(CreateHeaderRandomArray(168, 2, Profile_Random_Id_Array), + public static readonly byte[] Profile_Random_Array = ArrayHelper.Concat(CreateHeaderRandomArray(168, 2, Profile_Random_Id_Array), new byte[] { 0x00, 0x00, 0x00, 0x00, // tag signature (Unknown) @@ -119,7 +119,7 @@ namespace SixLabors.ImageSharp.Tests IccTestDataTagDataEntry.Unknown_Arr ); - public static IccProfile Profile_Random_Val = new IccProfile(CreateHeaderRandomValue(168, + public static readonly IccProfile Profile_Random_Val = new IccProfile(CreateHeaderRandomValue(168, #if !NETSTANDARD1_1 Profile_Random_Id_Value, #else @@ -132,41 +132,110 @@ namespace SixLabors.ImageSharp.Tests IccTestDataTagDataEntry.Unknown_Val }); - public static byte[] Header_Corrupt1_Array = + public static readonly byte[] Header_CorruptDataColorSpace_Array = { - 0x81, 0xB1, 0x81, 0xE4, 0x82, 0x16, 0x82, 0x49, 0x82, 0x7B, 0x82, 0xAD, 0x82, 0xDF, 0x83, 0x11, - 0x83, 0x43, 0x83, 0x75, 0x83, 0xA7, 0x83, 0xD8, 0x84, 0x0A, 0x84, 0x3B, 0x84, 0x6C, 0x84, 0x9E, - 0x84, 0xCF, 0x85, 0x00, 0x85, 0x31, 0x85, 0x62, 0x85, 0x93, 0x85, 0xC3, 0x85, 0xF4, 0x86, 0x24, - 0x86, 0x55, 0x86, 0x85, 0x86, 0xB5, 0x86, 0xE6, 0x87, 0x16, 0x87, 0x46, 0x87, 0x76, 0x87, 0xA5, - 0x87, 0xD5, 0x88, 0x05, 0x88, 0x34, 0x88, 0x64, 0x88, 0x93, 0x88, 0xC3, 0x88, 0xF2, 0x89, 0x21, - 0x89, 0x50, 0x89, 0x7F, 0x89, 0xAE, 0x89, 0xDD, 0x8A, 0x0C, 0x8A, 0x3B, 0x8A, 0x69, 0x8A, 0x98, - 0x8A, 0xC6, 0x8A, 0xF5, 0x8B, 0x23, 0x8B, 0x51, 0x8B, 0x7F, 0x8B, 0xAE, 0x8B, 0xDC, 0x8C, 0x09, - 0x8C, 0x37, 0x8C, 0x65, 0x8C, 0x93, 0x8C, 0xC1, 0x8C, 0xEE, 0x8D, 0x1C, 0x8D, 0x49, 0x8D, 0x76, + 0x00, 0x00, 0x00, 0x80, // Size + 0x61, 0x62, 0x63, 0x64, // CmmType + 0x04, 0x30, 0x00, 0x00, // Version + 0x6D, 0x6E, 0x74, 0x72, // Class + 0x68, 0x45, 0x8D, 0x6A, // DataColorSpace + 0x58, 0x59, 0x5A, 0x20, // ProfileConnectionSpace + 0x07, 0xC6, 0x00, 0x0B, 0x00, 0x1A, 0x00, 0x07, 0x00, 0x15, 0x00, 0x2A, // CreationDate + 0x61, 0x63, 0x73, 0x70, // FileSignature + 0x4D, 0x53, 0x46, 0x54, // PrimaryPlatformSignature + 0x00, 0x00, 0x00, 0x01, // Flags + 0x07, 0x5B, 0xCD, 0x15, // DeviceManufacturer + 0x3A, 0xDE, 0x68, 0xB1, // DeviceModel + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, // DeviceAttributes + 0x00, 0x00, 0x00, 0x03, // RenderingIntent + 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // PcsIlluminant + 0x64, 0x63, 0x62, 0x61, // CreatorSignature + // Profile ID + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Padding + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; - public static byte[] Header_Corrupt2_Array = + public static readonly byte[] Header_CorruptProfileConnectionSpace_Array = { - 0x23, 0x74, 0x6D, 0x6D, 0xB1, 0xBC, 0x28, 0xB2, 0x6D, 0x0B, 0xA3, 0x9C, 0x2D, 0x60, 0x6C, 0xB4, - 0x96, 0xF2, 0x31, 0x88, 0x6C, 0x67, 0x8B, 0xA9, 0x35, 0x31, 0x6C, 0x24, 0x81, 0xAE, 0x38, 0x64, - 0x6B, 0xE9, 0x78, 0xEC, 0x3B, 0x28, 0x6B, 0xB7, 0x71, 0x4F, 0x3D, 0x87, 0x6B, 0x8C, 0x6A, 0xC3, - 0x3F, 0x87, 0x6B, 0x68, 0x65, 0x33, 0x41, 0x30, 0x6B, 0x4A, 0x60, 0x8C, 0x42, 0x8C, 0x6B, 0x32, - 0x5C, 0xB8, 0x43, 0xA2, 0x6B, 0x1F, 0x59, 0xA4, 0x44, 0x79, 0x6B, 0x10, 0x57, 0x3B, 0x45, 0x1A, - 0x6B, 0x05, 0x55, 0x68, 0x45, 0x8D, 0x6A, 0xFE, 0x54, 0x15, 0x45, 0xDA, 0x6A, 0xF9, 0x53, 0x2A, - 0x46, 0x16, 0x6A, 0xF5, 0x52, 0x74, 0x46, 0x27, 0x6A, 0xF4, 0x52, 0x43, 0x46, 0x27, 0x6A, 0xF4, - 0x52, 0x43, 0x46, 0x27, 0x6A, 0xF4, 0x52, 0x43, 0x46, 0x27, 0x6A, 0xF4, 0x52, 0x43, 0x46, 0x27, + 0x00, 0x00, 0x00, 0x80, // Size + 0x62, 0x63, 0x64, 0x65, // CmmType + 0x04, 0x30, 0x00, 0x00, // Version + 0x6D, 0x6E, 0x74, 0x72, // Class + 0x52, 0x47, 0x42, 0x20, // DataColorSpace + 0x68, 0x45, 0x8D, 0x6A, // ProfileConnectionSpace + 0x07, 0xC6, 0x00, 0x0B, 0x00, 0x1A, 0x00, 0x07, 0x00, 0x15, 0x00, 0x2A, // CreationDate + 0x61, 0x63, 0x73, 0x70, // FileSignature + 0x4D, 0x53, 0x46, 0x54, // PrimaryPlatformSignature + 0x00, 0x00, 0x00, 0x01, // Flags + 0x07, 0x5B, 0xCD, 0x15, // DeviceManufacturer + 0x3A, 0xDE, 0x68, 0xB1, // DeviceModel + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, // DeviceAttributes + 0x00, 0x00, 0x00, 0x03, // RenderingIntent + 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // PcsIlluminant + 0x64, 0x63, 0x62, 0x61, // CreatorSignature + // Profile ID + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Padding + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + public static readonly byte[] Header_CorruptRenderingIntent_Array = + { + 0x00, 0x00, 0x00, 0x80, // Size + 0x63, 0x64, 0x65, 0x66, // CmmType + 0x04, 0x30, 0x00, 0x00, // Version + 0x6D, 0x6E, 0x74, 0x72, // Class + 0x52, 0x47, 0x42, 0x20, // DataColorSpace + 0x58, 0x59, 0x5A, 0x20, // ProfileConnectionSpace + 0x07, 0xC6, 0x00, 0x0B, 0x00, 0x1A, 0x00, 0x07, 0x00, 0x15, 0x00, 0x2A, // CreationDate + 0x61, 0x63, 0x73, 0x70, // FileSignature + 0x4D, 0x53, 0x46, 0x54, // PrimaryPlatformSignature + 0x00, 0x00, 0x00, 0x01, // Flags + 0x07, 0x5B, 0xCD, 0x15, // DeviceManufacturer + 0x3A, 0xDE, 0x68, 0xB1, // DeviceModel + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, // DeviceAttributes + 0x33, 0x41, 0x30, 0x6B, // RenderingIntent + 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, // PcsIlluminant + 0x64, 0x63, 0x62, 0x61, // CreatorSignature + // Profile ID + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + // Padding + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + }; + + public static readonly byte[] Header_DataTooSmall_Array = new byte[127]; + + public static readonly byte[] Header_InvalidSizeSmall_Array = CreateHeaderRandomArray(127, 0, Header_Random_Id_Array); + + public static readonly byte[] Header_InvalidSizeBig_Array = CreateHeaderRandomArray(50_000_000, 0, Header_Random_Id_Array); + + public static readonly byte[] Header_SizeBiggerThanData_Array = CreateHeaderRandomArray(160, 0, Header_Random_Id_Array); - public static object[][] ProfileIdTestData = + public static readonly object[][] ProfileIdTestData = { new object[] { Header_Random_Array, Header_Random_Id_Value }, new object[] { Profile_Random_Array, Profile_Random_Id_Value }, }; - public static object[][] ProfileValidityTestData = + public static readonly object[][] ProfileValidityTestData = { - new object[] { Header_Corrupt1_Array, false }, - new object[] { Header_Corrupt2_Array, false }, + new object[] { Header_CorruptDataColorSpace_Array, false }, + new object[] { Header_CorruptProfileConnectionSpace_Array, false }, + new object[] { Header_CorruptRenderingIntent_Array, false }, + new object[] { Header_DataTooSmall_Array, false }, + new object[] { Header_InvalidSizeSmall_Array, false }, + new object[] { Header_InvalidSizeBig_Array, false }, + new object[] { Header_SizeBiggerThanData_Array, false }, new object[] { Header_Random_Array, true }, }; } From 0475a072d5bfeaaf27edab490d996fa979ad6a7b Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Wed, 4 Jul 2018 00:39:29 +0200 Subject: [PATCH 36/36] remove unnecessary partial keyword --- src/ImageSharp.Drawing/Processing/DrawTextExtensions.cs | 2 +- src/ImageSharp.Drawing/Processing/RecolorBrush{TPixel}.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ImageSharp.Drawing/Processing/DrawTextExtensions.cs b/src/ImageSharp.Drawing/Processing/DrawTextExtensions.cs index 114de7610..46061ce9b 100644 --- a/src/ImageSharp.Drawing/Processing/DrawTextExtensions.cs +++ b/src/ImageSharp.Drawing/Processing/DrawTextExtensions.cs @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Processing /// /// Adds extensions that allow the drawing of text to the type. /// - public static partial class DrawTextExtensions + public static class DrawTextExtensions { /// /// Draws the text onto the the image filled via the brush. diff --git a/src/ImageSharp.Drawing/Processing/RecolorBrush{TPixel}.cs b/src/ImageSharp.Drawing/Processing/RecolorBrush{TPixel}.cs index 480c42ee0..058b03d62 100644 --- a/src/ImageSharp.Drawing/Processing/RecolorBrush{TPixel}.cs +++ b/src/ImageSharp.Drawing/Processing/RecolorBrush{TPixel}.cs @@ -15,7 +15,7 @@ namespace SixLabors.ImageSharp.Processing /// /// The pixel format. public class RecolorBrush : IBrush - where TPixel : struct, IPixel + where TPixel : struct, IPixel { /// /// Initializes a new instance of the class.