private int m_scan_number; /* current index in scan_info[] */ public jpeg_comp_master(jpeg_compress_struct cinfo, bool transcode_only) { m_cinfo = cinfo; if (transcode_only) { /* no main pass in transcoding */ if (cinfo.m_optimize_coding) { m_pass_type = c_pass_type.huff_opt_pass; } else { m_pass_type = c_pass_type.output_pass; } } else { /* for normal compression, first pass is always this type: */ m_pass_type = c_pass_type.main_pass; } if (cinfo.m_optimize_coding) { m_total_passes = cinfo.m_num_scans * 2; } else { m_total_passes = cinfo.m_num_scans; } }
private bool prepare_for_huff_opt_pass() { /* Do Huffman optimization for a scan after the first one. */ select_scan_parameters(); per_scan_setup(); if (m_cinfo.m_Ss != 0 || m_cinfo.m_Ah == 0) { m_cinfo.m_entropy.start_pass(true); m_cinfo.m_coef.start_pass(J_BUF_MODE.JBUF_CRANK_DEST); m_call_pass_startup = false; return(false); } /* Special case: Huffman DC refinement scans need no Huffman table * and therefore we can skip the optimization pass for them. */ m_pass_type = c_pass_type.output_pass; m_pass_number++; return(true); }
/// <summary> /// Finish up at end of pass. /// </summary> public void finish_pass() { /* The entropy coder always needs an end-of-pass call, * either to analyze statistics or to flush its output buffer. */ m_cinfo.m_entropy.finish_pass(); /* Update state for next pass */ switch (m_pass_type) { case c_pass_type.main_pass: /* next pass is either output of scan 0 (after optimization) * or output of scan 1 (if no optimization). */ m_pass_type = c_pass_type.output_pass; if (!m_cinfo.m_optimize_coding) { m_scan_number++; } break; case c_pass_type.huff_opt_pass: /* next pass is always output of current scan */ m_pass_type = c_pass_type.output_pass; break; case c_pass_type.output_pass: /* next pass is either optimization or output of next scan */ if (m_cinfo.m_optimize_coding) { m_pass_type = c_pass_type.huff_opt_pass; } m_scan_number++; break; } m_pass_number++; }
private int m_scan_number; /* current index in scan_info[] */ public jpeg_comp_master(jpeg_compress_struct cinfo, bool transcode_only) { m_cinfo = cinfo; if (transcode_only) { /* no main pass in transcoding */ if (cinfo.m_optimize_coding) m_pass_type = c_pass_type.huff_opt_pass; else m_pass_type = c_pass_type.output_pass; } else { /* for normal compression, first pass is always this type: */ m_pass_type = c_pass_type.main_pass; } if (cinfo.m_optimize_coding) m_total_passes = cinfo.m_num_scans * 2; else m_total_passes = cinfo.m_num_scans; }
private bool prepare_for_huff_opt_pass() { /* Do Huffman optimization for a scan after the first one. */ select_scan_parameters(); per_scan_setup(); if (m_cinfo.m_Ss != 0 || m_cinfo.m_Ah == 0) { m_cinfo.m_entropy.start_pass(true); m_cinfo.m_coef.start_pass(J_BUF_MODE.JBUF_CRANK_DEST); m_call_pass_startup = false; return false; } /* Special case: Huffman DC refinement scans need no Huffman table * and therefore we can skip the optimization pass for them. */ m_pass_type = c_pass_type.output_pass; m_pass_number++; return true; }
/// <summary> /// Finish up at end of pass. /// </summary> public void finish_pass() { /* The entropy coder always needs an end-of-pass call, * either to analyze statistics or to flush its output buffer. */ m_cinfo.m_entropy.finish_pass(); /* Update state for next pass */ switch (m_pass_type) { case c_pass_type.main_pass: /* next pass is either output of scan 0 (after optimization) * or output of scan 1 (if no optimization). */ m_pass_type = c_pass_type.output_pass; if (!m_cinfo.m_optimize_coding) m_scan_number++; break; case c_pass_type.huff_opt_pass: /* next pass is always output of current scan */ m_pass_type = c_pass_type.output_pass; break; case c_pass_type.output_pass: /* next pass is either optimization or output of next scan */ if (m_cinfo.m_optimize_coding) m_pass_type = c_pass_type.huff_opt_pass; m_scan_number++; break; } m_pass_number++; }