| OLD | NEW |
| 1 /* | 1 /* |
| 2 * jpeglib.h | 2 * jpeglib.h |
| 3 * | 3 * |
| 4 * Copyright (C) 1991-1998, Thomas G. Lane. | 4 * Copyright (C) 1991-1998, Thomas G. Lane. |
| 5 * Copyright (C) 2009, D. R. Commander. | 5 * Modified 2002-2009 by Guido Vollbeding. |
| 6 * Copyright (C) 2009-2010, D. R. Commander. |
| 6 * This file is part of the Independent JPEG Group's software. | 7 * This file is part of the Independent JPEG Group's software. |
| 7 * For conditions of distribution and use, see the accompanying README file. | 8 * For conditions of distribution and use, see the accompanying README file. |
| 8 * | 9 * |
| 9 * This file defines the application interface for the JPEG library. | 10 * This file defines the application interface for the JPEG library. |
| 10 * Most applications using the library need only include this file, | 11 * Most applications using the library need only include this file, |
| 11 * and perhaps jerror.h if they want to know the exact error codes. | 12 * and perhaps jerror.h if they want to know the exact error codes. |
| 12 */ | 13 */ |
| 13 | 14 |
| 14 #ifndef JPEGLIB_H | 15 #ifndef JPEGLIB_H |
| 15 #define JPEGLIB_H | 16 #define JPEGLIB_H |
| 16 | 17 |
| 17 #ifdef __cplusplus | |
| 18 extern "C" { | |
| 19 #endif | |
| 20 | |
| 21 /* Begin chromium edits */ | 18 /* Begin chromium edits */ |
| 22 #include "jpeglibmangler.h" | 19 #include "jpeglibmangler.h" |
| 23 /* End chromium edits */ | 20 /* End chromium edits */ |
| 24 | 21 |
| 25 /* | 22 /* |
| 26 * First we include the configuration files that record how this | 23 * First we include the configuration files that record how this |
| 27 * installation of the JPEG library is set up. jconfig.h can be | 24 * installation of the JPEG library is set up. jconfig.h can be |
| 28 * generated automatically for many systems. jmorecfg.h contains | 25 * generated automatically for many systems. jmorecfg.h contains |
| 29 * manual configuration options that most people need not worry about. | 26 * manual configuration options that most people need not worry about. |
| 30 */ | 27 */ |
| 31 | 28 |
| 32 #ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ | 29 #ifndef JCONFIG_INCLUDED /* in case jinclude.h already did */ |
| 33 #include "jconfig.h" /* widely used configuration options */ | 30 #include "jconfig.h" /* widely used configuration options */ |
| 34 #endif | 31 #endif |
| 35 #include "jmorecfg.h" /* seldom changed options */ | 32 #include "jmorecfg.h" /* seldom changed options */ |
| 36 | 33 |
| 37 | 34 |
| 38 /* Version ID for the JPEG library. | 35 #ifdef __cplusplus |
| 39 * Might be useful for tests like "#if JPEG_LIB_VERSION >= 60". | 36 #ifndef DONT_USE_EXTERN_C |
| 40 */ | 37 extern "C" { |
| 41 | 38 #endif |
| 42 #define JPEG_LIB_VERSION 62» /* Version 6b */ | 39 #endif |
| 43 | 40 |
| 44 | 41 |
| 45 /* Various constants determining the sizes of things. | 42 /* Various constants determining the sizes of things. |
| 46 * All of these are specified by the JPEG standard, so don't change them | 43 * All of these are specified by the JPEG standard, so don't change them |
| 47 * if you want to be compatible. | 44 * if you want to be compatible. |
| 48 */ | 45 */ |
| 49 | 46 |
| 50 #define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ | 47 #define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ |
| 51 #define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ | 48 #define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ |
| 52 #define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ | 49 #define NUM_QUANT_TBLS 4 /* Quantization tables are numbered 0..3 */ |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 * these values do not depend on whether a scan is interleaved or not. | 143 * these values do not depend on whether a scan is interleaved or not. |
| 147 */ | 144 */ |
| 148 JDIMENSION width_in_blocks; | 145 JDIMENSION width_in_blocks; |
| 149 JDIMENSION height_in_blocks; | 146 JDIMENSION height_in_blocks; |
| 150 /* Size of a DCT block in samples. Always DCTSIZE for compression. | 147 /* Size of a DCT block in samples. Always DCTSIZE for compression. |
| 151 * For decompression this is the size of the output from one DCT block, | 148 * For decompression this is the size of the output from one DCT block, |
| 152 * reflecting any scaling we choose to apply during the IDCT step. | 149 * reflecting any scaling we choose to apply during the IDCT step. |
| 153 * Values of 1,2,4,8 are likely to be supported. Note that different | 150 * Values of 1,2,4,8 are likely to be supported. Note that different |
| 154 * components may receive different IDCT scalings. | 151 * components may receive different IDCT scalings. |
| 155 */ | 152 */ |
| 153 #if JPEG_LIB_VERSION >= 70 |
| 154 int DCT_h_scaled_size; |
| 155 int DCT_v_scaled_size; |
| 156 #else |
| 156 int DCT_scaled_size; | 157 int DCT_scaled_size; |
| 158 #endif |
| 157 /* The downsampled dimensions are the component's actual, unpadded number | 159 /* The downsampled dimensions are the component's actual, unpadded number |
| 158 * of samples at the main buffer (preprocessing/compression interface), thus | 160 * of samples at the main buffer (preprocessing/compression interface), thus |
| 159 * downsampled_width = ceil(image_width * Hi/Hmax) | 161 * downsampled_width = ceil(image_width * Hi/Hmax) |
| 160 * and similarly for height. For decompression, IDCT scaling is included, so | 162 * and similarly for height. For decompression, IDCT scaling is included, so |
| 161 * downsampled_width = ceil(image_width * Hi/Hmax * DCT_scaled_size/DCTSIZE) | 163 * downsampled_width = ceil(image_width * Hi/Hmax * DCT_[h_]scaled_size/DCTSIZ
E) |
| 162 */ | 164 */ |
| 163 JDIMENSION downsampled_width; /* actual width in samples */ | 165 JDIMENSION downsampled_width; /* actual width in samples */ |
| 164 JDIMENSION downsampled_height; /* actual height in samples */ | 166 JDIMENSION downsampled_height; /* actual height in samples */ |
| 165 /* This flag is used only for decompression. In cases where some of the | 167 /* This flag is used only for decompression. In cases where some of the |
| 166 * components will be ignored (eg grayscale output from YCbCr image), | 168 * components will be ignored (eg grayscale output from YCbCr image), |
| 167 * we can skip most computations for the unused components. | 169 * we can skip most computations for the unused components. |
| 168 */ | 170 */ |
| 169 boolean component_needed; /* do we need the value of this component? */ | 171 boolean component_needed; /* do we need the value of this component? */ |
| 170 | 172 |
| 171 /* These values are computed before starting a scan of the component. */ | 173 /* These values are computed before starting a scan of the component. */ |
| 172 /* The decompressor output side may not use these variables. */ | 174 /* The decompressor output side may not use these variables. */ |
| 173 int MCU_width; /* number of blocks per MCU, horizontally */ | 175 int MCU_width; /* number of blocks per MCU, horizontally */ |
| 174 int MCU_height; /* number of blocks per MCU, vertically */ | 176 int MCU_height; /* number of blocks per MCU, vertically */ |
| 175 int MCU_blocks; /* MCU_width * MCU_height */ | 177 int MCU_blocks; /* MCU_width * MCU_height */ |
| 176 int MCU_sample_width;»» /* MCU width in samples, MCU_width*DCT_scaled_si
ze */ | 178 int MCU_sample_width;»» /* MCU width in samples, MCU_width*DCT_[h_]scale
d_size */ |
| 177 int last_col_width; /* # of non-dummy blocks across in last MCU */ | 179 int last_col_width; /* # of non-dummy blocks across in last MCU */ |
| 178 int last_row_height; /* # of non-dummy blocks down in last MCU */ | 180 int last_row_height; /* # of non-dummy blocks down in last MCU */ |
| 179 | 181 |
| 180 /* Saved quantization table for component; NULL if none yet saved. | 182 /* Saved quantization table for component; NULL if none yet saved. |
| 181 * See jdinput.c comments about the need for this information. | 183 * See jdinput.c comments about the need for this information. |
| 182 * This field is currently used only for decompression. | 184 * This field is currently used only for decompression. |
| 183 */ | 185 */ |
| 184 JQUANT_TBL * quant_table; | 186 JQUANT_TBL * quant_table; |
| 185 | 187 |
| 186 /* Private per-component storage for DCT or IDCT subsystem. */ | 188 /* Private per-component storage for DCT or IDCT subsystem. */ |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 double input_gamma; /* image gamma of input image */ | 304 double input_gamma; /* image gamma of input image */ |
| 303 | 305 |
| 304 /* Compression parameters --- these fields must be set before calling | 306 /* Compression parameters --- these fields must be set before calling |
| 305 * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to | 307 * jpeg_start_compress(). We recommend calling jpeg_set_defaults() to |
| 306 * initialize everything to reasonable defaults, then changing anything | 308 * initialize everything to reasonable defaults, then changing anything |
| 307 * the application specifically wants to change. That way you won't get | 309 * the application specifically wants to change. That way you won't get |
| 308 * burnt when new parameters are added. Also note that there are several | 310 * burnt when new parameters are added. Also note that there are several |
| 309 * helper routines to simplify changing parameters. | 311 * helper routines to simplify changing parameters. |
| 310 */ | 312 */ |
| 311 | 313 |
| 314 #if JPEG_LIB_VERSION >= 70 |
| 315 unsigned int scale_num, scale_denom; /* fraction by which to scale image */ |
| 316 |
| 317 JDIMENSION jpeg_width; /* scaled JPEG image width */ |
| 318 JDIMENSION jpeg_height; /* scaled JPEG image height */ |
| 319 /* Dimensions of actual JPEG image that will be written to file, |
| 320 * derived from input dimensions by scaling factors above. |
| 321 * These fields are computed by jpeg_start_compress(). |
| 322 * You can also use jpeg_calc_jpeg_dimensions() to determine these values |
| 323 * in advance of calling jpeg_start_compress(). |
| 324 */ |
| 325 #endif |
| 326 |
| 312 int data_precision; /* bits of precision in image data */ | 327 int data_precision; /* bits of precision in image data */ |
| 313 | 328 |
| 314 int num_components; /* # of color components in JPEG image */ | 329 int num_components; /* # of color components in JPEG image */ |
| 315 J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ | 330 J_COLOR_SPACE jpeg_color_space; /* colorspace of JPEG image */ |
| 316 | 331 |
| 317 jpeg_component_info * comp_info; | 332 jpeg_component_info * comp_info; |
| 318 /* comp_info[i] describes component that appears i'th in SOF */ | 333 /* comp_info[i] describes component that appears i'th in SOF */ |
| 319 | 334 |
| 320 JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; | 335 JQUANT_TBL * quant_tbl_ptrs[NUM_QUANT_TBLS]; |
| 321 /* ptrs to coefficient quantization tables, or NULL if not defined */ | 336 #if JPEG_LIB_VERSION >= 70 |
| 322 | 337 int q_scale_factor[NUM_QUANT_TBLS]; |
| 338 #endif |
| 339 /* ptrs to coefficient quantization tables, or NULL if not defined, |
| 340 * and corresponding scale factors (percentage, initialized 100). |
| 341 */ |
| 342 |
| 323 JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; | 343 JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; |
| 324 JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; | 344 JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; |
| 325 /* ptrs to Huffman coding tables, or NULL if not defined */ | 345 /* ptrs to Huffman coding tables, or NULL if not defined */ |
| 326 | 346 |
| 327 UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ | 347 UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ |
| 328 UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ | 348 UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ |
| 329 UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ | 349 UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ |
| 330 | 350 |
| 331 int num_scans; /* # of entries in scan_info array */ | 351 int num_scans; /* # of entries in scan_info array */ |
| 332 const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */ | 352 const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */ |
| 333 /* The default value of scan_info is NULL, which causes a single-scan | 353 /* The default value of scan_info is NULL, which causes a single-scan |
| 334 * sequential JPEG file to be emitted. To create a multi-scan file, | 354 * sequential JPEG file to be emitted. To create a multi-scan file, |
| 335 * set num_scans and scan_info to point to an array of scan definitions. | 355 * set num_scans and scan_info to point to an array of scan definitions. |
| 336 */ | 356 */ |
| 337 | 357 |
| 338 boolean raw_data_in; /* TRUE=caller supplies downsampled data */ | 358 boolean raw_data_in; /* TRUE=caller supplies downsampled data */ |
| 339 boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ | 359 boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ |
| 340 boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ | 360 boolean optimize_coding; /* TRUE=optimize entropy encoding parms */ |
| 341 boolean CCIR601_sampling; /* TRUE=first samples are cosited */ | 361 boolean CCIR601_sampling; /* TRUE=first samples are cosited */ |
| 362 #if JPEG_LIB_VERSION >= 70 |
| 363 boolean do_fancy_downsampling; /* TRUE=apply fancy downsampling */ |
| 364 #endif |
| 342 int smoothing_factor; /* 1..100, or 0 for no input smoothing */ | 365 int smoothing_factor; /* 1..100, or 0 for no input smoothing */ |
| 343 J_DCT_METHOD dct_method; /* DCT algorithm selector */ | 366 J_DCT_METHOD dct_method; /* DCT algorithm selector */ |
| 344 | 367 |
| 345 /* The restart interval can be specified in absolute MCUs by setting | 368 /* The restart interval can be specified in absolute MCUs by setting |
| 346 * restart_interval, or in MCU rows by setting restart_in_rows | 369 * restart_interval, or in MCU rows by setting restart_in_rows |
| 347 * (in which case the correct restart_interval will be figured | 370 * (in which case the correct restart_interval will be figured |
| 348 * for each scan). | 371 * for each scan). |
| 349 */ | 372 */ |
| 350 unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ | 373 unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ |
| 351 int restart_in_rows; /* if > 0, MCU rows per restart interval */ | 374 int restart_in_rows; /* if > 0, MCU rows per restart interval */ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 375 * should not be touched by a surrounding application. | 398 * should not be touched by a surrounding application. |
| 376 */ | 399 */ |
| 377 | 400 |
| 378 /* | 401 /* |
| 379 * These fields are computed during compression startup | 402 * These fields are computed during compression startup |
| 380 */ | 403 */ |
| 381 boolean progressive_mode; /* TRUE if scan script uses progressive mode */ | 404 boolean progressive_mode; /* TRUE if scan script uses progressive mode */ |
| 382 int max_h_samp_factor; /* largest h_samp_factor */ | 405 int max_h_samp_factor; /* largest h_samp_factor */ |
| 383 int max_v_samp_factor; /* largest v_samp_factor */ | 406 int max_v_samp_factor; /* largest v_samp_factor */ |
| 384 | 407 |
| 408 #if JPEG_LIB_VERSION >= 70 |
| 409 int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component *
/ |
| 410 int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component *
/ |
| 411 #endif |
| 412 |
| 385 JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ | 413 JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ |
| 386 /* The coefficient controller receives data in units of MCU rows as defined | 414 /* The coefficient controller receives data in units of MCU rows as defined |
| 387 * for fully interleaved scans (whether the JPEG file is interleaved or not). | 415 * for fully interleaved scans (whether the JPEG file is interleaved or not). |
| 388 * There are v_samp_factor * DCTSIZE sample rows of each component in an | 416 * There are v_samp_factor * DCTSIZE sample rows of each component in an |
| 389 * "iMCU" (interleaved MCU) row. | 417 * "iMCU" (interleaved MCU) row. |
| 390 */ | 418 */ |
| 391 | 419 |
| 392 /* | 420 /* |
| 393 * These fields are valid during any one scan. | 421 * These fields are valid during any one scan. |
| 394 * They describe the components and MCUs actually appearing in the scan. | 422 * They describe the components and MCUs actually appearing in the scan. |
| 395 */ | 423 */ |
| 396 int comps_in_scan; /* # of JPEG components in this scan */ | 424 int comps_in_scan; /* # of JPEG components in this scan */ |
| 397 jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; | 425 jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; |
| 398 /* *cur_comp_info[i] describes component that appears i'th in SOS */ | 426 /* *cur_comp_info[i] describes component that appears i'th in SOS */ |
| 399 | 427 |
| 400 JDIMENSION MCUs_per_row; /* # of MCUs across the image */ | 428 JDIMENSION MCUs_per_row; /* # of MCUs across the image */ |
| 401 JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ | 429 JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ |
| 402 | 430 |
| 403 int blocks_in_MCU; /* # of DCT blocks per MCU */ | 431 int blocks_in_MCU; /* # of DCT blocks per MCU */ |
| 404 int MCU_membership[C_MAX_BLOCKS_IN_MCU]; | 432 int MCU_membership[C_MAX_BLOCKS_IN_MCU]; |
| 405 /* MCU_membership[i] is index in cur_comp_info of component owning */ | 433 /* MCU_membership[i] is index in cur_comp_info of component owning */ |
| 406 /* i'th block in an MCU */ | 434 /* i'th block in an MCU */ |
| 407 | 435 |
| 408 int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ | 436 int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ |
| 409 | 437 |
| 438 #if JPEG_LIB_VERSION >= 80 |
| 439 int block_size; /* the basic DCT block size: 1..16 */ |
| 440 const int * natural_order; /* natural-order position array */ |
| 441 int lim_Se; /* min( Se, DCTSIZE2-1 ) */ |
| 442 #endif |
| 443 |
| 410 /* | 444 /* |
| 411 * Links to compression subobjects (methods and private variables of modules) | 445 * Links to compression subobjects (methods and private variables of modules) |
| 412 */ | 446 */ |
| 413 struct jpeg_comp_master * master; | 447 struct jpeg_comp_master * master; |
| 414 struct jpeg_c_main_controller * main; | 448 struct jpeg_c_main_controller * main; |
| 415 struct jpeg_c_prep_controller * prep; | 449 struct jpeg_c_prep_controller * prep; |
| 416 struct jpeg_c_coef_controller * coef; | 450 struct jpeg_c_coef_controller * coef; |
| 417 struct jpeg_marker_writer * marker; | 451 struct jpeg_marker_writer * marker; |
| 418 struct jpeg_color_converter * cconvert; | 452 struct jpeg_color_converter * cconvert; |
| 419 struct jpeg_downsampler * downsample; | 453 struct jpeg_downsampler * downsample; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 | 580 |
| 547 /* These parameters are never carried across datastreams, since they | 581 /* These parameters are never carried across datastreams, since they |
| 548 * are given in SOF/SOS markers or defined to be reset by SOI. | 582 * are given in SOF/SOS markers or defined to be reset by SOI. |
| 549 */ | 583 */ |
| 550 | 584 |
| 551 int data_precision; /* bits of precision in image data */ | 585 int data_precision; /* bits of precision in image data */ |
| 552 | 586 |
| 553 jpeg_component_info * comp_info; | 587 jpeg_component_info * comp_info; |
| 554 /* comp_info[i] describes component that appears i'th in SOF */ | 588 /* comp_info[i] describes component that appears i'th in SOF */ |
| 555 | 589 |
| 590 #if JPEG_LIB_VERSION >= 80 |
| 591 boolean is_baseline; /* TRUE if Baseline SOF0 encountered */ |
| 592 #endif |
| 556 boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */ | 593 boolean progressive_mode; /* TRUE if SOFn specifies progressive mode */ |
| 557 boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ | 594 boolean arith_code; /* TRUE=arithmetic coding, FALSE=Huffman */ |
| 558 | 595 |
| 559 UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ | 596 UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ |
| 560 UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ | 597 UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ |
| 561 UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ | 598 UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ |
| 562 | 599 |
| 563 unsigned int restart_interval; /* MCUs per restart interval, or 0 for no resta
rt */ | 600 unsigned int restart_interval; /* MCUs per restart interval, or 0 for no resta
rt */ |
| 564 | 601 |
| 565 /* These fields record data obtained from optional markers recognized by | 602 /* These fields record data obtained from optional markers recognized by |
| (...skipping 20 matching lines...) Expand all Loading... |
| 586 /* Remaining fields are known throughout decompressor, but generally | 623 /* Remaining fields are known throughout decompressor, but generally |
| 587 * should not be touched by a surrounding application. | 624 * should not be touched by a surrounding application. |
| 588 */ | 625 */ |
| 589 | 626 |
| 590 /* | 627 /* |
| 591 * These fields are computed during decompression startup | 628 * These fields are computed during decompression startup |
| 592 */ | 629 */ |
| 593 int max_h_samp_factor; /* largest h_samp_factor */ | 630 int max_h_samp_factor; /* largest h_samp_factor */ |
| 594 int max_v_samp_factor; /* largest v_samp_factor */ | 631 int max_v_samp_factor; /* largest v_samp_factor */ |
| 595 | 632 |
| 633 #if JPEG_LIB_VERSION >= 70 |
| 634 int min_DCT_h_scaled_size; /* smallest DCT_h_scaled_size of any component *
/ |
| 635 int min_DCT_v_scaled_size; /* smallest DCT_v_scaled_size of any component *
/ |
| 636 #else |
| 596 int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */ | 637 int min_DCT_scaled_size; /* smallest DCT_scaled_size of any component */ |
| 638 #endif |
| 597 | 639 |
| 598 JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ | 640 JDIMENSION total_iMCU_rows; /* # of iMCU rows in image */ |
| 599 /* The coefficient controller's input and output progress is measured in | 641 /* The coefficient controller's input and output progress is measured in |
| 600 * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows | 642 * units of "iMCU" (interleaved MCU) rows. These are the same as MCU rows |
| 601 * in fully interleaved JPEG scans, but are used whether the scan is | 643 * in fully interleaved JPEG scans, but are used whether the scan is |
| 602 * interleaved or not. We define an iMCU row as v_samp_factor DCT block | 644 * interleaved or not. We define an iMCU row as v_samp_factor DCT block |
| 603 * rows of each component. Therefore, the IDCT output contains | 645 * rows of each component. Therefore, the IDCT output contains |
| 604 * v_samp_factor*DCT_scaled_size sample rows of a component per iMCU row. | 646 * v_samp_factor*DCT_[v_]scaled_size sample rows of a component per iMCU row. |
| 605 */ | 647 */ |
| 606 | 648 |
| 607 JSAMPLE * sample_range_limit; /* table for fast range-limiting */ | 649 JSAMPLE * sample_range_limit; /* table for fast range-limiting */ |
| 608 | 650 |
| 609 /* | 651 /* |
| 610 * These fields are valid during any one scan. | 652 * These fields are valid during any one scan. |
| 611 * They describe the components and MCUs actually appearing in the scan. | 653 * They describe the components and MCUs actually appearing in the scan. |
| 612 * Note that the decompressor output side must not use these fields. | 654 * Note that the decompressor output side must not use these fields. |
| 613 */ | 655 */ |
| 614 int comps_in_scan; /* # of JPEG components in this scan */ | 656 int comps_in_scan; /* # of JPEG components in this scan */ |
| 615 jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; | 657 jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]; |
| 616 /* *cur_comp_info[i] describes component that appears i'th in SOS */ | 658 /* *cur_comp_info[i] describes component that appears i'th in SOS */ |
| 617 | 659 |
| 618 JDIMENSION MCUs_per_row; /* # of MCUs across the image */ | 660 JDIMENSION MCUs_per_row; /* # of MCUs across the image */ |
| 619 JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ | 661 JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */ |
| 620 | 662 |
| 621 int blocks_in_MCU; /* # of DCT blocks per MCU */ | 663 int blocks_in_MCU; /* # of DCT blocks per MCU */ |
| 622 int MCU_membership[D_MAX_BLOCKS_IN_MCU]; | 664 int MCU_membership[D_MAX_BLOCKS_IN_MCU]; |
| 623 /* MCU_membership[i] is index in cur_comp_info of component owning */ | 665 /* MCU_membership[i] is index in cur_comp_info of component owning */ |
| 624 /* i'th block in an MCU */ | 666 /* i'th block in an MCU */ |
| 625 | 667 |
| 626 int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ | 668 int Ss, Se, Ah, Al; /* progressive JPEG parameters for scan */ |
| 627 | 669 |
| 670 #if JPEG_LIB_VERSION >= 80 |
| 671 /* These fields are derived from Se of first SOS marker. |
| 672 */ |
| 673 int block_size; /* the basic DCT block size: 1..16 */ |
| 674 const int * natural_order; /* natural-order position array for entropy decode
*/ |
| 675 int lim_Se; /* min( Se, DCTSIZE2-1 ) for entropy decode */ |
| 676 #endif |
| 677 |
| 628 /* This field is shared between entropy decoder and marker parser. | 678 /* This field is shared between entropy decoder and marker parser. |
| 629 * It is either zero or the code of a JPEG marker that has been | 679 * It is either zero or the code of a JPEG marker that has been |
| 630 * read from the data source, but has not yet been processed. | 680 * read from the data source, but has not yet been processed. |
| 631 */ | 681 */ |
| 632 int unread_marker; | 682 int unread_marker; |
| 633 | 683 |
| 634 /* | 684 /* |
| 635 * Links to decompression subobjects (methods, private variables of modules) | 685 * Links to decompression subobjects (methods, private variables of modules) |
| 636 */ | 686 */ |
| 637 struct jpeg_decomp_master * master; | 687 struct jpeg_decomp_master * master; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 */ | 897 */ |
| 848 | 898 |
| 849 #ifdef NEED_SHORT_EXTERNAL_NAMES | 899 #ifdef NEED_SHORT_EXTERNAL_NAMES |
| 850 #define jpeg_std_error jStdError | 900 #define jpeg_std_error jStdError |
| 851 #define jpeg_CreateCompress jCreaCompress | 901 #define jpeg_CreateCompress jCreaCompress |
| 852 #define jpeg_CreateDecompress jCreaDecompress | 902 #define jpeg_CreateDecompress jCreaDecompress |
| 853 #define jpeg_destroy_compress jDestCompress | 903 #define jpeg_destroy_compress jDestCompress |
| 854 #define jpeg_destroy_decompress jDestDecompress | 904 #define jpeg_destroy_decompress jDestDecompress |
| 855 #define jpeg_stdio_dest jStdDest | 905 #define jpeg_stdio_dest jStdDest |
| 856 #define jpeg_stdio_src jStdSrc | 906 #define jpeg_stdio_src jStdSrc |
| 907 #if JPEG_LIB_VERSION >= 80 |
| 908 #define jpeg_mem_dest jMemDest |
| 909 #define jpeg_mem_src jMemSrc |
| 910 #endif |
| 857 #define jpeg_set_defaults jSetDefaults | 911 #define jpeg_set_defaults jSetDefaults |
| 858 #define jpeg_set_colorspace jSetColorspace | 912 #define jpeg_set_colorspace jSetColorspace |
| 859 #define jpeg_default_colorspace jDefColorspace | 913 #define jpeg_default_colorspace jDefColorspace |
| 860 #define jpeg_set_quality jSetQuality | 914 #define jpeg_set_quality jSetQuality |
| 861 #define jpeg_set_linear_quality jSetLQuality | 915 #define jpeg_set_linear_quality jSetLQuality |
| 916 #if JPEG_LIB_VERSION >= 70 |
| 917 #define jpeg_default_qtables jDefQTables |
| 918 #endif |
| 862 #define jpeg_add_quant_table jAddQuantTable | 919 #define jpeg_add_quant_table jAddQuantTable |
| 863 #define jpeg_quality_scaling jQualityScaling | 920 #define jpeg_quality_scaling jQualityScaling |
| 864 #define jpeg_simple_progression jSimProgress | 921 #define jpeg_simple_progression jSimProgress |
| 865 #define jpeg_suppress_tables jSuppressTables | 922 #define jpeg_suppress_tables jSuppressTables |
| 866 #define jpeg_alloc_quant_table jAlcQTable | 923 #define jpeg_alloc_quant_table jAlcQTable |
| 867 #define jpeg_alloc_huff_table jAlcHTable | 924 #define jpeg_alloc_huff_table jAlcHTable |
| 868 #define jpeg_start_compress jStrtCompress | 925 #define jpeg_start_compress jStrtCompress |
| 869 #define jpeg_write_scanlines jWrtScanlines | 926 #define jpeg_write_scanlines jWrtScanlines |
| 870 #define jpeg_finish_compress jFinCompress | 927 #define jpeg_finish_compress jFinCompress |
| 928 #if JPEG_LIB_VERSION >= 70 |
| 929 #define jpeg_calc_jpeg_dimensions jCjpegDimensions |
| 930 #endif |
| 871 #define jpeg_write_raw_data jWrtRawData | 931 #define jpeg_write_raw_data jWrtRawData |
| 872 #define jpeg_write_marker jWrtMarker | 932 #define jpeg_write_marker jWrtMarker |
| 873 #define jpeg_write_m_header jWrtMHeader | 933 #define jpeg_write_m_header jWrtMHeader |
| 874 #define jpeg_write_m_byte jWrtMByte | 934 #define jpeg_write_m_byte jWrtMByte |
| 875 #define jpeg_write_tables jWrtTables | 935 #define jpeg_write_tables jWrtTables |
| 876 #define jpeg_read_header jReadHeader | 936 #define jpeg_read_header jReadHeader |
| 877 #define jpeg_start_decompress jStrtDecompress | 937 #define jpeg_start_decompress jStrtDecompress |
| 878 #define jpeg_read_scanlines jReadScanlines | 938 #define jpeg_read_scanlines jReadScanlines |
| 879 #define jpeg_finish_decompress jFinDecompress | 939 #define jpeg_finish_decompress jFinDecompress |
| 880 #define jpeg_read_raw_data jReadRawData | 940 #define jpeg_read_raw_data jReadRawData |
| 881 #define jpeg_has_multiple_scans jHasMultScn | 941 #define jpeg_has_multiple_scans jHasMultScn |
| 882 #define jpeg_start_output jStrtOutput | 942 #define jpeg_start_output jStrtOutput |
| 883 #define jpeg_finish_output jFinOutput | 943 #define jpeg_finish_output jFinOutput |
| 884 #define jpeg_input_complete jInComplete | 944 #define jpeg_input_complete jInComplete |
| 885 #define jpeg_new_colormap jNewCMap | 945 #define jpeg_new_colormap jNewCMap |
| 886 #define jpeg_consume_input jConsumeInput | 946 #define jpeg_consume_input jConsumeInput |
| 947 #if JPEG_LIB_VERSION >= 80 |
| 948 #define jpeg_core_output_dimensions jCoreDimensions |
| 949 #endif |
| 887 #define jpeg_calc_output_dimensions jCalcDimensions | 950 #define jpeg_calc_output_dimensions jCalcDimensions |
| 888 #define jpeg_save_markers jSaveMarkers | 951 #define jpeg_save_markers jSaveMarkers |
| 889 #define jpeg_set_marker_processor jSetMarker | 952 #define jpeg_set_marker_processor jSetMarker |
| 890 #define jpeg_read_coefficients jReadCoefs | 953 #define jpeg_read_coefficients jReadCoefs |
| 891 #define jpeg_write_coefficients jWrtCoefs | 954 #define jpeg_write_coefficients jWrtCoefs |
| 892 #define jpeg_copy_critical_parameters jCopyCrit | 955 #define jpeg_copy_critical_parameters jCopyCrit |
| 893 #define jpeg_abort_compress jAbrtCompress | 956 #define jpeg_abort_compress jAbrtCompress |
| 894 #define jpeg_abort_decompress jAbrtDecompress | 957 #define jpeg_abort_decompress jAbrtDecompress |
| 895 #define jpeg_abort jAbort | 958 #define jpeg_abort jAbort |
| 896 #define jpeg_destroy jDestroy | 959 #define jpeg_destroy jDestroy |
| (...skipping 24 matching lines...) Expand all Loading... |
| 921 int version, size_t structsize)); | 984 int version, size_t structsize)); |
| 922 /* Destruction of JPEG compression objects */ | 985 /* Destruction of JPEG compression objects */ |
| 923 EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo)); | 986 EXTERN(void) jpeg_destroy_compress JPP((j_compress_ptr cinfo)); |
| 924 EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo)); | 987 EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo)); |
| 925 | 988 |
| 926 /* Standard data source and destination managers: stdio streams. */ | 989 /* Standard data source and destination managers: stdio streams. */ |
| 927 /* Caller is responsible for opening the file before and closing after. */ | 990 /* Caller is responsible for opening the file before and closing after. */ |
| 928 EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile)); | 991 EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile)); |
| 929 EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); | 992 EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile)); |
| 930 | 993 |
| 994 #if JPEG_LIB_VERSION >= 80 |
| 995 /* Data source and destination managers: memory buffers. */ |
| 996 EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo, |
| 997 unsigned char ** outbuffer, |
| 998 unsigned long * outsize)); |
| 999 EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo, |
| 1000 unsigned char * inbuffer, |
| 1001 unsigned long insize)); |
| 1002 #endif |
| 1003 |
| 931 /* Default parameter setup for compression */ | 1004 /* Default parameter setup for compression */ |
| 932 EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo)); | 1005 EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo)); |
| 933 /* Compression parameter setup aids */ | 1006 /* Compression parameter setup aids */ |
| 934 EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo, | 1007 EXTERN(void) jpeg_set_colorspace JPP((j_compress_ptr cinfo, |
| 935 J_COLOR_SPACE colorspace)); | 1008 J_COLOR_SPACE colorspace)); |
| 936 EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo)); | 1009 EXTERN(void) jpeg_default_colorspace JPP((j_compress_ptr cinfo)); |
| 937 EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality, | 1010 EXTERN(void) jpeg_set_quality JPP((j_compress_ptr cinfo, int quality, |
| 938 boolean force_baseline)); | 1011 boolean force_baseline)); |
| 939 EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo, | 1012 EXTERN(void) jpeg_set_linear_quality JPP((j_compress_ptr cinfo, |
| 940 int scale_factor, | 1013 int scale_factor, |
| 941 boolean force_baseline)); | 1014 boolean force_baseline)); |
| 1015 #if JPEG_LIB_VERSION >= 70 |
| 1016 EXTERN(void) jpeg_default_qtables JPP((j_compress_ptr cinfo, |
| 1017 boolean force_baseline)); |
| 1018 #endif |
| 942 EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl, | 1019 EXTERN(void) jpeg_add_quant_table JPP((j_compress_ptr cinfo, int which_tbl, |
| 943 const unsigned int *basic_table, | 1020 const unsigned int *basic_table, |
| 944 int scale_factor, | 1021 int scale_factor, |
| 945 boolean force_baseline)); | 1022 boolean force_baseline)); |
| 946 EXTERN(int) jpeg_quality_scaling JPP((int quality)); | 1023 EXTERN(int) jpeg_quality_scaling JPP((int quality)); |
| 947 EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo)); | 1024 EXTERN(void) jpeg_simple_progression JPP((j_compress_ptr cinfo)); |
| 948 EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo, | 1025 EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo, |
| 949 boolean suppress)); | 1026 boolean suppress)); |
| 950 EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo)); | 1027 EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo)); |
| 951 EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo)); | 1028 EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo)); |
| 952 | 1029 |
| 953 /* Main entry points for compression */ | 1030 /* Main entry points for compression */ |
| 954 EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo, | 1031 EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo, |
| 955 boolean write_all_tables)); | 1032 boolean write_all_tables)); |
| 956 EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo, | 1033 EXTERN(JDIMENSION) jpeg_write_scanlines JPP((j_compress_ptr cinfo, |
| 957 JSAMPARRAY scanlines, | 1034 JSAMPARRAY scanlines, |
| 958 JDIMENSION num_lines)); | 1035 JDIMENSION num_lines)); |
| 959 EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo)); | 1036 EXTERN(void) jpeg_finish_compress JPP((j_compress_ptr cinfo)); |
| 960 | 1037 |
| 1038 #if JPEG_LIB_VERSION >= 70 |
| 1039 /* Precalculate JPEG dimensions for current compression parameters. */ |
| 1040 EXTERN(void) jpeg_calc_jpeg_dimensions JPP((j_compress_ptr cinfo)); |
| 1041 #endif |
| 1042 |
| 961 /* Replaces jpeg_write_scanlines when writing raw downsampled data. */ | 1043 /* Replaces jpeg_write_scanlines when writing raw downsampled data. */ |
| 962 EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo, | 1044 EXTERN(JDIMENSION) jpeg_write_raw_data JPP((j_compress_ptr cinfo, |
| 963 JSAMPIMAGE data, | 1045 JSAMPIMAGE data, |
| 964 JDIMENSION num_lines)); | 1046 JDIMENSION num_lines)); |
| 965 | 1047 |
| 966 /* Write a special marker. See libjpeg.doc concerning safe usage. */ | 1048 /* Write a special marker. See libjpeg.txt concerning safe usage. */ |
| 967 EXTERN(void) jpeg_write_marker | 1049 EXTERN(void) jpeg_write_marker |
| 968 JPP((j_compress_ptr cinfo, int marker, | 1050 JPP((j_compress_ptr cinfo, int marker, |
| 969 const JOCTET * dataptr, unsigned int datalen)); | 1051 const JOCTET * dataptr, unsigned int datalen)); |
| 970 /* Same, but piecemeal. */ | 1052 /* Same, but piecemeal. */ |
| 971 EXTERN(void) jpeg_write_m_header | 1053 EXTERN(void) jpeg_write_m_header |
| 972 JPP((j_compress_ptr cinfo, int marker, unsigned int datalen)); | 1054 JPP((j_compress_ptr cinfo, int marker, unsigned int datalen)); |
| 973 EXTERN(void) jpeg_write_m_byte | 1055 EXTERN(void) jpeg_write_m_byte |
| 974 JPP((j_compress_ptr cinfo, int val)); | 1056 JPP((j_compress_ptr cinfo, int val)); |
| 975 | 1057 |
| 976 /* Alternate compression function: just write an abbreviated table file */ | 1058 /* Alternate compression function: just write an abbreviated table file */ |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo)); | 1092 EXTERN(void) jpeg_new_colormap JPP((j_decompress_ptr cinfo)); |
| 1011 EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo)); | 1093 EXTERN(int) jpeg_consume_input JPP((j_decompress_ptr cinfo)); |
| 1012 /* Return value is one of: */ | 1094 /* Return value is one of: */ |
| 1013 /* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ | 1095 /* #define JPEG_SUSPENDED 0 Suspended due to lack of input data */ |
| 1014 #define JPEG_REACHED_SOS 1 /* Reached start of new scan */ | 1096 #define JPEG_REACHED_SOS 1 /* Reached start of new scan */ |
| 1015 #define JPEG_REACHED_EOI 2 /* Reached end of image */ | 1097 #define JPEG_REACHED_EOI 2 /* Reached end of image */ |
| 1016 #define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ | 1098 #define JPEG_ROW_COMPLETED 3 /* Completed one iMCU row */ |
| 1017 #define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ | 1099 #define JPEG_SCAN_COMPLETED 4 /* Completed last iMCU row of a scan */ |
| 1018 | 1100 |
| 1019 /* Precalculate output dimensions for current decompression parameters. */ | 1101 /* Precalculate output dimensions for current decompression parameters. */ |
| 1102 #if JPEG_LIB_VERSION >= 80 |
| 1103 EXTERN(void) jpeg_core_output_dimensions JPP((j_decompress_ptr cinfo)); |
| 1104 #endif |
| 1020 EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); | 1105 EXTERN(void) jpeg_calc_output_dimensions JPP((j_decompress_ptr cinfo)); |
| 1021 | 1106 |
| 1022 /* Control saving of COM and APPn markers into marker_list. */ | 1107 /* Control saving of COM and APPn markers into marker_list. */ |
| 1023 EXTERN(void) jpeg_save_markers | 1108 EXTERN(void) jpeg_save_markers |
| 1024 JPP((j_decompress_ptr cinfo, int marker_code, | 1109 JPP((j_decompress_ptr cinfo, int marker_code, |
| 1025 unsigned int length_limit)); | 1110 unsigned int length_limit)); |
| 1026 | 1111 |
| 1027 /* Install a special processing method for COM or APPn markers. */ | 1112 /* Install a special processing method for COM or APPn markers. */ |
| 1028 EXTERN(void) jpeg_set_marker_processor | 1113 EXTERN(void) jpeg_set_marker_processor |
| 1029 JPP((j_decompress_ptr cinfo, int marker_code, | 1114 JPP((j_decompress_ptr cinfo, int marker_code, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 * Applications using the library should not include jpegint.h, but may wish | 1190 * Applications using the library should not include jpegint.h, but may wish |
| 1106 * to include jerror.h. | 1191 * to include jerror.h. |
| 1107 */ | 1192 */ |
| 1108 | 1193 |
| 1109 #ifdef JPEG_INTERNALS | 1194 #ifdef JPEG_INTERNALS |
| 1110 #include "jpegint.h" /* fetch private declarations */ | 1195 #include "jpegint.h" /* fetch private declarations */ |
| 1111 #include "jerror.h" /* fetch error codes too */ | 1196 #include "jerror.h" /* fetch error codes too */ |
| 1112 #endif | 1197 #endif |
| 1113 | 1198 |
| 1114 #ifdef __cplusplus | 1199 #ifdef __cplusplus |
| 1200 #ifndef DONT_USE_EXTERN_C |
| 1115 } | 1201 } |
| 1116 #endif | 1202 #endif |
| 1203 #endif |
| 1117 | 1204 |
| 1118 #endif /* JPEGLIB_H */ | 1205 #endif /* JPEGLIB_H */ |
| OLD | NEW |