BitMiracle.LibJpeg.Classic.Internal.jpeg_d_main_controller.process_data_simple_main C# (CSharp) Method

process_data_simple_main() private method

Process some data. This handles the simple case where no context is required.
private process_data_simple_main ( byte output_buf, int &out_row_ctr, int out_rows_avail ) : void
output_buf byte
out_row_ctr int
out_rows_avail int
return void
        private void process_data_simple_main(byte[][] output_buf, ref int out_row_ctr, int out_rows_avail)
        {
            ComponentBuffer[] cb = new ComponentBuffer[JpegConstants.MAX_COMPONENTS];
            for (int i = 0; i < JpegConstants.MAX_COMPONENTS; i++)
            {
                cb[i] = new ComponentBuffer();
                cb[i].SetBuffer(m_buffer[i], null, 0);
            }

            /* Read input data if we haven't filled the main buffer yet */
            if (!m_buffer_full)
            {
                if (m_cinfo.m_coef.decompress_data(cb) == ReadResult.JPEG_SUSPENDED)
                {
                    /* suspension forced, can do nothing more */
                    return;
                }

                /* OK, we have an iMCU row to work with */
                m_buffer_full = true;
            }

            /* There are always min_DCT_scaled_size row groups in an iMCU row. */
            int rowgroups_avail = m_cinfo.min_DCT_v_scaled_size;

            /* Note: at the bottom of the image, we may pass extra garbage row groups
             * to the postprocessor.  The postprocessor has to check for bottom
             * of image anyway (at row resolution), so no point in us doing it too.
             */

            /* Feed the postprocessor */
            m_cinfo.m_post.post_process_data(cb, ref m_rowgroup_ctr, rowgroups_avail, output_buf, ref out_row_ctr, out_rows_avail);

            /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
            if (m_rowgroup_ctr >= rowgroups_avail)
            {
                m_buffer_full = false;
                m_rowgroup_ctr = 0;
            }
        }