From df6f544341d00d611b202d588ffe66a235771b65 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Fri, 11 May 2018 16:46:20 +1000 Subject: [PATCH] Move common components --- .../Jpeg/{Common => Components}/Block8x8.cs | 2 +- .../Block8x8F.CopyTo.cs | 3 +- .../Block8x8F.Generated.cs | 2 +- .../Block8x8F.Generated.tt | 2 +- .../Jpeg/{Common => Components}/Block8x8F.cs | 58 +++++++++---------- .../Jpeg/Components/Decoder/IJpegComponent.cs | 1 - .../Jpeg/Components/Decoder/IRawJpegData.cs | 1 - .../Decoder/JpegBlockPostProcessor.cs | 1 - .../Decoder/JpegComponentPostProcessor.cs | 1 - .../Jpeg/Components/Encoder/BlockQuad.cs | 6 +- .../Encoder/YCbCrForwardConverter{TPixel}.cs | 1 - .../FastFloatingPointDCT.cs | 2 +- .../GenericBlock8x8.Generated.cs | 5 +- .../GenericBlock8x8.Generated.tt | 5 +- .../{Common => Components}/GenericBlock8x8.cs | 7 ++- .../{Common => Components}/SizeExtensions.cs | 3 +- .../Jpeg/{Common => Components}/ZigZag.cs | 3 +- .../GolangPort/Components/Decoder/Bytes.cs | 2 - .../Components/Decoder/GolangComponent.cs | 3 +- .../GolangJpegScanDecoder.ComputationData.cs | 3 +- .../GolangJpegScanDecoder.DataPointers.cs | 4 +- .../Decoder/GolangJpegScanDecoder.cs | 5 +- .../Jpeg/GolangPort/GolangJpegDecoderCore.cs | 3 +- .../Jpeg/GolangPort/JpegEncoderCore.cs | 4 +- src/ImageSharp/Formats/Jpeg/JpegFormat.cs | 2 - .../Components/PdfJsFrameComponent.cs | 3 +- .../PdfJsPort/Components/PdfJsScanDecoder.cs | 3 +- .../Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs | 3 +- src/ImageSharp/ImageSharp.csproj | 11 ++-- .../ImageSharp.Benchmarks/Color/RgbToYCbCr.cs | 17 +++--- .../General/Block8x8F_DivideRound.cs | 4 +- .../General/Block8x8F_Round.cs | 3 +- .../Jpg/Block8x8FTests.CopyToBufferArea.cs | 2 +- .../Formats/Jpg/Block8x8FTests.cs | 2 +- .../Formats/Jpg/Block8x8Tests.cs | 2 +- .../ImageSharp.Tests/Formats/Jpg/DCTTests.cs | 4 +- .../Formats/Jpg/GenericBlock8x8Tests.cs | 2 +- .../Formats/Jpg/ParseStreamTests.cs | 3 +- ...ferenceImplementationsTests.AccurateDCT.cs | 5 +- ...plementationsTests.FastFloatingPointDCT.cs | 16 ++--- ...ImplementationsTests.StandardIntegerDCT.cs | 2 +- .../Formats/Jpg/Utils/JpegFixture.cs | 8 +-- .../Jpg/Utils/LibJpegTools.ComponentData.cs | 2 +- .../Jpg/Utils/LibJpegTools.SpectralData.cs | 5 +- .../Formats/Jpg/Utils/LibJpegTools.cs | 8 +-- .../ReferenceImplementations.AccurateDCT.cs | 2 +- ...ceImplementations.LLM_FloatingPoint_DCT.cs | 4 +- ...renceImplementations.StandardIntegerDCT.cs | 4 +- .../Jpg/Utils/ReferenceImplementations.cs | 2 +- 49 files changed, 125 insertions(+), 121 deletions(-) rename src/ImageSharp/Formats/Jpeg/{Common => Components}/Block8x8.cs (99%) rename src/ImageSharp/Formats/Jpeg/{Common => Components}/Block8x8F.CopyTo.cs (99%) rename src/ImageSharp/Formats/Jpeg/{Common => Components}/Block8x8F.Generated.cs (99%) rename src/ImageSharp/Formats/Jpeg/{Common => Components}/Block8x8F.Generated.tt (98%) rename src/ImageSharp/Formats/Jpeg/{Common => Components}/Block8x8F.cs (87%) rename src/ImageSharp/Formats/Jpeg/{Common => Components}/FastFloatingPointDCT.cs (99%) rename src/ImageSharp/Formats/Jpeg/{Common => Components}/GenericBlock8x8.Generated.cs (89%) rename src/ImageSharp/Formats/Jpeg/{Common => Components}/GenericBlock8x8.Generated.tt (90%) rename src/ImageSharp/Formats/Jpeg/{Common => Components}/GenericBlock8x8.cs (96%) rename src/ImageSharp/Formats/Jpeg/{Common => Components}/SizeExtensions.cs (97%) rename src/ImageSharp/Formats/Jpeg/{Common => Components}/ZigZag.cs (98%) diff --git a/src/ImageSharp/Formats/Jpeg/Common/Block8x8.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs similarity index 99% rename from src/ImageSharp/Formats/Jpeg/Common/Block8x8.cs rename to src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs index efaa0b4a48..cb73ee9478 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Block8x8.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs @@ -7,7 +7,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common +namespace SixLabors.ImageSharp.Formats.Jpeg.Components { /// /// Represents a Jpeg block with coefficiens. diff --git a/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.CopyTo.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.CopyTo.cs similarity index 99% rename from src/ImageSharp/Formats/Jpeg/Common/Block8x8F.CopyTo.cs rename to src/ImageSharp/Formats/Jpeg/Components/Block8x8F.CopyTo.cs index d8963a8b60..43cc3e9dba 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.CopyTo.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.CopyTo.cs @@ -3,10 +3,11 @@ using System.Numerics; using System.Runtime.CompilerServices; + using SixLabors.ImageSharp.Memory; // ReSharper disable InconsistentNaming -namespace SixLabors.ImageSharp.Formats.Jpeg.Common +namespace SixLabors.ImageSharp.Formats.Jpeg.Components { internal partial struct Block8x8F { diff --git a/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.Generated.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.cs similarity index 99% rename from src/ImageSharp/Formats/Jpeg/Common/Block8x8F.Generated.cs rename to src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.cs index 93e9e03885..e83896f587 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.Generated.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.cs @@ -5,7 +5,7 @@ using System.Numerics; using System.Runtime.CompilerServices; // -namespace SixLabors.ImageSharp.Formats.Jpeg.Common +namespace SixLabors.ImageSharp.Formats.Jpeg.Components { internal partial struct Block8x8F { diff --git a/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.Generated.tt b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.tt similarity index 98% rename from src/ImageSharp/Formats/Jpeg/Common/Block8x8F.Generated.tt rename to src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.tt index dc0996b65d..82d82ef0c2 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.Generated.tt +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.tt @@ -18,7 +18,7 @@ using System.Runtime.CompilerServices; <# char[] coordz = {'X', 'Y', 'Z', 'W'}; #> -namespace SixLabors.ImageSharp.Formats.Jpeg.Common +namespace SixLabors.ImageSharp.Formats.Jpeg.Components { internal partial struct Block8x8F { diff --git a/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs similarity index 87% rename from src/ImageSharp/Formats/Jpeg/Common/Block8x8F.cs rename to src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs index 53297ab550..7d42010cb8 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs @@ -9,7 +9,7 @@ using System.Runtime.InteropServices; using System.Text; // ReSharper disable InconsistentNaming -namespace SixLabors.ImageSharp.Formats.Jpeg.Common +namespace SixLabors.ImageSharp.Formats.Jpeg.Components { /// /// Represents a Jpeg block with coefficients. @@ -17,7 +17,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common internal partial struct Block8x8F { /// - /// A number of scalar coefficients in a + /// A number of scalar coefficients in a /// public const int Size = 64; @@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common get { GuardBlockIndex(idx); - ref float selfRef = ref Unsafe.As(ref this); + ref float selfRef = ref Unsafe.As(ref this); return Unsafe.Add(ref selfRef, idx); } @@ -69,7 +69,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common set { GuardBlockIndex(idx); - ref float selfRef = ref Unsafe.As(ref this); + ref float selfRef = ref Unsafe.As(ref this); Unsafe.Add(ref selfRef, idx) = value; } } @@ -80,9 +80,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common set => this[(y * 8) + x] = value; } - public static Block8x8F operator *(Block8x8F block, float value) + public static Components.Block8x8F operator *(Components.Block8x8F block, float value) { - Block8x8F result = block; + Components.Block8x8F result = block; for (int i = 0; i < Size; i++) { float val = result[i]; @@ -93,9 +93,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common return result; } - public static Block8x8F operator /(Block8x8F block, float value) + public static Components.Block8x8F operator /(Components.Block8x8F block, float value) { - Block8x8F result = block; + Components.Block8x8F result = block; for (int i = 0; i < Size; i++) { float val = result[i]; @@ -106,9 +106,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common return result; } - public static Block8x8F operator +(Block8x8F block, float value) + public static Components.Block8x8F operator +(Components.Block8x8F block, float value) { - Block8x8F result = block; + Components.Block8x8F result = block; for (int i = 0; i < Size; i++) { float val = result[i]; @@ -119,9 +119,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common return result; } - public static Block8x8F operator -(Block8x8F block, float value) + public static Components.Block8x8F operator -(Components.Block8x8F block, float value) { - Block8x8F result = block; + Components.Block8x8F result = block; for (int i = 0; i < Size; i++) { float val = result[i]; @@ -132,16 +132,16 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common return result; } - public static Block8x8F Load(Span data) + public static Components.Block8x8F Load(Span data) { - var result = default(Block8x8F); + var result = default(Components.Block8x8F); result.LoadFrom(data); return result; } - public static Block8x8F Load(Span data) + public static Components.Block8x8F Load(Span data) { - var result = default(Block8x8F); + var result = default(Components.Block8x8F); result.LoadFrom(data); return result; } @@ -153,7 +153,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common public void Clear() { // The cheapest way to do this in C#: - this = default(Block8x8F); + this = default(Components.Block8x8F); } /// @@ -164,7 +164,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common public void LoadFrom(Span source) { ref byte s = ref Unsafe.As(ref MemoryMarshal.GetReference(source)); - ref byte d = ref Unsafe.As(ref this); + ref byte d = ref Unsafe.As(ref this); Unsafe.CopyBlock(ref d, ref s, Size * sizeof(float)); } @@ -175,7 +175,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common /// Block pointer /// Source [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static unsafe void LoadFrom(Block8x8F* blockPtr, Span source) + public static unsafe void LoadFrom(Components.Block8x8F* blockPtr, Span source) { blockPtr->LoadFrom(source); } @@ -204,7 +204,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common public void CopyTo(Span dest) { ref byte d = ref Unsafe.As(ref MemoryMarshal.GetReference(dest)); - ref byte s = ref Unsafe.As(ref this); + ref byte s = ref Unsafe.As(ref this); Unsafe.CopyBlock(ref d, ref s, Size * sizeof(float)); } @@ -215,7 +215,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common /// Pointer to block /// Destination [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static unsafe void CopyTo(Block8x8F* blockPtr, Span dest) + public static unsafe void CopyTo(Components.Block8x8F* blockPtr, Span dest) { float* fPtr = (float*)blockPtr; for (int i = 0; i < Size; i++) @@ -231,7 +231,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common /// Block pointer /// Destination [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static unsafe void CopyTo(Block8x8F* blockPtr, Span dest) + public static unsafe void CopyTo(Components.Block8x8F* blockPtr, Span dest) { blockPtr->CopyTo(dest); } @@ -301,7 +301,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common /// Multiply all elements of the block by the corresponding elements of 'other' /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MultiplyInplace(ref Block8x8F other) + public void MultiplyInplace(ref Components.Block8x8F other) { this.V0L *= other.V0L; this.V0R *= other.V0R; @@ -353,7 +353,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common /// Qt pointer /// Unzig pointer // [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static unsafe void DequantizeBlock(Block8x8F* blockPtr, Block8x8F* qtPtr, byte* unzigPtr) + public static unsafe void DequantizeBlock(Components.Block8x8F* blockPtr, Components.Block8x8F* qtPtr, byte* unzigPtr) { float* b = (float*)blockPtr; float* qtp = (float*)qtPtr; @@ -378,9 +378,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common /// The quantization table /// Pointer to elements of public static unsafe void Quantize( - Block8x8F* block, - Block8x8F* dest, - Block8x8F* qt, + Components.Block8x8F* block, + Components.Block8x8F* dest, + Components.Block8x8F* qt, byte* unzigPtr) { float* s = (float*)block; @@ -399,7 +399,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common /// /// The destination block. /// The source block. - public static unsafe void Scale16X16To8X8(Block8x8F* destination, Block8x8F* source) + public static unsafe void Scale16X16To8X8(Components.Block8x8F* destination, Components.Block8x8F* source) { float* d = (float*)destination; for (int i = 0; i < 4; i++) @@ -421,7 +421,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void DivideRoundAll(ref Block8x8F a, ref Block8x8F b) + private static void DivideRoundAll(ref Components.Block8x8F a, ref Components.Block8x8F b) { a.V0L = DivideRound(a.V0L, b.V0L); a.V0R = DivideRound(a.V0R, b.V0R); diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/IJpegComponent.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IJpegComponent.cs index 0256bd4495..efa746819d 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/IJpegComponent.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IJpegComponent.cs @@ -1,7 +1,6 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using SixLabors.ImageSharp.Formats.Jpeg.Common; using SixLabors.ImageSharp.Memory; using SixLabors.Primitives; diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs index 2c383abe0a..dace78b337 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; -using SixLabors.ImageSharp.Formats.Jpeg.Common; using SixLabors.Primitives; namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs index 640ca74ed7..b586d520a6 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs @@ -3,7 +3,6 @@ using System.Runtime.InteropServices; -using SixLabors.ImageSharp.Formats.Jpeg.Common; using SixLabors.ImageSharp.Memory; using SixLabors.Primitives; diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs index ac49b08a51..fe18f8438c 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs @@ -3,7 +3,6 @@ using System; -using SixLabors.ImageSharp.Formats.Jpeg.Common; using SixLabors.ImageSharp.Memory; using SixLabors.Primitives; diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/BlockQuad.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/BlockQuad.cs index 39970d7695..7a312138d0 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/BlockQuad.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/BlockQuad.cs @@ -1,12 +1,10 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using Block8x8F = SixLabors.ImageSharp.Formats.Jpeg.Common.Block8x8F; - -namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Encoder +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder { /// - /// Poor man's stackalloc: Contains a value-type buffer sized for 4 instances. + /// Poor man's stackalloc: Contains a value-type buffer sized for 4 instances. /// Useful for decoder/encoder operations allocating a block for each Jpeg component. /// internal unsafe struct BlockQuad diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/YCbCrForwardConverter{TPixel}.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/YCbCrForwardConverter{TPixel}.cs index 48392b85ad..311ffed24b 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/YCbCrForwardConverter{TPixel}.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/YCbCrForwardConverter{TPixel}.cs @@ -2,7 +2,6 @@ using System.Runtime.CompilerServices; using SixLabors.ImageSharp.Advanced; -using SixLabors.ImageSharp.Formats.Jpeg.Common; using SixLabors.ImageSharp.PixelFormats; namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder diff --git a/src/ImageSharp/Formats/Jpeg/Common/FastFloatingPointDCT.cs b/src/ImageSharp/Formats/Jpeg/Components/FastFloatingPointDCT.cs similarity index 99% rename from src/ImageSharp/Formats/Jpeg/Common/FastFloatingPointDCT.cs rename to src/ImageSharp/Formats/Jpeg/Components/FastFloatingPointDCT.cs index 3ee6e72c5d..dcdc7e9ba7 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/FastFloatingPointDCT.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/FastFloatingPointDCT.cs @@ -5,7 +5,7 @@ using System.Numerics; using System.Runtime.CompilerServices; // ReSharper disable InconsistentNaming -namespace SixLabors.ImageSharp.Formats.Jpeg.Common +namespace SixLabors.ImageSharp.Formats.Jpeg.Components { /// /// Contains inaccurate, but fast forward and inverse DCT implementations. diff --git a/src/ImageSharp/Formats/Jpeg/Common/GenericBlock8x8.Generated.cs b/src/ImageSharp/Formats/Jpeg/Components/GenericBlock8x8.Generated.cs similarity index 89% rename from src/ImageSharp/Formats/Jpeg/Common/GenericBlock8x8.Generated.cs rename to src/ImageSharp/Formats/Jpeg/Components/GenericBlock8x8.Generated.cs index 1bb37a7d32..0cc729371f 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/GenericBlock8x8.Generated.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/GenericBlock8x8.Generated.cs @@ -1,11 +1,8 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using System.Numerics; -using System.Runtime.CompilerServices; - // -namespace SixLabors.ImageSharp.Formats.Jpeg.Common +namespace SixLabors.ImageSharp.Formats.Jpeg.Components { internal unsafe partial struct GenericBlock8x8 { diff --git a/src/ImageSharp/Formats/Jpeg/Common/GenericBlock8x8.Generated.tt b/src/ImageSharp/Formats/Jpeg/Components/GenericBlock8x8.Generated.tt similarity index 90% rename from src/ImageSharp/Formats/Jpeg/Common/GenericBlock8x8.Generated.tt rename to src/ImageSharp/Formats/Jpeg/Components/GenericBlock8x8.Generated.tt index d9b15b34fa..28bcea791b 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/GenericBlock8x8.Generated.tt +++ b/src/ImageSharp/Formats/Jpeg/Components/GenericBlock8x8.Generated.tt @@ -11,11 +11,8 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using System.Numerics; -using System.Runtime.CompilerServices; - // -namespace SixLabors.ImageSharp.Formats.Jpeg.Common +namespace SixLabors.ImageSharp.Formats.Jpeg.Components { internal unsafe partial struct GenericBlock8x8 { diff --git a/src/ImageSharp/Formats/Jpeg/Common/GenericBlock8x8.cs b/src/ImageSharp/Formats/Jpeg/Components/GenericBlock8x8.cs similarity index 96% rename from src/ImageSharp/Formats/Jpeg/Common/GenericBlock8x8.cs rename to src/ImageSharp/Formats/Jpeg/Components/GenericBlock8x8.cs index 09a7eb73aa..4cbca2d8dd 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/GenericBlock8x8.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/GenericBlock8x8.cs @@ -1,13 +1,16 @@ +// 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.Advanced; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; -using SixLabors.Primitives; // ReSharper disable InconsistentNaming -namespace SixLabors.ImageSharp.Formats.Jpeg.Common +namespace SixLabors.ImageSharp.Formats.Jpeg.Components { /// /// A generic 8x8 block implementation, useful for manipulating custom 8x8 pixel data. diff --git a/src/ImageSharp/Formats/Jpeg/Common/SizeExtensions.cs b/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs similarity index 97% rename from src/ImageSharp/Formats/Jpeg/Common/SizeExtensions.cs rename to src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs index 978688673f..48ad188561 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/SizeExtensions.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/SizeExtensions.cs @@ -3,9 +3,10 @@ using System; using System.Numerics; + using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common +namespace SixLabors.ImageSharp.Formats.Jpeg.Components { /// /// Extension methods for diff --git a/src/ImageSharp/Formats/Jpeg/Common/ZigZag.cs b/src/ImageSharp/Formats/Jpeg/Components/ZigZag.cs similarity index 98% rename from src/ImageSharp/Formats/Jpeg/Common/ZigZag.cs rename to src/ImageSharp/Formats/Jpeg/Components/ZigZag.cs index cb035a8d3d..a3701f2c1b 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/ZigZag.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/ZigZag.cs @@ -1,10 +1,11 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. + using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common +namespace SixLabors.ImageSharp.Formats.Jpeg.Components { /// /// Holds the Jpeg UnZig array in a value/stack type. diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs index aaaa10a160..c8c68aa7ea 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/Bytes.cs @@ -5,8 +5,6 @@ using System; using System.IO; using System.Runtime.CompilerServices; -using SixLabors.ImageSharp.Formats.Jpeg.Common; - namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder { /// diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangComponent.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangComponent.cs index 67ef3aa48b..bb3bd01aa3 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangComponent.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangComponent.cs @@ -3,7 +3,8 @@ using System; using System.Runtime.CompilerServices; -using SixLabors.ImageSharp.Formats.Jpeg.Common; + +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.Memory; using SixLabors.Primitives; diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangJpegScanDecoder.ComputationData.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangJpegScanDecoder.ComputationData.cs index f912cfccdc..f1dd2526ae 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangJpegScanDecoder.ComputationData.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangJpegScanDecoder.ComputationData.cs @@ -2,7 +2,8 @@ // Licensed under the Apache License, Version 2.0. using System.Runtime.InteropServices; -using SixLabors.ImageSharp.Formats.Jpeg.Common; + +using SixLabors.ImageSharp.Formats.Jpeg.Components; namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder { diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangJpegScanDecoder.DataPointers.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangJpegScanDecoder.DataPointers.cs index 87a35a49f3..bc9e0a5c62 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangJpegScanDecoder.DataPointers.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangJpegScanDecoder.DataPointers.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder { @@ -11,7 +11,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder internal unsafe partial struct GolangJpegScanDecoder { /// - /// Contains pointers to the memory regions of so they can be easily passed around to pointer based utility methods of + /// Contains pointers to the memory regions of so they can be easily passed around to pointer based utility methods of /// public struct DataPointers { diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangJpegScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangJpegScanDecoder.cs index 156ccdd63e..3a88cfad4b 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangJpegScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangJpegScanDecoder.cs @@ -3,7 +3,8 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using SixLabors.ImageSharp.Formats.Jpeg.Common; + +using SixLabors.ImageSharp.Formats.Jpeg.Components; // ReSharper disable InconsistentNaming namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder @@ -558,7 +559,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder if (bit) { - int stuff = (int)Block8x8.GetScalarAt(b, 0); + int stuff = Block8x8.GetScalarAt(b, 0); // int stuff = (int)b[0]; stuff |= delta; diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/GolangJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/GolangJpegDecoderCore.cs index bfd84723e6..fbcd265ac3 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/GolangJpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/GolangJpegDecoderCore.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using System.IO; -using SixLabors.ImageSharp.Formats.Jpeg.Common; + +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder; using SixLabors.ImageSharp.MetaData; diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/JpegEncoderCore.cs index 7131d1a77f..9af73cc810 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/JpegEncoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/JpegEncoderCore.cs @@ -3,9 +3,9 @@ using System.IO; using System.Runtime.CompilerServices; -using SixLabors.ImageSharp.Formats.Jpeg.Common; + +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder; -using SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Encoder; using SixLabors.ImageSharp.MetaData.Profiles.Exif; using SixLabors.ImageSharp.MetaData.Profiles.Icc; using SixLabors.ImageSharp.PixelFormats; diff --git a/src/ImageSharp/Formats/Jpeg/JpegFormat.cs b/src/ImageSharp/Formats/Jpeg/JpegFormat.cs index 51d5824996..9a18f14d30 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegFormat.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegFormat.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; -using SixLabors.ImageSharp.Formats.Jpeg.Common; - namespace SixLabors.ImageSharp.Formats.Jpeg { /// diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs index 9c74aef908..ccbb5c6c01 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs @@ -4,7 +4,8 @@ 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.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.Memory; using SixLabors.Primitives; diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs index 0cdce7485a..49bc105391 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs @@ -7,7 +7,8 @@ using System.Diagnostics; #endif using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using SixLabors.ImageSharp.Formats.Jpeg.Common; + +using SixLabors.ImageSharp.Formats.Jpeg.Components; namespace SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components { diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs index 4a6ec4377e..6ce7e92ece 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs @@ -7,7 +7,8 @@ using System.Collections.Generic; using System.IO; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using SixLabors.ImageSharp.Formats.Jpeg.Common; + +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components; using SixLabors.ImageSharp.Memory; diff --git a/src/ImageSharp/ImageSharp.csproj b/src/ImageSharp/ImageSharp.csproj index 7cbe862835..0c793d4bc3 100644 --- a/src/ImageSharp/ImageSharp.csproj +++ b/src/ImageSharp/ImageSharp.csproj @@ -57,11 +57,11 @@ true - + TextTemplatingFileGenerator Block8x8F.Generated.cs - + TextTemplatingFileGenerator GenericBlock8x8.Generated.cs @@ -87,12 +87,12 @@ - + True True Block8x8F.Generated.tt - + True True GenericBlock8x8.Generated.tt @@ -123,4 +123,7 @@ PorterDuffFunctions.Generated.tt + + + \ No newline at end of file diff --git a/tests/ImageSharp.Benchmarks/Color/RgbToYCbCr.cs b/tests/ImageSharp.Benchmarks/Color/RgbToYCbCr.cs index c4a77acc26..07ae17d754 100644 --- a/tests/ImageSharp.Benchmarks/Color/RgbToYCbCr.cs +++ b/tests/ImageSharp.Benchmarks/Color/RgbToYCbCr.cs @@ -1,13 +1,12 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using System; -using System.Buffers; using System.Numerics; using System.Runtime.CompilerServices; using BenchmarkDotNet.Attributes; -using SixLabors.ImageSharp.Formats.Jpeg.Common; + +using SixLabors.ImageSharp.Formats.Jpeg.Components; namespace SixLabors.ImageSharp.Benchmarks { @@ -104,14 +103,14 @@ namespace SixLabors.ImageSharp.Benchmarks } } } - + public struct Result { internal Block8x8F Y; internal Block8x8F Cb; internal Block8x8F Cr; } - + // The operation is defined as "RGBA -> YCbCr Transform a stream of bytes into a stream of floats" // We need to benchmark the whole operation, to get true results, not missing any side effects! private byte[] inputSourceRGB = null; @@ -200,11 +199,11 @@ namespace SixLabors.ImageSharp.Benchmarks float* cbPtr = (float*)&result.Cb; float* crPtr = (float*)&result.Cr; // end of code-bloat block :) - + Vector yCoeffs = new Vector(ScaledCoeffs.Y); Vector cbCoeffs = new Vector(ScaledCoeffs.Cb); Vector crCoeffs = new Vector(ScaledCoeffs.Cr); - + for (int i = 0; i < this.inputSourceRGB.Length; i++) { this.inputSourceRGBAsInteger[i] = this.inputSourceRGB[i]; @@ -217,7 +216,7 @@ namespace SixLabors.ImageSharp.Benchmarks Vector y = yCoeffs * rgb; Vector cb = cbCoeffs * rgb; Vector cr = crCoeffs * rgb; - + *yPtr++ = (y[0] + y[1] + y[2]) >> 10; *cbPtr++ = 128 + ((cb[0] - cb[1] + cb[2]) >> 10); *crPtr++ = 128 + ((cr[0] - cr[1] - cr[2]) >> 10); @@ -335,7 +334,7 @@ namespace SixLabors.ImageSharp.Benchmarks *crPtr++ = 128 + ((cr0 - cr1 - cr2) >> 10); } } - + [Benchmark(Description = "Scaled Integer LUT Conversion")] public unsafe void RgbaToYcbCrScaledIntegerLut() { diff --git a/tests/ImageSharp.Benchmarks/General/Block8x8F_DivideRound.cs b/tests/ImageSharp.Benchmarks/General/Block8x8F_DivideRound.cs index bad87cc11a..fcc5f9a592 100644 --- a/tests/ImageSharp.Benchmarks/General/Block8x8F_DivideRound.cs +++ b/tests/ImageSharp.Benchmarks/General/Block8x8F_DivideRound.cs @@ -5,7 +5,9 @@ using System.Numerics; using System.Runtime.CompilerServices; using BenchmarkDotNet.Attributes; -using SixLabors.ImageSharp.Formats.Jpeg.Common; + +using SixLabors.ImageSharp.Formats.Jpeg.Components; + // ReSharper disable InconsistentNaming namespace SixLabors.ImageSharp.Benchmarks.General diff --git a/tests/ImageSharp.Benchmarks/General/Block8x8F_Round.cs b/tests/ImageSharp.Benchmarks/General/Block8x8F_Round.cs index d101bf0509..200af64c25 100644 --- a/tests/ImageSharp.Benchmarks/General/Block8x8F_Round.cs +++ b/tests/ImageSharp.Benchmarks/General/Block8x8F_Round.cs @@ -6,8 +6,7 @@ using System.Runtime.CompilerServices; using BenchmarkDotNet.Attributes; -using SixLabors.ImageSharp; -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; namespace SixLabors.ImageSharp.Benchmarks.General { diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs index 4b5cf526b0..aa7d101c0d 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs @@ -4,7 +4,7 @@ // Uncomment this to turn unit tests into benchmarks: //#define BENCHMARKING -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils; using SixLabors.Primitives; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs index ac8bed13b0..e72f4945b7 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs @@ -7,7 +7,7 @@ using System; using System.Diagnostics; -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils; using Xunit; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8Tests.cs b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8Tests.cs index c7869a6ba8..3df927aeb0 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8Tests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8Tests.cs @@ -1,7 +1,7 @@ // Copyright (c) Six Labors and contributors. // Licensed under the Apache License, Version 2.0. -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils; using Xunit; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs index 1c18df76c6..92b92eb100 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs @@ -1,7 +1,7 @@ // ReSharper disable InconsistentNaming using System; -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils; using Xunit; @@ -102,7 +102,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg var temp = default(Block8x8F); var actual = default(Block8x8F); FastFloatingPointDCT.TransformIDCT(ref source, ref actual, ref temp); - + this.CompareBlocks(expected, actual, 1f); } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/GenericBlock8x8Tests.cs b/tests/ImageSharp.Tests/Formats/Jpg/GenericBlock8x8Tests.cs index 5bb3ded0b1..05ded4341d 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/GenericBlock8x8Tests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/GenericBlock8x8Tests.cs @@ -3,7 +3,7 @@ using System; -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.PixelFormats; using Xunit; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs index 72c2dddc4f..e26557424f 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs @@ -2,8 +2,7 @@ // Licensed under the Apache License, Version 2.0. using System.Text; - -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.Formats.Jpeg.GolangPort; using SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.AccurateDCT.cs b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.AccurateDCT.cs index b9ae97409c..dd2113624e 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.AccurateDCT.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.AccurateDCT.cs @@ -1,4 +1,7 @@ -using SixLabors.ImageSharp.Formats.Jpeg.Common; +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils; using Xunit; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.FastFloatingPointDCT.cs b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.FastFloatingPointDCT.cs index 11612d3e2b..ce6f0a744f 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.FastFloatingPointDCT.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.FastFloatingPointDCT.cs @@ -1,8 +1,8 @@ -// ReSharper disable InconsistentNaming - -using System; +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. -using SixLabors.ImageSharp.Formats.Jpeg.Common; +// ReSharper disable InconsistentNaming +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils; using Xunit; @@ -36,13 +36,13 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg this.CompareBlocks(original, src, 0.1f); } - + // [Fact] public void LLM_CalcConstants() { ReferenceImplementations.LLM_FloatingPoint_DCT.PrintConstants(this.Output); } - + [Theory] [InlineData(42, 1000)] [InlineData(1, 1000)] @@ -76,7 +76,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg Block8x8F fExpected = iExpected.AsFloatBlock(); Block8x8F fActual = ReferenceImplementations.LLM_FloatingPoint_DCT.TransformIDCT(ref fSource); - + this.CompareBlocks(fExpected, fActual, 2); } @@ -113,7 +113,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg ReferenceImplementations.AccurateDCT.TransformIDCTInplace(intData); float[] dest = new float[64]; - + ReferenceImplementations.GT_FloatingPoint_DCT.iDCT8x8GT(floatSrc, dest); this.CompareBlocks(intData.ConvertAllToFloat(), dest, 1f); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.StandardIntegerDCT.cs b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.StandardIntegerDCT.cs index f249aa93bf..f299807fc7 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.StandardIntegerDCT.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ReferenceImplementationsTests.StandardIntegerDCT.cs @@ -2,7 +2,7 @@ using System; -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils; using Xunit; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.cs index ea11d395d4..bb6ade0e70 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/JpegFixture.cs @@ -9,7 +9,7 @@ using System.IO; using System.Text; using SixLabors.ImageSharp.Formats.Jpeg; -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Formats.Jpeg.GolangPort; using Xunit; @@ -94,7 +94,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils double val = rnd.NextDouble(); val *= maxValue - minValue; val += minValue; - + result[i * 8 + j] = (float)val; } } @@ -147,7 +147,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils internal void CompareBlocks(Block8x8 a, Block8x8 b, int tolerance) => this.CompareBlocks(a.AsFloatBlock(), b.AsFloatBlock(), (float)tolerance + 1e-5f); - internal void CompareBlocks(Block8x8F a, Block8x8F b, float tolerance) + internal void CompareBlocks(Block8x8F a, Block8x8F b, float tolerance) => this.CompareBlocks(a.ToArray(), b.ToArray(), tolerance); internal void CompareBlocks(Span a, Span b, float tolerance) @@ -170,7 +170,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils } } - this.Output.WriteLine("TOTAL DIFF: "+totalDifference); + this.Output.WriteLine("TOTAL DIFF: " + totalDifference); Assert.False(failed); } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.ComponentData.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.ComponentData.cs index 1e7d77722a..90cc45e4aa 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.ComponentData.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.ComponentData.cs @@ -1,3 +1,4 @@ +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.PixelFormats; @@ -7,7 +8,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils using System.Linq; using System.Numerics; - using SixLabors.ImageSharp.Formats.Jpeg.Common; using SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder; using SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components; using SixLabors.ImageSharp.Memory; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.SpectralData.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.SpectralData.cs index 4285950f8e..ae8194e1a9 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.SpectralData.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.SpectralData.cs @@ -1,8 +1,11 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + using System; using System.Linq; using System.Numerics; -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; using SixLabors.ImageSharp.Formats.Jpeg.GolangPort; using SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder; using SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs index fd78d2ece8..3de4673f5d 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.IO; using System.Numerics; -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils { @@ -66,14 +66,14 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils string args = $@"""{sourceFile}"" ""{destFile}"""; var process = new Process - { - StartInfo = + { + StartInfo = { FileName = DumpToolFullPath, Arguments = args, WindowStyle = ProcessWindowStyle.Hidden } - }; + }; process.Start(); process.WaitForExit(); } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.AccurateDCT.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.AccurateDCT.cs index 08ef40952b..2712d1933c 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.AccurateDCT.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.AccurateDCT.cs @@ -1,6 +1,6 @@ using System; -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils { diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs index e3bae95c82..46f4fe14dc 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs @@ -3,7 +3,7 @@ using System; using System.Numerics; using System.Runtime.CompilerServices; -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; using Xunit.Abstractions; @@ -520,7 +520,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils y[1] = c0 + c3; y[7] = c0 - c3; } - + internal static void fDCT2D_llm( Span s, Span d, diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.StandardIntegerDCT.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.StandardIntegerDCT.cs index 3d2cbe54f7..18c0bdb50e 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.StandardIntegerDCT.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.StandardIntegerDCT.cs @@ -1,7 +1,7 @@ // ReSharper disable InconsistentNaming using System; -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils { @@ -88,7 +88,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils result.LoadFrom(temp); return result; } - + /// /// Performs a forward DCT on an 8x8 block of coefficients, including a level shift. /// Leave results scaled up by an overall factor of 8. diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.cs index 3e3a732e75..f5940e05d4 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.cs @@ -6,7 +6,7 @@ using System; using System.Runtime.CompilerServices; -using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Components; namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils {