diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/AdobeMarker.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs similarity index 97% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/AdobeMarker.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs index 40059c5a0..af0938d30 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/AdobeMarker.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/AdobeMarker.cs @@ -4,7 +4,7 @@ using System; // ReSharper disable InconsistentNaming -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder { /// /// Provides information about the Adobe marker segment. @@ -78,7 +78,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder return true; } - marker = default(AdobeMarker); + marker = default; return false; } diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromCmyk.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromCmyk.cs similarity index 90% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromCmyk.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromCmyk.cs index 86d595784..dd951f6a1 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromCmyk.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromCmyk.cs @@ -4,11 +4,11 @@ using System; using System.Numerics; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder.ColorConverters +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters { internal abstract partial class JpegColorConverter { - internal class FromCmyk : ColorConverters.JpegColorConverter + internal class FromCmyk : JpegColorConverter { public FromCmyk() : base(JpegColorSpace.Cmyk) diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromGrayScale.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromGrayScale.cs similarity index 87% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromGrayScale.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromGrayScale.cs index 4769bef1d..cf622db06 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromGrayScale.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromGrayScale.cs @@ -4,11 +4,11 @@ using System; using System.Numerics; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder.ColorConverters +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters { internal abstract partial class JpegColorConverter { - internal class FromGrayscale : ColorConverters.JpegColorConverter + internal class FromGrayscale : JpegColorConverter { public FromGrayscale() : base(JpegColorSpace.Grayscale) diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromRgb.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromRgb.cs similarity index 89% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromRgb.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromRgb.cs index 7f01eedad..4a0a76651 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromRgb.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromRgb.cs @@ -4,11 +4,11 @@ using System; using System.Numerics; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder.ColorConverters +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters { internal abstract partial class JpegColorConverter { - internal class FromRgb : ColorConverters.JpegColorConverter + internal class FromRgb : JpegColorConverter { public FromRgb() : base(JpegColorSpace.RGB) diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromYCbCrBasic.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYCbCrBasic.cs similarity index 91% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromYCbCrBasic.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYCbCrBasic.cs index ddd2197d4..e05db7feb 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromYCbCrBasic.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYCbCrBasic.cs @@ -4,11 +4,11 @@ using System; using System.Numerics; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder.ColorConverters +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters { internal abstract partial class JpegColorConverter { - internal class FromYCbCrBasic : ColorConverters.JpegColorConverter + internal class FromYCbCrBasic : JpegColorConverter { public FromYCbCrBasic() : base(JpegColorSpace.YCbCr) diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimd.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimd.cs similarity index 96% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimd.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimd.cs index 2f214f88a..7452caad4 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimd.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimd.cs @@ -5,13 +5,14 @@ using System; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; + using SixLabors.ImageSharp.Common.Tuples; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder.ColorConverters +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters { internal abstract partial class JpegColorConverter { - internal class FromYCbCrSimd : ColorConverters.JpegColorConverter + internal class FromYCbCrSimd : JpegColorConverter { public FromYCbCrSimd() : base(JpegColorSpace.YCbCr) diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimdAvx2.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimdAvx2.cs similarity index 96% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimdAvx2.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimdAvx2.cs index f8a451422..f75c72c4a 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimdAvx2.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimdAvx2.cs @@ -5,14 +5,15 @@ using System; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; + using SixLabors.ImageSharp.Common.Tuples; // ReSharper disable ImpureMethodCallOnReadonlyValueField -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder.ColorConverters +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters { internal abstract partial class JpegColorConverter { - internal class FromYCbCrSimdAvx2 : ColorConverters.JpegColorConverter + internal class FromYCbCrSimdAvx2 : JpegColorConverter { public FromYCbCrSimdAvx2() : base(JpegColorSpace.YCbCr) diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromYccK.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYccK.cs similarity index 95% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromYccK.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYccK.cs index 6d8e6ef5a..e9356c707 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.FromYccK.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYccK.cs @@ -4,7 +4,7 @@ using System; using System.Numerics; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder.ColorConverters +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters { internal abstract partial class JpegColorConverter { diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs similarity index 94% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs index 4391be548..e3c2533a8 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ColorConverters/JpegColorConverter.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs @@ -5,10 +5,11 @@ using System; using System.Collections.Generic; using System.Linq; using System.Numerics; + using SixLabors.ImageSharp.Common.Tuples; using SixLabors.ImageSharp.Memory; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder.ColorConverters +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters { /// /// Encapsulates the conversion of Jpeg channels to RGBA values packed in buffer. @@ -20,7 +21,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder.ColorConverters /// private static readonly JpegColorConverter[] Converters = { - GetYCbCrConverter(), new FromYccK(), new FromCmyk(), new FromGrayscale(), new FromRgb() + GetYCbCrConverter(), new JpegColorConverter.FromYccK(), new JpegColorConverter.FromCmyk(), new JpegColorConverter.FromGrayscale(), new JpegColorConverter.FromRgb() }; /// @@ -61,7 +62,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder.ColorConverters /// Returns the for the YCbCr colorspace that matches the current CPU architecture. /// private static JpegColorConverter GetYCbCrConverter() => - FromYCbCrSimdAvx2.IsAvailable ? (JpegColorConverter)new FromYCbCrSimdAvx2() : new FromYCbCrSimd(); + JpegColorConverter.FromYCbCrSimdAvx2.IsAvailable ? (JpegColorConverter)new JpegColorConverter.FromYCbCrSimdAvx2() : new JpegColorConverter.FromYCbCrSimd(); /// /// A stack-only struct to reference the input buffers using -s. diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/IJpegComponent.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IJpegComponent.cs similarity index 90% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/IJpegComponent.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/IJpegComponent.cs index de9f75dc1..0256bd449 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/IJpegComponent.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IJpegComponent.cs @@ -1,7 +1,11 @@ +// 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; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder { /// /// Common interface to represent raw Jpeg components. diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/IRawJpegData.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs similarity index 78% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/IRawJpegData.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs index 3873656a4..2c383abe0 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/IRawJpegData.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/IRawJpegData.cs @@ -1,13 +1,17 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + using System; using System.Collections.Generic; +using SixLabors.ImageSharp.Formats.Jpeg.Common; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder { /// /// - /// Represents decompressed, unprocessed jpeg data with spectral space -s. + /// Represents decompressed, unprocessed jpeg data with spectral space -s. /// internal interface IRawJpegData : IDisposable { diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JFifMarker.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs similarity index 98% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/JFifMarker.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs index afe4794a2..591af6344 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JFifMarker.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JFifMarker.cs @@ -3,7 +3,7 @@ using System; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder { /// /// Provides information about the JFIF marker segment diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegBlockPostProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs similarity index 96% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegBlockPostProcessor.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs index 2f59bcb82..640ca74ed 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegBlockPostProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs @@ -2,10 +2,12 @@ // Licensed under the Apache License, Version 2.0. using System.Runtime.InteropServices; + +using SixLabors.ImageSharp.Formats.Jpeg.Common; using SixLabors.ImageSharp.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder { /// /// Encapsulates the implementation of processing "raw" -s into Jpeg image channels. diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegColorSpace.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegColorSpace.cs similarity index 59% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegColorSpace.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegColorSpace.cs index abc93727e..2861a2c2e 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegColorSpace.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegColorSpace.cs @@ -1,4 +1,7 @@ -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder { /// /// Identifies the colorspace of a Jpeg image diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegComponentPostProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs similarity index 94% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegComponentPostProcessor.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs index 1be637b6d..ac49b08a5 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegComponentPostProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs @@ -1,8 +1,13 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + using System; + +using SixLabors.ImageSharp.Formats.Jpeg.Common; using SixLabors.ImageSharp.Memory; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder { /// /// Encapsulates postprocessing data for one component for . diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegImagePostProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs similarity index 90% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegImagePostProcessor.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs index 483242c76..2d4865555 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegImagePostProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs @@ -1,12 +1,18 @@ +// 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.Advanced; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.PixelFormats; using SixLabors.Primitives; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder +using JpegColorConverter = SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters.JpegColorConverter; + +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder { /// /// Encapsulates the execution od post-processing algorithms to be applied on a to produce a valid :
@@ -36,9 +42,9 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder private readonly IBuffer rgbaBuffer; /// - /// The corresponding to the current determined by . + /// The corresponding to the current determined by . /// - private ColorConverters.JpegColorConverter colorConverter; + private readonly JpegColorConverter colorConverter; /// /// Initializes a new instance of the class. @@ -54,7 +60,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder this.ComponentProcessors = rawJpeg.Components.Select(c => new JpegComponentPostProcessor(memoryManager, this, c)).ToArray(); this.rgbaBuffer = memoryManager.Allocate(rawJpeg.ImageSizeInPixels.Width); - this.colorConverter = ColorConverters.JpegColorConverter.GetConverter(rawJpeg.ColorSpace); + this.colorConverter = JpegColorConverter.GetConverter(rawJpeg.ColorSpace); } /// @@ -148,7 +154,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder { int y = yy - this.PixelRowCounter; - var values = new ColorConverters.JpegColorConverter.ComponentValues(buffers, y); + var values = new JpegColorConverter.ComponentValues(buffers, y); this.colorConverter.ConvertToRGBA(values, this.rgbaBuffer.Span); Span destRow = destination.GetPixelRowSpan(yy); diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ProfileResolver.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ProfileResolver.cs similarity index 96% rename from src/ImageSharp/Formats/Jpeg/Common/Decoder/ProfileResolver.cs rename to src/ImageSharp/Formats/Jpeg/Components/Decoder/ProfileResolver.cs index 2030ad71b..e5de4441c 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/ProfileResolver.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ProfileResolver.cs @@ -4,7 +4,7 @@ using System; using System.Text; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder +namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder { /// /// Provides methods for identifying metadata and color profiles within jpeg images. diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangComponent.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangComponent.cs index ec8d96db9..67ef3aa48 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangComponent.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/GolangComponent.cs @@ -4,7 +4,7 @@ using System; using System.Runtime.CompilerServices; using SixLabors.ImageSharp.Formats.Jpeg.Common; -using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder; +using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.Memory; using SixLabors.Primitives; diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs index 8019de2f2..c7e14ee4f 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs @@ -30,7 +30,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder /// Temporal buffer, same as public InputProcessor(Stream inputStream, byte[] temp) { - this.Bits = default(Bits); + this.Bits = default; this.Bytes = Bytes.Create(); this.InputStream = inputStream; this.Temp = temp; @@ -386,7 +386,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder /// public void ResetHuffmanDecoder() { - this.Bits = default(Bits); + this.Bits = default; } } } \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/GolangJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/GolangJpegDecoderCore.cs index 4f9524070..bfd84723e 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/GolangJpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/GolangJpegDecoderCore.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.IO; using SixLabors.ImageSharp.Formats.Jpeg.Common; -using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder; +using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder; using SixLabors.ImageSharp.MetaData; using SixLabors.ImageSharp.MetaData.Profiles.Exif; @@ -768,7 +768,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort { var scan = default(GolangJpegScanDecoder); GolangJpegScanDecoder.InitStreamReading(&scan, this, remaining); - this.InputProcessor.Bits = default(Bits); + this.InputProcessor.Bits = default; scan.DecodeBlocks(this); } diff --git a/src/ImageSharp/Formats/Jpeg/Common/JpegConstants.cs b/src/ImageSharp/Formats/Jpeg/JpegConstants.cs similarity index 99% rename from src/ImageSharp/Formats/Jpeg/Common/JpegConstants.cs rename to src/ImageSharp/Formats/Jpeg/JpegConstants.cs index e0f4e0731..49e3b4170 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/JpegConstants.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegConstants.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace SixLabors.ImageSharp.Formats.Jpeg.Common +namespace SixLabors.ImageSharp.Formats.Jpeg { /// /// Contains jpeg constant values defined in the specification. diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs index 7f50a8529..9c74aef90 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsFrameComponent.cs @@ -5,7 +5,7 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using SixLabors.ImageSharp.Formats.Jpeg.Common; -using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder; +using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.Memory; using SixLabors.Primitives; @@ -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/PdfJsScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/Components/PdfJsScanDecoder.cs index 8b6282e4e..0cdce7485 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; @@ -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)] diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs index 67d921ef1..4a6ec4377 100644 --- a/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegDecoderCore.cs @@ -8,7 +8,7 @@ using System.IO; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using SixLabors.ImageSharp.Formats.Jpeg.Common; -using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder; +using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.Formats.Jpeg.PdfJsPort.Components; using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.MetaData; diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/YCbCrColorConversion.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/YCbCrColorConversion.cs index 5f902ff64..ef0d55765 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/YCbCrColorConversion.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/YCbCrColorConversion.cs @@ -1,14 +1,14 @@ -namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg +using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters; + +namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg { using System; using System.Numerics; using BenchmarkDotNet.Attributes; - using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder; - using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder.ColorConverters; using SixLabors.ImageSharp.Memory; - + [Config(typeof(Config.ShortClr))] public class YCbCrColorConversion { @@ -57,7 +57,7 @@ JpegColorConverter.FromYCbCrSimdAvx2.ConvertCore(values, this.output); } - + private static Buffer2D[] CreateRandomValues( int componentCount, int inputBufferLength, @@ -81,6 +81,6 @@ return buffers; } - + } } \ No newline at end of file diff --git a/tests/ImageSharp.Tests/Formats/Jpg/AdobeMarkerTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/AdobeMarkerTests.cs index 7b0a0a7b1..8b0e89f59 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/AdobeMarkerTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/AdobeMarkerTests.cs @@ -1,8 +1,8 @@ // 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.Common.Decoder; +using SixLabors.ImageSharp.Formats.Jpeg; +using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using Xunit; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JFifMarkerTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JFifMarkerTests.cs index 4e63c97de..332899e8d 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JFifMarkerTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JFifMarkerTests.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.Decoder; +using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using Xunit; @@ -27,7 +27,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg [Fact] public void MarkerReturnsCorrectParsedValue() { - bool isJFif = JFifMarker.TryParse(this.bytes, out var marker); + bool isJFif = JFifMarker.TryParse(this.bytes, out JFifMarker marker); Assert.True(isJFif); Assert.Equal(1, marker.MajorVersion); @@ -40,26 +40,26 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg [Fact] public void MarkerIgnoresIncorrectValue() { - bool isJFif = JFifMarker.TryParse(new byte[] { 0, 0, 0, 0 }, out var marker); + bool isJFif = JFifMarker.TryParse(new byte[] { 0, 0, 0, 0 }, out JFifMarker marker); Assert.False(isJFif); - Assert.Equal(default(JFifMarker), marker); + Assert.Equal(default, marker); } [Fact] public void MarkerIgnoresCorrectHeaderButInvalidDensities() { - bool isJFif = JFifMarker.TryParse(this.bytes3, out var marker); + bool isJFif = JFifMarker.TryParse(this.bytes3, out JFifMarker marker); Assert.False(isJFif); - Assert.Equal(default(JFifMarker), marker); + Assert.Equal(default, marker); } [Fact] public void MarkerEqualityIsCorrect() { - JFifMarker.TryParse(this.bytes, out var marker); - JFifMarker.TryParse(this.bytes, out var marker2); + JFifMarker.TryParse(this.bytes, out JFifMarker marker); + JFifMarker.TryParse(this.bytes, out JFifMarker marker2); Assert.True(marker.Equals(marker2)); } @@ -67,8 +67,8 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg [Fact] public void MarkerInEqualityIsCorrect() { - JFifMarker.TryParse(this.bytes, out var marker); - JFifMarker.TryParse(this.bytes2, out var marker2); + JFifMarker.TryParse(this.bytes, out JFifMarker marker); + JFifMarker.TryParse(this.bytes2, out JFifMarker marker2); Assert.False(marker.Equals(marker2)); } @@ -76,8 +76,8 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg [Fact] public void MarkerHashCodeIsReplicable() { - JFifMarker.TryParse(this.bytes, out var marker); - JFifMarker.TryParse(this.bytes, out var marker2); + JFifMarker.TryParse(this.bytes, out JFifMarker marker); + JFifMarker.TryParse(this.bytes, out JFifMarker marker2); Assert.True(marker.GetHashCode().Equals(marker2.GetHashCode())); } @@ -85,8 +85,8 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg [Fact] public void MarkerHashCodeIsUnique() { - JFifMarker.TryParse(this.bytes, out var marker); - JFifMarker.TryParse(this.bytes2, out var marker2); + JFifMarker.TryParse(this.bytes, out JFifMarker marker); + JFifMarker.TryParse(this.bytes2, out JFifMarker marker2); Assert.False(marker.GetHashCode().Equals(marker2.GetHashCode())); } diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs index d2f064175..e46d59fdd 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs @@ -6,8 +6,8 @@ using System.Numerics; using SixLabors.ImageSharp.ColorSpaces; using SixLabors.ImageSharp.ColorSpaces.Conversion; -using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder; -using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder.ColorConverters; +using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; +using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters; using SixLabors.ImageSharp.Memory; using Xunit; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/JpegImagePostProcessorTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/JpegImagePostProcessorTests.cs index 4eea6a74d..079f94cd2 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/JpegImagePostProcessorTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/JpegImagePostProcessorTests.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.Decoder; +using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.Formats.Jpeg.GolangPort; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils; @@ -97,7 +97,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg ImageSimilarityReport report = ImageComparer.Exact.CompareImagesOrFrames(referenceImage, image); this.Output.WriteLine($"*** {imageFile} ***"); - this.Output.WriteLine($"Difference: "+ report.DifferencePercentageString); + this.Output.WriteLine($"Difference: {report.DifferencePercentageString}"); // ReSharper disable once PossibleInvalidOperationException Assert.True(report.TotalNormalizedDifference.Value < 0.005f); diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs index 270f313a6..72c2dddc4 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ParseStreamTests.cs @@ -4,7 +4,7 @@ using System.Text; using SixLabors.ImageSharp.Formats.Jpeg.Common; -using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder; +using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.Formats.Jpeg.GolangPort; using SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder; using SixLabors.ImageSharp.Tests.Formats.Jpg.Utils; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ProfileResolverTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/ProfileResolverTests.cs index fa06f91da..c908abc50 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/ProfileResolverTests.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/ProfileResolverTests.cs @@ -3,7 +3,7 @@ using System.Text; -using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder; +using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using Xunit; diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.ComponentData.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/LibJpegTools.ComponentData.cs index 9569b4765..1e7d77722 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.Decoder; using SixLabors.ImageSharp.PixelFormats; namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils @@ -7,7 +8,6 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils using System.Numerics; using SixLabors.ImageSharp.Formats.Jpeg.Common; - using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder; 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/VerifyJpeg.cs b/tests/ImageSharp.Tests/Formats/Jpg/Utils/VerifyJpeg.cs index d0f7df12c..296f424fa 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Utils/VerifyJpeg.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Utils/VerifyJpeg.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Linq; -using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder; +using SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder; using SixLabors.ImageSharp.PixelFormats; using SixLabors.Primitives;