BitMiracle.LibJpeg.Classic.Internal.jpeg_color_converter.rgb_gray_convert C# (CSharp) Метод

rgb_gray_convert() приватный Метод

Convert some rows of samples to the JPEG colorspace. This version handles RGB->grayscale conversion, which is the same as the RGB->Y portion of RGB->YCbCr. We assume rgb_ycc_start has been called (we only use the Y tables).
private rgb_gray_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
Результат void
        private void rgb_gray_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 + JpegConstants.RGB_RED];
                    int g = input_buf[input_row + row][columnOffset + JpegConstants.RGB_GREEN];
                    int b = input_buf[input_row + row][columnOffset + JpegConstants.RGB_BLUE];
                    columnOffset += JpegConstants.RGB_PIXELSIZE;

                    /* Y */
                    output_buf[0][output_row][col] = (byte)((m_rgb_ycc_tab[r + R_Y_OFF] + m_rgb_ycc_tab[g + G_Y_OFF] + m_rgb_ycc_tab[b + B_Y_OFF]) >> SCALEBITS);
                }

                output_row++;
            }
        }