public void start_pass(J_BUF_MODE pass_mode)
{
switch (pass_mode)
{
case J_BUF_MODE.JBUF_PASS_THRU:
if (m_cinfo.m_quantize_colors)
{
/* Single-pass processing with color quantization. */
m_processor = ProcessorType.OnePass;
/* We could be doing buffered-image output before starting a 2-pass
* color quantization; in that case, jinit_d_post_controller did not
* allocate a strip buffer. Use the virtual-array buffer as workspace.
*/
if (m_buffer == null)
m_buffer = m_whole_image.Access(0, m_strip_height);
}
else
{
/* For single-pass processing without color quantization,
* I have no work to do; just call the upsampler directly.
*/
m_processor = ProcessorType.Upsample;
}
break;
case J_BUF_MODE.JBUF_SAVE_AND_PASS:
/* First pass of 2-pass quantization */
if (m_whole_image == null)
m_cinfo.ERREXIT(J_MESSAGE_CODE.JERR_BAD_BUFFER_MODE);
m_processor = ProcessorType.PrePass;
break;
case J_BUF_MODE.JBUF_CRANK_DEST:
/* Second pass of 2-pass quantization */
if (m_whole_image == null)
m_cinfo.ERREXIT(J_MESSAGE_CODE.JERR_BAD_BUFFER_MODE);
m_processor = ProcessorType.SecondPass;
break;
default:
m_cinfo.ERREXIT(J_MESSAGE_CODE.JERR_BAD_BUFFER_MODE);
break;
}
m_starting_row = m_next_row = 0;
}