| 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 * This file is part of the Independent JPEG Group's software. | 5 * This file is part of the Independent JPEG Group's software. |
| 6 * For conditions of distribution and use, see the accompanying README file. | 6 * For conditions of distribution and use, see the accompanying README file. |
| 7 * | 7 * |
| 8 * This file defines the application interface for the JPEG library. | 8 * This file defines the application interface for the JPEG library. |
| 9 * Most applications using the library need only include this file, | 9 * Most applications using the library need only include this file, |
| 10 * and perhaps jerror.h if they want to know the exact error codes. | 10 * and perhaps jerror.h if they want to know the exact error codes. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 | 147 |
| 148 /* DCT coefficient quantization tables. */ | 148 /* DCT coefficient quantization tables. */ |
| 149 | 149 |
| 150 typedef struct { | 150 typedef struct { |
| 151 /* This array gives the coefficient quantizers in natural array order | 151 /* This array gives the coefficient quantizers in natural array order |
| 152 * (not the zigzag order in which they are stored in a JPEG DQT marker). | 152 * (not the zigzag order in which they are stored in a JPEG DQT marker). |
| 153 * CAUTION: IJG versions prior to v6a kept this array in zigzag order. | 153 * CAUTION: IJG versions prior to v6a kept this array in zigzag order. |
| 154 */ | 154 */ |
| 155 UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ | 155 UINT16 quantval[DCTSIZE2]; /* quantization step for each coefficient */ |
| 156 /* This field is used only during compression. It's initialized FALSE when | 156 /* This field is used only during compression. It's initialized false when |
| 157 * the table is created, and set TRUE when it's been output to the file. | 157 * the table is created, and set true when it's been output to the file. |
| 158 * You could suppress output of a table by setting this to TRUE. | 158 * You could suppress output of a table by setting this to true. |
| 159 * (See jpeg_suppress_tables for an example.) | 159 * (See jpeg_suppress_tables for an example.) |
| 160 */ | 160 */ |
| 161 boolean sent_table;» » /* TRUE when table has been output */ | 161 boolean sent_table;» » /* true when table has been output */ |
| 162 } JQUANT_TBL; | 162 } JQUANT_TBL; |
| 163 | 163 |
| 164 | 164 |
| 165 /* Huffman coding tables. */ | 165 /* Huffman coding tables. */ |
| 166 | 166 |
| 167 typedef struct { | 167 typedef struct { |
| 168 /* These two fields directly represent the contents of a JPEG DHT marker */ | 168 /* These two fields directly represent the contents of a JPEG DHT marker */ |
| 169 UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ | 169 UINT8 bits[17]; /* bits[k] = # of symbols with codes of */ |
| 170 /* length k bits; bits[0] is unused */ | 170 /* length k bits; bits[0] is unused */ |
| 171 UINT8 huffval[256]; /* The symbols, in order of incr code length */ | 171 UINT8 huffval[256]; /* The symbols, in order of incr code length */ |
| 172 /* This field is used only during compression. It's initialized FALSE when | 172 /* This field is used only during compression. It's initialized false when |
| 173 * the table is created, and set TRUE when it's been output to the file. | 173 * the table is created, and set true when it's been output to the file. |
| 174 * You could suppress output of a table by setting this to TRUE. | 174 * You could suppress output of a table by setting this to true. |
| 175 * (See jpeg_suppress_tables for an example.) | 175 * (See jpeg_suppress_tables for an example.) |
| 176 */ | 176 */ |
| 177 boolean sent_table;» » /* TRUE when table has been output */ | 177 boolean sent_table;» » /* true when table has been output */ |
| 178 } JHUFF_TBL; | 178 } JHUFF_TBL; |
| 179 | 179 |
| 180 | 180 |
| 181 /* Basic info about one component (color channel). */ | 181 /* Basic info about one component (color channel). */ |
| 182 | 182 |
| 183 typedef struct { | 183 typedef struct { |
| 184 /* These values are fixed over the whole image. */ | 184 /* These values are fixed over the whole image. */ |
| 185 /* For compression, they must be supplied by parameter setup; */ | 185 /* For compression, they must be supplied by parameter setup; */ |
| 186 /* for decompression, they are read from the SOF marker. */ | 186 /* for decompression, they are read from the SOF marker. */ |
| 187 int component_id; /* identifier for this component (0..255) */ | 187 int component_id; /* identifier for this component (0..255) */ |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ | 377 UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ |
| 378 UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ | 378 UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ |
| 379 | 379 |
| 380 int num_scans; /* # of entries in scan_info array */ | 380 int num_scans; /* # of entries in scan_info array */ |
| 381 const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */ | 381 const jpeg_scan_info * scan_info; /* script for multi-scan file, or NULL */ |
| 382 /* The default value of scan_info is NULL, which causes a single-scan | 382 /* The default value of scan_info is NULL, which causes a single-scan |
| 383 * sequential JPEG file to be emitted. To create a multi-scan file, | 383 * sequential JPEG file to be emitted. To create a multi-scan file, |
| 384 * set num_scans and scan_info to point to an array of scan definitions. | 384 * set num_scans and scan_info to point to an array of scan definitions. |
| 385 */ | 385 */ |
| 386 | 386 |
| 387 boolean raw_data_in;» » /* TRUE=caller supplies downsampled data */ | 387 boolean raw_data_in;» » /* true=caller supplies downsampled data */ |
| 388 boolean arith_code;» » /* TRUE=arithmetic coding, FALSE=Huffman */ | 388 boolean arith_code;» » /* true=arithmetic coding, false=Huffman */ |
| 389 boolean optimize_coding;» /* TRUE=optimize entropy encoding parms */ | 389 boolean optimize_coding;» /* true=optimize entropy encoding parms */ |
| 390 boolean CCIR601_sampling;» /* TRUE=first samples are cosited */ | 390 boolean CCIR601_sampling;» /* true=first samples are cosited */ |
| 391 int smoothing_factor; /* 1..100, or 0 for no input smoothing */ | 391 int smoothing_factor; /* 1..100, or 0 for no input smoothing */ |
| 392 J_DCT_METHOD dct_method; /* DCT algorithm selector */ | 392 J_DCT_METHOD dct_method; /* DCT algorithm selector */ |
| 393 | 393 |
| 394 /* The restart interval can be specified in absolute MCUs by setting | 394 /* The restart interval can be specified in absolute MCUs by setting |
| 395 * restart_interval, or in MCU rows by setting restart_in_rows | 395 * restart_interval, or in MCU rows by setting restart_in_rows |
| 396 * (in which case the correct restart_interval will be figured | 396 * (in which case the correct restart_interval will be figured |
| 397 * for each scan). | 397 * for each scan). |
| 398 */ | 398 */ |
| 399 unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ | 399 unsigned int restart_interval; /* MCUs per restart, or 0 for no restart */ |
| 400 int restart_in_rows; /* if > 0, MCU rows per restart interval */ | 400 int restart_in_rows; /* if > 0, MCU rows per restart interval */ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 420 | 420 |
| 421 JDIMENSION next_scanline; /* 0 .. image_height-1 */ | 421 JDIMENSION next_scanline; /* 0 .. image_height-1 */ |
| 422 | 422 |
| 423 /* Remaining fields are known throughout compressor, but generally | 423 /* Remaining fields are known throughout compressor, but generally |
| 424 * should not be touched by a surrounding application. | 424 * should not be touched by a surrounding application. |
| 425 */ | 425 */ |
| 426 | 426 |
| 427 /* | 427 /* |
| 428 * These fields are computed during compression startup | 428 * These fields are computed during compression startup |
| 429 */ | 429 */ |
| 430 boolean progressive_mode;» /* TRUE if scan script uses progressive mode */ | 430 boolean progressive_mode;» /* true if scan script uses progressive mode */ |
| 431 int max_h_samp_factor; /* largest h_samp_factor */ | 431 int max_h_samp_factor; /* largest h_samp_factor */ |
| 432 int max_v_samp_factor; /* largest v_samp_factor */ | 432 int max_v_samp_factor; /* largest v_samp_factor */ |
| 433 | 433 |
| 434 JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ | 434 JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */ |
| 435 /* The coefficient controller receives data in units of MCU rows as defined | 435 /* The coefficient controller receives data in units of MCU rows as defined |
| 436 * for fully interleaved scans (whether the JPEG file is interleaved or not). | 436 * for fully interleaved scans (whether the JPEG file is interleaved or not). |
| 437 * There are v_samp_factor * DCTSIZE sample rows of each component in an | 437 * There are v_samp_factor * DCTSIZE sample rows of each component in an |
| 438 * "iMCU" (interleaved MCU) row. | 438 * "iMCU" (interleaved MCU) row. |
| 439 */ | 439 */ |
| 440 | 440 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes | 493 * calling jpeg_start_decompress(). Note that jpeg_read_header() initializes |
| 494 * them to default values. | 494 * them to default values. |
| 495 */ | 495 */ |
| 496 | 496 |
| 497 J_COLOR_SPACE out_color_space; /* colorspace for output */ | 497 J_COLOR_SPACE out_color_space; /* colorspace for output */ |
| 498 | 498 |
| 499 unsigned int scale_num, scale_denom; /* fraction by which to scale image */ | 499 unsigned int scale_num, scale_denom; /* fraction by which to scale image */ |
| 500 | 500 |
| 501 double output_gamma; /* image gamma wanted in output */ | 501 double output_gamma; /* image gamma wanted in output */ |
| 502 | 502 |
| 503 boolean buffered_image;» /* TRUE=multiple output passes */ | 503 boolean buffered_image;» /* true=multiple output passes */ |
| 504 boolean raw_data_out;»» /* TRUE=downsampled data wanted */ | 504 boolean raw_data_out;»» /* true=downsampled data wanted */ |
| 505 | 505 |
| 506 J_DCT_METHOD dct_method; /* IDCT algorithm selector */ | 506 J_DCT_METHOD dct_method; /* IDCT algorithm selector */ |
| 507 boolean do_fancy_upsampling;» /* TRUE=apply fancy upsampling */ | 507 boolean do_fancy_upsampling;» /* true=apply fancy upsampling */ |
| 508 boolean do_block_smoothing;» /* TRUE=apply interblock smoothing */ | 508 boolean do_block_smoothing;» /* true=apply interblock smoothing */ |
| 509 | 509 |
| 510 boolean quantize_colors;» /* TRUE=colormapped output wanted */ | 510 boolean quantize_colors;» /* true=colormapped output wanted */ |
| 511 /* the following are ignored if not quantize_colors: */ | 511 /* the following are ignored if not quantize_colors: */ |
| 512 J_DITHER_MODE dither_mode; /* type of color dithering to use */ | 512 J_DITHER_MODE dither_mode; /* type of color dithering to use */ |
| 513 boolean two_pass_quantize;» /* TRUE=use two-pass color quantization */ | 513 boolean two_pass_quantize;» /* true=use two-pass color quantization */ |
| 514 int desired_number_of_colors; /* max # colors to use in created colormap */ | 514 int desired_number_of_colors; /* max # colors to use in created colormap */ |
| 515 /* these are significant only in buffered-image mode: */ | 515 /* these are significant only in buffered-image mode: */ |
| 516 boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ | 516 boolean enable_1pass_quant; /* enable future use of 1-pass quantizer */ |
| 517 boolean enable_external_quant;/* enable future use of external colormap */ | 517 boolean enable_external_quant;/* enable future use of external colormap */ |
| 518 boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ | 518 boolean enable_2pass_quant; /* enable future use of 2-pass quantizer */ |
| 519 | 519 |
| 520 /* Description of actual output image that will be returned to application. | 520 /* Description of actual output image that will be returned to application. |
| 521 * These fields are computed by jpeg_start_decompress(). | 521 * These fields are computed by jpeg_start_decompress(). |
| 522 * You can also use jpeg_calc_output_dimensions() to determine these values | 522 * You can also use jpeg_calc_output_dimensions() to determine these values |
| 523 * in advance of calling jpeg_start_decompress(). | 523 * in advance of calling jpeg_start_decompress(). |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 | 595 |
| 596 /* These parameters are never carried across datastreams, since they | 596 /* These parameters are never carried across datastreams, since they |
| 597 * are given in SOF/SOS markers or defined to be reset by SOI. | 597 * are given in SOF/SOS markers or defined to be reset by SOI. |
| 598 */ | 598 */ |
| 599 | 599 |
| 600 int data_precision; /* bits of precision in image data */ | 600 int data_precision; /* bits of precision in image data */ |
| 601 | 601 |
| 602 jpeg_component_info * comp_info; | 602 jpeg_component_info * comp_info; |
| 603 /* comp_info[i] describes component that appears i'th in SOF */ | 603 /* comp_info[i] describes component that appears i'th in SOF */ |
| 604 | 604 |
| 605 boolean progressive_mode;» /* TRUE if SOFn specifies progressive mode */ | 605 boolean progressive_mode;» /* true if SOFn specifies progressive mode */ |
| 606 boolean arith_code;» » /* TRUE=arithmetic coding, FALSE=Huffman */ | 606 boolean arith_code;» » /* true=arithmetic coding, false=Huffman */ |
| 607 | 607 |
| 608 UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ | 608 UINT8 arith_dc_L[NUM_ARITH_TBLS]; /* L values for DC arith-coding tables */ |
| 609 UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ | 609 UINT8 arith_dc_U[NUM_ARITH_TBLS]; /* U values for DC arith-coding tables */ |
| 610 UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ | 610 UINT8 arith_ac_K[NUM_ARITH_TBLS]; /* Kx values for AC arith-coding tables */ |
| 611 | 611 |
| 612 unsigned int restart_interval; /* MCUs per restart interval, or 0 for no resta
rt */ | 612 unsigned int restart_interval; /* MCUs per restart interval, or 0 for no resta
rt */ |
| 613 | 613 |
| 614 /* These fields record data obtained from optional markers recognized by | 614 /* These fields record data obtained from optional markers recognized by |
| 615 * the JPEG library. | 615 * the JPEG library. |
| 616 */ | 616 */ |
| 617 boolean saw_JFIF_marker;» /* TRUE iff a JFIF APP0 marker was found */ | 617 boolean saw_JFIF_marker;» /* true iff a JFIF APP0 marker was found */ |
| 618 /* Data copied from JFIF marker; only valid if saw_JFIF_marker is TRUE: */ | 618 /* Data copied from JFIF marker; only valid if saw_JFIF_marker is true: */ |
| 619 UINT8 JFIF_major_version; /* JFIF version number */ | 619 UINT8 JFIF_major_version; /* JFIF version number */ |
| 620 UINT8 JFIF_minor_version; | 620 UINT8 JFIF_minor_version; |
| 621 UINT8 density_unit; /* JFIF code for pixel size units */ | 621 UINT8 density_unit; /* JFIF code for pixel size units */ |
| 622 UINT16 X_density; /* Horizontal pixel density */ | 622 UINT16 X_density; /* Horizontal pixel density */ |
| 623 UINT16 Y_density; /* Vertical pixel density */ | 623 UINT16 Y_density; /* Vertical pixel density */ |
| 624 boolean saw_Adobe_marker;» /* TRUE iff an Adobe APP14 marker was found */ | 624 boolean saw_Adobe_marker;» /* true iff an Adobe APP14 marker was found */ |
| 625 UINT8 Adobe_transform; /* Color transform code from Adobe marker */ | 625 UINT8 Adobe_transform; /* Color transform code from Adobe marker */ |
| 626 | 626 |
| 627 boolean CCIR601_sampling;» /* TRUE=first samples are cosited */ | 627 boolean CCIR601_sampling;» /* true=first samples are cosited */ |
| 628 | 628 |
| 629 /* Aside from the specific data retained from APPn markers known to the | 629 /* Aside from the specific data retained from APPn markers known to the |
| 630 * library, the uninterpreted contents of any or all APPn and COM markers | 630 * library, the uninterpreted contents of any or all APPn and COM markers |
| 631 * can be saved in a list for examination by the application. | 631 * can be saved in a list for examination by the application. |
| 632 */ | 632 */ |
| 633 jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */ | 633 jpeg_saved_marker_ptr marker_list; /* Head of list of saved markers */ |
| 634 | 634 |
| 635 /* Remaining fields are known throughout decompressor, but generally | 635 /* Remaining fields are known throughout decompressor, but generally |
| 636 * should not be touched by a surrounding application. | 636 * should not be touched by a surrounding application. |
| 637 */ | 637 */ |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 /* Alternate compression function: just write an abbreviated table file */ | 1027 /* Alternate compression function: just write an abbreviated table file */ |
| 1028 EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo)); | 1028 EXTERN(void) jpeg_write_tables JPP((j_compress_ptr cinfo)); |
| 1029 | 1029 |
| 1030 /* Decompression startup: read start of JPEG datastream to see what's there */ | 1030 /* Decompression startup: read start of JPEG datastream to see what's there */ |
| 1031 EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo, | 1031 EXTERN(int) jpeg_read_header JPP((j_decompress_ptr cinfo, |
| 1032 boolean require_image)); | 1032 boolean require_image)); |
| 1033 /* Return value is one of: */ | 1033 /* Return value is one of: */ |
| 1034 #define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ | 1034 #define JPEG_SUSPENDED 0 /* Suspended due to lack of input data */ |
| 1035 #define JPEG_HEADER_OK 1 /* Found valid image datastream */ | 1035 #define JPEG_HEADER_OK 1 /* Found valid image datastream */ |
| 1036 #define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ | 1036 #define JPEG_HEADER_TABLES_ONLY 2 /* Found valid table-specs-only datastream */ |
| 1037 /* If you pass require_image = TRUE (normal case), you need not check for | 1037 /* If you pass require_image = true (normal case), you need not check for |
| 1038 * a TABLES_ONLY return code; an abbreviated file will cause an error exit. | 1038 * a TABLES_ONLY return code; an abbreviated file will cause an error exit. |
| 1039 * JPEG_SUSPENDED is only possible if you use a data source module that can | 1039 * JPEG_SUSPENDED is only possible if you use a data source module that can |
| 1040 * give a suspension return (the stdio source module doesn't). | 1040 * give a suspension return (the stdio source module doesn't). |
| 1041 */ | 1041 */ |
| 1042 | 1042 |
| 1043 /* Main entry points for decompression */ | 1043 /* Main entry points for decompression */ |
| 1044 EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo)); | 1044 EXTERN(boolean) jpeg_start_decompress JPP((j_decompress_ptr cinfo)); |
| 1045 EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo, | 1045 EXTERN(JDIMENSION) jpeg_read_scanlines JPP((j_decompress_ptr cinfo, |
| 1046 JSAMPARRAY scanlines, | 1046 JSAMPARRAY scanlines, |
| 1047 JDIMENSION max_lines)); | 1047 JDIMENSION max_lines)); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 * Applications using the library should not include jpegint.h, but may wish | 1156 * Applications using the library should not include jpegint.h, but may wish |
| 1157 * to include jerror.h. | 1157 * to include jerror.h. |
| 1158 */ | 1158 */ |
| 1159 | 1159 |
| 1160 #ifdef JPEG_INTERNALS | 1160 #ifdef JPEG_INTERNALS |
| 1161 #include "jpegint.h" /* fetch private declarations */ | 1161 #include "jpegint.h" /* fetch private declarations */ |
| 1162 #include "jerror.h" /* fetch error codes too */ | 1162 #include "jerror.h" /* fetch error codes too */ |
| 1163 #endif | 1163 #endif |
| 1164 | 1164 |
| 1165 #endif /* JPEGLIB_H */ | 1165 #endif /* JPEGLIB_H */ |
| OLD | NEW |