public void process_data(byte[][] input_buf, ref int in_row_ctr, int in_rows_avail)
{
while (m_cur_iMCU_row < m_cinfo.m_total_iMCU_rows)
{
/* Read input data if we haven't filled the main buffer yet */
if (m_rowgroup_ctr < m_cinfo.min_DCT_v_scaled_size)
{
m_cinfo.m_prep.pre_process_data(input_buf, ref in_row_ctr, in_rows_avail, m_buffer,
ref m_rowgroup_ctr, m_cinfo.min_DCT_v_scaled_size);
}
/* If we don't have a full iMCU row buffered, return to application for
* more data. Note that preprocessor will always pad to fill the iMCU row
* at the bottom of the image.
*/
if (m_rowgroup_ctr != m_cinfo.min_DCT_v_scaled_size)
return;
/* Send the completed row to the compressor */
if (!m_cinfo.m_coef.compress_data(m_buffer))
{
/* If compressor did not consume the whole row, then we must need to
* suspend processing and return to the application. In this situation
* we pretend we didn't yet consume the last input row; otherwise, if
* it happened to be the last row of the image, the application would
* think we were done.
*/
if (!m_suspended)
{
in_row_ctr--;
m_suspended = true;
}
return;
}
/* We did finish the row. Undo our little suspension hack if a previous
* call suspended; then mark the main buffer empty.
*/
if (m_suspended)
{
in_row_ctr++;
m_suspended = false;
}
m_rowgroup_ctr = 0;
m_cur_iMCU_row++;
}
}
}