private void quantize(byte[][] input_buf, int in_row, byte[][] output_buf, int out_row, int num_rows)
{
int nc = m_cinfo.m_out_color_components;
for (int row = 0; row < num_rows; row++)
{
int inIndex = 0;
int inRow = in_row + row;
int outIndex = 0;
int outRow = out_row + row;
for (int col = m_cinfo.m_output_width; col > 0; col--)
{
int pixcode = 0;
for (int ci = 0; ci < nc; ci++)
{
pixcode += m_colorindex[ci][m_colorindexOffset[ci] + input_buf[inRow][inIndex]];
inIndex++;
}
output_buf[outRow][outIndex] = (byte)pixcode;
outIndex++;
}
}
}