00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 typedef enum {
00017 JBUF_PASS_THRU,
00018
00019 JBUF_SAVE_SOURCE,
00020 JBUF_CRANK_DEST,
00021 JBUF_SAVE_AND_PASS
00022 } J_BUF_MODE;
00023
00024
00025 #define CSTATE_START 100
00026 #define CSTATE_SCANNING 101
00027 #define CSTATE_RAW_OK 102
00028 #define CSTATE_WRCOEFS 103
00029 #define DSTATE_START 200
00030 #define DSTATE_INHEADER 201
00031 #define DSTATE_READY 202
00032 #define DSTATE_PRELOAD 203
00033 #define DSTATE_PRESCAN 204
00034 #define DSTATE_SCANNING 205
00035 #define DSTATE_RAW_OK 206
00036 #define DSTATE_BUFIMAGE 207
00037 #define DSTATE_BUFPOST 208
00038 #define DSTATE_RDCOEFS 209
00039 #define DSTATE_STOPPING 210
00040
00041
00042
00043
00044
00045 struct jpeg_comp_master {
00046 JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo));
00047 JMETHOD(void, pass_startup, (j_compress_ptr cinfo));
00048 JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
00049
00050
00051 boolean call_pass_startup;
00052 boolean is_last_pass;
00053 };
00054
00055
00056 struct jpeg_c_main_controller {
00057 JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
00058 JMETHOD(void, process_data, (j_compress_ptr cinfo,
00059 JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
00060 JDIMENSION in_rows_avail));
00061 };
00062
00063
00064 struct jpeg_c_prep_controller {
00065 JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
00066 JMETHOD(void, pre_process_data, (j_compress_ptr cinfo,
00067 JSAMPARRAY input_buf,
00068 JDIMENSION *in_row_ctr,
00069 JDIMENSION in_rows_avail,
00070 JSAMPIMAGE output_buf,
00071 JDIMENSION *out_row_group_ctr,
00072 JDIMENSION out_row_groups_avail));
00073 };
00074
00075
00076 struct jpeg_c_coef_controller {
00077 JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
00078 JMETHOD(boolean, compress_data, (j_compress_ptr cinfo,
00079 JSAMPIMAGE input_buf));
00080 };
00081
00082
00083 struct jpeg_color_converter {
00084 JMETHOD(void, start_pass, (j_compress_ptr cinfo));
00085 JMETHOD(void, color_convert, (j_compress_ptr cinfo,
00086 JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
00087 JDIMENSION output_row, int num_rows));
00088 };
00089
00090
00091 struct jpeg_downsampler {
00092 JMETHOD(void, start_pass, (j_compress_ptr cinfo));
00093 JMETHOD(void, downsample, (j_compress_ptr cinfo,
00094 JSAMPIMAGE input_buf, JDIMENSION in_row_index,
00095 JSAMPIMAGE output_buf,
00096 JDIMENSION out_row_group_index));
00097
00098 boolean need_context_rows;
00099 };
00100
00101
00102 struct jpeg_forward_dct {
00103 JMETHOD(void, start_pass, (j_compress_ptr cinfo));
00104
00105 JMETHOD(void, forward_DCT, (j_compress_ptr cinfo,
00106 jpeg_component_info * compptr,
00107 JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
00108 JDIMENSION start_row, JDIMENSION start_col,
00109 JDIMENSION num_blocks));
00110 };
00111
00112
00113 struct jpeg_entropy_encoder {
00114 JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics));
00115 JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data));
00116 JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
00117 };
00118
00119
00120 struct jpeg_marker_writer {
00121 JMETHOD(void, write_file_header, (j_compress_ptr cinfo));
00122 JMETHOD(void, write_frame_header, (j_compress_ptr cinfo));
00123 JMETHOD(void, write_scan_header, (j_compress_ptr cinfo));
00124 JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo));
00125 JMETHOD(void, write_tables_only, (j_compress_ptr cinfo));
00126
00127
00128 JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker,
00129 unsigned int datalen));
00130 JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val));
00131 };
00132
00133
00134
00135
00136
00137 struct jpeg_decomp_master {
00138 JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo));
00139 JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo));
00140
00141
00142 boolean is_dummy_pass;
00143 };
00144
00145
00146 struct jpeg_input_controller {
00147 JMETHOD(int, consume_input, (j_decompress_ptr cinfo));
00148 JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo));
00149 JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
00150 JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo));
00151
00152
00153 boolean has_multiple_scans;
00154 boolean eoi_reached;
00155 };
00156
00157
00158 struct jpeg_d_main_controller {
00159 JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
00160 JMETHOD(void, process_data, (j_decompress_ptr cinfo,
00161 JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
00162 JDIMENSION out_rows_avail));
00163 };
00164
00165
00166 struct jpeg_d_coef_controller {
00167 JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo));
00168 JMETHOD(int, consume_data, (j_decompress_ptr cinfo));
00169 JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo));
00170 JMETHOD(int, decompress_data, (j_decompress_ptr cinfo,
00171 JSAMPIMAGE output_buf));
00172
00173 jvirt_barray_ptr *coef_arrays;
00174 };
00175
00176
00177 struct jpeg_d_post_controller {
00178 JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode));
00179 JMETHOD(void, post_process_data, (j_decompress_ptr cinfo,
00180 JSAMPIMAGE input_buf,
00181 JDIMENSION *in_row_group_ctr,
00182 JDIMENSION in_row_groups_avail,
00183 JSAMPARRAY output_buf,
00184 JDIMENSION *out_row_ctr,
00185 JDIMENSION out_rows_avail));
00186 };
00187
00188
00189 struct jpeg_marker_reader {
00190 JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo));
00191
00192
00193
00194
00195 JMETHOD(int, read_markers, (j_decompress_ptr cinfo));
00196
00197 jpeg_marker_parser_method read_restart_marker;
00198
00199
00200
00201
00202 boolean saw_SOI;
00203 boolean saw_SOF;
00204 int next_restart_num;
00205 unsigned int discarded_bytes;
00206 };
00207
00208
00209 struct jpeg_entropy_decoder {
00210 JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
00211 JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,
00212 JBLOCKROW *MCU_data));
00213
00214
00215
00216 boolean insufficient_data;
00217 };
00218
00219
00220 typedef JMETHOD(void, inverse_DCT_method_ptr,
00221 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
00222 JCOEFPTR coef_block,
00223 JSAMPARRAY output_buf, JDIMENSION output_col));
00224
00225 struct jpeg_inverse_dct {
00226 JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
00227
00228 inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS];
00229 };
00230
00231
00232 struct jpeg_upsampler {
00233 JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
00234 JMETHOD(void, upsample, (j_decompress_ptr cinfo,
00235 JSAMPIMAGE input_buf,
00236 JDIMENSION *in_row_group_ctr,
00237 JDIMENSION in_row_groups_avail,
00238 JSAMPARRAY output_buf,
00239 JDIMENSION *out_row_ctr,
00240 JDIMENSION out_rows_avail));
00241
00242 boolean need_context_rows;
00243 };
00244
00245
00246 struct jpeg_color_deconverter {
00247 JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
00248 JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
00249 JSAMPIMAGE input_buf, JDIMENSION input_row,
00250 JSAMPARRAY output_buf, int num_rows));
00251 };
00252
00253
00254 struct jpeg_color_quantizer {
00255 JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan));
00256 JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
00257 JSAMPARRAY input_buf, JSAMPARRAY output_buf,
00258 int num_rows));
00259 JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
00260 JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
00261 };
00262
00263
00264
00265
00266 #undef MAX
00267 #define MAX(a,b) ((a) > (b) ? (a) : (b))
00268 #undef MIN
00269 #define MIN(a,b) ((a) < (b) ? (a) : (b))
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282 #ifdef RIGHT_SHIFT_IS_UNSIGNED
00283 #define SHIFT_TEMPS INT32 shift_temp;
00284 #define RIGHT_SHIFT(x,shft) \
00285 ((shift_temp = (x)) < 0 ? \
00286 (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
00287 (shift_temp >> (shft)))
00288 #else
00289 #define SHIFT_TEMPS
00290 #define RIGHT_SHIFT(x,shft) ((x) >> (shft))
00291 #endif
00292
00293
00294
00295
00296 #ifdef NEED_SHORT_EXTERNAL_NAMES
00297 #define jinit_compress_master jICompress
00298 #define jinit_c_master_control jICMaster
00299 #define jinit_c_main_controller jICMainC
00300 #define jinit_c_prep_controller jICPrepC
00301 #define jinit_c_coef_controller jICCoefC
00302 #define jinit_color_converter jICColor
00303 #define jinit_downsampler jIDownsampler
00304 #define jinit_forward_dct jIFDCT
00305 #define jinit_huff_encoder jIHEncoder
00306 #define jinit_phuff_encoder jIPHEncoder
00307 #define jinit_marker_writer jIMWriter
00308 #define jinit_master_decompress jIDMaster
00309 #define jinit_d_main_controller jIDMainC
00310 #define jinit_d_coef_controller jIDCoefC
00311 #define jinit_d_post_controller jIDPostC
00312 #define jinit_input_controller jIInCtlr
00313 #define jinit_marker_reader jIMReader
00314 #define jinit_huff_decoder jIHDecoder
00315 #define jinit_phuff_decoder jIPHDecoder
00316 #define jinit_inverse_dct jIIDCT
00317 #define jinit_upsampler jIUpsampler
00318 #define jinit_color_deconverter jIDColor
00319 #define jinit_1pass_quantizer jI1Quant
00320 #define jinit_2pass_quantizer jI2Quant
00321 #define jinit_merged_upsampler jIMUpsampler
00322 #define jinit_memory_mgr jIMemMgr
00323 #define jdiv_round_up jDivRound
00324 #define jround_up jRound
00325 #define jcopy_sample_rows jCopySamples
00326 #define jcopy_block_row jCopyBlocks
00327 #define jzero_far jZeroFar
00328 #define jpeg_zigzag_order jZIGTable
00329 #define jpeg_natural_order jZAGTable
00330 #endif
00331
00332
00333
00334 EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
00335 EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
00336 boolean transcode_only));
00337 EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo,
00338 boolean need_full_buffer));
00339 EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo,
00340 boolean need_full_buffer));
00341 EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo,
00342 boolean need_full_buffer));
00343 EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo));
00344 EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
00345 EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
00346 EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo));
00347 EXTERN(void) jinit_phuff_encoder JPP((j_compress_ptr cinfo));
00348 EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
00349
00350 EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo));
00351 EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo,
00352 boolean need_full_buffer));
00353 EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo,
00354 boolean need_full_buffer));
00355 EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo,
00356 boolean need_full_buffer));
00357 EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo));
00358 EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
00359 EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
00360 EXTERN(void) jinit_phuff_decoder JPP((j_decompress_ptr cinfo));
00361 EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo));
00362 EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo));
00363 EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo));
00364 EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo));
00365 EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo));
00366 EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo));
00367
00368 EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
00369
00370
00371 EXTERN(long) jdiv_round_up JPP((long a, long b));
00372 EXTERN(long) jround_up JPP((long a, long b));
00373 EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
00374 JSAMPARRAY output_array, int dest_row,
00375 int num_rows, JDIMENSION num_cols));
00376 EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
00377 JDIMENSION num_blocks));
00378 EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
00379
00380 #if 0
00381 extern const int jpeg_zigzag_order[];
00382 #endif
00383 extern const int jpeg_natural_order[];
00384
00385
00386
00387 #ifdef INCOMPLETE_TYPES_BROKEN
00388 #ifndef AM_MEMORY_MANAGER
00389 struct jvirt_sarray_control { long dummy; };
00390 struct jvirt_barray_control { long dummy; };
00391 #endif
00392 #endif