BitMiracle.LibJpeg.Classic.Internal.jpeg_input_controller.jpeg_core_output_dimensions C# (CSharp) Method

jpeg_core_output_dimensions() public method

public jpeg_core_output_dimensions ( ) : void
return void
        public void jpeg_core_output_dimensions()
        {
            /* Compute actual output image dimensions and DCT scaling choices. */
            if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom)
            {
                /* Provide 1/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 1;
                m_cinfo.min_DCT_v_scaled_size = 1;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 2)
            {
                /* Provide 2/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 2L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 2L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 2;
                m_cinfo.min_DCT_v_scaled_size = 2;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 3)
            {
                /* Provide 3/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 3L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 3L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 3;
                m_cinfo.min_DCT_v_scaled_size = 3;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 4)
            {
                /* Provide 4/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 4L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 4L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 4;
                m_cinfo.min_DCT_v_scaled_size = 4;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 5)
            {
                /* Provide 5/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 5L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 5L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 5;
                m_cinfo.min_DCT_v_scaled_size = 5;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 6)
            {
                /* Provide 6/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 6L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 6L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 6;
                m_cinfo.min_DCT_v_scaled_size = 6;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 7)
            {
                /* Provide 7/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 7L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 7L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 7;
                m_cinfo.min_DCT_v_scaled_size = 7;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 8)
            {
                /* Provide 8/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 8L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 8L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 8;
                m_cinfo.min_DCT_v_scaled_size = 8;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 9)
            {
                /* Provide 9/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 9L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 9L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 9;
                m_cinfo.min_DCT_v_scaled_size = 9;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 10)
            {
                /* Provide 10/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 10L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 10L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 10;
                m_cinfo.min_DCT_v_scaled_size = 10;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 11)
            {
                /* Provide 11/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 11L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 11L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 11;
                m_cinfo.min_DCT_v_scaled_size = 11;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 12)
            {
                /* Provide 12/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 12L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 12L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 12;
                m_cinfo.min_DCT_v_scaled_size = 12;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 13)
            {
                /* Provide 13/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 13L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 13L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 13;
                m_cinfo.min_DCT_v_scaled_size = 13;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 14)
            {
                /* Provide 14/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 14L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 14L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 14;
                m_cinfo.min_DCT_v_scaled_size = 14;
            }
            else if (m_cinfo.m_scale_num * m_cinfo.block_size <= m_cinfo.m_scale_denom * 15)
            {
                /* Provide 15/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 15L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 15L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 15;
                m_cinfo.min_DCT_v_scaled_size = 15;
            }
            else {
                /* Provide 16/block_size scaling */
                m_cinfo.m_output_width = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_width * 16L, (long)m_cinfo.block_size);
                m_cinfo.m_output_height = (int)
                  JpegUtils.jdiv_round_up((long)m_cinfo.m_image_height * 16L, (long)m_cinfo.block_size);
                m_cinfo.min_DCT_h_scaled_size = 16;
                m_cinfo.min_DCT_v_scaled_size = 16;
            }

            /* Recompute dimensions of components */
            for (int ci = 0; ci < m_cinfo.m_num_components; ci++)
            {
                jpeg_component_info compptr = m_cinfo.Comp_info[ci];
                compptr.DCT_h_scaled_size = m_cinfo.min_DCT_h_scaled_size;
                compptr.DCT_v_scaled_size = m_cinfo.min_DCT_v_scaled_size;
            }
        }