Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

jpeglib.h

Go to the documentation of this file.
00001 /*
00002  * jpeglib.h
00003  *
00004  * Copyright (C) 1991-1995, Thomas G. Lane.
00005  * This file is part of the Independent JPEG Group's software.
00006  * For conditions of distribution and use, see the accompanying README file.
00007  *
00008  * This file defines the application interface for the JPEG library.
00009  * Most applications using the library need only include this file,
00010  * and perhaps jerror.h if they want to know the exact error codes.
00011  */
00012 
00013 #ifndef JPEGLIB_H
00014 #define JPEGLIB_H
00015 
00016 typedef unsigned char boolean;
00017 /*
00018  * First we include the configuration files that record how this
00019  * installation of the JPEG library is set up.  jconfig.h can be
00020  * generated automatically for many systems.  jmorecfg.h contains
00021  * manual configuration options that most people need not worry about.
00022  */
00023 
00024 #ifndef JCONFIG_INCLUDED    /* in case jinclude.h already did */
00025 #include "../jpeg-6/jconfig.h"      /* widely used configuration options */
00026 #endif
00027 #include "../jpeg-6/jmorecfg.h"     /* seldom changed options */
00028 
00029 
00030 /* Version ID for the JPEG library.
00031  * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
00032  */
00033 
00034 #define JPEG_LIB_VERSION  60    /* Version 6 */
00035 
00036 
00037 /* Various constants determining the sizes of things.
00038  * All of these are specified by the JPEG standard, so don't change them
00039  * if you want to be compatible.
00040  */
00041 
00042 #define DCTSIZE         8   /* The basic DCT block is 8x8 samples */
00043 #define DCTSIZE2        64  /* DCTSIZE squared; # of elements in a block */
00044 #define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
00045 #define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
00046 #define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
00047 #define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
00048 #define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
00049 /* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard;
00050  * the PostScript DCT filter can emit files with many more than 10 blocks/MCU.
00051  * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU
00052  * to handle it.  We even let you do this from the jconfig.h file.  However,
00053  * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe
00054  * sometimes emits noncompliant files doesn't mean you should too.
00055  */
00056 #define C_MAX_BLOCKS_IN_MCU   10 /* compressor's limit on blocks per MCU */
00057 #ifndef D_MAX_BLOCKS_IN_MCU
00058 #define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on blocks per MCU */
00059 #endif
00060 
00061 
00062 /* This macro is used to declare a "method", that is, a function pointer.
00063  * We want to supply prototype parameters if the compiler can cope.
00064  * Note that the arglist parameter must be parenthesized!
00065  */
00066 
00067 #ifdef HAVE_PROTOTYPES
00068 #define JMETHOD(type,methodname,arglist)  type (*methodname) arglist
00069 #else
00070 #define JMETHOD(type,methodname,arglist)  type (*methodname) ()
00071 #endif
00072 
00073 
00074 /* Data structures for images (arrays of samples and of DCT coefficients).
00075  * On 80x86 machines, the image arrays are too big for near pointers,
00076  * but the pointer arrays can fit in near memory.
00077  */
00078 
00079 typedef JSAMPLE FAR *JSAMPROW;  /* ptr to one image row of pixel samples. */
00080 typedef JSAMPROW *JSAMPARRAY;   /* ptr to some rows (a 2-D sample array) */
00081 typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */
00082 
00083 typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */
00084 typedef JBLOCK FAR *JBLOCKROW;  /* pointer to one row of coefficient blocks */
00085 typedef JBLOCKROW *JBLOCKARRAY;     /* a 2-D array of coefficient blocks */
00086 typedef JBLOCKARRAY *JBLOCKIMAGE;   /* a 3-D array of coefficient blocks */
00087 
00088 typedef JCOEF FAR *JCOEFPTR;    /* useful in a couple of places */
00089 
00090 
00091 /* Types for JPEG compression parameters and working tables. */
00092 
00093 
00094 /* DCT coefficient quantization tables. */
00095 
00096 typedef struct {
00097   /* This field directly represents the contents of a JPEG DQT marker.
00098    * Note: the values are always given in zigzag order.
00099    */
00100   UINT16 quantval[DCTSIZE2];    /* quantization step for each coefficient */
00101   /* This field is used only during compression.  It's initialized FALSE when
00102    * the table is created, and set TRUE when it's been output to the file.
00103    * You could suppress output of a table by setting this to TRUE.
00104    * (See jpeg_suppress_tables for an example.)
00105    */
00106   boolean sent_table;       /* TRUE when table has been output */
00107 } JQUANT_TBL;
00108 
00109 
00110 /* Huffman coding tables. */
00111 
00112 typedef struct {
00113   /* These two fields directly represent the contents of a JPEG DHT marker */
00114   UINT8 bits[17];       /* bits[k] = # of symbols with codes of */
00115                 /* length k bits; bits[0] is unused */
00116   UINT8 huffval[256];       /* The symbols, in order of incr code length */
00117   /* This field is used only during compression.  It's initialized FALSE when
00118    * the table is created, and set TRUE when it's been output to the file.
00119    * You could suppress output of a table by setting this to TRUE.
00120    * (See jpeg_suppress_tables for an example.)
00121    */
00122   boolean sent_table;       /* TRUE when table has been output */
00123 } JHUFF_TBL;
00124 
00125 
00126 /* Basic info about one component (color channel). */
00127 
00128 typedef struct {
00129   /* These values are fixed over the whole image. */
00130   /* For compression, they must be supplied by parameter setup; */
00131   /* for decompression, they are read from the SOF marker. */
00132   int component_id;     /* identifier for this component (0..255) */
00133   int component_index;      /* its index in SOF or cinfo->comp_info[] */
00134   int h_samp_factor;        /* horizontal sampling factor (1..4) */
00135   int v_samp_factor;        /* vertical sampling factor (1..4) */
00136   int quant_tbl_no;     /* quantization table selector (0..3) */
00137   /* These values may vary between scans. */
00138   /* For compression, they must be supplied by parameter setup; */
00139   /* for decompression, they are read from the SOS marker. */
00140   /* The decompressor output side may not use these variables. */
00141   int dc_tbl_no;        /* DC entropy table selector (0..3) */
00142   int ac_tbl_no;        /* AC entropy table selector (0..3) */
00143   
00144   /* Remaining fields should be treated as private by applications. */
00145   
00146   /* These values are computed during compression or decompression startup: */
00147   /* Component's size in DCT blocks.
00148    * Any dummy blocks added to complete an MCU are not counted; therefore
00149    * these values do not depend on whether a scan is interleaved or not.
00150    */
00151   JDIMENSION width_in_blocks;
00152   JDIMENSION height_in_blocks;
00153   /* Size of a DCT block in samples.  Always DCTSIZE for compression.
00154    * For decompression this is the size of the output from one DCT block,
00155    * reflecting any scaling we choose to apply during the IDCT step.
00156    * Values of 1,2,4,8 are likely to be supported.  Note that different
00157    * components may receive different IDCT scalings.
00158    */
00159   int DCT_scaled_size;
00160   /* The downsampled dimensions are the component's actual, unpadded number
00161    * of samples at the main buffer (preprocessing/compression interface), thus
00162    * downsampled_width = ceil(image_width * Hi/Hmax)
00163    * and similarly for height.  For decompression, IDCT scaling is included, so
00164    * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE)
00165    */
00166   JDIMENSION downsampled_width;  /* actual width in samples */
00167   JDIMENSION downsampled_height; /* actual height in samples */
00168   /* This flag is used only for decompression.  In cases where some of the
00169    * components will be ignored (eg grayscale output from YCbCr image),
00170    * we can skip most computations for the unused components.
00171    */
00172   boolean component_needed; /* do we need the value of this component? */
00173 
00174   /* These values are computed before starting a scan of the component. */
00175   /* The decompressor output side may not use these variables. */
00176   int MCU_width;        /* number of blocks per MCU, horizontally */
00177   int MCU_height;       /* number of blocks per MCU, vertically */
00178   int MCU_blocks;       /* MCU_width * MCU_height */
00179   int MCU_sample_width;     /* MCU width in samples, MCU_width*DCT_scaled_size */
00180   int last_col_width;       /* # of non-dummy blocks across in last MCU */
00181   int last_row_height;      /* # of non-dummy blocks down in last MCU */
00182 
00183   /* Saved quantization table for component; NULL if none yet saved.
00184    * See jdinput.c comments about the need for this information.
00185    * This field is not currently used by the compressor.
00186    */
00187   JQUANT_TBL * quant_table;
00188 
00189   /* Private per-component storage for DCT or IDCT subsystem. */
00190   void * dct_table;
00191 } jpeg_component_info;
00192 
00193 
00194 /* The script for encoding a multiple-scan file is an array of these: */
00195 
00196 typedef struct {
00197   int comps_in_scan;        /* number of components encoded in this scan */
00198   int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */
00199   int Ss, Se;           /* progressive JPEG spectral selection parms */
00200   int Ah, Al;           /* progressive JPEG successive approx. parms */
00201 } jpeg_scan_info;
00202 
00203 
00204 /* Known color spaces. */
00205 
00206 typedef enum {
00207     JCS_UNKNOWN,        /* error/unspecified */
00208     JCS_GRAYSCALE,      /* monochrome */
00209     JCS_RGB,        /* red/green/blue */
00210     JCS_YCbCr,      /* Y/Cb/Cr (also known as YUV) */
00211     JCS_CMYK,       /* C/M/Y/K */
00212     JCS_YCCK        /* Y/Cb/Cr/K */
00213 } J_COLOR_SPACE;
00214 
00215 /* DCT/IDCT algorithm options. */
00216 
00217 typedef enum {
00218     JDCT_ISLOW,     /* slow but accurate integer algorithm */
00219     JDCT_IFAST,     /* faster, less accurate integer method */
00220     JDCT_FLOAT      /* floating-point: accurate, fast on fast HW */
00221 } J_DCT_METHOD;
00222 
00223 #ifndef JDCT_DEFAULT        /* may be overridden in jconfig.h */
00224 #define JDCT_DEFAULT  JDCT_ISLOW
00225 #endif
00226 #ifndef JDCT_FASTEST        /* may be overridden in jconfig.h */
00227 #define JDCT_FASTEST  JDCT_IFAST
00228 #endif
00229 
00230 /* Dithering options for decompression. */
00231 
00232 typedef enum {
00233     JDITHER_NONE,       /* no dithering */
00234     JDITHER_ORDERED,    /* simple ordered dither */
00235     JDITHER_FS      /* Floyd-Steinberg error diffusion dither */
00236 } J_DITHER_MODE;
00237 
00238 
00239 /* Common fields between JPEG compression and decompression master structs. */
00240 
00241 #define jpeg_common_fields \
00242   struct jpeg_error_mgr * err;  /* Error handler module */\
00243   struct jpeg_memory_mgr * mem; /* Memory manager module */\
00244   struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\
00245   boolean is_decompressor;  /* so common code can tell which is which */\
00246   int global_state      /* for checking call sequence validity */
00247 
00248 /* Routines that are to be used by both halves of the library are declared
00249  * to receive a pointer to this structure.  There are no actual instances of
00250  * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.
00251  */
00252 struct jpeg_common_struct {
00253   jpeg_common_fields;       /* Fields common to both master struct types */
00254   /* Additional fields follow in an actual jpeg_compress_struct or
00255    * jpeg_decompress_struct.  All three structs must agree on these
00256    * initial fields!  (This would be a lot cleaner in C++.)
00257    */
00258 };
00259 
00260 typedef struct jpeg_common_struct * j_common_ptr;
00261 typedef struct jpeg_compress_struct * j_compress_ptr;
00262 typedef struct jpeg_decompress_struct * j_decompress_ptr;
00263 
00264 
00265 /* Master record for a compression instance */
00266 
00267 struct jpeg_compress_struct {
00268   jpeg_common_fields;       /* Fields shared with jpeg_decompress_struct */
00269 
00270   /* Destination for compressed data */
00271   struct jpeg_destination_mgr * dest;
00272 
00273   /* Description of source image --- these fields must be filled in by
00274    * outer application before starting compression.  in_color_space must
00275    * be correct before you can even call jpeg_set_defaults().
00276    */
00277 
00278   JDIMENSION image_width;   /* input image width */
00279   JDIMENSION image_height;  /* input image height */
00280   int input_components;     /* # of color components in input image */
00281   J_COLOR_SPACE in_color_space; /* colorspace of input image */
00282 
00283   double input_gamma;       /* image gamma of input image */
00284 
00285   /* Compression parameters --- these fields must be set before calling
00286    * jpeg_start_compress().  We recommend calling jpeg_set_defaults() to
00287    * initialize everything to reasonable defaults, then changing anything
00288    * the application specifically wants to change.  That way you won't get
00289    * burnt when new parameters are added.  Also note that there are several
00290    * helper routines to simplify changing parameters.
00291    */
00292 
00293   int data_precision;       /* bits of precision in image data */
00294 
00295   int num_components;       /* # of color components in JPEG image */
00296   J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
00297 
00298   jpeg_component_info * comp_info;
00299   /* comp_info[i] describes component that appears i'th in SOF */
00300   
00301   JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
00302   /* ptrs to coefficient quantization tables, or NULL if not defined */
00303   
00304   JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
00305   JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
00306   /* ptrs to Huffman coding tables, or NULL if not defined */
00307   
00308   UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
00309   UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
00310   UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
00311 
00312   int num_scans;        /* # of entries in scan_info array */
00313   const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */
00314   /* The default value of scan_info is NULL, which causes a single-scan
00315    * sequential JPEG file to be emitted.  To create a multi-scan file,
00316    * set num_scans and scan_info to point to an array of scan definitions.
00317    */
00318 
00319   boolean raw_data_in;      /* TRUE=caller supplies downsampled data */
00320   boolean arith_code;       /* TRUE=arithmetic coding, FALSE=Huffman */
00321   boolean optimize_coding;  /* TRUE=optimize entropy encoding parms */
00322   boolean CCIR601_sampling; /* TRUE=first samples are cosited */
00323   int smoothing_factor;     /* 1..100, or 0 for no input smoothing */
00324   J_DCT_METHOD dct_method;  /* DCT algorithm selector */
00325 
00326   /* The restart interval can be specified in absolute MCUs by setting
00327    * restart_interval, or in MCU rows by setting restart_in_rows
00328    * (in which case the correct restart_interval will be figured
00329    * for each scan).
00330    */
00331   unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */
00332   int restart_in_rows;      /* if > 0, MCU rows per restart interval */
00333 
00334   /* Parameters controlling emission of special markers. */
00335 
00336   boolean write_JFIF_header;    /* should a JFIF marker be written? */
00337   /* These three values are not used by the JPEG code, merely copied */
00338   /* into the JFIF APP0 marker.  density_unit can be 0 for unknown, */
00339   /* 1 for dots/inch, or 2 for dots/cm.  Note that the pixel aspect */
00340   /* ratio is defined by X_density/Y_density even when density_unit=0. */
00341   UINT8 density_unit;       /* JFIF code for pixel size units */
00342   UINT16 X_density;     /* Horizontal pixel density */
00343   UINT16 Y_density;     /* Vertical pixel density */
00344   boolean write_Adobe_marker;   /* should an Adobe marker be written? */
00345   
00346   /* State variable: index of next scanline to be written to
00347    * jpeg_write_scanlines().  Application may use this to control its
00348    * processing loop, e.g., "while (next_scanline < image_height)".
00349    */
00350 
00351   JDIMENSION next_scanline; /* 0 .. image_height-1  */
00352 
00353   /* Remaining fields are known throughout compressor, but generally
00354    * should not be touched by a surrounding application.
00355    */
00356 
00357   /*
00358    * These fields are computed during compression startup
00359    */
00360   boolean progressive_mode; /* TRUE if scan script uses progressive mode */
00361   int max_h_samp_factor;    /* largest h_samp_factor */
00362   int max_v_samp_factor;    /* largest v_samp_factor */
00363 
00364   JDIMENSION total_iMCU_rows;   /* # of iMCU rows to be input to coef ctlr */
00365   /* The coefficient controller receives data in units of MCU rows as defined
00366    * for fully interleaved scans (whether the JPEG file is interleaved or not).
00367    * There are v_samp_factor * DCTSIZE sample rows of each component in an
00368    * "iMCU" (interleaved MCU) row.
00369    */
00370   
00371   /*
00372    * These fields are valid during any one scan.
00373    * They describe the components and MCUs actually appearing in the scan.
00374    */
00375   int comps_in_scan;        /* # of JPEG components in this scan */
00376   jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
00377   /* *cur_comp_info[i] describes component that appears i'th in SOS */
00378   
00379   JDIMENSION MCUs_per_row;  /* # of MCUs across the image */
00380   JDIMENSION MCU_rows_in_scan;  /* # of MCU rows in the image */
00381   
00382   int blocks_in_MCU;        /* # of DCT blocks per MCU */
00383   int MCU_membership[C_MAX_BLOCKS_IN_MCU];
00384   /* MCU_membership[i] is index in cur_comp_info of component owning */
00385   /* i'th block in an MCU */
00386 
00387   int Ss, Se, Ah, Al;       /* progressive JPEG parameters for scan */
00388 
00389   /*
00390    * Links to compression subobjects (methods and private variables of modules)
00391    */
00392   struct jpeg_comp_master * master;
00393   struct jpeg_c_main_controller * main;
00394   struct jpeg_c_prep_controller * prep;
00395   struct jpeg_c_coef_controller * coef;
00396   struct jpeg_marker_writer * marker;
00397   struct jpeg_color_converter * cconvert;
00398   struct jpeg_downsampler * downsample;
00399   struct jpeg_forward_dct * fdct;
00400   struct jpeg_entropy_encoder * entropy;
00401 };
00402 
00403 
00404 /* Master record for a decompression instance */
00405 
00406 struct jpeg_decompress_struct {
00407   jpeg_common_fields;       /* Fields shared with jpeg_compress_struct */
00408 
00409   /* Source of compressed data */
00410   struct jpeg_source_mgr * src;
00411 
00412   /* Basic description of image --- filled in by jpeg_read_header(). */
00413   /* Application may inspect these values to decide how to process image. */
00414 
00415   JDIMENSION image_width;   /* nominal image width (from SOF marker) */
00416   JDIMENSION image_height;  /* nominal image height */
00417   int num_components;       /* # of color components in JPEG image */
00418   J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
00419 
00420   /* Decompression processing parameters --- these fields must be set before
00421    * calling jpeg_start_decompress().  Note that jpeg_read_header() initializes
00422    * them to default values.
00423    */
00424 
00425   J_COLOR_SPACE out_color_space; /* colorspace for output */
00426 
00427   unsigned int scale_num, scale_denom; /* fraction by which to scale image */
00428 
00429   double output_gamma;      /* image gamma wanted in output */
00430 
00431   boolean buffered_image;   /* TRUE=multiple output passes */
00432   boolean raw_data_out;     /* TRUE=downsampled data wanted */
00433 
00434   J_DCT_METHOD dct_method;  /* IDCT algorithm selector */
00435   boolean do_fancy_upsampling;  /* TRUE=apply fancy upsampling */
00436   boolean do_block_smoothing;   /* TRUE=apply interblock smoothing */
00437 
00438   boolean quantize_colors;  /* TRUE=colormapped output wanted */
00439   /* the following are ignored if not quantize_colors: */
00440   J_DITHER_MODE dither_mode;    /* type of color dithering to use */
00441   boolean two_pass_quantize;    /* TRUE=use two-pass color quantization */
00442   int desired_number_of_colors; /* max # colors to use in created colormap */
00443   /* these are significant only in buffered-image mode: */
00444   boolean enable_1pass_quant;   /* enable future use of 1-pass quantizer */
00445   boolean enable_external_quant;/* enable future use of external colormap */
00446   boolean enable_2pass_quant;   /* enable future use of 2-pass quantizer */
00447 
00448   /* Description of actual output image that will be returned to application.
00449    * These fields are computed by jpeg_start_decompress().
00450    * You can also use jpeg_calc_output_dimensions() to determine these values
00451    * in advance of calling jpeg_start_decompress().
00452    */
00453 
00454   JDIMENSION output_width;  /* scaled image width */
00455   JDIMENSION output_height; /* scaled image height */
00456   int out_color_components; /* # of color components in out_color_space */
00457   int output_components;    /* # of color components returned */
00458   /* output_components is 1 (a colormap index) when quantizing colors;
00459    * otherwise it equals out_color_components.
00460    */
00461   int rec_outbuf_height;    /* min recommended height of scanline buffer */
00462   /* If the buffer passed to jpeg_read_scanlines() is less than this many rows
00463    * high, space and time will be wasted due to unnecessary data copying.
00464    * Usually rec_outbuf_height will be 1 or 2, at most 4.
00465    */
00466 
00467   /* When quantizing colors, the output colormap is described by these fields.
00468    * The application can supply a colormap by setting colormap non-NULL before
00469    * calling jpeg_start_decompress; otherwise a colormap is created during
00470    * jpeg_start_decompress or jpeg_start_output.
00471    * The map has out_color_components rows and actual_number_of_colors columns.
00472    */
00473   int actual_number_of_colors;  /* number of entries in use */
00474   JSAMPARRAY colormap;      /* The color map as a 2-D pixel array */
00475 
00476   /* State variables: these variables indicate the progress of decompression.
00477    * The application may examine these but must not modify them.
00478    */
00479 
00480   /* Row index of next scanline to be read from jpeg_read_scanlines().
00481    * Application may use this to control its processing loop, e.g.,
00482    * "while (output_scanline < output_height)".
00483    */
00484   JDIMENSION output_scanline;   /* 0 .. output_height-1  */
00485 
00486   /* Current input scan number and number of iMCU rows completed in scan.
00487    * These indicate the progress of the decompressor input side.
00488    */
00489   int input_scan_number;    /* Number of SOS markers seen so far */
00490   JDIMENSION input_iMCU_row;    /* Number of iMCU rows completed */
00491 
00492   /* The "output scan number" is the notional scan being displayed by the
00493    * output side.  The decompressor will not allow output scan/row number
00494    * to get ahead of input scan/row, but it can fall arbitrarily far behind.
00495    */
00496   int output_scan_number;   /* Nominal scan number being displayed */
00497   JDIMENSION output_iMCU_row;   /* Number of iMCU rows read */
00498 
00499   /* Current progression status.  coef_bits[c][i] indicates the precision
00500    * with which component c's DCT coefficient i (in zigzag order) is known.
00501    * It is -1 when no data has yet been received, otherwise it is the point
00502    * transform (shift) value for the most recent scan of the coefficient
00503    * (thus, 0 at completion of the progression).
00504    * This pointer is NULL when reading a non-progressive file.
00505    */
00506   int (*coef_bits)[DCTSIZE2];   /* -1 or current Al value for each coef */
00507 
00508   /* Internal JPEG parameters --- the application usually need not look at
00509    * these fields.  Note that the decompressor output side may not use
00510    * any parameters that can change between scans.
00511    */
00512 
00513   /* Quantization and Huffman tables are carried forward across input
00514    * datastreams when processing abbreviated JPEG datastreams.
00515    */
00516 
00517   JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
00518   /* ptrs to coefficient quantization tables, or NULL if not defined */
00519 
00520   JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
00521   JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
00522   /* ptrs to Huffman coding tables, or NULL if not defined */
00523 
00524   /* These parameters are never carried across datastreams, since they
00525    * are given in SOF/SOS markers or defined to be reset by SOI.
00526    */
00527 
00528   int data_precision;       /* bits of precision in image data */
00529 
00530   jpeg_component_info * comp_info;
00531   /* comp_info[i] describes component that appears i'th in SOF */
00532 
00533   boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */
00534   boolean arith_code;       /* TRUE=arithmetic coding, FALSE=Huffman */
00535 
00536   UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
00537   UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
00538   UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
00539 
00540   unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */
00541 
00542   /* These fields record data obtained from optional markers recognized by
00543    * the JPEG library.
00544    */
00545   boolean saw_JFIF_marker;  /* TRUE iff a JFIF APP0 marker was found */
00546   /* Data copied from JFIF marker: */
00547   UINT8 density_unit;       /* JFIF code for pixel size units */
00548   UINT16 X_density;     /* Horizontal pixel density */
00549   UINT16 Y_density;     /* Vertical pixel density */
00550   boolean saw_Adobe_marker; /* TRUE iff an Adobe APP14 marker was found */
00551   UINT8 Adobe_transform;    /* Color transform code from Adobe marker */
00552 
00553   boolean CCIR601_sampling; /* TRUE=first samples are cosited */
00554 
00555   /* Remaining fields are known throughout decompressor, but generally
00556    * should not be touched by a surrounding application.
00557    */
00558 
00559   /*
00560    * These fields are computed during decompression startup
00561    */
00562   int max_h_samp_factor;    /* largest h_samp_factor */
00563   int max_v_samp_factor;    /* largest v_samp_factor */
00564 
00565   int min_DCT_scaled_size;  /* smallest DCT_scaled_size of any component */
00566 
00567   JDIMENSION total_iMCU_rows;   /* # of iMCU rows in image */
00568   /* The coefficient controller's input and output progress is measured in
00569    * units of "iMCU" (interleaved MCU) rows.  These are the same as MCU rows
00570    * in fully interleaved JPEG scans, but are used whether the scan is
00571    * interleaved or not.  We define an iMCU row as v_samp_factor DCT block
00572    * rows of each component.  Therefore, the IDCT output contains
00573    * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row.
00574    */
00575 
00576   JSAMPLE * sample_range_limit; /* table for fast range-limiting */
00577 
00578   /*
00579    * These fields are valid during any one scan.
00580    * They describe the components and MCUs actually appearing in the scan.
00581    * Note that the decompressor output side must not use these fields.
00582    */
00583   int comps_in_scan;        /* # of JPEG components in this scan */
00584   jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
00585   /* *cur_comp_info[i] describes component that appears i'th in SOS */
00586 
00587   JDIMENSION MCUs_per_row;  /* # of MCUs across the image */
00588   JDIMENSION MCU_rows_in_scan;  /* # of MCU rows in the image */
00589 
00590   int blocks_in_MCU;        /* # of DCT blocks per MCU */
00591   int MCU_membership[D_MAX_BLOCKS_IN_MCU];
00592   /* MCU_membership[i] is index in cur_comp_info of component owning */
00593   /* i'th block in an MCU */
00594 
00595   int Ss, Se, Ah, Al;       /* progressive JPEG parameters for scan */
00596 
00597   /* This field is shared between entropy decoder and marker parser.
00598    * It is either zero or the code of a JPEG marker that has been
00599    * read from the data source, but has not yet been processed.
00600    */
00601   int unread_marker;
00602 
00603   /*
00604    * Links to decompression subobjects (methods, private variables of modules)
00605    */
00606   struct jpeg_decomp_master * master;
00607   struct jpeg_d_main_controller * main;
00608   struct jpeg_d_coef_controller * coef;
00609   struct jpeg_d_post_controller * post;
00610   struct jpeg_input_controller * inputctl;
00611   struct jpeg_marker_reader * marker;
00612   struct jpeg_entropy_decoder * entropy;
00613   struct jpeg_inverse_dct * idct;
00614   struct jpeg_upsampler * upsample;
00615   struct jpeg_color_deconverter * cconvert;
00616   struct jpeg_color_quantizer * cquantize;
00617 };
00618 
00619 
00620 /* "Object" declarations for JPEG modules that may be supplied or called
00621  * directly by the surrounding application.
00622  * As with all objects in the JPEG library, these structs only define the
00623  * publicly visible methods and state variables of a module.  Additional
00624  * private fields may exist after the public ones.
00625  */
00626 
00627 
00628 /* Error handler object */
00629 
00630 struct jpeg_error_mgr {
00631   /* Error exit handler: does not return to caller */
00632   JMETHOD(void, error_exit, (j_common_ptr cinfo));
00633   /* Conditionally emit a trace or warning message */
00634   JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level));
00635   /* Routine that actually outputs a trace or error message */
00636   JMETHOD(void, output_message, (j_common_ptr cinfo));
00637   /* Format a message string for the most recent JPEG error or message */
00638   JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer));
00639 #define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
00640   /* Reset error state variables at start of a new image */
00641   JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
00642   
00643   /* The message ID code and any parameters are saved here.
00644    * A message can have one string parameter or up to 8 int parameters.
00645    */
00646   int msg_code;
00647 #define JMSG_STR_PARM_MAX  80
00648   union {
00649     int i[8];
00650     char s[JMSG_STR_PARM_MAX];
00651   } msg_parm;
00652   
00653   /* Standard state variables for error facility */
00654   
00655   int trace_level;      /* max msg_level that will be displayed */
00656   
00657   /* For recoverable corrupt-data errors, we emit a warning message,
00658    * but keep going unless emit_message chooses to abort.  emit_message
00659    * should count warnings in num_warnings.  The surrounding application
00660    * can check for bad data by seeing if num_warnings is nonzero at the
00661    * end of processing.
00662    */
00663   long num_warnings;        /* number of corrupt-data warnings */
00664 
00665   /* These fields point to the table(s) of error message strings.
00666    * An application can change the table pointer to switch to a different
00667    * message list (typically, to change the language in which errors are
00668    * reported).  Some applications may wish to add additional error codes
00669    * that will be handled by the JPEG library error mechanism; the second
00670    * table pointer is used for this purpose.
00671    *
00672    * First table includes all errors generated by JPEG library itself.
00673    * Error code 0 is reserved for a "no such error string" message.
00674    */
00675   const char * const * jpeg_message_table; /* Library errors */
00676   int last_jpeg_message;    /* Table contains strings 0..last_jpeg_message */
00677   /* Second table can be added by application (see cjpeg/djpeg for example).
00678    * It contains strings numbered first_addon_message..last_addon_message.
00679    */
00680   const char * const * addon_message_table; /* Non-library errors */
00681   int first_addon_message;  /* code for first string in addon table */
00682   int last_addon_message;   /* code for last string in addon table */
00683 };
00684 
00685 
00686 /* Progress monitor object */
00687 
00688 struct jpeg_progress_mgr {
00689   JMETHOD(void, progress_monitor, (j_common_ptr cinfo));
00690 
00691   long pass_counter;        /* work units completed in this pass */
00692   long pass_limit;      /* total number of work units in this pass */
00693   int completed_passes;     /* passes completed so far */
00694   int total_passes;     /* total number of passes expected */
00695 };
00696 
00697 
00698 /* Data destination object for compression */
00699 
00700 struct jpeg_destination_mgr {
00701   JOCTET * next_output_byte;    /* => next byte to write in buffer */
00702   size_t free_in_buffer;    /* # of byte spaces remaining in buffer */
00703 
00704   JMETHOD(void, init_destination, (j_compress_ptr cinfo));
00705   JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo));
00706   JMETHOD(void, term_destination, (j_compress_ptr cinfo));
00707 };
00708 
00709 
00710 /* Data source object for decompression */
00711 
00712 struct jpeg_source_mgr {
00713   const JOCTET * next_input_byte; /* => next byte to read from buffer */
00714   size_t bytes_in_buffer;   /* # of bytes remaining in buffer */
00715 
00716   JMETHOD(void, init_source, (j_decompress_ptr cinfo));
00717   JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo));
00718   JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes));
00719   JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired));
00720   JMETHOD(void, term_source, (j_decompress_ptr cinfo));
00721 };
00722 
00723 
00724 /* Memory manager object.
00725  * Allocates "small" objects (a few K total), "large" objects (tens of K),
00726  * and "really big" objects (virtual arrays with backing store if needed).
00727  * The memory manager does not allow individual objects to be freed; rather,
00728  * each created object is assigned to a pool, and whole pools can be freed
00729  * at once.  This is faster and more convenient than remembering exactly what
00730  * to free, especially where malloc()/free() are not too speedy.
00731  * NB: alloc routines never return NULL.  They exit to error_exit if not
00732  * successful.
00733  */
00734 
00735 #define JPOOL_PERMANENT 0   /* lasts until master record is destroyed */
00736 #define JPOOL_IMAGE 1   /* lasts until done with image/datastream */
00737 #define JPOOL_NUMPOOLS  2
00738 
00739 typedef struct jvirt_sarray_control * jvirt_sarray_ptr;
00740 typedef struct jvirt_barray_control * jvirt_barray_ptr;
00741 
00742 
00743 struct jpeg_memory_mgr {
00744   /* Method pointers */
00745   JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id,
00746                 size_t sizeofobject));
00747   JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id,
00748                      size_t sizeofobject));
00749   JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id,
00750                      JDIMENSION samplesperrow,
00751                      JDIMENSION numrows));
00752   JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id,
00753                       JDIMENSION blocksperrow,
00754                       JDIMENSION numrows));
00755   JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo,
00756                           int pool_id,
00757                           boolean pre_zero,
00758                           JDIMENSION samplesperrow,
00759                           JDIMENSION numrows,
00760                           JDIMENSION maxaccess));
00761   JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo,
00762                           int pool_id,
00763                           boolean pre_zero,
00764                           JDIMENSION blocksperrow,
00765                           JDIMENSION numrows,
00766                           JDIMENSION maxaccess));
00767   JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo));
00768   JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo,
00769                        jvirt_sarray_ptr ptr,
00770                        JDIMENSION start_row,
00771                        JDIMENSION num_rows,
00772                        boolean writable));
00773   JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo,
00774                         jvirt_barray_ptr ptr,
00775                         JDIMENSION start_row,
00776                         JDIMENSION num_rows,
00777                         boolean writable));
00778   JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id));
00779   JMETHOD(void, self_destruct, (j_common_ptr cinfo));
00780 
00781   /* Limit on memory allocation for this JPEG object.  (Note that this is
00782    * merely advisory, not a guaranteed maximum; it only affects the space
00783    * used for virtual-array buffers.)  May be changed by outer application
00784    * after creating the JPEG object.
00785    */
00786   long max_memory_to_use;
00787 };
00788 
00789 
00790 /* Routine signature for application-supplied marker processing methods.
00791  * Need not pass marker code since it is stored in cinfo->unread_marker.
00792  */
00793 typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
00794 
00795 
00796 /* Declarations for routines called by application.
00797  * The JPP macro hides prototype parameters from compilers that can't cope.
00798  * Note JPP requires double parentheses.
00799  */
00800 
00801 #ifdef HAVE_PROTOTYPES
00802 #define JPP(arglist)    arglist
00803 #else
00804 #define JPP(arglist)    ()
00805 #endif
00806 
00807 
00808 /* Short forms of external names for systems with brain-damaged linkers.
00809  * We shorten external names to be unique in the first six letters, which
00810  * is good enough for all known systems.
00811  * (If your compiler itself needs names to be unique in less than 15 
00812  * characters, you are out of luck.  Get a better compiler.)
00813  */
00814 
00815 #ifdef NEED_SHORT_EXTERNAL_NAMES
00816 #define jpeg_std_error      jStdError
00817 #define jpeg_create_compress    jCreaCompress
00818 #define jpeg_create_decompress  jCreaDecompress
00819 #define jpeg_destroy_compress   jDestCompress
00820 #define jpeg_destroy_decompress jDestDecompress
00821 #define jpeg_stdio_dest     jStdDest
00822 #define jpeg_stdio_src      jStdSrc
00823 #define jpeg_set_defaults   jSetDefaults
00824 #define jpeg_set_colorspace jSetColorspace
00825 #define jpeg_default_colorspace jDefColorspace
00826 #define jpeg_set_quality    jSetQuality
00827 #define jpeg_set_linear_quality jSetLQuality
00828 #define jpeg_add_quant_table    jAddQuantTable
00829 #define jpeg_quality_scaling    jQualityScaling
00830 #define jpeg_simple_progression jSimProgress
00831 #define jpeg_suppress_tables    jSuppressTables
00832 #define jpeg_alloc_quant_table  jAlcQTable
00833 #define jpeg_alloc_huff_table   jAlcHTable
00834 #define jpeg_start_compress jStrtCompress
00835 #define jpeg_write_scanlines    jWrtScanlines
00836 #define jpeg_finish_compress    jFinCompress
00837 #define jpeg_write_raw_data jWrtRawData
00838 #define jpeg_write_marker   jWrtMarker
00839 #define jpeg_write_tables   jWrtTables
00840 #define jpeg_read_header    jReadHeader
00841 #define jpeg_start_decompress   jStrtDecompress
00842 #define jpeg_read_scanlines jReadScanlines
00843 #define jpeg_finish_decompress  jFinDecompress
00844 #define jpeg_read_raw_data  jReadRawData
00845 #define jpeg_has_multiple_scans jHasMultScn
00846 #define jpeg_start_output   jStrtOutput
00847 #define jpeg_finish_output  jFinOutput
00848 #define jpeg_input_complete jInComplete
00849 #define jpeg_new_colormap   jNewCMap
00850 #define jpeg_consume_input  jConsumeInput
00851 #define jpeg_calc_output_dimensions jCalcDimensions
00852 #define jpeg_set_marker_processor   jSetMarker
00853 #define jpeg_read_coefficients  jReadCoefs
00854 #define jpeg_write_coefficients jWrtCoefs
00855 #define jpeg_copy_critical_parameters   jCopyCrit
00856 #define jpeg_abort_compress jAbrtCompress
00857 #define jpeg_abort_decompress   jAbrtDecompress
00858 #define jpeg_abort      jAbort
00859 #define jpeg_destroy        jDestroy
00860 #define jpeg_resync_to_restart  jResyncRestart
00861 #endif /* NEED_SHORT_EXTERNAL_NAMES */
00862 
00863 
00864 /* Default error-management setup */
00865 EXTERN struct jpeg_error_mgr *jpeg_std_error JPP((struct jpeg_error_mgr *err));
00866 
00867 /* Initialization and destruction of JPEG compression objects */
00868 /* NB: you must set up the error-manager BEFORE calling jpeg_create_xxx */
00869 EXTERN void jpeg_create_compress JPP((j_compress_ptr cinfo));
00870 EXTERN void jpeg_create_decompress JPP((j_decompress_ptr cinfo));
00871 EXTERN void jpeg_destroy_compress JPP((j_compress_ptr cinfo));
00872 EXTERN void jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));
00873 
00874 /* Standard data source and destination managers: stdio streams. */
00875 /* Caller is responsible for opening the file before and closing after. */
00876 EXTERN void jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
00877 EXTERN void jpeg_stdio_src JPP((j_decompress_ptr cinfo, unsigned char *infile));
00878 
00879 /* Default parameter setup for compression */
00880 EXTERN void jpeg_set_defaults JPP((j_compress_ptr cinfo));
00881 /* Compression parameter setup aids */
00882 EXTERN void jpeg_set_colorspace JPP((j_compress_ptr cinfo,
00883                      J_COLOR_SPACE colorspace));
00884 EXTERN void jpeg_default_colorspace JPP((j_compress_ptr cinfo));
00885 EXTERN void jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,
00886                   boolean force_baseline));
00887 EXTERN void jpeg_set_linear_quality JPP((j_compress_ptr cinfo,
00888                      int scale_factor,
00889                      boolean force_baseline));
00890 EXTERN void jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
00891                       const unsigned int *basic_table,
00892                       int scale_factor,
00893                       boolean force_baseline));
00894 EXTERN int jpeg_quality_scaling JPP((int quality));
00895 EXTERN void jpeg_simple_progression JPP((j_compress_ptr cinfo));
00896 EXTERN void jpeg_suppress_tables JPP((j_compress_ptr cinfo,
00897                       boolean suppress));
00898 EXTERN JQUANT_TBL * jpeg_alloc_quant_table JPP((j_common_ptr cinfo));
00899 EXTERN JHUFF_TBL * jpeg_alloc_huff_table JPP((j_common_ptr cinfo));
00900 
00901 /* Main entry points for compression */
00902 EXTERN void jpeg_start_compress JPP((j_compress_ptr cinfo,
00903                      boolean write_all_tables));
00904 EXTERN JDIMENSION jpeg_write_scanlines JPP((j_compress_ptr cinfo,
00905                         JSAMPARRAY scanlines,
00906                         JDIMENSION num_lines));
00907 EXTERN void jpeg_finish_compress JPP((j_compress_ptr cinfo));
00908 
00909 /* Replaces jpeg_write_scanlines when writing raw downsampled data. */
00910 EXTERN JDIMENSION jpeg_write_raw_data JPP((j_compress_ptr cinfo,
00911                        JSAMPIMAGE data,
00912                        JDIMENSION num_lines));
00913 
00914 /* Write a special marker.  See libjpeg.doc concerning safe usage. */
00915 EXTERN void jpeg_write_marker JPP((j_compress_ptr cinfo, int marker,
00916                    const JOCTET *dataptr, unsigned int datalen));
00917 
00918 /* Alternate compression function: just write an abbreviated table file */
00919 EXTERN void jpeg_write_tables JPP((j_compress_ptr cinfo));
00920 
00921 /* Decompression startup: read start of JPEG datastream to see what's there */
00922 EXTERN int jpeg_read_header JPP((j_decompress_ptr cinfo,
00923                  boolean require_image));
00924 /* Return value is one of: */
00925 #define JPEG_SUSPENDED      0 /* Suspended due to lack of input data */
00926 #define JPEG_HEADER_OK      1 /* Found valid image datastream */
00927 #define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */
00928 /* If you pass require_image = TRUE (normal case), you need not check for
00929  * a TABLES_ONLY return code; an abbreviated file will cause an error exit.
00930  * JPEG_SUSPENDED is only possible if you use a data source module that can
00931  * give a suspension return (the stdio source module doesn't).
00932  */
00933 
00934 /* Main entry points for decompression */
00935 EXTERN boolean jpeg_start_decompress JPP((j_decompress_ptr cinfo));
00936 EXTERN JDIMENSION jpeg_read_scanlines JPP((j_decompress_ptr cinfo,
00937                        JSAMPARRAY scanlines,
00938                        JDIMENSION max_lines));
00939 EXTERN boolean jpeg_finish_decompress JPP((j_decompress_ptr cinfo));
00940 
00941 /* Replaces jpeg_read_scanlines when reading raw downsampled data. */
00942 EXTERN JDIMENSION jpeg_read_raw_data JPP((j_decompress_ptr cinfo,
00943                       JSAMPIMAGE data,
00944                       JDIMENSION max_lines));
00945 
00946 /* Additional entry points for buffered-image mode. */
00947 EXTERN boolean jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo));
00948 EXTERN boolean jpeg_start_output JPP((j_decompress_ptr cinfo,
00949                       int scan_number));
00950 EXTERN boolean jpeg_finish_output JPP((j_decompress_ptr cinfo));
00951 EXTERN boolean jpeg_input_complete JPP((j_decompress_ptr cinfo));
00952 EXTERN void jpeg_new_colormap JPP((j_decompress_ptr cinfo));
00953 EXTERN int jpeg_consume_input JPP((j_decompress_ptr cinfo));
00954 /* Return value is one of: */
00955 /* #define JPEG_SUSPENDED   0    Suspended due to lack of input data */
00956 #define JPEG_REACHED_SOS    1 /* Reached start of new scan */
00957 #define JPEG_REACHED_EOI    2 /* Reached end of image */
00958 #define JPEG_ROW_COMPLETED  3 /* Completed one iMCU row */
00959 #define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */
00960 
00961 /* Precalculate output dimensions for current decompression parameters. */
00962 EXTERN void jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));
00963 
00964 /* Install a special processing method for COM or APPn markers. */
00965 EXTERN void jpeg_set_marker_processor JPP((j_decompress_ptr cinfo,
00966                        int marker_code,
00967                        jpeg_marker_parser_method routine));
00968 
00969 /* Read or write raw DCT coefficients --- useful for lossless transcoding. */
00970 EXTERN jvirt_barray_ptr * jpeg_read_coefficients JPP((j_decompress_ptr cinfo));
00971 EXTERN void jpeg_write_coefficients JPP((j_compress_ptr cinfo,
00972                      jvirt_barray_ptr * coef_arrays));
00973 EXTERN void jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo,
00974                            j_compress_ptr dstinfo));
00975 
00976 /* If you choose to abort compression or decompression before completing
00977  * jpeg_finish_(de)compress, then you need to clean up to release memory,
00978  * temporary files, etc.  You can just call jpeg_destroy_(de)compress
00979  * if you're done with the JPEG object, but if you want to clean it up and
00980  * reuse it, call this:
00981  */
00982 EXTERN void jpeg_abort_compress JPP((j_compress_ptr cinfo));
00983 EXTERN void jpeg_abort_decompress JPP((j_decompress_ptr cinfo));
00984 
00985 /* Generic versions of jpeg_abort and jpeg_destroy that work on either
00986  * flavor of JPEG object.  These may be more convenient in some places.
00987  */
00988 EXTERN void jpeg_abort JPP((j_common_ptr cinfo));
00989 EXTERN void jpeg_destroy JPP((j_common_ptr cinfo));
00990 
00991 /* Default restart-marker-resync procedure for use by data source modules */
00992 EXTERN boolean jpeg_resync_to_restart JPP((j_decompress_ptr cinfo,
00993                        int desired));
00994 
00995 
00996 /* These marker codes are exported since applications and data source modules
00997  * are likely to want to use them.
00998  */
00999 
01000 #define JPEG_RST0   0xD0    /* RST0 marker code */
01001 #define JPEG_EOI    0xD9    /* EOI marker code */
01002 #define JPEG_APP0   0xE0    /* APP0 marker code */
01003 #define JPEG_COM    0xFE    /* COM marker code */
01004 
01005 
01006 /* If we have a brain-damaged compiler that emits warnings (or worse, errors)
01007  * for structure definitions that are never filled in, keep it quiet by
01008  * supplying dummy definitions for the various substructures.
01009  */
01010 
01011 #ifdef INCOMPLETE_TYPES_BROKEN
01012 #ifndef JPEG_INTERNALS      /* will be defined in jpegint.h */
01013 struct jvirt_sarray_control { long dummy; };
01014 struct jvirt_barray_control { long dummy; };
01015 struct jpeg_comp_master { long dummy; };
01016 struct jpeg_c_main_controller { long dummy; };
01017 struct jpeg_c_prep_controller { long dummy; };
01018 struct jpeg_c_coef_controller { long dummy; };
01019 struct jpeg_marker_writer { long dummy; };
01020 struct jpeg_color_converter { long dummy; };
01021 struct jpeg_downsampler { long dummy; };
01022 struct jpeg_forward_dct { long dummy; };
01023 struct jpeg_entropy_encoder { long dummy; };
01024 struct jpeg_decomp_master { long dummy; };
01025 struct jpeg_d_main_controller { long dummy; };
01026 struct jpeg_d_coef_controller { long dummy; };
01027 struct jpeg_d_post_controller { long dummy; };
01028 struct jpeg_input_controller { long dummy; };
01029 struct jpeg_marker_reader { long dummy; };
01030 struct jpeg_entropy_decoder { long dummy; };
01031 struct jpeg_inverse_dct { long dummy; };
01032 struct jpeg_upsampler { long dummy; };
01033 struct jpeg_color_deconverter { long dummy; };
01034 struct jpeg_color_quantizer { long dummy; };
01035 #endif /* JPEG_INTERNALS */
01036 #endif /* INCOMPLETE_TYPES_BROKEN */
01037 
01038 
01039 /*
01040  * The JPEG library modules define JPEG_INTERNALS before including this file.
01041  * The internal structure declarations are read only when that is true.
01042  * Applications using the library should not include jpegint.h, but may wish
01043  * to include jerror.h.
01044  */
01045 
01046 #ifdef JPEG_INTERNALS
01047 #include "../jpeg-6/jpegint.h"      /* fetch private declarations */
01048 #include "../jpeg-6/jerror.h"       /* fetch error codes too */
01049 #endif
01050 
01051 #endif /* JPEGLIB_H */

Generated on Thu Aug 25 12:37:37 2005 for Quake III Arena by  doxygen 1.3.9.1