| OLD | NEW |
| 1 /* | 1 /* |
| 2 * jpegint.h | 2 * jpegint.h |
| 3 * | 3 * |
| 4 * Copyright (C) 1991-1997, Thomas G. Lane. | 4 * Copyright (C) 1991-1997, 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 provides common declarations for the various JPEG modules. | 8 * This file provides common declarations for the various JPEG modules. |
| 9 * These declarations are considered internal to the JPEG library; most | 9 * These declarations are considered internal to the JPEG library; most |
| 10 * applications using the library shouldn't need to include this file. | 10 * applications using the library shouldn't need to include this file. |
| 11 */ | 11 */ |
| 12 | 12 |
| 13 | |
| 14 /* Declarations for both compression & decompression */ | 13 /* Declarations for both compression & decompression */ |
| 15 | 14 |
| 16 typedef enum {» » » /* Operating modes for buffer controllers */ | 15 typedef enum { /* Operating modes for buffer controllers */ |
| 17 » JBUF_PASS_THRU,»» /* Plain stripwise operation */ | 16 JBUF_PASS_THRU, /* Plain stripwise operation */ |
| 18 » /* Remaining modes require a full-image buffer to have been created */ | 17 /* Remaining modes require a full-image buffer to have been |
| 19 » JBUF_SAVE_SOURCE,» /* Run source subobject only, save output */ | 18 created */ |
| 20 » JBUF_CRANK_DEST,» /* Run dest subobject only, using saved data */ | 19 JBUF_SAVE_SOURCE, /* Run source subobject only, save output */ |
| 21 » JBUF_SAVE_AND_PASS» /* Run both subobjects, save output */ | 20 JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */ |
| 21 JBUF_SAVE_AND_PASS /* Run both subobjects, save output */ |
| 22 } J_BUF_MODE; | 22 } J_BUF_MODE; |
| 23 | 23 |
| 24 /* Values of global_state field (jdapi.c has some dependencies on ordering!) */ | 24 /* Values of global_state field (jdapi.c has some dependencies on ordering!) */ |
| 25 #define CSTATE_START» 100» /* after create_compress */ | 25 #define CSTATE_START 100 /* after create_compress */ |
| 26 #define CSTATE_SCANNING»101» /* start_compress done, write_scanlines OK */ | 26 #define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */ |
| 27 #define CSTATE_RAW_OK» 102» /* start_compress done, write_raw_data OK */ | 27 #define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */ |
| 28 #define CSTATE_WRCOEFS» 103» /* jpeg_write_coefficients done */ | 28 #define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */ |
| 29 #define DSTATE_START» 200» /* after create_decompress */ | 29 #define DSTATE_START 200 /* after create_decompress */ |
| 30 #define DSTATE_INHEADER»201» /* reading header markers, no SOS yet */ | 30 #define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */ |
| 31 #define DSTATE_READY» 202» /* found SOS, ready for start_decompress */ | 31 #define DSTATE_READY 202 /* found SOS, ready for start_decompress */ |
| 32 #define DSTATE_PRELOAD» 203» /* reading multiscan file in start_decompress*/ | 32 #define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/ |
| 33 #define DSTATE_PRESCAN» 204» /* performing dummy pass for 2-pass quant */ | 33 #define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */ |
| 34 #define DSTATE_SCANNING»205» /* start_decompress done, read_scanlines OK */ | 34 #define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */ |
| 35 #define DSTATE_RAW_OK» 206» /* start_decompress done, read_raw_data OK */ | 35 #define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */ |
| 36 #define DSTATE_BUFIMAGE»207» /* expecting jpeg_start_output */ | 36 #define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */ |
| 37 #define DSTATE_BUFPOST» 208» /* looking for SOS/EOI in jpeg_finish_output */ | 37 #define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */ |
| 38 #define DSTATE_RDCOEFS» 209» /* reading file in jpeg_read_coefficients */ | 38 #define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */ |
| 39 #define DSTATE_STOPPING»210» /* looking for EOI in jpeg_finish_decompress */ | 39 #define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */ |
| 40 | |
| 41 | 40 |
| 42 /* Declarations for compression modules */ | 41 /* Declarations for compression modules */ |
| 43 | 42 |
| 44 /* Master control module */ | 43 /* Master control module */ |
| 45 struct jpeg_comp_master { | 44 struct jpeg_comp_master { |
| 46 JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo)); | 45 JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo)); |
| 47 JMETHOD(void, pass_startup, (j_compress_ptr cinfo)); | 46 JMETHOD(void, pass_startup, (j_compress_ptr cinfo)); |
| 48 JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); | 47 JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); |
| 49 | 48 |
| 50 /* State variables made visible to other modules */ | 49 /* State variables made visible to other modules */ |
| 51 boolean call_pass_startup;» /* True if pass_startup must be called */ | 50 boolean call_pass_startup; /* True if pass_startup must be called */ |
| 52 boolean is_last_pass;»» /* True during last pass */ | 51 boolean is_last_pass; /* True during last pass */ |
| 53 }; | 52 }; |
| 54 | 53 |
| 55 /* Main buffer control (downsampled-data buffer) */ | 54 /* Main buffer control (downsampled-data buffer) */ |
| 56 struct jpeg_c_main_controller { | 55 struct jpeg_c_main_controller { |
| 57 JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); | 56 JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); |
| 58 JMETHOD(void, process_data, (j_compress_ptr cinfo, | 57 JMETHOD(void, |
| 59 » » » JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, | 58 process_data, |
| 60 » » » JDIMENSION in_rows_avail)); | 59 (j_compress_ptr cinfo, |
| 60 JSAMPARRAY input_buf, |
| 61 JDIMENSION* in_row_ctr, |
| 62 JDIMENSION in_rows_avail)); |
| 61 }; | 63 }; |
| 62 | 64 |
| 63 /* Compression preprocessing (downsampling input buffer control) */ | 65 /* Compression preprocessing (downsampling input buffer control) */ |
| 64 struct jpeg_c_prep_controller { | 66 struct jpeg_c_prep_controller { |
| 65 JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); | 67 JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); |
| 66 JMETHOD(void, pre_process_data, (j_compress_ptr cinfo, | 68 JMETHOD(void, |
| 67 » » » » JSAMPARRAY input_buf, | 69 pre_process_data, |
| 68 » » » » JDIMENSION *in_row_ctr, | 70 (j_compress_ptr cinfo, |
| 69 » » » » JDIMENSION in_rows_avail, | 71 JSAMPARRAY input_buf, |
| 70 » » » » JSAMPIMAGE output_buf, | 72 JDIMENSION* in_row_ctr, |
| 71 » » » » JDIMENSION *out_row_group_ctr, | 73 JDIMENSION in_rows_avail, |
| 72 » » » » JDIMENSION out_row_groups_avail)); | 74 JSAMPIMAGE output_buf, |
| 75 JDIMENSION* out_row_group_ctr, |
| 76 JDIMENSION out_row_groups_avail)); |
| 73 }; | 77 }; |
| 74 | 78 |
| 75 /* Coefficient buffer control */ | 79 /* Coefficient buffer control */ |
| 76 struct jpeg_c_coef_controller { | 80 struct jpeg_c_coef_controller { |
| 77 JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); | 81 JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); |
| 78 JMETHOD(boolean, compress_data, (j_compress_ptr cinfo, | 82 JMETHOD(boolean, compress_data, (j_compress_ptr cinfo, JSAMPIMAGE input_buf)); |
| 79 » » » » JSAMPIMAGE input_buf)); | |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 /* Colorspace conversion */ | 85 /* Colorspace conversion */ |
| 83 struct jpeg_color_converter { | 86 struct jpeg_color_converter { |
| 84 JMETHOD(void, start_pass, (j_compress_ptr cinfo)); | 87 JMETHOD(void, start_pass, (j_compress_ptr cinfo)); |
| 85 JMETHOD(void, color_convert, (j_compress_ptr cinfo, | 88 JMETHOD(void, |
| 86 » » » » JSAMPARRAY input_buf, JSAMPIMAGE output_buf, | 89 color_convert, |
| 87 » » » » JDIMENSION output_row, int num_rows)); | 90 (j_compress_ptr cinfo, |
| 91 JSAMPARRAY input_buf, |
| 92 JSAMPIMAGE output_buf, |
| 93 JDIMENSION output_row, |
| 94 int num_rows)); |
| 88 }; | 95 }; |
| 89 | 96 |
| 90 /* Downsampling */ | 97 /* Downsampling */ |
| 91 struct jpeg_downsampler { | 98 struct jpeg_downsampler { |
| 92 JMETHOD(void, start_pass, (j_compress_ptr cinfo)); | 99 JMETHOD(void, start_pass, (j_compress_ptr cinfo)); |
| 93 JMETHOD(void, downsample, (j_compress_ptr cinfo, | 100 JMETHOD(void, |
| 94 » » » JSAMPIMAGE input_buf, JDIMENSION in_row_index, | 101 downsample, |
| 95 » » » JSAMPIMAGE output_buf, | 102 (j_compress_ptr cinfo, |
| 96 » » » JDIMENSION out_row_group_index)); | 103 JSAMPIMAGE input_buf, |
| 104 JDIMENSION in_row_index, |
| 105 JSAMPIMAGE output_buf, |
| 106 JDIMENSION out_row_group_index)); |
| 97 | 107 |
| 98 boolean need_context_rows;» /* TRUE if need rows above & below */ | 108 boolean need_context_rows; /* TRUE if need rows above & below */ |
| 99 }; | 109 }; |
| 100 | 110 |
| 101 /* Forward DCT (also controls coefficient quantization) */ | 111 /* Forward DCT (also controls coefficient quantization) */ |
| 102 struct jpeg_forward_dct { | 112 struct jpeg_forward_dct { |
| 103 JMETHOD(void, start_pass, (j_compress_ptr cinfo)); | 113 JMETHOD(void, start_pass, (j_compress_ptr cinfo)); |
| 104 /* perhaps this should be an array??? */ | 114 /* perhaps this should be an array??? */ |
| 105 JMETHOD(void, forward_DCT, (j_compress_ptr cinfo, | 115 JMETHOD(void, |
| 106 » » » jpeg_component_info * compptr, | 116 forward_DCT, |
| 107 » » » JSAMPARRAY sample_data, JBLOCKROW coef_blocks, | 117 (j_compress_ptr cinfo, |
| 108 » » » JDIMENSION start_row, JDIMENSION start_col, | 118 jpeg_component_info* compptr, |
| 109 » » » JDIMENSION num_blocks)); | 119 JSAMPARRAY sample_data, |
| 120 JBLOCKROW coef_blocks, |
| 121 JDIMENSION start_row, |
| 122 JDIMENSION start_col, |
| 123 JDIMENSION num_blocks)); |
| 110 }; | 124 }; |
| 111 | 125 |
| 112 /* Entropy encoding */ | 126 /* Entropy encoding */ |
| 113 struct jpeg_entropy_encoder { | 127 struct jpeg_entropy_encoder { |
| 114 JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics)); | 128 JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics)); |
| 115 JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data)); | 129 JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW* MCU_data)); |
| 116 JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); | 130 JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); |
| 117 }; | 131 }; |
| 118 | 132 |
| 119 /* Marker writing */ | 133 /* Marker writing */ |
| 120 struct jpeg_marker_writer { | 134 struct jpeg_marker_writer { |
| 121 JMETHOD(void, write_file_header, (j_compress_ptr cinfo)); | 135 JMETHOD(void, write_file_header, (j_compress_ptr cinfo)); |
| 122 JMETHOD(void, write_frame_header, (j_compress_ptr cinfo)); | 136 JMETHOD(void, write_frame_header, (j_compress_ptr cinfo)); |
| 123 JMETHOD(void, write_scan_header, (j_compress_ptr cinfo)); | 137 JMETHOD(void, write_scan_header, (j_compress_ptr cinfo)); |
| 124 JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo)); | 138 JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo)); |
| 125 JMETHOD(void, write_tables_only, (j_compress_ptr cinfo)); | 139 JMETHOD(void, write_tables_only, (j_compress_ptr cinfo)); |
| 126 /* These routines are exported to allow insertion of extra markers */ | 140 /* These routines are exported to allow insertion of extra markers */ |
| 127 /* Probably only COM and APPn markers should be written this way */ | 141 /* Probably only COM and APPn markers should be written this way */ |
| 128 JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker, | 142 JMETHOD(void, |
| 129 » » » » unsigned int datalen)); | 143 write_marker_header, |
| 144 (j_compress_ptr cinfo, int marker, unsigned int datalen)); |
| 130 JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val)); | 145 JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val)); |
| 131 }; | 146 }; |
| 132 | 147 |
| 133 | |
| 134 /* Declarations for decompression modules */ | 148 /* Declarations for decompression modules */ |
| 135 | 149 |
| 136 /* Master control module */ | 150 /* Master control module */ |
| 137 struct jpeg_decomp_master { | 151 struct jpeg_decomp_master { |
| 138 JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo)); | 152 JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo)); |
| 139 JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo)); | 153 JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo)); |
| 140 | 154 |
| 141 /* State variables made visible to other modules */ | 155 /* State variables made visible to other modules */ |
| 142 boolean is_dummy_pass;» /* True during 1st pass for 2-pass quant */ | 156 boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */ |
| 143 }; | 157 }; |
| 144 | 158 |
| 145 /* Input control module */ | 159 /* Input control module */ |
| 146 struct jpeg_input_controller { | 160 struct jpeg_input_controller { |
| 147 JMETHOD(int, consume_input, (j_decompress_ptr cinfo)); | 161 JMETHOD(int, consume_input, (j_decompress_ptr cinfo)); |
| 148 JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo)); | 162 JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo)); |
| 149 JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); | 163 JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); |
| 150 JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo)); | 164 JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo)); |
| 151 | 165 |
| 152 /* State variables made visible to other modules */ | 166 /* State variables made visible to other modules */ |
| 153 boolean has_multiple_scans;» /* True if file has multiple scans */ | 167 boolean has_multiple_scans; /* True if file has multiple scans */ |
| 154 boolean eoi_reached;» » /* True when EOI has been consumed */ | 168 boolean eoi_reached; /* True when EOI has been consumed */ |
| 155 }; | 169 }; |
| 156 | 170 |
| 157 /* Main buffer control (downsampled-data buffer) */ | 171 /* Main buffer control (downsampled-data buffer) */ |
| 158 struct jpeg_d_main_controller { | 172 struct jpeg_d_main_controller { |
| 159 JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); | 173 JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); |
| 160 JMETHOD(void, process_data, (j_decompress_ptr cinfo, | 174 JMETHOD(void, |
| 161 » » » JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, | 175 process_data, |
| 162 » » » JDIMENSION out_rows_avail)); | 176 (j_decompress_ptr cinfo, |
| 177 JSAMPARRAY output_buf, |
| 178 JDIMENSION* out_row_ctr, |
| 179 JDIMENSION out_rows_avail)); |
| 163 }; | 180 }; |
| 164 | 181 |
| 165 /* Coefficient buffer control */ | 182 /* Coefficient buffer control */ |
| 166 struct jpeg_d_coef_controller { | 183 struct jpeg_d_coef_controller { |
| 167 JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); | 184 JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); |
| 168 JMETHOD(int, consume_data, (j_decompress_ptr cinfo)); | 185 JMETHOD(int, consume_data, (j_decompress_ptr cinfo)); |
| 169 JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo)); | 186 JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo)); |
| 170 JMETHOD(int, decompress_data, (j_decompress_ptr cinfo, | 187 JMETHOD(int, |
| 171 » » » » JSAMPIMAGE output_buf)); | 188 decompress_data, |
| 189 (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); |
| 172 /* Pointer to array of coefficient virtual arrays, or NULL if none */ | 190 /* Pointer to array of coefficient virtual arrays, or NULL if none */ |
| 173 jvirt_barray_ptr *coef_arrays; | 191 jvirt_barray_ptr* coef_arrays; |
| 174 }; | 192 }; |
| 175 | 193 |
| 176 /* Decompression postprocessing (color quantization buffer control) */ | 194 /* Decompression postprocessing (color quantization buffer control) */ |
| 177 struct jpeg_d_post_controller { | 195 struct jpeg_d_post_controller { |
| 178 JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); | 196 JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); |
| 179 JMETHOD(void, post_process_data, (j_decompress_ptr cinfo, | 197 JMETHOD(void, |
| 180 » » » » JSAMPIMAGE input_buf, | 198 post_process_data, |
| 181 » » » » JDIMENSION *in_row_group_ctr, | 199 (j_decompress_ptr cinfo, |
| 182 » » » » JDIMENSION in_row_groups_avail, | 200 JSAMPIMAGE input_buf, |
| 183 » » » » JSAMPARRAY output_buf, | 201 JDIMENSION* in_row_group_ctr, |
| 184 » » » » JDIMENSION *out_row_ctr, | 202 JDIMENSION in_row_groups_avail, |
| 185 » » » » JDIMENSION out_rows_avail)); | 203 JSAMPARRAY output_buf, |
| 204 JDIMENSION* out_row_ctr, |
| 205 JDIMENSION out_rows_avail)); |
| 186 }; | 206 }; |
| 187 | 207 |
| 188 /* Marker reading & parsing */ | 208 /* Marker reading & parsing */ |
| 189 struct jpeg_marker_reader { | 209 struct jpeg_marker_reader { |
| 190 JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo)); | 210 JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo)); |
| 191 /* Read markers until SOS or EOI. | 211 /* Read markers until SOS or EOI. |
| 192 * Returns same codes as are defined for jpeg_consume_input: | 212 * Returns same codes as are defined for jpeg_consume_input: |
| 193 * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. | 213 * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. |
| 194 */ | 214 */ |
| 195 JMETHOD(int, read_markers, (j_decompress_ptr cinfo)); | 215 JMETHOD(int, read_markers, (j_decompress_ptr cinfo)); |
| 196 /* Read a restart marker --- exported for use by entropy decoder only */ | 216 /* Read a restart marker --- exported for use by entropy decoder only */ |
| 197 jpeg_marker_parser_method read_restart_marker; | 217 jpeg_marker_parser_method read_restart_marker; |
| 198 | 218 |
| 199 /* State of marker reader --- nominally internal, but applications | 219 /* State of marker reader --- nominally internal, but applications |
| 200 * supplying COM or APPn handlers might like to know the state. | 220 * supplying COM or APPn handlers might like to know the state. |
| 201 */ | 221 */ |
| 202 boolean saw_SOI;» » /* found SOI? */ | 222 boolean saw_SOI; /* found SOI? */ |
| 203 boolean saw_SOF;» » /* found SOF? */ | 223 boolean saw_SOF; /* found SOF? */ |
| 204 int next_restart_num;»» /* next restart number expected (0-7) */ | 224 int next_restart_num; /* next restart number expected (0-7) */ |
| 205 unsigned int discarded_bytes;»/* # of bytes skipped looking for a marker */ | 225 unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */ |
| 206 }; | 226 }; |
| 207 | 227 |
| 208 /* Entropy decoding */ | 228 /* Entropy decoding */ |
| 209 struct jpeg_entropy_decoder { | 229 struct jpeg_entropy_decoder { |
| 210 JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); | 230 JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); |
| 211 JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, | 231 JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, JBLOCKROW* MCU_data)); |
| 212 » » » » JBLOCKROW *MCU_data)); | |
| 213 | 232 |
| 214 /* This is here to share code between baseline and progressive decoders; */ | 233 /* This is here to share code between baseline and progressive decoders; */ |
| 215 /* other modules probably should not use it */ | 234 /* other modules probably should not use it */ |
| 216 boolean insufficient_data;» /* set TRUE after emitting warning */ | 235 boolean insufficient_data; /* set TRUE after emitting warning */ |
| 217 }; | 236 }; |
| 218 | 237 |
| 219 /* Inverse DCT (also performs dequantization) */ | 238 /* Inverse DCT (also performs dequantization) */ |
| 220 typedef JMETHOD(void, inverse_DCT_method_ptr, | 239 typedef JMETHOD(void, |
| 221 » » (j_decompress_ptr cinfo, jpeg_component_info * compptr, | 240 inverse_DCT_method_ptr, |
| 222 » » JCOEFPTR coef_block, | 241 (j_decompress_ptr cinfo, |
| 223 » » JSAMPARRAY output_buf, JDIMENSION output_col)); | 242 jpeg_component_info* compptr, |
| 243 JCOEFPTR coef_block, |
| 244 JSAMPARRAY output_buf, |
| 245 JDIMENSION output_col)); |
| 224 | 246 |
| 225 struct jpeg_inverse_dct { | 247 struct jpeg_inverse_dct { |
| 226 JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); | 248 JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); |
| 227 /* It is useful to allow each component to have a separate IDCT method. */ | 249 /* It is useful to allow each component to have a separate IDCT method. */ |
| 228 inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS]; | 250 inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS]; |
| 229 }; | 251 }; |
| 230 | 252 |
| 231 /* Upsampling (note that upsampler must also call color converter) */ | 253 /* Upsampling (note that upsampler must also call color converter) */ |
| 232 struct jpeg_upsampler { | 254 struct jpeg_upsampler { |
| 233 JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); | 255 JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); |
| 234 JMETHOD(void, upsample, (j_decompress_ptr cinfo, | 256 JMETHOD(void, |
| 235 » » » JSAMPIMAGE input_buf, | 257 upsample, |
| 236 » » » JDIMENSION *in_row_group_ctr, | 258 (j_decompress_ptr cinfo, |
| 237 » » » JDIMENSION in_row_groups_avail, | 259 JSAMPIMAGE input_buf, |
| 238 » » » JSAMPARRAY output_buf, | 260 JDIMENSION* in_row_group_ctr, |
| 239 » » » JDIMENSION *out_row_ctr, | 261 JDIMENSION in_row_groups_avail, |
| 240 » » » JDIMENSION out_rows_avail)); | 262 JSAMPARRAY output_buf, |
| 263 JDIMENSION* out_row_ctr, |
| 264 JDIMENSION out_rows_avail)); |
| 241 | 265 |
| 242 boolean need_context_rows;» /* TRUE if need rows above & below */ | 266 boolean need_context_rows; /* TRUE if need rows above & below */ |
| 243 }; | 267 }; |
| 244 | 268 |
| 245 /* Colorspace conversion */ | 269 /* Colorspace conversion */ |
| 246 struct jpeg_color_deconverter { | 270 struct jpeg_color_deconverter { |
| 247 JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); | 271 JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); |
| 248 JMETHOD(void, color_convert, (j_decompress_ptr cinfo, | 272 JMETHOD(void, |
| 249 » » » » JSAMPIMAGE input_buf, JDIMENSION input_row, | 273 color_convert, |
| 250 » » » » JSAMPARRAY output_buf, int num_rows)); | 274 (j_decompress_ptr cinfo, |
| 275 JSAMPIMAGE input_buf, |
| 276 JDIMENSION input_row, |
| 277 JSAMPARRAY output_buf, |
| 278 int num_rows)); |
| 251 }; | 279 }; |
| 252 | 280 |
| 253 /* Color quantization or color precision reduction */ | 281 /* Color quantization or color precision reduction */ |
| 254 struct jpeg_color_quantizer { | 282 struct jpeg_color_quantizer { |
| 255 JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan)); | 283 JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan)); |
| 256 JMETHOD(void, color_quantize, (j_decompress_ptr cinfo, | 284 JMETHOD(void, |
| 257 » » » » JSAMPARRAY input_buf, JSAMPARRAY output_buf, | 285 color_quantize, |
| 258 » » » » int num_rows)); | 286 (j_decompress_ptr cinfo, |
| 287 JSAMPARRAY input_buf, |
| 288 JSAMPARRAY output_buf, |
| 289 int num_rows)); |
| 259 JMETHOD(void, finish_pass, (j_decompress_ptr cinfo)); | 290 JMETHOD(void, finish_pass, (j_decompress_ptr cinfo)); |
| 260 JMETHOD(void, new_color_map, (j_decompress_ptr cinfo)); | 291 JMETHOD(void, new_color_map, (j_decompress_ptr cinfo)); |
| 261 }; | 292 }; |
| 262 | 293 |
| 263 | |
| 264 /* Miscellaneous useful macros */ | 294 /* Miscellaneous useful macros */ |
| 265 | 295 |
| 266 #undef MAX | 296 #undef MAX |
| 267 #define MAX(a,b)» ((a) > (b) ? (a) : (b)) | 297 #define MAX(a, b) ((a) > (b) ? (a) : (b)) |
| 268 #undef MIN | 298 #undef MIN |
| 269 #define MIN(a,b)» ((a) < (b) ? (a) : (b)) | 299 #define MIN(a, b) ((a) < (b) ? (a) : (b)) |
| 270 | |
| 271 | 300 |
| 272 /* We assume that right shift corresponds to signed division by 2 with | 301 /* We assume that right shift corresponds to signed division by 2 with |
| 273 * rounding towards minus infinity. This is correct for typical "arithmetic | 302 * rounding towards minus infinity. This is correct for typical "arithmetic |
| 274 * shift" instructions that shift in copies of the sign bit. But some | 303 * shift" instructions that shift in copies of the sign bit. But some |
| 275 * C compilers implement >> with an unsigned shift. For these machines you | 304 * C compilers implement >> with an unsigned shift. For these machines you |
| 276 * must define RIGHT_SHIFT_IS_UNSIGNED. | 305 * must define RIGHT_SHIFT_IS_UNSIGNED. |
| 277 * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity. | 306 * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity. |
| 278 * It is only applied with constant shift counts. SHIFT_TEMPS must be | 307 * It is only applied with constant shift counts. SHIFT_TEMPS must be |
| 279 * included in the variables of any routine using RIGHT_SHIFT. | 308 * included in the variables of any routine using RIGHT_SHIFT. |
| 280 */ | 309 */ |
| 281 | 310 |
| 282 #ifdef RIGHT_SHIFT_IS_UNSIGNED | 311 #ifdef RIGHT_SHIFT_IS_UNSIGNED |
| 283 #define SHIFT_TEMPS» INT32 shift_temp; | 312 #define SHIFT_TEMPS INT32 shift_temp; |
| 284 #define RIGHT_SHIFT(x,shft) \ | 313 #define RIGHT_SHIFT(x, shft) \ |
| 285 » ((shift_temp = (x)) < 0 ? \ | 314 ((shift_temp = (x)) < 0 \ |
| 286 » (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \ | 315 ? (shift_temp >> (shft)) | ((~((INT32)0)) << (32 - (shft))) \ |
| 287 » (shift_temp >> (shft))) | 316 : (shift_temp >> (shft))) |
| 288 #else | 317 #else |
| 289 #define SHIFT_TEMPS | 318 #define SHIFT_TEMPS |
| 290 #define RIGHT_SHIFT(x,shft)» ((x) >> (shft)) | 319 #define RIGHT_SHIFT(x, shft) ((x) >> (shft)) |
| 291 #endif | 320 #endif |
| 292 | 321 |
| 293 | |
| 294 /* Short forms of external names for systems with brain-damaged linkers. */ | 322 /* Short forms of external names for systems with brain-damaged linkers. */ |
| 295 | 323 |
| 296 #ifdef NEED_SHORT_EXTERNAL_NAMES | 324 #ifdef NEED_SHORT_EXTERNAL_NAMES |
| 297 #define jinit_compress_master» jICompress | 325 #define jinit_compress_master jICompress |
| 298 #define jinit_c_master_control» jICMaster | 326 #define jinit_c_master_control jICMaster |
| 299 #define jinit_c_main_controller»jICMainC | 327 #define jinit_c_main_controller jICMainC |
| 300 #define jinit_c_prep_controller»jICPrepC | 328 #define jinit_c_prep_controller jICPrepC |
| 301 #define jinit_c_coef_controller»jICCoefC | 329 #define jinit_c_coef_controller jICCoefC |
| 302 #define jinit_color_converter» jICColor | 330 #define jinit_color_converter jICColor |
| 303 #define jinit_downsampler» jIDownsampler | 331 #define jinit_downsampler jIDownsampler |
| 304 #define jinit_forward_dct» jIFDCT | 332 #define jinit_forward_dct jIFDCT |
| 305 #define jinit_huff_encoder» jIHEncoder | 333 #define jinit_huff_encoder jIHEncoder |
| 306 #define jinit_phuff_encoder» jIPHEncoder | 334 #define jinit_phuff_encoder jIPHEncoder |
| 307 #define jinit_marker_writer» jIMWriter | 335 #define jinit_marker_writer jIMWriter |
| 308 #define jinit_master_decompress»jIDMaster | 336 #define jinit_master_decompress jIDMaster |
| 309 #define jinit_d_main_controller»jIDMainC | 337 #define jinit_d_main_controller jIDMainC |
| 310 #define jinit_d_coef_controller»jIDCoefC | 338 #define jinit_d_coef_controller jIDCoefC |
| 311 #define jinit_d_post_controller»jIDPostC | 339 #define jinit_d_post_controller jIDPostC |
| 312 #define jinit_input_controller» jIInCtlr | 340 #define jinit_input_controller jIInCtlr |
| 313 #define jinit_marker_reader» jIMReader | 341 #define jinit_marker_reader jIMReader |
| 314 #define jinit_huff_decoder» jIHDecoder | 342 #define jinit_huff_decoder jIHDecoder |
| 315 #define jinit_phuff_decoder» jIPHDecoder | 343 #define jinit_phuff_decoder jIPHDecoder |
| 316 #define jinit_inverse_dct» jIIDCT | 344 #define jinit_inverse_dct jIIDCT |
| 317 #define jinit_upsampler»» jIUpsampler | 345 #define jinit_upsampler jIUpsampler |
| 318 #define jinit_color_deconverter»jIDColor | 346 #define jinit_color_deconverter jIDColor |
| 319 #define jinit_1pass_quantizer» jI1Quant | 347 #define jinit_1pass_quantizer jI1Quant |
| 320 #define jinit_2pass_quantizer» jI2Quant | 348 #define jinit_2pass_quantizer jI2Quant |
| 321 #define jinit_merged_upsampler» jIMUpsampler | 349 #define jinit_merged_upsampler jIMUpsampler |
| 322 #define jinit_memory_mgr» jIMemMgr | 350 #define jinit_memory_mgr jIMemMgr |
| 323 #define jdiv_round_up» » jDivRound | 351 #define jdiv_round_up jDivRound |
| 324 #define jround_up» » jRound | 352 #define jround_up jRound |
| 325 #define jcopy_sample_rows» jCopySamples | 353 #define jcopy_sample_rows jCopySamples |
| 326 #define jcopy_block_row»» jCopyBlocks | 354 #define jcopy_block_row jCopyBlocks |
| 327 #define jzero_far» » jZeroFar | 355 #define jzero_far jZeroFar |
| 328 #define jpeg_zigzag_order» jZIGTable | 356 #define jpeg_zigzag_order jZIGTable |
| 329 #define jpeg_natural_order» jZAGTable | 357 #define jpeg_natural_order jZAGTable |
| 330 #endif /* NEED_SHORT_EXTERNAL_NAMES */ | 358 #endif /* NEED_SHORT_EXTERNAL_NAMES */ |
| 331 | 359 |
| 332 | |
| 333 /* Compression module initialization routines */ | 360 /* Compression module initialization routines */ |
| 334 EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo)); | 361 EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo)); |
| 335 EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo, | 362 EXTERN(void) |
| 336 » » » » » boolean transcode_only)); | 363 jinit_c_master_control JPP((j_compress_ptr cinfo, boolean transcode_only)); |
| 337 EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo, | 364 EXTERN(void) |
| 338 » » » » » boolean need_full_buffer)); | 365 jinit_c_main_controller JPP((j_compress_ptr cinfo, boolean need_full_buffer)); |
| 339 EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo, | 366 EXTERN(void) |
| 340 » » » » » boolean need_full_buffer)); | 367 jinit_c_prep_controller JPP((j_compress_ptr cinfo, boolean need_full_buffer)); |
| 341 EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo, | 368 EXTERN(void) |
| 342 » » » » » boolean need_full_buffer)); | 369 jinit_c_coef_controller JPP((j_compress_ptr cinfo, boolean need_full_buffer)); |
| 343 EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo)); | 370 EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo)); |
| 344 EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo)); | 371 EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo)); |
| 345 EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo)); | 372 EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo)); |
| 346 EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo)); | 373 EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo)); |
| 347 EXTERN(void) jinit_phuff_encoder JPP((j_compress_ptr cinfo)); | 374 EXTERN(void) jinit_phuff_encoder JPP((j_compress_ptr cinfo)); |
| 348 EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo)); | 375 EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo)); |
| 349 /* Decompression module initialization routines */ | 376 /* Decompression module initialization routines */ |
| 350 EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo)); | 377 EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo)); |
| 351 EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo, | 378 EXTERN(void) |
| 352 » » » » » boolean need_full_buffer)); | 379 jinit_d_main_controller JPP((j_decompress_ptr cinfo, boolean need_full_buffer)); |
| 353 EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo, | 380 EXTERN(void) |
| 354 » » » » » boolean need_full_buffer)); | 381 jinit_d_coef_controller JPP((j_decompress_ptr cinfo, boolean need_full_buffer)); |
| 355 EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo, | 382 EXTERN(void) |
| 356 » » » » » boolean need_full_buffer)); | 383 jinit_d_post_controller JPP((j_decompress_ptr cinfo, boolean need_full_buffer)); |
| 357 EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo)); | 384 EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo)); |
| 358 EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo)); | 385 EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo)); |
| 359 EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo)); | 386 EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo)); |
| 360 EXTERN(void) jinit_phuff_decoder JPP((j_decompress_ptr cinfo)); | 387 EXTERN(void) jinit_phuff_decoder JPP((j_decompress_ptr cinfo)); |
| 361 EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo)); | 388 EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo)); |
| 362 EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo)); | 389 EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo)); |
| 363 EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo)); | 390 EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo)); |
| 364 EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo)); | 391 EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo)); |
| 365 EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo)); | 392 EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo)); |
| 366 EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo)); | 393 EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo)); |
| 367 /* Memory manager initialization */ | 394 /* Memory manager initialization */ |
| 368 EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo)); | 395 EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo)); |
| 369 | 396 |
| 370 /* Utility routines in jutils.c */ | 397 /* Utility routines in jutils.c */ |
| 371 EXTERN(long) jdiv_round_up JPP((long a, long b)); | 398 EXTERN(long) jdiv_round_up JPP((long a, long b)); |
| 372 EXTERN(long) jround_up JPP((long a, long b)); | 399 EXTERN(long) jround_up JPP((long a, long b)); |
| 373 EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row, | 400 EXTERN(void) |
| 374 » » » » JSAMPARRAY output_array, int dest_row, | 401 jcopy_sample_rows JPP((JSAMPARRAY input_array, |
| 375 » » » » int num_rows, JDIMENSION num_cols)); | 402 int source_row, |
| 376 EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row, | 403 JSAMPARRAY output_array, |
| 377 » » » » JDIMENSION num_blocks)); | 404 int dest_row, |
| 378 EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero)); | 405 int num_rows, |
| 406 JDIMENSION num_cols)); |
| 407 EXTERN(void) |
| 408 jcopy_block_row |
| 409 JPP((JBLOCKROW input_row, JBLOCKROW output_row, JDIMENSION num_blocks)); |
| 410 EXTERN(void) jzero_far JPP((void FAR* target, size_t bytestozero)); |
| 379 /* Constant tables in jutils.c */ | 411 /* Constant tables in jutils.c */ |
| 380 #if 0» » » » /* This table is not actually needed in v6a */ | 412 #if 0 /* This table is not actually needed in v6a */ |
| 381 extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */ | 413 extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */ |
| 382 #endif | 414 #endif |
| 383 extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */ | 415 extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */ |
| 384 | 416 |
| 385 /* Suppress undefined-structure complaints if necessary. */ | 417 /* Suppress undefined-structure complaints if necessary. */ |
| 386 | 418 |
| 387 #ifdef INCOMPLETE_TYPES_BROKEN | 419 #ifdef INCOMPLETE_TYPES_BROKEN |
| 388 #ifndef AM_MEMORY_MANAGER» /* only jmemmgr.c defines these */ | 420 #ifndef AM_MEMORY_MANAGER /* only jmemmgr.c defines these */ |
| 389 struct jvirt_sarray_control { long dummy; }; | 421 struct jvirt_sarray_control { |
| 390 struct jvirt_barray_control { long dummy; }; | 422 long dummy; |
| 423 }; |
| 424 struct jvirt_barray_control { |
| 425 long dummy; |
| 426 }; |
| 391 #endif | 427 #endif |
| 392 #endif /* INCOMPLETE_TYPES_BROKEN */ | 428 #endif /* INCOMPLETE_TYPES_BROKEN */ |
| OLD | NEW |