DCT coefficient quantization tables.
 internal void Assign(jpeg_component_info ci)
 {
     component_id       = ci.component_id;
     component_index    = ci.component_index;
     h_samp_factor      = ci.h_samp_factor;
     v_samp_factor      = ci.v_samp_factor;
     quant_tbl_no       = ci.quant_tbl_no;
     dc_tbl_no          = ci.dc_tbl_no;
     ac_tbl_no          = ci.ac_tbl_no;
     width_in_blocks    = ci.width_in_blocks;
     height_in_blocks   = ci.height_in_blocks;
     DCT_scaled_size    = ci.DCT_scaled_size;
     downsampled_width  = ci.downsampled_width;
     downsampled_height = ci.downsampled_height;
     component_needed   = ci.component_needed;
     MCU_width          = ci.MCU_width;
     MCU_height         = ci.MCU_height;
     MCU_blocks         = ci.MCU_blocks;
     MCU_sample_width   = ci.MCU_sample_width;
     last_col_width     = ci.last_col_width;
     last_row_height    = ci.last_row_height;
     quant_table        = ci.quant_table;
 }
        /// <summary>
        /// Allows an arbitrary quantization table to be created.
        /// </summary>
        /// <param name="which_tbl">Indicates which table slot to fill.</param>
        /// <param name="basic_table">An array of 64 unsigned integers given in normal array order.
        /// These values are multiplied by <c>scale_factor/100</c> and then clamped to the range 1..65535 
        /// (or to 1..255 if <c>force_baseline</c> is <c>true</c>).<br/>
        /// The basic table should be given in JPEG zigzag order.
        /// </param>
        /// <param name="scale_factor">Multiplier for values in <c>basic_table</c>.</param>
        /// <param name="force_baseline">Defines range of values in <c>basic_table</c>. 
        /// If <c>true</c> - 1..255, otherwise - 1..65535.</param>
        /// <seealso href="ce3f6712-3633-4a58-af07-626a4fba9ae4.htm" target="_self">Compression parameter selection</seealso>
        public void jpeg_add_quant_table(int which_tbl, int[] basic_table, int scale_factor, bool force_baseline)
        {
            /* Safety check to ensure start_compress not called yet. */
            if (m_global_state != JpegState.CSTATE_START)
                ERREXIT(J_MESSAGE_CODE.JERR_BAD_STATE, (int)m_global_state);

            if (which_tbl < 0 || which_tbl >= JpegConstants.NUM_QUANT_TBLS)
                ERREXIT(J_MESSAGE_CODE.JERR_DQT_INDEX, which_tbl);

            if (m_quant_tbl_ptrs[which_tbl] == null)
                m_quant_tbl_ptrs[which_tbl] = new JQUANT_TBL();

            for (int i = 0; i < JpegConstants.DCTSIZE2; i++)
            {
                int temp = (basic_table[i] * scale_factor + 50) / 100;

                /* limit the values to the valid range */
                if (temp <= 0)
                    temp = 1;

                /* max quantizer needed for 12 bits */
                if (temp > 32767)
                    temp = 32767;

                /* limit to baseline range if requested */
                if (force_baseline && temp > 255)
                    temp = 255;
                
                m_quant_tbl_ptrs[which_tbl].quantval[i] = (short)temp;
            }

            /* Initialize sent_table false so table will be written to JPEG file. */
            m_quant_tbl_ptrs[which_tbl].Sent_table = false;
        }
 internal void Assign(jpeg_component_info ci)
 {
     component_id = ci.component_id;
     component_index = ci.component_index;
     h_samp_factor = ci.h_samp_factor;
     v_samp_factor = ci.v_samp_factor;
     quant_tbl_no = ci.quant_tbl_no;
     dc_tbl_no = ci.dc_tbl_no;
     ac_tbl_no = ci.ac_tbl_no;
     width_in_blocks = ci.width_in_blocks;
     height_in_blocks = ci.height_in_blocks;
     DCT_h_scaled_size = ci.DCT_h_scaled_size;
     DCT_v_scaled_size = ci.DCT_v_scaled_size;
     downsampled_width = ci.downsampled_width;
     downsampled_height = ci.downsampled_height;
     component_needed = ci.component_needed;
     MCU_width = ci.MCU_width;
     MCU_height = ci.MCU_height;
     MCU_blocks = ci.MCU_blocks;
     MCU_sample_width = ci.MCU_sample_width;
     last_col_width = ci.last_col_width;
     last_row_height = ci.last_row_height;
     quant_table = ci.quant_table;
 }