private void pass2_no_dither(byte[][] input_buf, int in_row, byte[][] output_buf, int out_row, int num_rows)
{
for (int row = 0; row < num_rows; row++)
{
int inRow = row + in_row;
int inIndex = 0;
int outIndex = 0;
int outRow = out_row + row;
for (int col = m_cinfo.m_output_width; col > 0; col--)
{
/* get pixel value and index into the cache */
int c0 = (int)input_buf[inRow][inIndex] >> C0_SHIFT;
inIndex++;
int c1 = (int)input_buf[inRow][inIndex] >> C1_SHIFT;
inIndex++;
int c2 = (int)input_buf[inRow][inIndex] >> C2_SHIFT;
inIndex++;
int hRow = c0;
int hColumn = c1 * HIST_C2_ELEMS + c2;
/* If we have not seen this color before, find nearest colormap entry */
/* and update the cache */
if (m_histogram[hRow][hColumn] == 0)
fill_inverse_cmap(c0, c1, c2);
/* Now emit the colormap index for this cell */
output_buf[outRow][outIndex] = (byte)(m_histogram[hRow][hColumn] - 1);
outIndex++;
}
}
}