Browse Source

JpegImagePostProcessor code path is the default now in OrigJpegDecoderCore

af/merge-core
Anton Firszov 9 years ago
parent
commit
6a64d37d79
  1. 5
      src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegImagePostProcessor.cs
  2. 17
      src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs

5
src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegImagePostProcessor.cs

@ -56,11 +56,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder
public bool DoPostProcessorStep<TPixel>(Image<TPixel> destination)
where TPixel : struct, IPixel<TPixel>
{
if (this.RawJpeg.ComponentCount != 3)
{
throw new NotImplementedException();
}
foreach (JpegComponentPostProcessor cpp in this.ComponentProcessors)
{
cpp.CopyBlocksToColorBuffer();

17
src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs

@ -211,11 +211,15 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort
{
this.ParseStream(stream);
#if OLDCODE
this.ProcessBlocksIntoJpegImageChannels();
return this.ConvertJpegPixelsToImagePixels<TPixel>();
#else
return this.PostProcessIntoImage<TPixel>();
#endif
}
/// <inheritdoc />
public void Dispose()
{
@ -1226,5 +1230,16 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort
throw new ImageFormatException("JpegDecoder only supports RGB, CMYK and Grayscale color spaces.");
}
}
private Image<TPixel> PostProcessIntoImage<TPixel>()
where TPixel : struct, IPixel<TPixel>
{
using (var postProcessor = new JpegImagePostProcessor(this))
{
var image = new Image<TPixel>(this.configuration, this.ImageWidth, this.ImageHeight, this.MetaData);
postProcessor.PostProcess(image);
return image;
}
}
}
}
Loading…
Cancel
Save