BitMiracle.LibJpeg.Classic.Internal.my_1pass_cquantizer.quantize3_ord_dither C# (CSharp) Method

quantize3_ord_dither() private method

Map some rows of pixels to the output colormapped representation. Fast path for out_color_components==3, with ordered dithering
private quantize3_ord_dither ( byte input_buf, int in_row, byte output_buf, int out_row, int num_rows ) : void
input_buf byte
in_row int
output_buf byte
out_row int
num_rows int
return void
        private void quantize3_ord_dither(byte[][] input_buf, int in_row, byte[][] output_buf, int out_row, int num_rows)
        {
            int width = m_cinfo.m_output_width;

            for (int row = 0; row < num_rows; row++)
            {
                int row_index = m_row_index;
                int inRow = in_row + row;
                int inIndex = 0;

                int outIndex = 0;
                int outRow = out_row + row;

                int col_index = 0;
                for (int col = width; col > 0; col--)
                {
                    int pixcode = m_colorindex[0][m_colorindexOffset[0] + input_buf[inRow][inIndex] + m_odither[0][row_index][col_index]];
                    inIndex++;

                    pixcode += m_colorindex[1][m_colorindexOffset[1] + input_buf[inRow][inIndex] + m_odither[1][row_index][col_index]];
                    inIndex++;

                    pixcode += m_colorindex[2][m_colorindexOffset[2] + input_buf[inRow][inIndex] + m_odither[2][row_index][col_index]];
                    inIndex++;

                    output_buf[outRow][outIndex] = (byte)pixcode;
                    outIndex++;

                    col_index = (col_index + 1) & ODITHER_MASK;
                }

                row_index = (row_index + 1) & ODITHER_MASK;
                m_row_index = row_index;
            }
        }