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

quantize() private method

Map some rows of pixels to the output colormapped representation. General case, no dithering.
private quantize ( 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 quantize(byte[][] input_buf, int in_row, byte[][] output_buf, int out_row, int num_rows)
        {
            int nc = m_cinfo.m_out_color_components;

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

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

                for (int col = m_cinfo.m_output_width; col > 0; col--)
                {
                    int pixcode = 0;
                    for (int ci = 0; ci < nc; ci++)
                    {
                        pixcode += m_colorindex[ci][m_colorindexOffset[ci] + input_buf[inRow][inIndex]];
                        inIndex++;
                    }

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