]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - libs/radiant_jpeglib.h
portability fixes
[xonotic/netradiant.git] / libs / radiant_jpeglib.h
1
2 /*
3  * jpeglib.h
4  *
5  * Copyright (C) 1991-1995, Thomas G. Lane.
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 defines the application interface for the JPEG library.
10  * Most applications using the library need only include this file,
11  * and perhaps jerror.h if they want to know the exact error codes.
12  */
13
14 #ifndef JPEGLIB_H
15 #define JPEGLIB_H
16
17 #ifdef __cplusplus
18 extern "C"
19 {
20 #endif
21
22 // LZ: linux stuff
23 #if !defined (WIN32)
24
25 #include <stdio.h>
26 #include <stdlib.h>
27
28 #ifndef boolean
29 #ifdef __cplusplus
30 #define boolean bool
31 #else
32 typedef int boolean;
33 #endif
34 #endif
35
36 #endif
37
38 #ifdef __MACOS__
39
40 // JDC: stuff to make mac version compile
41 #define boolean qboolean
42 #define register
43 #define INT32   int
44
45 #endif
46
47 // rad additions
48 // 11.29.99
49
50 //#include "cmdlib.h"
51 #ifdef _WIN32
52 #include "windows.h"
53 #include "stdio.h"
54 #endif
55
56 #ifndef INT32
57 #define INT32   int
58 #endif
59
60 // TTimo: if LoadJPGBuff returns -1, *pic is the error message
61 extern int LoadJPGBuff(unsigned char *fbuffer, int bufsize, unsigned char **pic, int *width, int *height );
62 // rad end
63
64
65 /*
66  * First we include the configuration files that record how this
67  * installation of the JPEG library is set up.  jconfig.h can be
68  * generated automatically for many systems.  jmorecfg.h contains
69  * manual configuration options that most people need not worry about.
70  */
71
72 #ifndef JCONFIG_INCLUDED        /* in case jinclude.h already did */
73 #include "jpeg6/jconfig.h"              /* widely used configuration options */
74 #endif
75 #include "jpeg6/jmorecfg.h"             /* seldom changed options */
76
77
78 /* Version ID for the JPEG library.
79  * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60".
80  */
81
82 #define JPEG_LIB_VERSION  60    /* Version 6 */
83
84
85 /* Various constants determining the sizes of things.
86  * All of these are specified by the JPEG standard, so don't change them
87  * if you want to be compatible.
88  */
89
90 #define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
91 #define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
92 #define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
93 #define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
94 #define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
95 #define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
96 #define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
97 /* Unfortunately, some bozo at Adobe saw no reason to be bound by the standard;
98  * the PostScript DCT filter can emit files with many more than 10 blocks/MCU.
99  * If you happen to run across such a file, you can up D_MAX_BLOCKS_IN_MCU
100  * to handle it.  We even let you do this from the jconfig.h file.  However,
101  * we strongly discourage changing C_MAX_BLOCKS_IN_MCU; just because Adobe
102  * sometimes emits noncompliant files doesn't mean you should too.
103  */
104 #define C_MAX_BLOCKS_IN_MCU   10 /* compressor's limit on blocks per MCU */
105 #ifndef D_MAX_BLOCKS_IN_MCU
106 #define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on blocks per MCU */
107 #endif
108
109
110 /* This macro is used to declare a "method", that is, a function pointer.
111  * We want to supply prototype parameters if the compiler can cope.
112  * Note that the arglist parameter must be parenthesized!
113  */
114
115 #ifdef HAVE_PROTOTYPES
116 #define JMETHOD(type,methodname,arglist)  type (*methodname) arglist
117 #else
118 #define JMETHOD(type,methodname,arglist)  type (*methodname)()
119 #endif
120
121
122 /* Data structures for images (arrays of samples and of DCT coefficients).
123  * On 80x86 machines, the image arrays are too big for near pointers,
124  * but the pointer arrays can fit in near memory.
125  */
126
127 typedef JSAMPLE FAR *JSAMPROW;  /* ptr to one image row of pixel samples. */
128 typedef JSAMPROW *JSAMPARRAY;   /* ptr to some rows (a 2-D sample array) */
129 typedef JSAMPARRAY *JSAMPIMAGE; /* a 3-D sample array: top index is color */
130
131 typedef JCOEF JBLOCK[DCTSIZE2]; /* one block of coefficients */
132 typedef JBLOCK FAR *JBLOCKROW;  /* pointer to one row of coefficient blocks */
133 typedef JBLOCKROW *JBLOCKARRAY;         /* a 2-D array of coefficient blocks */
134 typedef JBLOCKARRAY *JBLOCKIMAGE;       /* a 3-D array of coefficient blocks */
135
136 typedef JCOEF FAR *JCOEFPTR;    /* useful in a couple of places */
137
138
139 /* Types for JPEG compression parameters and working tables. */
140
141
142 /* DCT coefficient quantization tables. */
143
144 typedef struct {
145   /* This field directly represents the contents of a JPEG DQT marker.
146    * Note: the values are always given in zigzag order.
147    */
148   UINT16 quantval[DCTSIZE2];    /* quantization step for each coefficient */
149   /* This field is used only during compression.  It's initialized FALSE when
150    * the table is created, and set TRUE when it's been output to the file.
151    * You could suppress output of a table by setting this to TRUE.
152    * (See jpeg_suppress_tables for an example.)
153    */
154   boolean sent_table;           /* TRUE when table has been output */
155 } JQUANT_TBL;
156
157
158 /* Huffman coding tables. */
159
160 typedef struct {
161   /* These two fields directly represent the contents of a JPEG DHT marker */
162   UINT8 bits[17];               /* bits[k] = # of symbols with codes of */
163                                 /* length k bits; bits[0] is unused */
164   UINT8 huffval[256];           /* The symbols, in order of incr code length */
165   /* This field is used only during compression.  It's initialized FALSE when
166    * the table is created, and set TRUE when it's been output to the file.
167    * You could suppress output of a table by setting this to TRUE.
168    * (See jpeg_suppress_tables for an example.)
169    */
170   boolean sent_table;           /* TRUE when table has been output */
171 } JHUFF_TBL;
172
173
174 /* Basic info about one component (color channel). */
175
176 typedef struct {
177   /* These values are fixed over the whole image. */
178   /* For compression, they must be supplied by parameter setup; */
179   /* for decompression, they are read from the SOF marker. */
180   int component_id;             /* identifier for this component (0..255) */
181   int component_index;          /* its index in SOF or cinfo->comp_info[] */
182   int h_samp_factor;            /* horizontal sampling factor (1..4) */
183   int v_samp_factor;            /* vertical sampling factor (1..4) */
184   int quant_tbl_no;             /* quantization table selector (0..3) */
185   /* These values may vary between scans. */
186   /* For compression, they must be supplied by parameter setup; */
187   /* for decompression, they are read from the SOS marker. */
188   /* The decompressor output side may not use these variables. */
189   int dc_tbl_no;                /* DC entropy table selector (0..3) */
190   int ac_tbl_no;                /* AC entropy table selector (0..3) */
191   
192   /* Remaining fields should be treated as private by applications. */
193   
194   /* These values are computed during compression or decompression startup: */
195   /* Component's size in DCT blocks.
196    * Any dummy blocks added to complete an MCU are not counted; therefore
197    * these values do not depend on whether a scan is interleaved or not.
198    */
199   JDIMENSION width_in_blocks;
200   JDIMENSION height_in_blocks;
201   /* Size of a DCT block in samples.  Always DCTSIZE for compression.
202    * For decompression this is the size of the output from one DCT block,
203    * reflecting any scaling we choose to apply during the IDCT step.
204    * Values of 1,2,4,8 are likely to be supported.  Note that different
205    * components may receive different IDCT scalings.
206    */
207   int DCT_scaled_size;
208   /* The downsampled dimensions are the component's actual, unpadded number
209    * of samples at the main buffer (preprocessing/compression interface), thus
210    * downsampled_width = ceil(image_width * Hi/Hmax)
211    * and similarly for height.  For decompression, IDCT scaling is included, so
212    * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE)
213    */
214   JDIMENSION downsampled_width;  /* actual width in samples */
215   JDIMENSION downsampled_height; /* actual height in samples */
216   /* This flag is used only for decompression.  In cases where some of the
217    * components will be ignored (eg grayscale output from YCbCr image),
218    * we can skip most computations for the unused components.
219    */
220   boolean component_needed;     /* do we need the value of this component? */
221
222   /* These values are computed before starting a scan of the component. */
223   /* The decompressor output side may not use these variables. */
224   int MCU_width;                /* number of blocks per MCU, horizontally */
225   int MCU_height;               /* number of blocks per MCU, vertically */
226   int MCU_blocks;               /* MCU_width * MCU_height */
227   int MCU_sample_width;         /* MCU width in samples, MCU_width*DCT_scaled_size */
228   int last_col_width;           /* # of non-dummy blocks across in last MCU */
229   int last_row_height;          /* # of non-dummy blocks down in last MCU */
230
231   /* Saved quantization table for component; NULL if none yet saved.
232    * See jdinput.c comments about the need for this information.
233    * This field is not currently used by the compressor.
234    */
235   JQUANT_TBL * quant_table;
236
237   /* Private per-component storage for DCT or IDCT subsystem. */
238   void * dct_table;
239 } jpeg_component_info;
240
241
242 /* The script for encoding a multiple-scan file is an array of these: */
243
244 typedef struct {
245   int comps_in_scan;            /* number of components encoded in this scan */
246   int component_index[MAX_COMPS_IN_SCAN]; /* their SOF/comp_info[] indexes */
247   int Ss, Se;                   /* progressive JPEG spectral selection parms */
248   int Ah, Al;                   /* progressive JPEG successive approx. parms */
249 } jpeg_scan_info;
250
251
252 /* Known color spaces. */
253
254 typedef enum {
255         JCS_UNKNOWN,            /* error/unspecified */
256         JCS_GRAYSCALE,          /* monochrome */
257         JCS_RGB,                /* red/green/blue */
258         JCS_YCbCr,              /* Y/Cb/Cr (also known as YUV) */
259         JCS_CMYK,               /* C/M/Y/K */
260         JCS_YCCK                /* Y/Cb/Cr/K */
261 } J_COLOR_SPACE;
262
263 /* DCT/IDCT algorithm options. */
264
265 typedef enum {
266         JDCT_ISLOW,             /* slow but accurate integer algorithm */
267         JDCT_IFAST,             /* faster, less accurate integer method */
268         JDCT_FLOAT              /* floating-point: accurate, fast on fast HW */
269 } J_DCT_METHOD;
270
271 #ifndef JDCT_DEFAULT            /* may be overridden in jconfig.h */
272 #define JDCT_DEFAULT  JDCT_ISLOW
273 #endif
274 #ifndef JDCT_FASTEST            /* may be overridden in jconfig.h */
275 #define JDCT_FASTEST  JDCT_IFAST
276 #endif
277
278 /* Dithering options for decompression. */
279
280 typedef enum {
281         JDITHER_NONE,           /* no dithering */
282         JDITHER_ORDERED,        /* simple ordered dither */
283         JDITHER_FS              /* Floyd-Steinberg error diffusion dither */
284 } J_DITHER_MODE;
285
286
287 /* Common fields between JPEG compression and decompression master structs. */
288
289 #define jpeg_common_fields \
290   struct jpeg_error_mgr * err;  /* Error handler module */\
291   struct jpeg_memory_mgr * mem; /* Memory manager module */\
292   struct jpeg_progress_mgr * progress; /* Progress monitor, or NULL if none */\
293   boolean is_decompressor;      /* so common code can tell which is which */\
294   int global_state              /* for checking call sequence validity */
295
296 /* Routines that are to be used by both halves of the library are declared
297  * to receive a pointer to this structure.  There are no actual instances of
298  * jpeg_common_struct, only of jpeg_compress_struct and jpeg_decompress_struct.
299  */
300 struct jpeg_common_struct {
301   jpeg_common_fields;           /* Fields common to both master struct types */
302   /* Additional fields follow in an actual jpeg_compress_struct or
303    * jpeg_decompress_struct.  All three structs must agree on these
304    * initial fields!  (This would be a lot cleaner in C++.)
305    */
306 };
307
308 typedef struct jpeg_common_struct * j_common_ptr;
309 typedef struct jpeg_compress_struct * j_compress_ptr;
310 typedef struct jpeg_decompress_struct * j_decompress_ptr;
311
312
313 /* Master record for a compression instance */
314
315 struct jpeg_compress_struct {
316   jpeg_common_fields;           /* Fields shared with jpeg_decompress_struct */
317
318   /* Destination for compressed data */
319   struct jpeg_destination_mgr * dest;
320
321   /* Description of source image --- these fields must be filled in by
322    * outer application before starting compression.  in_color_space must
323    * be correct before you can even call jpeg_set_defaults().
324    */
325
326   JDIMENSION image_width;       /* input image width */
327   JDIMENSION image_height;      /* input image height */
328   int input_components;         /* # of color components in input image */
329   J_COLOR_SPACE in_color_space; /* colorspace of input image */
330
331   double input_gamma;           /* image gamma of input image */
332
333   /* Compression parameters --- these fields must be set before calling
334    * jpeg_start_compress().  We recommend calling jpeg_set_defaults() to
335    * initialize everything to reasonable defaults, then changing anything
336    * the application specifically wants to change.  That way you won't get
337    * burnt when new parameters are added.  Also note that there are several
338    * helper routines to simplify changing parameters.
339    */
340
341   int data_precision;           /* bits of precision in image data */
342
343   int num_components;           /* # of color components in JPEG image */
344   J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
345
346   jpeg_component_info * comp_info;
347   /* comp_info[i] describes component that appears i'th in SOF */
348   
349   JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
350   /* ptrs to coefficient quantization tables, or NULL if not defined */
351   
352   JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
353   JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
354   /* ptrs to Huffman coding tables, or NULL if not defined */
355   
356   UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
357   UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
358   UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
359
360   int num_scans;                /* # of entries in scan_info array */
361   const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */
362   /* The default value of scan_info is NULL, which causes a single-scan
363    * sequential JPEG file to be emitted.  To create a multi-scan file,
364    * set num_scans and scan_info to point to an array of scan definitions.
365    */
366
367   boolean raw_data_in;          /* TRUE=caller supplies downsampled data */
368   boolean arith_code;           /* TRUE=arithmetic coding, FALSE=Huffman */
369   boolean optimize_coding;      /* TRUE=optimize entropy encoding parms */
370   boolean CCIR601_sampling;     /* TRUE=first samples are cosited */
371   int smoothing_factor;         /* 1..100, or 0 for no input smoothing */
372   J_DCT_METHOD dct_method;      /* DCT algorithm selector */
373
374   /* The restart interval can be specified in absolute MCUs by setting
375    * restart_interval, or in MCU rows by setting restart_in_rows
376    * (in which case the correct restart_interval will be figured
377    * for each scan).
378    */
379   unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */
380   int restart_in_rows;          /* if > 0, MCU rows per restart interval */
381
382   /* Parameters controlling emission of special markers. */
383
384   boolean write_JFIF_header;    /* should a JFIF marker be written? */
385   /* These three values are not used by the JPEG code, merely copied */
386   /* into the JFIF APP0 marker.  density_unit can be 0 for unknown, */
387   /* 1 for dots/inch, or 2 for dots/cm.  Note that the pixel aspect */
388   /* ratio is defined by X_density/Y_density even when density_unit=0. */
389   UINT8 density_unit;           /* JFIF code for pixel size units */
390   UINT16 X_density;             /* Horizontal pixel density */
391   UINT16 Y_density;             /* Vertical pixel density */
392   boolean write_Adobe_marker;   /* should an Adobe marker be written? */
393   
394   /* State variable: index of next scanline to be written to
395    * jpeg_write_scanlines().  Application may use this to control its
396    * processing loop, e.g., "while (next_scanline < image_height)".
397    */
398
399   JDIMENSION next_scanline;     /* 0 .. image_height-1  */
400
401   /* Remaining fields are known throughout compressor, but generally
402    * should not be touched by a surrounding application.
403    */
404
405   /*
406    * These fields are computed during compression startup
407    */
408   boolean progressive_mode;     /* TRUE if scan script uses progressive mode */
409   int max_h_samp_factor;        /* largest h_samp_factor */
410   int max_v_samp_factor;        /* largest v_samp_factor */
411
412   JDIMENSION total_iMCU_rows;   /* # of iMCU rows to be input to coef ctlr */
413   /* The coefficient controller receives data in units of MCU rows as defined
414    * for fully interleaved scans (whether the JPEG file is interleaved or not).
415    * There are v_samp_factor * DCTSIZE sample rows of each component in an
416    * "iMCU" (interleaved MCU) row.
417    */
418   
419   /*
420    * These fields are valid during any one scan.
421    * They describe the components and MCUs actually appearing in the scan.
422    */
423   int comps_in_scan;            /* # of JPEG components in this scan */
424   jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
425   /* *cur_comp_info[i] describes component that appears i'th in SOS */
426   
427   JDIMENSION MCUs_per_row;      /* # of MCUs across the image */
428   JDIMENSION MCU_rows_in_scan;  /* # of MCU rows in the image */
429   
430   int blocks_in_MCU;            /* # of DCT blocks per MCU */
431   int MCU_membership[C_MAX_BLOCKS_IN_MCU];
432   /* MCU_membership[i] is index in cur_comp_info of component owning */
433   /* i'th block in an MCU */
434
435   int Ss, Se, Ah, Al;           /* progressive JPEG parameters for scan */
436
437   /*
438    * Links to compression subobjects (methods and private variables of modules)
439    */
440   struct jpeg_comp_master * master;
441   struct jpeg_c_main_controller * main;
442   struct jpeg_c_prep_controller * prep;
443   struct jpeg_c_coef_controller * coef;
444   struct jpeg_marker_writer * marker;
445   struct jpeg_color_converter * cconvert;
446   struct jpeg_downsampler * downsample;
447   struct jpeg_forward_dct * fdct;
448   struct jpeg_entropy_encoder * entropy;
449 };
450
451
452 /* Master record for a decompression instance */
453
454 struct jpeg_decompress_struct {
455   jpeg_common_fields;           /* Fields shared with jpeg_compress_struct */
456
457   /* Source of compressed data */
458   struct jpeg_source_mgr * src;
459
460   /* Basic description of image --- filled in by jpeg_read_header(). */
461   /* Application may inspect these values to decide how to process image. */
462
463   JDIMENSION image_width;       /* nominal image width (from SOF marker) */
464   JDIMENSION image_height;      /* nominal image height */
465   int num_components;           /* # of color components in JPEG image */
466   J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */
467
468   /* Decompression processing parameters --- these fields must be set before
469    * calling jpeg_start_decompress().  Note that jpeg_read_header() initializes
470    * them to default values.
471    */
472
473   J_COLOR_SPACE out_color_space; /* colorspace for output */
474
475   unsigned int scale_num, scale_denom; /* fraction by which to scale image */
476
477   double output_gamma;          /* image gamma wanted in output */
478
479   boolean buffered_image;       /* TRUE=multiple output passes */
480   boolean raw_data_out;         /* TRUE=downsampled data wanted */
481
482   J_DCT_METHOD dct_method;      /* IDCT algorithm selector */
483   boolean do_fancy_upsampling;  /* TRUE=apply fancy upsampling */
484   boolean do_block_smoothing;   /* TRUE=apply interblock smoothing */
485
486   boolean quantize_colors;      /* TRUE=colormapped output wanted */
487   /* the following are ignored if not quantize_colors: */
488   J_DITHER_MODE dither_mode;    /* type of color dithering to use */
489   boolean two_pass_quantize;    /* TRUE=use two-pass color quantization */
490   int desired_number_of_colors; /* max # colors to use in created colormap */
491   /* these are significant only in buffered-image mode: */
492   boolean enable_1pass_quant;   /* enable future use of 1-pass quantizer */
493   boolean enable_external_quant;/* enable future use of external colormap */
494   boolean enable_2pass_quant;   /* enable future use of 2-pass quantizer */
495
496   /* Description of actual output image that will be returned to application.
497    * These fields are computed by jpeg_start_decompress().
498    * You can also use jpeg_calc_output_dimensions() to determine these values
499    * in advance of calling jpeg_start_decompress().
500    */
501
502   JDIMENSION output_width;      /* scaled image width */
503   JDIMENSION output_height;     /* scaled image height */
504   int out_color_components;     /* # of color components in out_color_space */
505   int output_components;        /* # of color components returned */
506   /* output_components is 1 (a colormap index) when quantizing colors;
507    * otherwise it equals out_color_components.
508    */
509   int rec_outbuf_height;        /* min recommended height of scanline buffer */
510   /* If the buffer passed to jpeg_read_scanlines() is less than this many rows
511    * high, space and time will be wasted due to unnecessary data copying.
512    * Usually rec_outbuf_height will be 1 or 2, at most 4.
513    */
514
515   /* When quantizing colors, the output colormap is described by these fields.
516    * The application can supply a colormap by setting colormap non-NULL before
517    * calling jpeg_start_decompress; otherwise a colormap is created during
518    * jpeg_start_decompress or jpeg_start_output.
519    * The map has out_color_components rows and actual_number_of_colors columns.
520    */
521   int actual_number_of_colors;  /* number of entries in use */
522   JSAMPARRAY colormap;          /* The color map as a 2-D pixel array */
523
524   /* State variables: these variables indicate the progress of decompression.
525    * The application may examine these but must not modify them.
526    */
527
528   /* Row index of next scanline to be read from jpeg_read_scanlines().
529    * Application may use this to control its processing loop, e.g.,
530    * "while (output_scanline < output_height)".
531    */
532   JDIMENSION output_scanline;   /* 0 .. output_height-1  */
533
534   /* Current input scan number and number of iMCU rows completed in scan.
535    * These indicate the progress of the decompressor input side.
536    */
537   int input_scan_number;        /* Number of SOS markers seen so far */
538   JDIMENSION input_iMCU_row;    /* Number of iMCU rows completed */
539
540   /* The "output scan number" is the notional scan being displayed by the
541    * output side.  The decompressor will not allow output scan/row number
542    * to get ahead of input scan/row, but it can fall arbitrarily far behind.
543    */
544   int output_scan_number;       /* Nominal scan number being displayed */
545   JDIMENSION output_iMCU_row;   /* Number of iMCU rows read */
546
547   /* Current progression status.  coef_bits[c][i] indicates the precision
548    * with which component c's DCT coefficient i (in zigzag order) is known.
549    * It is -1 when no data has yet been received, otherwise it is the point
550    * transform (shift) value for the most recent scan of the coefficient
551    * (thus, 0 at completion of the progression).
552    * This pointer is NULL when reading a non-progressive file.
553    */
554   int (*coef_bits)[DCTSIZE2];   /* -1 or current Al value for each coef */
555
556   /* Internal JPEG parameters --- the application usually need not look at
557    * these fields.  Note that the decompressor output side may not use
558    * any parameters that can change between scans.
559    */
560
561   /* Quantization and Huffman tables are carried forward across input
562    * datastreams when processing abbreviated JPEG datastreams.
563    */
564
565   JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS];
566   /* ptrs to coefficient quantization tables, or NULL if not defined */
567
568   JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS];
569   JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS];
570   /* ptrs to Huffman coding tables, or NULL if not defined */
571
572   /* These parameters are never carried across datastreams, since they
573    * are given in SOF/SOS markers or defined to be reset by SOI.
574    */
575
576   int data_precision;           /* bits of precision in image data */
577
578   jpeg_component_info * comp_info;
579   /* comp_info[i] describes component that appears i'th in SOF */
580
581   boolean progressive_mode;     /* TRUE if SOFn specifies progressive mode */
582   boolean arith_code;           /* TRUE=arithmetic coding, FALSE=Huffman */
583
584   UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */
585   UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */
586   UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */
587
588   unsigned int restart_interval; /* MCUs per restart interval, or 0 for no restart */
589
590   /* These fields record data obtained from optional markers recognized by
591    * the JPEG library.
592    */
593   boolean saw_JFIF_marker;      /* TRUE iff a JFIF APP0 marker was found */
594   /* Data copied from JFIF marker: */
595   UINT8 density_unit;           /* JFIF code for pixel size units */
596   UINT16 X_density;             /* Horizontal pixel density */
597   UINT16 Y_density;             /* Vertical pixel density */
598   boolean saw_Adobe_marker;     /* TRUE iff an Adobe APP14 marker was found */
599   UINT8 Adobe_transform;        /* Color transform code from Adobe marker */
600
601   boolean CCIR601_sampling;     /* TRUE=first samples are cosited */
602
603   /* Remaining fields are known throughout decompressor, but generally
604    * should not be touched by a surrounding application.
605    */
606
607   /*
608    * These fields are computed during decompression startup
609    */
610   int max_h_samp_factor;        /* largest h_samp_factor */
611   int max_v_samp_factor;        /* largest v_samp_factor */
612
613   int min_DCT_scaled_size;      /* smallest DCT_scaled_size of any component */
614
615   JDIMENSION total_iMCU_rows;   /* # of iMCU rows in image */
616   /* The coefficient controller's input and output progress is measured in
617    * units of "iMCU" (interleaved MCU) rows.  These are the same as MCU rows
618    * in fully interleaved JPEG scans, but are used whether the scan is
619    * interleaved or not.  We define an iMCU row as v_samp_factor DCT block
620    * rows of each component.  Therefore, the IDCT output contains
621    * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row.
622    */
623
624   JSAMPLE * sample_range_limit; /* table for fast range-limiting */
625
626   /*
627    * These fields are valid during any one scan.
628    * They describe the components and MCUs actually appearing in the scan.
629    * Note that the decompressor output side must not use these fields.
630    */
631   int comps_in_scan;            /* # of JPEG components in this scan */
632   jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
633   /* *cur_comp_info[i] describes component that appears i'th in SOS */
634
635   JDIMENSION MCUs_per_row;      /* # of MCUs across the image */
636   JDIMENSION MCU_rows_in_scan;  /* # of MCU rows in the image */
637
638   int blocks_in_MCU;            /* # of DCT blocks per MCU */
639   int MCU_membership[D_MAX_BLOCKS_IN_MCU];
640   /* MCU_membership[i] is index in cur_comp_info of component owning */
641   /* i'th block in an MCU */
642
643   int Ss, Se, Ah, Al;           /* progressive JPEG parameters for scan */
644
645   /* This field is shared between entropy decoder and marker parser.
646    * It is either zero or the code of a JPEG marker that has been
647    * read from the data source, but has not yet been processed.
648    */
649   int unread_marker;
650
651   /*
652    * Links to decompression subobjects (methods, private variables of modules)
653    */
654   struct jpeg_decomp_master * master;
655   struct jpeg_d_main_controller * main;
656   struct jpeg_d_coef_controller * coef;
657   struct jpeg_d_post_controller * post;
658   struct jpeg_input_controller * inputctl;
659   struct jpeg_marker_reader * marker;
660   struct jpeg_entropy_decoder * entropy;
661   struct jpeg_inverse_dct * idct;
662   struct jpeg_upsampler * upsample;
663   struct jpeg_color_deconverter * cconvert;
664   struct jpeg_color_quantizer * cquantize;
665 };
666
667
668 /* "Object" declarations for JPEG modules that may be supplied or called
669  * directly by the surrounding application.
670  * As with all objects in the JPEG library, these structs only define the
671  * publicly visible methods and state variables of a module.  Additional
672  * private fields may exist after the public ones.
673  */
674
675
676 /* Error handler object */
677
678 struct jpeg_error_mgr {
679   /* Error exit handler: does not return to caller */
680   JMETHOD(void, error_exit, (j_common_ptr cinfo));
681   /* Conditionally emit a trace or warning message */
682   JMETHOD(void, emit_message, (j_common_ptr cinfo, int msg_level));
683   /* Routine that actually outputs a trace or error message */
684   JMETHOD(void, output_message, (j_common_ptr cinfo));
685   /* Format a message string for the most recent JPEG error or message */
686   JMETHOD(void, format_message, (j_common_ptr cinfo, char * buffer));
687 #define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
688   /* Reset error state variables at start of a new image */
689   JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
690   
691   /* The message ID code and any parameters are saved here.
692    * A message can have one string parameter or up to 8 int parameters.
693    */
694   int msg_code;
695 #define JMSG_STR_PARM_MAX  80
696   union {
697     int i[8];
698     char s[JMSG_STR_PARM_MAX];
699   } msg_parm;
700   
701   /* Standard state variables for error facility */
702   
703   int trace_level;              /* max msg_level that will be displayed */
704   
705   /* For recoverable corrupt-data errors, we emit a warning message,
706    * but keep going unless emit_message chooses to abort.  emit_message
707    * should count warnings in num_warnings.  The surrounding application
708    * can check for bad data by seeing if num_warnings is nonzero at the
709    * end of processing.
710    */
711   long num_warnings;            /* number of corrupt-data warnings */
712
713   /* These fields point to the table(s) of error message strings.
714    * An application can change the table pointer to switch to a different
715    * message list (typically, to change the language in which errors are
716    * reported).  Some applications may wish to add additional error codes
717    * that will be handled by the JPEG library error mechanism; the second
718    * table pointer is used for this purpose.
719    *
720    * First table includes all errors generated by JPEG library itself.
721    * Error code 0 is reserved for a "no such error string" message.
722    */
723   const char * const * jpeg_message_table; /* Library errors */
724   int last_jpeg_message;    /* Table contains strings 0..last_jpeg_message */
725   /* Second table can be added by application (see cjpeg/djpeg for example).
726    * It contains strings numbered first_addon_message..last_addon_message.
727    */
728   const char * const * addon_message_table; /* Non-library errors */
729   int first_addon_message;      /* code for first string in addon table */
730   int last_addon_message;       /* code for last string in addon table */
731 };
732
733
734 /* Progress monitor object */
735
736 struct jpeg_progress_mgr {
737   JMETHOD(void, progress_monitor, (j_common_ptr cinfo));
738
739   long pass_counter;            /* work units completed in this pass */
740   long pass_limit;              /* total number of work units in this pass */
741   int completed_passes;         /* passes completed so far */
742   int total_passes;             /* total number of passes expected */
743 };
744
745
746 /* Data destination object for compression */
747
748 struct jpeg_destination_mgr {
749   JOCTET * next_output_byte;    /* => next byte to write in buffer */
750   size_t free_in_buffer;        /* # of byte spaces remaining in buffer */
751
752   JMETHOD(void, init_destination, (j_compress_ptr cinfo));
753   JMETHOD(boolean, empty_output_buffer, (j_compress_ptr cinfo));
754   JMETHOD(void, term_destination, (j_compress_ptr cinfo));
755 };
756
757
758 /* Data source object for decompression */
759
760 struct jpeg_source_mgr {
761   const JOCTET * next_input_byte; /* => next byte to read from buffer */
762   size_t bytes_in_buffer;       /* # of bytes remaining in buffer */
763
764   JMETHOD(void, init_source, (j_decompress_ptr cinfo));
765   JMETHOD(boolean, fill_input_buffer, (j_decompress_ptr cinfo));
766   JMETHOD(void, skip_input_data, (j_decompress_ptr cinfo, long num_bytes));
767   JMETHOD(boolean, resync_to_restart, (j_decompress_ptr cinfo, int desired));
768   JMETHOD(void, term_source, (j_decompress_ptr cinfo));
769 };
770
771
772 /* Memory manager object.
773  * Allocates "small" objects (a few K total), "large" objects (tens of K),
774  * and "really big" objects (virtual arrays with backing store if needed).
775  * The memory manager does not allow individual objects to be freed; rather,
776  * each created object is assigned to a pool, and whole pools can be freed
777  * at once.  This is faster and more convenient than remembering exactly what
778  * to free, especially where malloc()/free() are not too speedy.
779  * NB: alloc routines never return NULL.  They exit to error_exit if not
780  * successful.
781  */
782
783 #define JPOOL_PERMANENT 0       /* lasts until master record is destroyed */
784 #define JPOOL_IMAGE     1       /* lasts until done with image/datastream */
785 #define JPOOL_NUMPOOLS  2
786
787 typedef struct jvirt_sarray_control * jvirt_sarray_ptr;
788 typedef struct jvirt_barray_control * jvirt_barray_ptr;
789
790
791 struct jpeg_memory_mgr {
792   /* Method pointers */
793   JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id,
794                                 size_t sizeofobject));
795   JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id,
796                                      size_t sizeofobject));
797   JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id,
798                                      JDIMENSION samplesperrow,
799                                      JDIMENSION numrows));
800   JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id,
801                                       JDIMENSION blocksperrow,
802                                       JDIMENSION numrows));
803   JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo,
804                                                   int pool_id,
805                                                   boolean pre_zero,
806                                                   JDIMENSION samplesperrow,
807                                                   JDIMENSION numrows,
808                                                   JDIMENSION maxaccess));
809   JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo,
810                                                   int pool_id,
811                                                   boolean pre_zero,
812                                                   JDIMENSION blocksperrow,
813                                                   JDIMENSION numrows,
814                                                   JDIMENSION maxaccess));
815   JMETHOD(void, realize_virt_arrays, (j_common_ptr cinfo));
816   JMETHOD(JSAMPARRAY, access_virt_sarray, (j_common_ptr cinfo,
817                                            jvirt_sarray_ptr ptr,
818                                            JDIMENSION start_row,
819                                            JDIMENSION num_rows,
820                                            boolean writable));
821   JMETHOD(JBLOCKARRAY, access_virt_barray, (j_common_ptr cinfo,
822                                             jvirt_barray_ptr ptr,
823                                             JDIMENSION start_row,
824                                             JDIMENSION num_rows,
825                                             boolean writable));
826   JMETHOD(void, free_pool, (j_common_ptr cinfo, int pool_id));
827   JMETHOD(void, self_destruct, (j_common_ptr cinfo));
828
829   /* Limit on memory allocation for this JPEG object.  (Note that this is
830    * merely advisory, not a guaranteed maximum; it only affects the space
831    * used for virtual-array buffers.)  May be changed by outer application
832    * after creating the JPEG object.
833    */
834   long max_memory_to_use;
835 };
836
837
838 /* Routine signature for application-supplied marker processing methods.
839  * Need not pass marker code since it is stored in cinfo->unread_marker.
840  */
841 typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
842
843
844 /* Declarations for routines called by application.
845  * The JPP macro hides prototype parameters from compilers that can't cope.
846  * Note JPP requires double parentheses.
847  */
848
849 #ifdef HAVE_PROTOTYPES
850 #define JPP(arglist)    arglist
851 #else
852 #define JPP(arglist)    ()
853 #endif
854
855
856 /* Short forms of external names for systems with brain-damaged linkers.
857  * We shorten external names to be unique in the first six letters, which
858  * is good enough for all known systems.
859  * (If your compiler itself needs names to be unique in less than 15 
860  * characters, you are out of luck.  Get a better compiler.)
861  */
862
863 #ifdef NEED_SHORT_EXTERNAL_NAMES
864 #define jpeg_std_error          jStdError
865 #define jpeg_create_compress    jCreaCompress
866 #define jpeg_create_decompress  jCreaDecompress
867 #define jpeg_destroy_compress   jDestCompress
868 #define jpeg_destroy_decompress jDestDecompress
869 #define jpeg_stdio_dest         jStdDest
870 #define jpeg_stdio_src          jStdSrc
871 #define jpeg_set_defaults       jSetDefaults
872 #define jpeg_set_colorspace     jSetColorspace
873 #define jpeg_default_colorspace jDefColorspace
874 #define jpeg_set_quality        jSetQuality
875 #define jpeg_set_linear_quality jSetLQuality
876 #define jpeg_add_quant_table    jAddQuantTable
877 #define jpeg_quality_scaling    jQualityScaling
878 #define jpeg_simple_progression jSimProgress
879 #define jpeg_suppress_tables    jSuppressTables
880 #define jpeg_alloc_quant_table  jAlcQTable
881 #define jpeg_alloc_huff_table   jAlcHTable
882 #define jpeg_start_compress     jStrtCompress
883 #define jpeg_write_scanlines    jWrtScanlines
884 #define jpeg_finish_compress    jFinCompress
885 #define jpeg_write_raw_data     jWrtRawData
886 #define jpeg_write_marker       jWrtMarker
887 #define jpeg_write_tables       jWrtTables
888 #define jpeg_read_header        jReadHeader
889 #define jpeg_start_decompress   jStrtDecompress
890 #define jpeg_read_scanlines     jReadScanlines
891 #define jpeg_finish_decompress  jFinDecompress
892 #define jpeg_read_raw_data      jReadRawData
893 #define jpeg_has_multiple_scans jHasMultScn
894 #define jpeg_start_output       jStrtOutput
895 #define jpeg_finish_output      jFinOutput
896 #define jpeg_input_complete     jInComplete
897 #define jpeg_new_colormap       jNewCMap
898 #define jpeg_consume_input      jConsumeInput
899 #define jpeg_calc_output_dimensions     jCalcDimensions
900 #define jpeg_set_marker_processor       jSetMarker
901 #define jpeg_read_coefficients  jReadCoefs
902 #define jpeg_write_coefficients jWrtCoefs
903 #define jpeg_copy_critical_parameters   jCopyCrit
904 #define jpeg_abort_compress     jAbrtCompress
905 #define jpeg_abort_decompress   jAbrtDecompress
906 #define jpeg_abort              jAbort
907 #define jpeg_destroy            jDestroy
908 #define jpeg_resync_to_restart  jResyncRestart
909 #endif /* NEED_SHORT_EXTERNAL_NAMES */
910
911
912 /* Default error-management setup */
913 EXTERN struct jpeg_error_mgr *jpeg_std_error JPP((struct jpeg_error_mgr *err));
914
915 /* Initialization and destruction of JPEG compression objects */
916 /* NB: you must set up the error-manager BEFORE calling jpeg_create_xxx */
917 EXTERN void jpeg_create_compress JPP((j_compress_ptr cinfo));
918 EXTERN void jpeg_create_decompress JPP((j_decompress_ptr cinfo));
919 EXTERN void jpeg_destroy_compress JPP((j_compress_ptr cinfo));
920 EXTERN void jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));
921
922 /* Standard data source and destination managers: stdio streams. */
923 /* Caller is responsible for opening the file before and closing after. */
924 EXTERN void jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
925 EXTERN void jpeg_stdio_src JPP((j_decompress_ptr cinfo, unsigned char *infile, int bufsize));
926
927 /* Default parameter setup for compression */
928 EXTERN void jpeg_set_defaults JPP((j_compress_ptr cinfo));
929 /* Compression parameter setup aids */
930 EXTERN void jpeg_set_colorspace JPP((j_compress_ptr cinfo,
931                                      J_COLOR_SPACE colorspace));
932 EXTERN void jpeg_default_colorspace JPP((j_compress_ptr cinfo));
933 EXTERN void jpeg_set_quality JPP((j_compress_ptr cinfo, int quality,
934                                   boolean force_baseline));
935 EXTERN void jpeg_set_linear_quality JPP((j_compress_ptr cinfo,
936                                          int scale_factor,
937                                          boolean force_baseline));
938 EXTERN void jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl,
939                                       const unsigned int *basic_table,
940                                       int scale_factor,
941                                       boolean force_baseline));
942 EXTERN int jpeg_quality_scaling JPP((int quality));
943 EXTERN void jpeg_simple_progression JPP((j_compress_ptr cinfo));
944 EXTERN void jpeg_suppress_tables JPP((j_compress_ptr cinfo,
945                                       boolean suppress));
946 EXTERN JQUANT_TBL * jpeg_alloc_quant_table JPP((j_common_ptr cinfo));
947 EXTERN JHUFF_TBL * jpeg_alloc_huff_table JPP((j_common_ptr cinfo));
948
949 /* Main entry points for compression */
950 EXTERN void jpeg_start_compress JPP((j_compress_ptr cinfo,
951                                      boolean write_all_tables));
952 EXTERN JDIMENSION jpeg_write_scanlines JPP((j_compress_ptr cinfo,
953                                             JSAMPARRAY scanlines,
954                                             JDIMENSION num_lines));
955 EXTERN void jpeg_finish_compress JPP((j_compress_ptr cinfo));
956
957 /* Replaces jpeg_write_scanlines when writing raw downsampled data. */
958 EXTERN JDIMENSION jpeg_write_raw_data JPP((j_compress_ptr cinfo,
959                                            JSAMPIMAGE data,
960                                            JDIMENSION num_lines));
961
962 /* Write a special marker.  See libjpeg.doc concerning safe usage. */
963 EXTERN void jpeg_write_marker JPP((j_compress_ptr cinfo, int marker,
964                                    const JOCTET *dataptr, unsigned int datalen));
965
966 /* Alternate compression function: just write an abbreviated table file */
967 EXTERN void jpeg_write_tables JPP((j_compress_ptr cinfo));
968
969 /* Decompression startup: read start of JPEG datastream to see what's there */
970 EXTERN int jpeg_read_header JPP((j_decompress_ptr cinfo,
971                                  boolean require_image));
972 /* Return value is one of: */
973 #define JPEG_SUSPENDED          0 /* Suspended due to lack of input data */
974 #define JPEG_HEADER_OK          1 /* Found valid image datastream */
975 #define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */
976 /* If you pass require_image = TRUE (normal case), you need not check for
977  * a TABLES_ONLY return code; an abbreviated file will cause an error exit.
978  * JPEG_SUSPENDED is only possible if you use a data source module that can
979  * give a suspension return (the stdio source module doesn't).
980  */
981
982 /* Main entry points for decompression */
983 EXTERN boolean jpeg_start_decompress JPP((j_decompress_ptr cinfo));
984 EXTERN JDIMENSION jpeg_read_scanlines JPP((j_decompress_ptr cinfo,
985                                            JSAMPARRAY scanlines,
986                                            JDIMENSION max_lines));
987 EXTERN boolean jpeg_finish_decompress JPP((j_decompress_ptr cinfo));
988
989 /* Replaces jpeg_read_scanlines when reading raw downsampled data. */
990 EXTERN JDIMENSION jpeg_read_raw_data JPP((j_decompress_ptr cinfo,
991                                           JSAMPIMAGE data,
992                                           JDIMENSION max_lines));
993
994 /* Additional entry points for buffered-image mode. */
995 EXTERN boolean jpeg_has_multiple_scans JPP((j_decompress_ptr cinfo));
996 EXTERN boolean jpeg_start_output JPP((j_decompress_ptr cinfo,
997                                       int scan_number));
998 EXTERN boolean jpeg_finish_output JPP((j_decompress_ptr cinfo));
999 EXTERN boolean jpeg_input_complete JPP((j_decompress_ptr cinfo));
1000 EXTERN void jpeg_new_colormap JPP((j_decompress_ptr cinfo));
1001 EXTERN int jpeg_consume_input JPP((j_decompress_ptr cinfo));
1002 /* Return value is one of: */
1003 /* #define JPEG_SUSPENDED       0    Suspended due to lack of input data */
1004 #define JPEG_REACHED_SOS        1 /* Reached start of new scan */
1005 #define JPEG_REACHED_EOI        2 /* Reached end of image */
1006 #define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
1007 #define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
1008
1009 /* Precalculate output dimensions for current decompression parameters. */
1010 EXTERN void jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo));
1011
1012 /* Install a special processing method for COM or APPn markers. */
1013 EXTERN void jpeg_set_marker_processor JPP((j_decompress_ptr cinfo,
1014                                            int marker_code,
1015                                            jpeg_marker_parser_method routine));
1016
1017 /* Read or write raw DCT coefficients --- useful for lossless transcoding. */
1018 EXTERN jvirt_barray_ptr * jpeg_read_coefficients JPP((j_decompress_ptr cinfo));
1019 EXTERN void jpeg_write_coefficients JPP((j_compress_ptr cinfo,
1020                                          jvirt_barray_ptr * coef_arrays));
1021 EXTERN void jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo,
1022                                                j_compress_ptr dstinfo));
1023
1024 /* If you choose to abort compression or decompression before completing
1025  * jpeg_finish_(de)compress, then you need to clean up to release memory,
1026  * temporary files, etc.  You can just call jpeg_destroy_(de)compress
1027  * if you're done with the JPEG object, but if you want to clean it up and
1028  * reuse it, call this:
1029  */
1030 EXTERN void jpeg_abort_compress JPP((j_compress_ptr cinfo));
1031 EXTERN void jpeg_abort_decompress JPP((j_decompress_ptr cinfo));
1032
1033 /* Generic versions of jpeg_abort and jpeg_destroy that work on either
1034  * flavor of JPEG object.  These may be more convenient in some places.
1035  */
1036 EXTERN void jpeg_abort JPP((j_common_ptr cinfo));
1037 EXTERN void jpeg_destroy JPP((j_common_ptr cinfo));
1038
1039 /* Default restart-marker-resync procedure for use by data source modules */
1040 EXTERN boolean jpeg_resync_to_restart JPP((j_decompress_ptr cinfo,
1041                                            int desired));
1042
1043
1044 /* These marker codes are exported since applications and data source modules
1045  * are likely to want to use them.
1046  */
1047
1048 #define JPEG_RST0       0xD0    /* RST0 marker code */
1049 #define JPEG_EOI        0xD9    /* EOI marker code */
1050 #define JPEG_APP0       0xE0    /* APP0 marker code */
1051 #define JPEG_COM        0xFE    /* COM marker code */
1052
1053
1054 /* If we have a brain-damaged compiler that emits warnings (or worse, errors)
1055  * for structure definitions that are never filled in, keep it quiet by
1056  * supplying dummy definitions for the various substructures.
1057  */
1058
1059 #ifdef INCOMPLETE_TYPES_BROKEN
1060 #ifndef JPEG_INTERNALS          /* will be defined in jpegint.h */
1061 struct jvirt_sarray_control { long dummy; };
1062 struct jvirt_barray_control { long dummy; };
1063 struct jpeg_comp_master { long dummy; };
1064 struct jpeg_c_main_controller { long dummy; };
1065 struct jpeg_c_prep_controller { long dummy; };
1066 struct jpeg_c_coef_controller { long dummy; };
1067 struct jpeg_marker_writer { long dummy; };
1068 struct jpeg_color_converter { long dummy; };
1069 struct jpeg_downsampler { long dummy; };
1070 struct jpeg_forward_dct { long dummy; };
1071 struct jpeg_entropy_encoder { long dummy; };
1072 struct jpeg_decomp_master { long dummy; };
1073 struct jpeg_d_main_controller { long dummy; };
1074 struct jpeg_d_coef_controller { long dummy; };
1075 struct jpeg_d_post_controller { long dummy; };
1076 struct jpeg_input_controller { long dummy; };
1077 struct jpeg_marker_reader { long dummy; };
1078 struct jpeg_entropy_decoder { long dummy; };
1079 struct jpeg_inverse_dct { long dummy; };
1080 struct jpeg_upsampler { long dummy; };
1081 struct jpeg_color_deconverter { long dummy; };
1082 struct jpeg_color_quantizer { long dummy; };
1083 #endif /* JPEG_INTERNALS */
1084 #endif /* INCOMPLETE_TYPES_BROKEN */
1085
1086
1087 /*
1088  * The JPEG library modules define JPEG_INTERNALS before including this file.
1089  * The internal structure declarations are read only when that is true.
1090  * Applications using the library should not include jpegint.h, but may wish
1091  * to include jerror.h.
1092  */
1093
1094 #ifdef JPEG_INTERNALS
1095 #include "jpegint.h"            /* fetch private declarations */
1096 #include "jerror.h"             /* fetch error codes too */
1097 #endif
1098
1099 #ifdef __cplusplus
1100 }
1101 #endif
1102
1103 #endif /* JPEGLIB_H */