BitMiracle.LibJpeg.Classic.jpeg_decompress_struct.use_merged_upsample C# (CSharp) Method

use_merged_upsample() private method

Determine whether merged upsample/color conversion should be used. CRUCIAL: this must match the actual capabilities of merged upsampler!
private use_merged_upsample ( ) : bool
return bool
        internal bool use_merged_upsample()
        {
            /* Merging is the equivalent of plain box-filter upsampling. */
            /* The following condition is only needed if fancy shall select
             * a different upsampling method.  In our current implementation
             * fancy only affects the DCT scaling, thus we can use fancy
             * upsampling and merged upsample simultaneously, in particular
             * with scaled DCT sizes larger than the default DCTSIZE.
             */
            if (m_CCIR601_sampling)
                return false;

            /* my_upsampler only supports YCC=>RGB color conversion */
            if ((m_jpeg_color_space != J_COLOR_SPACE.JCS_YCbCr &&
                m_jpeg_color_space != J_COLOR_SPACE.JCS_BG_YCC) ||
                m_num_components != 3 ||
                m_out_color_space != J_COLOR_SPACE.JCS_RGB ||
                m_out_color_components != JpegConstants.RGB_PIXELSIZE ||
                color_transform != J_COLOR_TRANSFORM.JCT_NONE)
            {
                return false;
            }

            /* and it only handles 2h1v or 2h2v sampling ratios */
            if (m_comp_info[0].H_samp_factor != 2 || m_comp_info[1].H_samp_factor != 1 ||
                m_comp_info[2].H_samp_factor != 1 || m_comp_info[0].V_samp_factor > 2 ||
                m_comp_info[1].V_samp_factor != 1 || m_comp_info[2].V_samp_factor != 1)
            {
                return false;
            }

            /* furthermore, it doesn't work if we've scaled the IDCTs differently */
            if (m_comp_info[0].DCT_h_scaled_size != min_DCT_h_scaled_size ||
                m_comp_info[1].DCT_h_scaled_size != min_DCT_h_scaled_size ||
                m_comp_info[2].DCT_h_scaled_size != min_DCT_h_scaled_size ||
                m_comp_info[0].DCT_v_scaled_size != min_DCT_v_scaled_size ||
                m_comp_info[1].DCT_v_scaled_size != min_DCT_v_scaled_size ||
                m_comp_info[2].DCT_v_scaled_size != min_DCT_v_scaled_size)
            {
                return false;
            }

            /* ??? also need to test for upsample-time rescaling, when & if supported */
            /* by golly, it'll work... */
            return true;
        }