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) public bool DoPostProcessorStep<TPixel>(Image<TPixel> destination)
where TPixel : struct, IPixel<TPixel> where TPixel : struct, IPixel<TPixel>
{ {
if (this.RawJpeg.ComponentCount != 3)
{
throw new NotImplementedException();
}
foreach (JpegComponentPostProcessor cpp in this.ComponentProcessors) foreach (JpegComponentPostProcessor cpp in this.ComponentProcessors)
{ {
cpp.CopyBlocksToColorBuffer(); cpp.CopyBlocksToColorBuffer();

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

@ -211,11 +211,15 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort
{ {
this.ParseStream(stream); this.ParseStream(stream);
#if OLDCODE
this.ProcessBlocksIntoJpegImageChannels(); this.ProcessBlocksIntoJpegImageChannels();
return this.ConvertJpegPixelsToImagePixels<TPixel>(); return this.ConvertJpegPixelsToImagePixels<TPixel>();
#else
return this.PostProcessIntoImage<TPixel>();
#endif
} }
/// <inheritdoc /> /// <inheritdoc />
public void Dispose() 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."); 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