Пример #1
0
        private int m_next_row;                           /* index of next row to fill/empty in strip */

        /// <summary>
        /// Initialize postprocessing controller.
        /// </summary>
        public JpegDPostController(JpegDecompressStruct cinfo, bool need_full_buffer)
        {
            m_cinfo = cinfo;

            /* Create the quantization buffer, if needed */
            if (cinfo.quantizeColors)
            {
                /* The buffer strip height is max_v_samp_factor, which is typically
                 * an efficient number of rows for upsampling to return.
                 * (In the presence of output rescaling, we might want to be smarter?)
                 */
                m_strip_height = cinfo.m_maxVSampleFactor;

                if (need_full_buffer)
                {
                    /* Two-pass color quantization: need full-image storage. */
                    /* We round up the number of rows to a multiple of the strip height. */
                    m_whole_image = JpegCommonStruct.CreateSamplesArray(
                        cinfo.outputWidth * cinfo.outColorComponents,
                        JpegUtils.jround_up(cinfo.outputHeight, m_strip_height));
                    m_whole_image.ErrorProcessor = cinfo;
                }
                else
                {
                    /* One-pass color quantization: just make a strip buffer. */
                    m_buffer = JpegCommonStruct.AllocJpegSamples(
                        cinfo.outputWidth * cinfo.outColorComponents, m_strip_height);
                }
            }
        }