Beispiel #1
0
jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
{
  if (cinfo->global_state != CSTATE_START)
    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);

  if (write_all_tables)
    jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */

  /* setting up scan optimisation pattern failed, disable scan optimisation */
  if (cinfo->num_scans_luma == 0 || cinfo->scan_info == NULL || cinfo->num_scans == 0)
    cinfo->optimize_scans = FALSE;
  
  /* (Re)initialize error mgr and destination modules */
  (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
  (*cinfo->dest->init_destination) (cinfo);
  /* Perform master selection of active modules */
  jinit_compress_master(cinfo);
  /* Set up for the first pass */
  (*cinfo->master->prepare_for_pass) (cinfo);
  /* Ready for application to drive first pass through jpeg_write_scanlines
   * or jpeg_write_raw_data.
   */
  cinfo->next_scanline = 0;
  cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING);
}
GLOBAL(void)jpeg_start_compress(j_compress_ptr cinfo, boolean write_all_tables)
{
    // DHKIM
    //  cinfo->raw_data_in = 1;

    if (cinfo->global_state != CSTATE_START)
        ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);

    if (write_all_tables)
        jpeg_suppress_tables(cinfo, FALSE);
    /* mark all tables to be written */

    /* (Re)initialize error mgr and destination modules */
    //  (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
#ifndef JPEG_ENC_OPT  //bmy 04.12.29 jpeg_enc_opt +
    init_destination(cinfo);
#endif //bmy 04.12.29 jpeg_enc_opt +
    /* Perform master selection of active modules */
    jinit_compress_master(cinfo);
    /* Set up for the first pass */
    prepare_for_pass(cinfo);
    /* Ready for application to drive first pass through jpeg_write_scanlines
     * or jpeg_write_raw_data.
     */
    //  cinfo->next_scanline = 0;


    cinfo->global_state = CSTATE_SCANNING;
}