Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JpegImagePostProcessor"/> class.
        /// </summary>
        /// <param name="memoryManager">The <see cref="MemoryManager"/> to use for buffer allocations.</param>
        /// <param name="rawJpeg">The <see cref="IRawJpegData"/> representing the uncompressed spectral Jpeg data</param>
        public JpegImagePostProcessor(MemoryManager memoryManager, 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(memoryManager, this, c)).ToArray();
            this.rgbaBuffer          = memoryManager.Allocate <Vector4>(rawJpeg.ImageSizeInPixels.Width);
            this.colorConverter      = JpegColorConverter.GetConverter(rawJpeg.ColorSpace);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JpegImagePostProcessor"/> class.
        /// </summary>
        /// <param name="configuration">The <see cref="Configuration"/> to configure internal operations.</param>
        /// <param name="rawJpeg">The <see cref="IRawJpegData"/> representing the uncompressed spectral Jpeg data</param>
        public JpegImagePostProcessor(Configuration configuration, IRawJpegData rawJpeg)
        {
            this.configuration = configuration;
            this.RawJpeg       = rawJpeg;
            IJpegComponent c0 = rawJpeg.Components[0];

            this.NumberOfPostProcessorSteps = c0.SizeInBlocks.Height / BlockRowsPerStep;
            this.PostProcessorBufferSize    = new Size(c0.SizeInBlocks.Width * 8, PixelRowsPerStep);

            MemoryAllocator memoryAllocator = configuration.MemoryAllocator;

            this.ComponentProcessors = new JpegComponentPostProcessor[rawJpeg.Components.Length];
            for (int i = 0; i < rawJpeg.Components.Length; i++)
            {
                this.ComponentProcessors[i] = new JpegComponentPostProcessor(memoryAllocator, this, rawJpeg.Components[i]);
            }

            this.rgbaBuffer     = memoryAllocator.Allocate <Vector4>(rawJpeg.ImageSizeInPixels.Width);
            this.colorConverter = JpegColorConverter.GetConverter(rawJpeg.ColorSpace, rawJpeg.Precision);
        }