private void rgb1_rgb_convert(ComponentBuffer[] input_buf, int input_row, byte[][] output_buf, int output_row, int num_rows)
{
int component0RowOffset = m_perComponentOffsets[0];
int component1RowOffset = m_perComponentOffsets[1];
int component2RowOffset = m_perComponentOffsets[2];
int num_cols = m_cinfo.m_output_width;
for (int row = 0; row < num_rows; row++)
{
int columnOffset = 0;
for (int col = 0; col < num_cols; col++)
{
int r = input_buf[0][input_row + component0RowOffset][col];
int g = input_buf[1][input_row + component1RowOffset][col];
int b = input_buf[2][input_row + component2RowOffset][col];
/* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD
* (modulo) operator is equivalent to the bitmask operator AND.
*/
output_buf[output_row + row][columnOffset + JpegConstants.RGB_RED] = (byte)((r + g - JpegConstants.CENTERJSAMPLE) & JpegConstants.MAXJSAMPLE);
output_buf[output_row + row][columnOffset + JpegConstants.RGB_GREEN] = (byte)g;
output_buf[output_row + row][columnOffset + JpegConstants.RGB_BLUE] = (byte)((b + g - JpegConstants.CENTERJSAMPLE) & JpegConstants.MAXJSAMPLE);
columnOffset += JpegConstants.RGB_PIXELSIZE;
}
}
}