/// <summary> /// Master selection of decompression modules for transcoding (that is, reading /// raw DCT coefficient arrays from an input JPEG file.) /// This substitutes for initialization of the full decompressor. /// </summary> private void transdecode_master_selection() { /* This is effectively a buffered-image operation. */ m_buffered_image = true; if (m_progressive_mode) m_entropy = new phuff_entropy_decoder(this); else m_entropy = new huff_entropy_decoder(this); /* Always get a full-image coefficient buffer. */ m_coef = new jpeg_d_coef_controller(this, true); /* Initialize input side of decompressor to consume first scan. */ m_inputctl.start_input_pass(); /* Initialize progress monitoring. */ if (m_progress != null) { int nscans = 1; /* Estimate number of scans to set pass_limit. */ if (m_progressive_mode) { /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */ nscans = 2 + 3 * m_num_components; } else if (m_inputctl.HasMultipleScans()) { /* For a nonprogressive multiscan file, estimate 1 scan per component. */ nscans = m_num_components; } m_progress.Pass_counter = 0; m_progress.Pass_limit = m_total_iMCU_rows * nscans; m_progress.Completed_passes = 0; m_progress.Total_passes = 1; } }