BitMiracle.LibJpeg.Classic.Internal.jpeg_decomp_master.prepare_for_output_pass C# (CSharp) Method

prepare_for_output_pass() public method

Per-pass setup. This is called at the beginning of each output pass. We determine which modules will be active during this pass and give them appropriate start_pass calls. We also set is_dummy_pass to indicate whether this is a "real" output pass or a dummy pass for color quantization. (In the latter case, we will crank the pass to completion.)
public prepare_for_output_pass ( ) : void
return void
        public void prepare_for_output_pass()
        {
            if (m_is_dummy_pass)
            {
                /* Final pass of 2-pass quantization */
                m_is_dummy_pass = false;
                m_cinfo.m_cquantize.start_pass(false);
                m_cinfo.m_post.start_pass(J_BUF_MODE.JBUF_CRANK_DEST);
                m_cinfo.m_main.start_pass(J_BUF_MODE.JBUF_CRANK_DEST);
            }
            else
            {
                if (m_cinfo.m_quantize_colors && m_cinfo.m_colormap == null)
                {
                    /* Select new quantization method */
                    if (m_cinfo.m_two_pass_quantize && m_cinfo.m_enable_2pass_quant)
                    {
                        m_cinfo.m_cquantize = m_quantizer_2pass;
                        m_is_dummy_pass = true;
                    }
                    else if (m_cinfo.m_enable_1pass_quant)
                        m_cinfo.m_cquantize = m_quantizer_1pass;
                    else
                        m_cinfo.ERREXIT(J_MESSAGE_CODE.JERR_MODE_CHANGE);
                }

                m_cinfo.m_idct.start_pass();
                m_cinfo.m_coef.start_output_pass();

                if (!m_cinfo.m_raw_data_out)
                {
                    m_cinfo.m_upsample.start_pass();

                    if (m_cinfo.m_quantize_colors)
                        m_cinfo.m_cquantize.start_pass(m_is_dummy_pass);

                    m_cinfo.m_post.start_pass((m_is_dummy_pass ? J_BUF_MODE.JBUF_SAVE_AND_PASS : J_BUF_MODE.JBUF_PASS_THRU));
                    m_cinfo.m_main.start_pass(J_BUF_MODE.JBUF_PASS_THRU);
                }
            }

            /* Set up progress monitor's pass info if present */
            if (m_cinfo.m_progress != null)
            {
                m_cinfo.m_progress.Completed_passes = m_pass_number;
                m_cinfo.m_progress.Total_passes = m_pass_number + (m_is_dummy_pass ? 2 : 1);

                /* In buffered-image mode, we assume one more output pass if EOI not
                 * yet reached, but no more passes if EOI has been reached.
                 */
                if (m_cinfo.m_buffered_image && !m_cinfo.m_inputctl.EOIReached())
                    m_cinfo.m_progress.Total_passes += (m_cinfo.m_enable_2pass_quant ? 2 : 1);
            }
        }