diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs index 5b0331c85..fd3b9b431 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegImagePostProcessor.cs @@ -132,28 +132,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder /// /// Execute one step processing pixel rows into 'destination'. - /// - /// The pixel type - /// The destination image. - public void DoPostProcessorStep(ImageFrame destination) - where TPixel : unmanaged, IPixel - { - foreach (JpegComponentPostProcessor cpp in this.ComponentProcessors) - { - cpp.CopyBlocksToColorBuffer(); - } - - this.ConvertColorsInto(destination); - - this.PixelRowCounter += PixelRowsPerStep; - } - - /// /// Convert and copy row of colors into 'destination' starting at row . /// /// The pixel type /// The destination image - private void ConvertColorsInto(ImageFrame destination) + public void DoPostProcessorStep(ImageFrame destination) where TPixel : unmanaged, IPixel { int maxY = Math.Min(destination.Height, this.PixelRowCounter + PixelRowsPerStep); @@ -161,6 +144,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder var buffers = new Buffer2D[this.ComponentProcessors.Length]; for (int i = 0; i < this.ComponentProcessors.Length; i++) { + this.ComponentProcessors[i].CopyBlocksToColorBuffer(); buffers[i] = this.ComponentProcessors[i].ColorBuffer; } @@ -176,6 +160,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder // TODO: Investigate if slicing is actually necessary PixelOperations.Instance.FromVector4Destructive(this.configuration, this.rgbaBuffer.GetSpan().Slice(0, destRow.Length), destRow); } + + this.PixelRowCounter += PixelRowsPerStep; } } }