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