diff --git a/src/ImageSharp/Formats/Jpeg/Common/Block8x8.cs b/src/ImageSharp/Formats/Jpeg/Common/Block8x8.cs index 13208822e..83aae3c94 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Block8x8.cs +++ b/src/ImageSharp/Formats/Jpeg/Common/Block8x8.cs @@ -5,8 +5,6 @@ using System.Text; namespace SixLabors.ImageSharp.Formats.Jpeg.Common { - using SixLabors.ImageSharp.Memory; - /// /// Represents a Jpeg block with coefficiens. /// @@ -249,6 +247,5 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common return result; } - } } \ No newline at end of file diff --git a/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.cs b/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.cs index 1c5cd4318..4d0ec3393 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.cs +++ b/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.cs @@ -6,12 +6,11 @@ using System.Diagnostics; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using SixLabors.ImageSharp.Memory; // ReSharper disable InconsistentNaming namespace SixLabors.ImageSharp.Formats.Jpeg.Common { - using SixLabors.ImageSharp.Memory; - /// /// Represents a Jpeg block with coefficients. /// diff --git a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegComponentPostProcessor.cs b/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegComponentPostProcessor.cs index 585843f8f..2c60728fd 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegComponentPostProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegComponentPostProcessor.cs @@ -63,8 +63,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder xBuffer, yBuffer, this.blockAreaSize.Width, - this.blockAreaSize.Height - ); + this.blockAreaSize.Height); blockPp.ProcessBlockColorsInto(this.ImagePostProcessor.RawJpeg, this.Component, ref block, destArea); } diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs index ca8bf10e5..a7a5fcd98 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs @@ -62,8 +62,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder /// If errorCode indicates unexpected EOF, sets to true and returns false. /// Calls and returns true otherwise. /// - /// The - /// indicating whether everything is OK + /// A indicating whether EOF reached public bool CheckEOFEnsureNoError() { if (this.LastErrorCode == OrigDecoderErrorCode.UnexpectedEndOfStream) @@ -79,8 +78,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder /// If errorCode indicates unexpected EOF, sets to true and returns false. /// Returns true otherwise. /// - /// The - /// indicating whether everything is OK + /// A indicating whether EOF reached public bool CheckEOF() { if (this.LastErrorCode == OrigDecoderErrorCode.UnexpectedEndOfStream) diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigComponent.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigComponent.cs index 6fb501a65..c87752b37 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigComponent.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigComponent.cs @@ -3,13 +3,12 @@ using System; using SixLabors.ImageSharp.Formats.Jpeg.Common; +using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder; using SixLabors.ImageSharp.Memory; +using SixLabors.Primitives; namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder { - using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder; - using SixLabors.Primitives; - /// /// /// Represents a single color component @@ -67,7 +66,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder // and Y channels subsample, they subsample both horizontally and // vertically. // - for YCbCrK, the Y and K channels have full samples. - this.SizeInBlocks = decoder.ImageSizeInMCU.MultiplyBy(this.SamplingFactors); if (this.Index == 0 || this.Index == 3) @@ -167,7 +165,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder case 1: { // Cb. - Size s0 = decoder.Components[0].SamplingFactors; if (s0.Width % h != 0 || s0.Height % v != 0) @@ -181,7 +178,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder case 2: { // Cr. - Size s1 = decoder.Components[1].SamplingFactors; if (s1.Width != h || s1.Height != v) diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.DataPointers.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.DataPointers.cs index cfa8030cd..0098b4a4e 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.DataPointers.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.DataPointers.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; +using SixLabors.ImageSharp.Formats.Jpeg.Common; namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder { - using SixLabors.ImageSharp.Formats.Jpeg.Common; - /// /// Conains the definition of /// diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.cs index 2b31417cd..b3a7bc4af 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.cs @@ -109,7 +109,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder /// /// Read Huffman data from Jpeg scans in , - /// and decode it as into . + /// and decode it as into . /// /// The blocks are traversed one MCU at a time. For 4:2:0 chroma /// subsampling, there are four Y 8x8 blocks in every 16x16 MCU. @@ -320,7 +320,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder else { int zig = this.zigStart; - //OrigDecoderErrorCode errorCode; + if (zig == 0) { zig++; @@ -352,7 +352,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder // b[0] = dc[compIndex] << al; value = this.pointers.Dc[this.ComponentIndex] << this.al; - Block8x8.SetScalarAt(b, 0, (short) value); + Block8x8.SetScalarAt(b, 0, (short)value); } if (zig <= this.zigEnd && this.eobRun > 0) @@ -388,11 +388,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder return; } - //if (!decoder.InputProcessor.CheckEOFEnsureNoError()) - //{ - // return; - //} - // b[Unzig[zig]] = ac << al; value = ac << this.al; Block8x8.SetScalarAt(b, this.pointers.Unzig[zig], (short)value); @@ -435,7 +430,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder } /// - /// Gets the block index used to retieve blocks from in + /// Gets the block index used to retieve blocks from in /// /// The instance /// The index diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/Utils/OldJpegUtils.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/Utils/OrigJpegUtils.cs similarity index 98% rename from src/ImageSharp/Formats/Jpeg/GolangPort/Utils/OldJpegUtils.cs rename to src/ImageSharp/Formats/Jpeg/GolangPort/Utils/OrigJpegUtils.cs index 98bfecb22..01ed5063b 100644 --- a/src/ImageSharp/Formats/Jpeg/GolangPort/Utils/OldJpegUtils.cs +++ b/src/ImageSharp/Formats/Jpeg/GolangPort/Utils/OrigJpegUtils.cs @@ -10,7 +10,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Utils /// /// Jpeg specific utilities and extension methods /// - internal static unsafe class OrigJpegUtils + internal static class OrigJpegUtils { /// /// Copy a region of an image into dest. De "outlier" area will be stretched out with pixels on the right and bottom of the image. diff --git a/src/ImageSharp/Formats/Jpeg/PdfJsPort/JpegConstants.cs b/src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegConstants.cs similarity index 100% rename from src/ImageSharp/Formats/Jpeg/PdfJsPort/JpegConstants.cs rename to src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegConstants.cs diff --git a/src/ImageSharp/Memory/Buffer2D.cs b/src/ImageSharp/Memory/Buffer2D.cs index cacd3c9f6..99b10cae7 100644 --- a/src/ImageSharp/Memory/Buffer2D.cs +++ b/src/ImageSharp/Memory/Buffer2D.cs @@ -2,11 +2,10 @@ // Licensed under the Apache License, Version 2.0. using System.Runtime.CompilerServices; +using SixLabors.Primitives; namespace SixLabors.ImageSharp.Memory { - using SixLabors.Primitives; - /// /// Represents a buffer of value type objects /// interpreted as a 2D region of x elements.