From 61ba0e70b94ef6c0df2a310fa1211b4be4a42d7e Mon Sep 17 00:00:00 2001 From: antonfirsov Date: Sat, 24 Dec 2016 16:28:57 +0100 Subject: [PATCH] moved Jpeg classes to separate folders --- .../Formats/Jpg/Components/Block8x8F.cs | 2 + .../Jpg/Components/{ => Decoder}/Bits.cs | 2 +- .../Jpg/Components/{ => Decoder}/Bytes.cs | 2 +- .../Jpg/Components/{ => Decoder}/Component.cs | 2 +- .../Jpg/Components/{ => Decoder}/GrayImage.cs | 2 +- .../{Huffman.cs => Decoder/HuffmanTree.cs} | 4 +- .../Components/{ => Decoder}/YCbCrImage.cs | 2 +- .../Jpg/Components/{ => Encoder}/HuffIndex.cs | 2 +- .../Components/{ => Encoder}/HuffmanLut.cs | 2 +- .../Components/{ => Encoder}/HuffmanSpec.cs | 2 +- .../Components/{ => Encoder}/QuantIndex.cs | 2 +- src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs | 55 ++++++++++--------- src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs | 11 ++-- .../Formats/Jpg/{ => Utils}/JpegUtils.cs | 2 +- .../Jpg/{Components => Utils}/MutableSpan.cs | 2 +- .../MutableSpanExtensions.cs | 2 +- .../Formats/Jpg/Block8x8FTests.cs | 1 + .../ImageSharp.Tests/Formats/Jpg/JpegTests.cs | 11 ++-- .../Formats/Jpg/ReferenceImplementations.cs | 1 + .../Jpg/ReferenceImplementationsTests.cs | 2 + .../Formats/Jpg/UtilityTestClassBase.cs | 4 +- 21 files changed, 65 insertions(+), 50 deletions(-) rename src/ImageSharp/Formats/Jpg/Components/{ => Decoder}/Bits.cs (98%) rename src/ImageSharp/Formats/Jpg/Components/{ => Decoder}/Bytes.cs (99%) rename src/ImageSharp/Formats/Jpg/Components/{ => Decoder}/Component.cs (94%) rename src/ImageSharp/Formats/Jpg/Components/{ => Decoder}/GrayImage.cs (98%) rename src/ImageSharp/Formats/Jpg/Components/{Huffman.cs => Decoder/HuffmanTree.cs} (96%) rename src/ImageSharp/Formats/Jpg/Components/{ => Decoder}/YCbCrImage.cs (99%) rename src/ImageSharp/Formats/Jpg/Components/{ => Encoder}/HuffIndex.cs (92%) rename src/ImageSharp/Formats/Jpg/Components/{ => Encoder}/HuffmanLut.cs (97%) rename src/ImageSharp/Formats/Jpg/Components/{ => Encoder}/HuffmanSpec.cs (98%) rename src/ImageSharp/Formats/Jpg/Components/{ => Encoder}/QuantIndex.cs (86%) rename src/ImageSharp/Formats/Jpg/{ => Utils}/JpegUtils.cs (98%) rename src/ImageSharp/Formats/Jpg/{Components => Utils}/MutableSpan.cs (98%) rename src/ImageSharp/Formats/Jpg/{Components => Utils}/MutableSpanExtensions.cs (99%) diff --git a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs index cfea24ad9..e0886e134 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs @@ -11,6 +11,8 @@ namespace ImageSharp.Formats using System.Runtime.CompilerServices; using System.Runtime.InteropServices; + using ImageSharp.Formats.Jpg.Utils; + /// /// DCT code Ported from https://github.com/norishigefukushima/dct_simd /// diff --git a/src/ImageSharp/Formats/Jpg/Components/Bits.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/Bits.cs similarity index 98% rename from src/ImageSharp/Formats/Jpg/Components/Bits.cs rename to src/ImageSharp/Formats/Jpg/Components/Decoder/Bits.cs index d7449f4a3..c9624c444 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Bits.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/Bits.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats +namespace ImageSharp.Formats.Jpg.Components.Decoder { using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Formats/Jpg/Components/Bytes.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/Bytes.cs similarity index 99% rename from src/ImageSharp/Formats/Jpg/Components/Bytes.cs rename to src/ImageSharp/Formats/Jpg/Components/Decoder/Bytes.cs index 127ba478b..55326a37c 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Bytes.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/Bytes.cs @@ -2,7 +2,7 @@ // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats +namespace ImageSharp.Formats.Jpg.Components.Decoder { using System; using System.Buffers; diff --git a/src/ImageSharp/Formats/Jpg/Components/Component.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/Component.cs similarity index 94% rename from src/ImageSharp/Formats/Jpg/Components/Component.cs rename to src/ImageSharp/Formats/Jpg/Components/Decoder/Component.cs index f70dbff3f..29117e492 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Component.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/Component.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats +namespace ImageSharp.Formats.Jpg.Components.Decoder { /// /// Represents a single color component diff --git a/src/ImageSharp/Formats/Jpg/Components/GrayImage.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/GrayImage.cs similarity index 98% rename from src/ImageSharp/Formats/Jpg/Components/GrayImage.cs rename to src/ImageSharp/Formats/Jpg/Components/Decoder/GrayImage.cs index 5f5f015ad..ccb42a1a6 100644 --- a/src/ImageSharp/Formats/Jpg/Components/GrayImage.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/GrayImage.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats +namespace ImageSharp.Formats.Jpg.Components.Decoder { /// /// Represents a grayscale image diff --git a/src/ImageSharp/Formats/Jpg/Components/Huffman.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/HuffmanTree.cs similarity index 96% rename from src/ImageSharp/Formats/Jpg/Components/Huffman.cs rename to src/ImageSharp/Formats/Jpg/Components/Decoder/HuffmanTree.cs index c0d5a5caa..7d5932b21 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Huffman.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/HuffmanTree.cs @@ -2,7 +2,7 @@ // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats +namespace ImageSharp.Formats.Jpg.Components.Decoder { using System; using System.Buffers; @@ -10,7 +10,7 @@ namespace ImageSharp.Formats /// /// Represents a Huffman tree /// - internal struct Huffman : IDisposable + internal struct HuffmanTree : IDisposable { /// /// Gets or sets the number of codes in the tree. diff --git a/src/ImageSharp/Formats/Jpg/Components/YCbCrImage.cs b/src/ImageSharp/Formats/Jpg/Components/Decoder/YCbCrImage.cs similarity index 99% rename from src/ImageSharp/Formats/Jpg/Components/YCbCrImage.cs rename to src/ImageSharp/Formats/Jpg/Components/Decoder/YCbCrImage.cs index 603324bcc..018150aeb 100644 --- a/src/ImageSharp/Formats/Jpg/Components/YCbCrImage.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Decoder/YCbCrImage.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats +namespace ImageSharp.Formats.Jpg.Components.Decoder { /// /// Represents an image made up of three color components (luminance, blue chroma, red chroma) diff --git a/src/ImageSharp/Formats/Jpg/Components/HuffIndex.cs b/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffIndex.cs similarity index 92% rename from src/ImageSharp/Formats/Jpg/Components/HuffIndex.cs rename to src/ImageSharp/Formats/Jpg/Components/Encoder/HuffIndex.cs index ff2a888a4..a4265ea8e 100644 --- a/src/ImageSharp/Formats/Jpg/Components/HuffIndex.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffIndex.cs @@ -1,4 +1,4 @@ -namespace ImageSharp.Formats.Jpg.Components +namespace ImageSharp.Formats.Jpg.Components.Encoder { /// /// Enumerates the Huffman tables diff --git a/src/ImageSharp/Formats/Jpg/Components/HuffmanLut.cs b/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanLut.cs similarity index 97% rename from src/ImageSharp/Formats/Jpg/Components/HuffmanLut.cs rename to src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanLut.cs index a53ebf61b..93b412b25 100644 --- a/src/ImageSharp/Formats/Jpg/Components/HuffmanLut.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanLut.cs @@ -1,4 +1,4 @@ -namespace ImageSharp.Formats.Jpg.Components +namespace ImageSharp.Formats.Jpg.Components.Encoder { /// /// A compiled look-up table representation of a huffmanSpec. diff --git a/src/ImageSharp/Formats/Jpg/Components/HuffmanSpec.cs b/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanSpec.cs similarity index 98% rename from src/ImageSharp/Formats/Jpg/Components/HuffmanSpec.cs rename to src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanSpec.cs index 909d7da03..2e856628a 100644 --- a/src/ImageSharp/Formats/Jpg/Components/HuffmanSpec.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Encoder/HuffmanSpec.cs @@ -1,4 +1,4 @@ -namespace ImageSharp.Formats.Jpg.Components +namespace ImageSharp.Formats.Jpg.Components.Encoder { /// /// The Huffman encoding specifications. diff --git a/src/ImageSharp/Formats/Jpg/Components/QuantIndex.cs b/src/ImageSharp/Formats/Jpg/Components/Encoder/QuantIndex.cs similarity index 86% rename from src/ImageSharp/Formats/Jpg/Components/QuantIndex.cs rename to src/ImageSharp/Formats/Jpg/Components/Encoder/QuantIndex.cs index 11a82f831..192e29f08 100644 --- a/src/ImageSharp/Formats/Jpg/Components/QuantIndex.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Encoder/QuantIndex.cs @@ -1,4 +1,4 @@ -namespace ImageSharp.Formats.Jpg.Components +namespace ImageSharp.Formats.Jpg.Components.Encoder { /// /// Enumerates the quantization tables diff --git a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs index b74ae2317..9e1ab8d00 100644 --- a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs @@ -11,6 +11,9 @@ namespace ImageSharp.Formats using System.Runtime.InteropServices; using System.Threading.Tasks; + using ImageSharp.Formats.Jpg.Components.Decoder; + using ImageSharp.Formats.Jpg.Utils; + /// /// Performs the jpeg decoding operation. /// @@ -76,7 +79,7 @@ namespace ImageSharp.Formats /// /// The huffman trees /// - private readonly Huffman[] huffmanTrees; + private readonly HuffmanTree[] huffmanTrees; /// /// Quantization tables, in zigzag order. @@ -186,7 +189,7 @@ namespace ImageSharp.Formats public JpegDecoderCore() { // this.huffmanTrees = new Huffman[MaxTc + 1, MaxTh + 1]; - this.huffmanTrees = new Huffman[(MaxTc + 1) * (MaxTh + 1)]; + this.huffmanTrees = new HuffmanTree[(MaxTc + 1) * (MaxTh + 1)]; this.quantizationTables = new Block8x8F[MaxTq + 1]; this.temp = new byte[2 * Block8x8F.ScalarCount]; @@ -546,42 +549,42 @@ namespace ImageSharp.Formats } } - private void ProcessDefineHuffmanTablesMarkerLoop(ref Huffman huffman, ref int remaining) + private void ProcessDefineHuffmanTablesMarkerLoop(ref HuffmanTree huffmanTree, ref int remaining) { // Read nCodes and huffman.Valuess (and derive h.Length). // nCodes[i] is the number of codes with code length i. // h.Length is the total number of codes. - huffman.Length = 0; + huffmanTree.Length = 0; int[] ncodes = new int[MaxCodeLength]; for (int i = 0; i < ncodes.Length; i++) { ncodes[i] = this.temp[i + 1]; - huffman.Length += ncodes[i]; + huffmanTree.Length += ncodes[i]; } - if (huffman.Length == 0) + if (huffmanTree.Length == 0) { throw new ImageFormatException("Huffman table has zero length"); } - if (huffman.Length > MaxNCodes) + if (huffmanTree.Length > MaxNCodes) { throw new ImageFormatException("Huffman table has excessive length"); } - remaining -= huffman.Length + 17; + remaining -= huffmanTree.Length + 17; if (remaining < 0) { throw new ImageFormatException("DHT has wrong length"); } - this.ReadFull(huffman.Values, 0, huffman.Length); + this.ReadFull(huffmanTree.Values, 0, huffmanTree.Length); // Derive the look-up table. - for (int i = 0; i < huffman.Lut.Length; i++) + for (int i = 0; i < huffmanTree.Lut.Length; i++) { - huffman.Lut[i] = 0; + huffmanTree.Lut[i] = 0; } uint x = 0, code = 0; @@ -598,11 +601,11 @@ namespace ImageSharp.Formats // The high 8 bits of lutValue are the encoded value. // The low 8 bits are 1 plus the codeLength. byte base2 = (byte)(code << (7 - i)); - ushort lutValue = (ushort)((huffman.Values[x] << 8) | (2 + i)); + ushort lutValue = (ushort)((huffmanTree.Values[x] << 8) | (2 + i)); for (int k = 0; k < 1 << (7 - i); k++) { - huffman.Lut[base2 | k] = lutValue; + huffmanTree.Lut[base2 | k] = lutValue; } code++; @@ -617,15 +620,15 @@ namespace ImageSharp.Formats int nc = ncodes[i]; if (nc == 0) { - huffman.MinCodes[i] = -1; - huffman.MaxCodes[i] = -1; - huffman.Indices[i] = -1; + huffmanTree.MinCodes[i] = -1; + huffmanTree.MaxCodes[i] = -1; + huffmanTree.Indices[i] = -1; } else { - huffman.MinCodes[i] = c; - huffman.MaxCodes[i] = c + nc - 1; - huffman.Indices[i] = index; + huffmanTree.MinCodes[i] = c; + huffmanTree.MaxCodes[i] = c + nc - 1; + huffmanTree.Indices[i] = index; c += nc; index += nc; } @@ -637,12 +640,12 @@ namespace ImageSharp.Formats /// /// Returns the next Huffman-coded value from the bit-stream, decoded according to the given value. /// - /// The huffman value + /// The huffman value /// The - private byte DecodeHuffman(ref Huffman huffman) + private byte DecodeHuffman(ref HuffmanTree huffmanTree) { // Copy stuff to the stack: - if (huffman.Length == 0) + if (huffmanTree.Length == 0) { throw new ImageFormatException("Uninitialized Huffman table"); } @@ -653,7 +656,7 @@ namespace ImageSharp.Formats if (errorCode == ErrorCodes.NoError) { - ushort v = huffman.Lut[(this.bits.Accumulator >> (this.bits.UnreadBits - LutSize)) & 0xff]; + ushort v = huffmanTree.Lut[(this.bits.Accumulator >> (this.bits.UnreadBits - LutSize)) & 0xff]; if (v != 0) { @@ -689,9 +692,9 @@ namespace ImageSharp.Formats this.bits.UnreadBits--; this.bits.Mask >>= 1; - if (code <= huffman.MaxCodes[i]) + if (code <= huffmanTree.MaxCodes[i]) { - return huffman.Values[huffman.Indices[i] + code - huffman.MinCodes[i]]; + return huffmanTree.Values[huffmanTree.Indices[i] + code - huffmanTree.MinCodes[i]]; } code <<= 1; @@ -1927,7 +1930,7 @@ namespace ImageSharp.Formats /// The zig-zag start index /// The zig-zag end index /// The low transform offset - private void Refine(Block8x8F* b, ref Huffman h, int* unzigPtr, int zigStart, int zigEnd, int delta) + private void Refine(Block8x8F* b, ref HuffmanTree h, int* unzigPtr, int zigStart, int zigEnd, int delta) { // Refining a DC component is trivial. if (zigStart == 0) diff --git a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs index 75c38ae5a..241db3a64 100644 --- a/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs @@ -11,6 +11,8 @@ namespace ImageSharp.Formats using System.Runtime.CompilerServices; using ImageSharp.Formats.Jpg.Components; + using ImageSharp.Formats.Jpg.Components.Encoder; + using ImageSharp.Formats.Jpg.Utils; /// /// Image encoder for writing an image to a stream as a jpeg. @@ -402,7 +404,7 @@ namespace ImageSharp.Formats private void Encode444(PixelAccessor pixels) where TColor : struct, IPackedPixel, IEquatable { - // TODO: Need a JpegEncoderScanImpl struct to encapsulate all this mess: + // TODO: Need a JpegEncoderScanProcessor struct to encapsulate all this mess: Block8x8F b = default(Block8x8F); Block8x8F cb = default(Block8x8F); Block8x8F cr = default(Block8x8F); @@ -740,7 +742,7 @@ namespace ImageSharp.Formats private void WriteStartOfScan(PixelAccessor pixels) where TColor : struct, IPackedPixel, IEquatable { - // TODO: This method should be the entry point for a JpegEncoderScanImpl struct + // TODO: This method should be the entry point for a JpegEncoderScanProcessor struct // TODO: We should allow grayscale writing. this.outputStream.Write(SosHeaderYCbCr, 0, SosHeaderYCbCr.Length); @@ -761,7 +763,8 @@ namespace ImageSharp.Formats #pragma warning disable SA1201 // MethodShouldNotFollowAStruct /// - /// This struct belongs to Encode420. Much easeier to understand code if they are together. Why should I move it Up? :P + /// Poor man's stackalloc for Encode420. + /// This struct belongs to Encode420. Much easeier to understand code if they are close to each other. Why should I move it Up? :P /// private struct BlockQuad { @@ -777,7 +780,7 @@ namespace ImageSharp.Formats private void Encode420(PixelAccessor pixels) where TColor : struct, IPackedPixel, IEquatable { - // TODO: Need a JpegEncoderScanImpl struct to encapsulate all this mess: + // TODO: Need a JpegEncoderScanProcessor struct to encapsulate all this mess: Block8x8F b = default(Block8x8F); BlockQuad cb = default(BlockQuad); diff --git a/src/ImageSharp/Formats/Jpg/JpegUtils.cs b/src/ImageSharp/Formats/Jpg/Utils/JpegUtils.cs similarity index 98% rename from src/ImageSharp/Formats/Jpg/JpegUtils.cs rename to src/ImageSharp/Formats/Jpg/Utils/JpegUtils.cs index 67b33ea25..dd0e1c33c 100644 --- a/src/ImageSharp/Formats/Jpg/JpegUtils.cs +++ b/src/ImageSharp/Formats/Jpg/Utils/JpegUtils.cs @@ -2,7 +2,7 @@ // Copyright (c) James Jackson-South and contributors. // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats +namespace ImageSharp.Formats.Jpg.Utils { using System; using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Formats/Jpg/Components/MutableSpan.cs b/src/ImageSharp/Formats/Jpg/Utils/MutableSpan.cs similarity index 98% rename from src/ImageSharp/Formats/Jpg/Components/MutableSpan.cs rename to src/ImageSharp/Formats/Jpg/Utils/MutableSpan.cs index 77ee17fc2..f4c1468d6 100644 --- a/src/ImageSharp/Formats/Jpg/Components/MutableSpan.cs +++ b/src/ImageSharp/Formats/Jpg/Utils/MutableSpan.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats +namespace ImageSharp.Formats.Jpg.Utils { using System.Runtime.CompilerServices; diff --git a/src/ImageSharp/Formats/Jpg/Components/MutableSpanExtensions.cs b/src/ImageSharp/Formats/Jpg/Utils/MutableSpanExtensions.cs similarity index 99% rename from src/ImageSharp/Formats/Jpg/Components/MutableSpanExtensions.cs rename to src/ImageSharp/Formats/Jpg/Utils/MutableSpanExtensions.cs index 31df4863c..a725c3e93 100644 --- a/src/ImageSharp/Formats/Jpg/Components/MutableSpanExtensions.cs +++ b/src/ImageSharp/Formats/Jpg/Utils/MutableSpanExtensions.cs @@ -3,7 +3,7 @@ // Licensed under the Apache License, Version 2.0. // -namespace ImageSharp.Formats +namespace ImageSharp.Formats.Jpg.Utils { using System.Numerics; using System.Runtime.CompilerServices; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs index 7d66f6347..ea198350b 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs @@ -9,6 +9,7 @@ namespace ImageSharp.Tests using System.Numerics; using ImageSharp.Formats; + using ImageSharp.Formats.Jpg.Utils; using Xunit; using Xunit.Abstractions; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegTests.cs index a84c64aba..13cf515bb 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegTests.cs @@ -11,6 +11,8 @@ namespace ImageSharp.Tests { using System.Numerics; + using ImageSharp.Formats.Jpg.Utils; + public class JpegTests { private ITestOutputHelper Output { get; } @@ -68,12 +70,11 @@ namespace ImageSharp.Tests TestImages.Jpeg.Cmyk }; - private const PixelTypes BenchmarkPixels = PixelTypes.StandardImageClass; - //PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb; + private const PixelTypes BenchmarkPixels = PixelTypes.StandardImageClass; //PixelTypes.Color | PixelTypes.Argb; + + - [Theory( - Skip = "Benchmark, enable manually!" - )] + //[Theory] // Benchmark, enable manually [WithFileCollection(nameof(BenchmarkFiles), BenchmarkPixels, JpegSubsample.Ratio420, 75)] [WithFileCollection(nameof(BenchmarkFiles), BenchmarkPixels, JpegSubsample.Ratio444, 75)] public void Benchmark_JpegEncoder(TestImageProvider provider, JpegSubsample subSample, int quality) diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementations.cs b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementations.cs index 860c1b55e..bdd66d1d1 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementations.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementations.cs @@ -7,6 +7,7 @@ namespace ImageSharp.Tests using System.Runtime.CompilerServices; using ImageSharp.Formats; + using ImageSharp.Formats.Jpg.Utils; /// /// This class contains simplified (unefficient) reference implementations to produce verification data for unit tests diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.cs index d117cfd0a..aadbf2c62 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.cs @@ -3,6 +3,8 @@ namespace ImageSharp.Tests.Formats.Jpg { using System.Numerics; using ImageSharp.Formats; + using ImageSharp.Formats.Jpg.Utils; + using Xunit; using Xunit.Abstractions; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/UtilityTestClassBase.cs b/tests/ImageSharp.Tests/Formats/Jpg/UtilityTestClassBase.cs index 6191d221c..a52395f17 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/UtilityTestClassBase.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/UtilityTestClassBase.cs @@ -9,7 +9,9 @@ namespace ImageSharp.Tests using System.Collections.Generic; using System.Diagnostics; using System.Runtime.CompilerServices; - + + using ImageSharp.Formats.Jpg.Utils; + /// /// Utility class to measure the execution of an operation. ///