< prev index next >

modules/javafx.graphics/src/main/native-iio/libjpeg7/jcapistd.c

Print this page


   1 /*
   2  * jcapistd.c
   3  *
   4  * Copyright (C) 1994-1996, Thomas G. Lane.

   5  * This file is part of the Independent JPEG Group's software.
   6  * For conditions of distribution and use, see the accompanying README file.
   7  *
   8  * This file contains application interface code for the compression half
   9  * of the JPEG library.  These are the "standard" API routines that are
  10  * used in the normal full-compression case.  They are not used by a
  11  * transcoding-only application.  Note that if an application links in
  12  * jpeg_start_compress, it will end up linking in the entire compressor.
  13  * We thus must separate this file from jcapimin.c to avoid linking the
  14  * whole compression library into a transcoder.
  15  */
  16 
  17 #define JPEG_INTERNALS
  18 #include "jinclude.h"
  19 #include "jpeglib.h"
  20 
  21 
  22 /*
  23  * Compression initialization.
  24  * Before calling this, all parameters and a data destination must be set up.


 128     WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
 129     return 0;
 130   }
 131 
 132   /* Call progress monitor hook if present */
 133   if (cinfo->progress != NULL) {
 134     cinfo->progress->pass_counter = (long) cinfo->next_scanline;
 135     cinfo->progress->pass_limit = (long) cinfo->image_height;
 136     (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
 137   }
 138 
 139   /* Give master control module another chance if this is first call to
 140    * jpeg_write_raw_data.  This lets output of the frame/scan headers be
 141    * delayed so that application can write COM, etc, markers between
 142    * jpeg_start_compress and jpeg_write_raw_data.
 143    */
 144   if (cinfo->master->call_pass_startup)
 145     (*cinfo->master->pass_startup) (cinfo);
 146 
 147   /* Verify that at least one iMCU row has been passed. */
 148   lines_per_iMCU_row = cinfo->max_v_samp_factor * DCTSIZE;
 149   if (num_lines < lines_per_iMCU_row)
 150     ERREXIT(cinfo, JERR_BUFFER_SIZE);
 151 
 152   /* Directly compress the row. */
 153   if (! (*cinfo->coef->compress_data) (cinfo, data)) {
 154     /* If compressor did not consume the whole row, suspend processing. */
 155     return 0;
 156   }
 157 
 158   /* OK, we processed one iMCU row. */
 159   cinfo->next_scanline += lines_per_iMCU_row;
 160   return lines_per_iMCU_row;
 161 }
   1 /*
   2  * jcapistd.c
   3  *
   4  * Copyright (C) 1994-1996, Thomas G. Lane.
   5  * Modified 2013 by Guido Vollbeding.
   6  * This file is part of the Independent JPEG Group's software.
   7  * For conditions of distribution and use, see the accompanying README file.
   8  *
   9  * This file contains application interface code for the compression half
  10  * of the JPEG library.  These are the "standard" API routines that are
  11  * used in the normal full-compression case.  They are not used by a
  12  * transcoding-only application.  Note that if an application links in
  13  * jpeg_start_compress, it will end up linking in the entire compressor.
  14  * We thus must separate this file from jcapimin.c to avoid linking the
  15  * whole compression library into a transcoder.
  16  */
  17 
  18 #define JPEG_INTERNALS
  19 #include "jinclude.h"
  20 #include "jpeglib.h"
  21 
  22 
  23 /*
  24  * Compression initialization.
  25  * Before calling this, all parameters and a data destination must be set up.


 129     WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
 130     return 0;
 131   }
 132 
 133   /* Call progress monitor hook if present */
 134   if (cinfo->progress != NULL) {
 135     cinfo->progress->pass_counter = (long) cinfo->next_scanline;
 136     cinfo->progress->pass_limit = (long) cinfo->image_height;
 137     (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
 138   }
 139 
 140   /* Give master control module another chance if this is first call to
 141    * jpeg_write_raw_data.  This lets output of the frame/scan headers be
 142    * delayed so that application can write COM, etc, markers between
 143    * jpeg_start_compress and jpeg_write_raw_data.
 144    */
 145   if (cinfo->master->call_pass_startup)
 146     (*cinfo->master->pass_startup) (cinfo);
 147 
 148   /* Verify that at least one iMCU row has been passed. */
 149   lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_v_scaled_size;
 150   if (num_lines < lines_per_iMCU_row)
 151     ERREXIT(cinfo, JERR_BUFFER_SIZE);
 152 
 153   /* Directly compress the row. */
 154   if (! (*cinfo->coef->compress_data) (cinfo, data)) {
 155     /* If compressor did not consume the whole row, suspend processing. */
 156     return 0;
 157   }
 158 
 159   /* OK, we processed one iMCU row. */
 160   cinfo->next_scanline += lines_per_iMCU_row;
 161   return lines_per_iMCU_row;
 162 }
< prev index next >