internal static jpeg_component_info[] createArrayOfComponents(int length)
        {
            if (length < 0)
            {
                throw new ArgumentOutOfRangeException("length");
            }

            jpeg_component_info[] result = new jpeg_component_info[length];
            for (int i = 0; i < result.Length; ++i)
            {
                result[i] = new jpeg_component_info();
            }

            return(result);
        }
 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;
 }
 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;
 }
        internal static jpeg_component_info[] createArrayOfComponents(int length)
        {
            if (length < 0)
                throw new ArgumentOutOfRangeException("length");

            jpeg_component_info[] result = new jpeg_component_info[length];
            for (int i = 0; i < result.Length; ++i)
                result[i] = new jpeg_component_info();

            return result;
        }
Example #5
0
        /*
        * Allocate downsampled-data buffers needed for downsampled I/O.
        * We use values computed in jpeg_start_compress or jpeg_start_decompress.
        * We use LibJpeg.Net's allocator so that buffers will be released automatically
        * when done with strip/tile.
        * This is also a handy place to compute samplesperclump, bytesperline.
        */
        private bool alloc_downsampled_buffers(jpeg_component_info[] comp_info, int num_components)
        {
            int samples_per_clump = 0;
            for (int ci = 0; ci < num_components; ci++)
            {
                jpeg_component_info compptr = comp_info[ci];
                samples_per_clump += compptr.H_samp_factor * compptr.V_samp_factor;

                byte[][] buf = TIFFjpeg_alloc_sarray(
                    compptr.Width_in_blocks * JpegConstants.DCTSIZE,
                    compptr.V_samp_factor * JpegConstants.DCTSIZE);
                m_ds_buffer[ci] = buf;
            }

            m_samplesperclump = samples_per_clump;
            return true;
        }