BitMiracle.LibJpeg.Classic.Internal.jpeg_color_converter.rgb_rgb1_convert C# (CSharp) Method

rgb_rgb1_convert() private method

private rgb_rgb1_convert ( byte input_buf, int input_row, byte output_buf, int output_row, int num_rows ) : void
input_buf byte
input_row int
output_buf byte
output_row int
num_rows int
return void
        private void rgb_rgb1_convert(byte[][] input_buf, int input_row, byte[][][] output_buf, int output_row, int num_rows)
        {
            int num_cols = m_cinfo.m_image_width;

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

                output_row++;
            }
        }