/// <summary> /// Returns the <see cref="JpegColorConverter"/> corresponding to the given <see cref="JpegColorSpace"/> /// </summary> public static JpegColorConverter GetConverter(JpegColorSpace colorSpace) { JpegColorConverter converter = Converters.FirstOrDefault(c => c.ColorSpace == colorSpace); if (converter == null) { throw new Exception($"Could not find any converter for JpegColorSpace {colorSpace}!"); } return(converter); }
/// <summary> /// Initializes a new instance of the <see cref="JpegImagePostProcessor"/> class. /// </summary> /// <param name="rawJpeg">The <see cref="IRawJpegData"/> representing the uncompressed spectral Jpeg data</param> public JpegImagePostProcessor(IRawJpegData rawJpeg) { this.RawJpeg = rawJpeg; IJpegComponent c0 = rawJpeg.Components.First(); this.NumberOfPostProcessorSteps = c0.SizeInBlocks.Height / BlockRowsPerStep; this.PostProcessorBufferSize = new Size(c0.SizeInBlocks.Width * 8, PixelRowsPerStep); this.ComponentProcessors = rawJpeg.Components.Select(c => new JpegComponentPostProcessor(this, c)).ToArray(); this.rgbaBuffer = new Buffer <Vector4>(rawJpeg.ImageSizeInPixels.Width); this.colorConverter = JpegColorConverter.GetConverter(rawJpeg.ColorSpace); }