jpeg_start_decompress (j_decompress_ptr cinfo)分析

来源:互联网 发布:泰兴减速机js txjsj 编辑:程序博客网 时间:2024/06/04 19:10
GLOBAL(boolean)jpeg_start_decompress (j_decompress_ptr cinfo){  if (cinfo->global_state == DSTATE_READY)
 {    /* First call: initialize master control, select active modules ;初始化参数*/    jinit_master_decompress(cinfo);    if (cinfo->buffered_image)
    {      /* No more work here; expecting jpeg_start_output next */      cinfo->global_state = DSTATE_BUFIMAGE;      return TRUE;    }    cinfo->global_state = DSTATE_PRELOAD;  }  if (cinfo->global_state == DSTATE_PRELOAD) {    /* If file has multiple scans, absorb them all into the coef buffer */    if (cinfo->inputctl->has_multiple_scans) {#ifdef D_MULTISCAN_FILES_SUPPORTED      for (;;) {int retcode;/* Call progress monitor hook if present */if (cinfo->progress != NULL)  (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);/* Absorb some more input */retcode = (*cinfo->inputctl->consume_input) (cinfo);if (retcode == JPEG_SUSPENDED)  return FALSE;if (retcode == JPEG_REACHED_EOI)  break;/* Advance progress counter if appropriate */if (cinfo->progress != NULL &&    (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {  if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {    /* jdmaster underestimated number of scans; ratchet up one scan */    cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;  }}      }#else      ERREXIT(cinfo, JERR_NOT_COMPILED);#endif /* D_MULTISCAN_FILES_SUPPORTED */    }    cinfo->output_scan_number = cinfo->input_scan_number;  } else if (cinfo->global_state != DSTATE_PRESCAN)    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);  /* Perform any dummy output passes, and set up for the final pass */  return output_pass_setup(cinfo);}

0 0
原创粉丝点击