diff --git a/src/ImageSharp/Advanced/AotCompilerTools.cs b/src/ImageSharp/Advanced/AotCompilerTools.cs index c263aaa13f..084f2403e5 100644 --- a/src/ImageSharp/Advanced/AotCompilerTools.cs +++ b/src/ImageSharp/Advanced/AotCompilerTools.cs @@ -133,7 +133,7 @@ private static void AotCompileDithering() { var test = new FloydSteinbergDiffuser(); TPixel pixel = default; - test.Dither(new ImageFrame(Configuration.Default, 1, 1), pixel, pixel, 0, 0, 0, 0, 0, 0); + test.Dither(new ImageFrame(Configuration.Default, 1, 1), pixel, pixel, 0, 0, 0, 0, 0, 0); } /// diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs index e8a298c5ab..fbb2b52727 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs @@ -209,7 +209,6 @@ private void ParseBaselineDataNonInterleaved() dcHuffmanTable.Configure(); acHuffmanTable.Configure(); - int mcu = 0; for (int j = 0; j < h; j++) { Span blockSpan = component.SpectralBlocks.GetRowSpan(j); @@ -228,9 +227,6 @@ ref Unsafe.Add(ref blockRef, i), ref dcHuffmanTable, ref acHuffmanTable); - // Every data block is an MCU, so countdown the restart interval - mcu++; - this.HandleRestart(); } } @@ -379,7 +375,6 @@ private void ParseProgressiveDataNonInterleaved() ref HuffmanTable dcHuffmanTable = ref this.dcHuffmanTables[component.DCHuffmanTableId]; dcHuffmanTable.Configure(); - int mcu = 0; for (int j = 0; j < h; j++) { Span blockSpan = component.SpectralBlocks.GetRowSpan(j); @@ -397,8 +392,6 @@ private void ParseProgressiveDataNonInterleaved() ref Unsafe.Add(ref blockRef, i), ref dcHuffmanTable); - // Every data block is an MCU, so countdown the restart interval - mcu++; this.HandleRestart(); } } @@ -408,7 +401,6 @@ ref Unsafe.Add(ref blockRef, i), ref HuffmanTable acHuffmanTable = ref this.acHuffmanTables[component.ACHuffmanTableId]; acHuffmanTable.Configure(); - int mcu = 0; for (int j = 0; j < h; j++) { Span blockSpan = component.SpectralBlocks.GetRowSpan(j); @@ -425,8 +417,6 @@ ref Unsafe.Add(ref blockRef, i), ref Unsafe.Add(ref blockRef, i), ref acHuffmanTable); - // Every data block is an MCU, so countdown the restart interval - mcu++; this.HandleRestart(); } } diff --git a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs index dd2f09bcd9..537a3089ec 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationProcessor{TPixel}.cs @@ -77,25 +77,22 @@ protected override void OnFrameApply(ImageFrame source, Rectangle source new ParallelOptions { MaxDegreeOfParallelism = configuration.MaxDegreeOfParallelism }, index => { - int cdfX = 0; - int tileX = 0; - int tileY = 0; int y = tileYStartPositions[index].y; int cdfYY = tileYStartPositions[index].cdfY; // It's unfortunate that we have to do this per iteration. ref TPixel sourceBase = ref source.GetPixelReference(0, 0); - cdfX = 0; + int cdfX = 0; for (int x = halfTileWidth; x < sourceWidth - halfTileWidth; x += tileWidth) { - tileY = 0; + int tileY = 0; int yEnd = Math.Min(y + tileHeight, sourceHeight); int xEnd = Math.Min(x + tileWidth, sourceWidth); for (int dy = y; dy < yEnd; dy++) { int dyOffSet = dy * sourceWidth; - tileX = 0; + int tileX = 0; for (int dx = x; dx < xEnd; dx++) { ref TPixel pixel = ref Unsafe.Add(ref sourceBase, dyOffSet + dx); @@ -221,7 +218,6 @@ private static void ProcessBorderColumn( int xEnd, int luminanceLevels) { - int halfTileWidth = tileWidth / 2; int halfTileHeight = tileHeight / 2; int cdfY = 0; @@ -232,13 +228,11 @@ private static void ProcessBorderColumn( for (int dy = y; dy < yLimit; dy++) { int dyOffSet = dy * sourceWidth; - int tileX = halfTileWidth; for (int dx = xStart; dx < xEnd; dx++) { ref TPixel pixel = ref Unsafe.Add(ref pixelBase, dyOffSet + dx); float luminanceEqualized = InterpolateBetweenTwoTiles(pixel, cdfData, cdfX, cdfY, cdfX, cdfY + 1, tileY, tileHeight, luminanceLevels); pixel.FromVector4(new Vector4(luminanceEqualized, luminanceEqualized, luminanceEqualized, pixel.ToVector4().W)); - tileX++; } tileY++; @@ -277,7 +271,6 @@ private static void ProcessBorderRow( int cdfX = 0; for (int x = halfTileWidth; x < sourceWidth - halfTileWidth; x += tileWidth) { - int tileY = 0; for (int dy = yStart; dy < yEnd; dy++) { int dyOffSet = dy * sourceWidth; @@ -290,8 +283,6 @@ private static void ProcessBorderRow( pixel.FromVector4(new Vector4(luminanceEqualized, luminanceEqualized, luminanceEqualized, pixel.ToVector4().W)); tileX++; } - - tileY++; } cdfX++; diff --git a/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs b/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs index 38cd5bc95e..d6d58eae7a 100644 --- a/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs +++ b/tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs @@ -150,7 +150,7 @@ public void NonMutatingEncodePreservesPaletteCount() outStream.Position = 0; var clone = Image.Load(outStream); - GifMetadata cloneMetaData = clone.Metadata.GetFormatMetadata(GifFormat.Instance); + GifMetadata cloneMetaData = clone.Metadata.GetFormatMetadata(GifFormat.Instance); Assert.Equal(metaData.ColorTableMode, cloneMetaData.ColorTableMode); // Gifiddle and Cyotek GifInfo say this image has 64 colors. diff --git a/tests/ImageSharp.Tests/Image/ImageSaveTests.cs b/tests/ImageSharp.Tests/Image/ImageSaveTests.cs index 6236d296e3..f5504fac26 100644 --- a/tests/ImageSharp.Tests/Image/ImageSaveTests.cs +++ b/tests/ImageSharp.Tests/Image/ImageSaveTests.cs @@ -52,7 +52,7 @@ public void SavePath() this.fileSystem.Setup(x => x.Create("path.png")).Returns(stream); this.Image.Save("path.png"); - this.encoder.Verify(x => x.Encode(this.Image, stream)); + this.encoder.Verify(x => x.Encode(this.Image, stream)); } @@ -64,7 +64,7 @@ public void SavePathWithEncoder() this.Image.Save("path.jpg", this.encoderNotInFormat.Object); - this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream)); + this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream)); } [Fact] @@ -72,7 +72,7 @@ public void ToBase64String() { string str = this.Image.ToBase64String(this.localImageFormat.Object); - this.encoder.Verify(x => x.Encode(this.Image, It.IsAny())); + this.encoder.Verify(x => x.Encode(this.Image, It.IsAny())); } [Fact] @@ -81,7 +81,7 @@ public void SaveStreamWithMime() Stream stream = new MemoryStream(); this.Image.Save(stream, this.localImageFormat.Object); - this.encoder.Verify(x => x.Encode(this.Image, stream)); + this.encoder.Verify(x => x.Encode(this.Image, stream)); } [Fact] @@ -91,7 +91,7 @@ public void SaveStreamWithEncoder() this.Image.Save(stream, this.encoderNotInFormat.Object); - this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream)); + this.encoderNotInFormat.Verify(x => x.Encode(this.Image, stream)); } public void Dispose()