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