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