public void finish_pass()
{
/* The entropy coder always needs an end-of-pass call,
* either to analyze statistics or to flush its output buffer.
*/
m_cinfo.m_entropy.finish_pass();
/* Update state for next pass */
switch (m_pass_type)
{
case c_pass_type.main_pass:
/* next pass is either output of scan 0 (after optimization)
* or output of scan 1 (if no optimization).
*/
m_pass_type = c_pass_type.output_pass;
if (!m_cinfo.m_optimize_coding)
m_scan_number++;
break;
case c_pass_type.huff_opt_pass:
/* next pass is always output of current scan */
m_pass_type = c_pass_type.output_pass;
break;
case c_pass_type.output_pass:
/* next pass is either optimization or output of next scan */
if (m_cinfo.m_optimize_coding)
m_pass_type = c_pass_type.huff_opt_pass;
m_scan_number++;
break;
}
m_pass_number++;
}