| 6 |
| * Modified 1997-2009 by Guido Vollbeding. |
| 7 | * libjpeg-turbo Modifications: |
| 8 | * Copyright (C) 2015-2016, D. R. Commander. |
| 9 | * Copyright (C) 2015, Google, Inc. |
| 10 | * mozjpeg Modifications: |
| 11 | * Copyright (C) 2014, Mozilla Corporation. |
| 12 | * For conditions of distribution and use, see the accompanying README.ijg |
| 13 | * file. |
| 14 | * |
| 15 | * This file provides common declarations for the various JPEG modules. |
| 16 | * These declarations are considered internal to the JPEG library; most |
| 17 | * applications using the library shouldn't need to include this file. |
| 18 | */ |
| 19 |
| 20 |
| 21 | /* Declarations for both compression & decompression */ |
| 22 |
| 23 | typedef enum { /* Operating modes for buffer controllers */ |
| 24 | JBUF_PASS_THRU, /* Plain stripwise operation */ |
| 25 | /* Remaining modes require a full-image buffer to have been created */ |
| 26 | JBUF_SAVE_SOURCE, /* Run source subobject only, save output */ |
| 27 | JBUF_CRANK_DEST, /* Run dest subobject only, using saved data */ |
| 28 | JBUF_SAVE_AND_PASS, /* Run both subobjects, save output */ |
| 29 | JBUF_REQUANT /* Requantize */ |
| 30 | } J_BUF_MODE; |
| 31 |
| 32 | /* Values of global_state field (jdapi.c has some dependencies on ordering!) */ |
| 33 | #define CSTATE_START 100 /* after create_compress */ |
| 34 | #define CSTATE_SCANNING 101 /* start_compress done, write_scanlines OK */ |
| 35 | #define CSTATE_RAW_OK 102 /* start_compress done, write_raw_data OK */ |
| 36 | #define CSTATE_WRCOEFS 103 /* jpeg_write_coefficients done */ |
| 37 | #define DSTATE_START 200 /* after create_decompress */ |
| 38 | #define DSTATE_INHEADER 201 /* reading header markers, no SOS yet */ |
| 39 | #define DSTATE_READY 202 /* found SOS, ready for start_decompress */ |
| 40 | #define DSTATE_PRELOAD 203 /* reading multiscan file in start_decompress*/ |
| 41 | #define DSTATE_PRESCAN 204 /* performing dummy pass for 2-pass quant */ |
| 42 | #define DSTATE_SCANNING 205 /* start_decompress done, read_scanlines OK */ |
| 43 | #define DSTATE_RAW_OK 206 /* start_decompress done, read_raw_data OK */ |
| 44 | #define DSTATE_BUFIMAGE 207 /* expecting jpeg_start_output */ |
| 45 | #define DSTATE_BUFPOST 208 /* looking for SOS/EOI in jpeg_finish_output */ |
| 46 | #define DSTATE_RDCOEFS 209 /* reading file in jpeg_read_coefficients */ |
| 47 | #define DSTATE_STOPPING 210 /* looking for EOI in jpeg_finish_decompress */ |
| 48 |
| 49 |
| 50 | /* JLONG must hold at least signed 32-bit values. */ |
| 51 | typedef long JLONG; |
| 52 |
| 53 |
| 54 | /* |
| 55 | * Left shift macro that handles a negative operand without causing any |
| 56 | * sanitizer warnings |
| 57 | */ |
| 58 |
| 59 | #define LEFT_SHIFT(a, b) ((JLONG)((unsigned long)(a) << (b))) |
| 60 |
| 61 |
| 62 | /* Declarations for compression modules */ |
| 63 |
| 64 | /* Master control module */ |
| 65 | struct jpeg_comp_master { |
| 66 | void (*prepare_for_pass) (j_compress_ptr cinfo); |
| 67 | void (*pass_startup) (j_compress_ptr cinfo); |
| 68 | void (*finish_pass) (j_compress_ptr cinfo); |
| 69 |
| 70 | /* State variables made visible to other modules */ |
| 71 | boolean call_pass_startup; /* True if pass_startup must be called */ |
| 72 | boolean is_last_pass; /* True during last pass */ |
| 73 |
| 74 | /* Extension parameters */ |
| 75 | boolean optimize_scans; /* TRUE=optimize progressive coding scans */ |
| 76 | boolean trellis_quant; /* TRUE=use trellis quantization */ |
| 77 | boolean trellis_quant_dc; /* TRUE=use trellis quant for DC coefficient */ |
| 78 | boolean trellis_eob_opt; /* TRUE=optimize for sequences of EOB */ |
| 79 | boolean use_lambda_weight_tbl; /* TRUE=use lambda weighting table */ |
| 80 | boolean use_scans_in_trellis; /* TRUE=use scans in trellis optimization */ |
| 81 | boolean trellis_passes; /* TRUE=currently doing trellis-related passes [not exposed] */ |
| 82 | boolean trellis_q_opt; /* TRUE=optimize quant table in trellis loop */ |
| 83 | boolean overshoot_deringing; /* TRUE=preprocess input to reduce ringing of edges on white background */ |
| 84 |
| 85 | double norm_src[NUM_QUANT_TBLS][DCTSIZE2]; |
| 86 | double norm_coef[NUM_QUANT_TBLS][DCTSIZE2]; |
| 87 |
| 88 | int compress_profile; /* compression profile */ |
| 89 | int dc_scan_opt_mode; /* DC scan optimization mode */ |
| 90 | int quant_tbl_master_idx; /* Quantization table master index */ |
| 91 | int trellis_freq_split; /* splitting point for frequency in trellis quantization */ |
| 92 | int trellis_num_loops; /* number of trellis loops */ |
| 93 |
| 94 | int num_scans_luma; /* # of entries in scan_info array pertaining to luma (used when optimize_scans is TRUE */ |
| 95 | int num_scans_luma_dc; |
| 96 | int num_scans_chroma_dc; |
| 97 | int num_frequency_splits; |
| 98 |
| 99 | int Al_max_luma; /* maximum value of Al tested when optimizing scans (luma) */ |
| 100 | int Al_max_chroma; /* maximum value of Al tested when optimizing scans (chroma) */ |
| 101 |
| 102 | float lambda_log_scale1; |
| 103 | float lambda_log_scale2; |
| 104 |
| 105 | float trellis_delta_dc_weight; |
| 106 | }; |
| 107 |
| 108 | #ifdef C_ARITH_CODING_SUPPORTED |
| 109 | /* The following two definitions specify the allocation chunk size |
| 110 | * for the statistics area. |
| 111 | * According to sections F.1.4.4.1.3 and F.1.4.4.2, we need at least |
| 112 | * 49 statistics bins for DC, and 245 statistics bins for AC coding. |
| 113 | * |
| 114 | * We use a compact representation with 1 byte per statistics bin, |
| 115 | * thus the numbers directly represent byte sizes. |
| 116 | * This 1 byte per statistics bin contains the meaning of the MPS |
| 117 | * (more probable symbol) in the highest bit (mask 0x80), and the |
| 118 | * index into the probability estimation state machine table |
| 119 | * in the lower bits (mask 0x7F). |
| 120 | */ |
| 121 |
| 122 | #define DC_STAT_BINS 64 |
| 123 | #define AC_STAT_BINS 256 |
| 124 |
| 125 | typedef struct { |
| 126 | float rate_dc[DC_STAT_BINS][2]; |
| 127 | float rate_ac[AC_STAT_BINS][2]; |
| 128 | int arith_dc_L; |
| 129 | int arith_dc_U; |
| 130 | int arith_ac_K; |
| 131 | } arith_rates; |
| 132 | #endif |
| 133 |
| 134 | /* Main buffer control (downsampled-data buffer) */ |
| 135 | struct jpeg_c_main_controller { |
| 136 | void (*start_pass) (j_compress_ptr cinfo, J_BUF_MODE pass_mode); |
| 137 | void (*process_data) (j_compress_ptr cinfo, JSAMPARRAY input_buf, |
| 138 | JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail); |
| 139 | }; |
| 140 |
| 141 | /* Compression preprocessing (downsampling input buffer control) */ |
| 142 | struct jpeg_c_prep_controller { |
| 143 | void (*start_pass) (j_compress_ptr cinfo, J_BUF_MODE pass_mode); |
| 144 | void (*pre_process_data) (j_compress_ptr cinfo, JSAMPARRAY input_buf, |
| 145 | JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail, |
| 146 | JSAMPIMAGE output_buf, |
| 147 | JDIMENSION *out_row_group_ctr, |
| 148 | JDIMENSION out_row_groups_avail); |
| 149 | }; |
| 150 |
| 151 | /* Coefficient buffer control */ |
| 152 | struct jpeg_c_coef_controller { |
| 153 | void (*start_pass) (j_compress_ptr cinfo, J_BUF_MODE pass_mode); |
| 154 | boolean (*compress_data) (j_compress_ptr cinfo, JSAMPIMAGE input_buf); |
| 155 | }; |
| 156 |
| 157 | /* Colorspace conversion */ |
| 158 | struct jpeg_color_converter { |
| 159 | void (*start_pass) (j_compress_ptr cinfo); |
| 160 | void (*color_convert) (j_compress_ptr cinfo, JSAMPARRAY input_buf, |
| 161 | JSAMPIMAGE output_buf, JDIMENSION output_row, |
| 162 | int num_rows); |
| 163 | }; |
| 164 |
| 165 | /* Downsampling */ |
| 166 | struct jpeg_downsampler { |
| 167 | void (*start_pass) (j_compress_ptr cinfo); |
| 168 | void (*downsample) (j_compress_ptr cinfo, JSAMPIMAGE input_buf, |
| 169 | JDIMENSION in_row_index, JSAMPIMAGE output_buf, |
| 170 | JDIMENSION out_row_group_index); |
| 171 |
| 172 | boolean need_context_rows; /* TRUE if need rows above & below */ |
| 173 | }; |
| 174 |
| 175 | /* Forward DCT (also controls coefficient quantization) */ |
| 176 | struct jpeg_forward_dct { |
| 177 | void (*start_pass) (j_compress_ptr cinfo); |
| 178 | /* perhaps this should be an array??? */ |
| 179 | void (*forward_DCT) (j_compress_ptr cinfo, jpeg_component_info *compptr, |
| 180 | JSAMPARRAY sample_data, JBLOCKROW coef_blocks, |
| 181 | JDIMENSION start_row, JDIMENSION start_col, |
| 182 | JDIMENSION num_blocks, JBLOCKROW dst); |
| 183 | }; |
| 184 |
| 185 | /* Entropy encoding */ |
| 186 | struct jpeg_entropy_encoder { |
| 187 | void (*start_pass) (j_compress_ptr cinfo, boolean gather_statistics); |
| 188 | boolean (*encode_mcu) (j_compress_ptr cinfo, JBLOCKROW *MCU_data); |
| 189 | void (*finish_pass) (j_compress_ptr cinfo); |
| 190 | }; |
| 191 |
| 192 | /* Marker writing */ |
| 193 | struct jpeg_marker_writer { |
| 194 | void (*write_file_header) (j_compress_ptr cinfo); |
| 195 | void (*write_frame_header) (j_compress_ptr cinfo); |
| 196 | void (*write_scan_header) (j_compress_ptr cinfo); |
| 197 | void (*write_file_trailer) (j_compress_ptr cinfo); |
| 198 | void (*write_tables_only) (j_compress_ptr cinfo); |
| 199 | /* These routines are exported to allow insertion of extra markers */ |
| 200 | /* Probably only COM and APPn markers should be written this way */ |
| 201 | void (*write_marker_header) (j_compress_ptr cinfo, int marker, |
| 202 | unsigned int datalen); |
| 203 | void (*write_marker_byte) (j_compress_ptr cinfo, int val); |
| 204 | }; |
| 205 |
| 206 |
| 207 | /* Declarations for decompression modules */ |
| 208 |
| 209 | /* Master control module */ |
| 210 | struct jpeg_decomp_master { |
| 211 | void (*prepare_for_output_pass) (j_decompress_ptr cinfo); |
| 212 | void (*finish_output_pass) (j_decompress_ptr cinfo); |
| 213 |
| 214 | /* State variables made visible to other modules */ |
| 215 | boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */ |
| 216 |
| 217 | /* Partial decompression variables */ |
| 218 | JDIMENSION first_iMCU_col; |
| 219 | JDIMENSION last_iMCU_col; |
| 220 | JDIMENSION first_MCU_col[MAX_COMPONENTS]; |
| 221 | JDIMENSION last_MCU_col[MAX_COMPONENTS]; |
| 222 | boolean jinit_upsampler_no_alloc; |
| 223 | }; |
| 224 |
| 225 | /* Input control module */ |
| 226 | struct jpeg_input_controller { |
| 227 | int (*consume_input) (j_decompress_ptr cinfo); |
| 228 | void (*reset_input_controller) (j_decompress_ptr cinfo); |
| 229 | void (*start_input_pass) (j_decompress_ptr cinfo); |
| 230 | void (*finish_input_pass) (j_decompress_ptr cinfo); |
| 231 |
| 232 | /* State variables made visible to other modules */ |
| 233 | boolean has_multiple_scans; /* True if file has multiple scans */ |
| 234 | boolean eoi_reached; /* True when EOI has been consumed */ |
| 235 | }; |
| 236 |
| 237 | /* Main buffer control (downsampled-data buffer) */ |
| 238 | struct jpeg_d_main_controller { |
| 239 | void (*start_pass) (j_decompress_ptr cinfo, J_BUF_MODE pass_mode); |
| 240 | void (*process_data) (j_decompress_ptr cinfo, JSAMPARRAY output_buf, |
| 241 | JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail); |
| 242 | }; |
| 243 |
| 244 | /* Coefficient buffer control */ |
| 245 | struct jpeg_d_coef_controller { |
| 246 | void (*start_input_pass) (j_decompress_ptr cinfo); |
| 247 | int (*consume_data) (j_decompress_ptr cinfo); |
| 248 | void (*start_output_pass) (j_decompress_ptr cinfo); |
| 249 | int (*decompress_data) (j_decompress_ptr cinfo, JSAMPIMAGE output_buf); |
| 250 | /* Pointer to array of coefficient virtual arrays, or NULL if none */ |
| 251 | jvirt_barray_ptr *coef_arrays; |
| 252 | }; |
| 253 |
| 254 | /* Decompression postprocessing (color quantization buffer control) */ |
| 255 | struct jpeg_d_post_controller { |
| 256 | void (*start_pass) (j_decompress_ptr cinfo, J_BUF_MODE pass_mode); |
| 257 | void (*post_process_data) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, |
| 258 | JDIMENSION *in_row_group_ctr, |
| 259 | JDIMENSION in_row_groups_avail, |
| 260 | JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, |
| 261 | JDIMENSION out_rows_avail); |
| 262 | }; |
| 263 |
| 264 | /* Marker reading & parsing */ |
| 265 | struct jpeg_marker_reader { |
| 266 | void (*reset_marker_reader) (j_decompress_ptr cinfo); |
| 267 | /* Read markers until SOS or EOI. |
| 268 | * Returns same codes as are defined for jpeg_consume_input: |
| 269 | * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. |
| 270 | */ |
| 271 | int (*read_markers) (j_decompress_ptr cinfo); |
| 272 | /* Read a restart marker --- exported for use by entropy decoder only */ |
| 273 | jpeg_marker_parser_method read_restart_marker; |
| 274 |
| 275 | /* State of marker reader --- nominally internal, but applications |
| 276 | * supplying COM or APPn handlers might like to know the state. |
| 277 | */ |
| 278 | boolean saw_SOI; /* found SOI? */ |
| 279 | boolean saw_SOF; /* found SOF? */ |
| 280 | int next_restart_num; /* next restart number expected (0-7) */ |
| 281 | unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */ |
| 282 | }; |
| 283 |
| 284 | /* Entropy decoding */ |
| 285 | struct jpeg_entropy_decoder { |
| 286 | void (*start_pass) (j_decompress_ptr cinfo); |
| 287 | boolean (*decode_mcu) (j_decompress_ptr cinfo, JBLOCKROW *MCU_data); |
| 288 |
| 289 | /* This is here to share code between baseline and progressive decoders; */ |
| 290 | /* other modules probably should not use it */ |
| 291 | boolean insufficient_data; /* set TRUE after emitting warning */ |
| 292 | }; |
| 293 |
| 294 | /* Inverse DCT (also performs dequantization) */ |
| 295 | typedef void (*inverse_DCT_method_ptr) (j_decompress_ptr cinfo, |
| 296 | jpeg_component_info *compptr, |
| 297 | JCOEFPTR coef_block, |
| 298 | JSAMPARRAY output_buf, |
| 299 | JDIMENSION output_col); |
| 300 |
| 301 | struct jpeg_inverse_dct { |
| 302 | void (*start_pass) (j_decompress_ptr cinfo); |
| 303 | /* It is useful to allow each component to have a separate IDCT method. */ |
| 304 | inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS]; |
| 305 | }; |
| 306 |
| 307 | /* Upsampling (note that upsampler must also call color converter) */ |
| 308 | struct jpeg_upsampler { |
| 309 | void (*start_pass) (j_decompress_ptr cinfo); |
| 310 | void (*upsample) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, |
| 311 | JDIMENSION *in_row_group_ctr, |
| 312 | JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, |
| 313 | JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail); |
| 314 |
| 315 | boolean need_context_rows; /* TRUE if need rows above & below */ |
| 316 | }; |
| 317 |
| 318 | /* Colorspace conversion */ |
| 319 | struct jpeg_color_deconverter { |
| 320 | void (*start_pass) (j_decompress_ptr cinfo); |
| 321 | void (*color_convert) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, |
| 322 | JDIMENSION input_row, JSAMPARRAY output_buf, |
| 323 | int num_rows); |
| 324 | }; |
| 325 |
| 326 | /* Color quantization or color precision reduction */ |
| 327 | struct jpeg_color_quantizer { |
| 328 | void (*start_pass) (j_decompress_ptr cinfo, boolean is_pre_scan); |
| 329 | void (*color_quantize) (j_decompress_ptr cinfo, JSAMPARRAY input_buf, |
| 330 | JSAMPARRAY output_buf, int num_rows); |
| 331 | void (*finish_pass) (j_decompress_ptr cinfo); |
| 332 | void (*new_color_map) (j_decompress_ptr cinfo); |
| 333 | }; |
| 334 |
| 335 |
| 336 | /* Miscellaneous useful macros */ |
| 337 |
| 338 | #undef MAX |
| 339 | #define MAX(a,b) ((a) > (b) ? (a) : (b)) |
| 340 | #undef MIN |
| 341 | #define MIN(a,b) ((a) < (b) ? (a) : (b)) |
| 342 |
| 343 |
| 344 | /* We assume that right shift corresponds to signed division by 2 with |
| 345 | * rounding towards minus infinity. This is correct for typical "arithmetic |
| 346 | * shift" instructions that shift in copies of the sign bit. But some |
| 347 | * C compilers implement >> with an unsigned shift. For these machines you |
| 348 | * must define RIGHT_SHIFT_IS_UNSIGNED. |
| 349 | * RIGHT_SHIFT provides a proper signed right shift of a JLONG quantity. |
| 350 | * It is only applied with constant shift counts. SHIFT_TEMPS must be |
| 351 | * included in the variables of any routine using RIGHT_SHIFT. |
| 352 | */ |
| 353 |
| 354 | #ifdef RIGHT_SHIFT_IS_UNSIGNED |
| 355 | #define SHIFT_TEMPS JLONG shift_temp; |
| 356 | #define RIGHT_SHIFT(x,shft) \ |
| 357 | ((shift_temp = (x)) < 0 ? \ |
| 358 | (shift_temp >> (shft)) | ((~((JLONG) 0)) << (32-(shft))) : \ |
| 359 | (shift_temp >> (shft))) |
| 360 | #else |
| 361 | #define SHIFT_TEMPS |
| 362 | #define RIGHT_SHIFT(x,shft) ((x) >> (shft)) |
| 363 | #endif |
| 364 |
| 365 |
| 366 | /* Compression module initialization routines */ |
| 367 | EXTERN(void) jinit_compress_master (j_compress_ptr cinfo); |
| 368 | EXTERN(void) jinit_c_master_control (j_compress_ptr cinfo, |
| 369 | boolean transcode_only); |
| 370 | EXTERN(void) jinit_c_main_controller (j_compress_ptr cinfo, |
| 371 | boolean need_full_buffer); |
| 372 | EXTERN(void) jinit_c_prep_controller (j_compress_ptr cinfo, |
| 373 | boolean need_full_buffer); |
| 374 | EXTERN(void) jinit_c_coef_controller (j_compress_ptr cinfo, |
| 375 | boolean need_full_buffer); |
| 376 | EXTERN(void) jinit_color_converter (j_compress_ptr cinfo); |
| 377 | EXTERN(void) jinit_downsampler (j_compress_ptr cinfo); |
| 378 | EXTERN(void) jinit_forward_dct (j_compress_ptr cinfo); |
| 379 | EXTERN(void) jinit_huff_encoder (j_compress_ptr cinfo); |
| 380 | EXTERN(void) jinit_phuff_encoder (j_compress_ptr cinfo); |
| 381 | EXTERN(void) jinit_arith_encoder (j_compress_ptr cinfo); |
| 382 | EXTERN(void) jinit_marker_writer (j_compress_ptr cinfo); |
| 383 | /* Decompression module initialization routines */ |
| 384 | EXTERN(void) jinit_master_decompress (j_decompress_ptr cinfo); |
| 385 | EXTERN(void) jinit_d_main_controller (j_decompress_ptr cinfo, |
| 386 | boolean need_full_buffer); |
| 387 | EXTERN(void) jinit_d_coef_controller (j_decompress_ptr cinfo, |
| 388 | boolean need_full_buffer); |
| 389 | EXTERN(void) jinit_d_post_controller (j_decompress_ptr cinfo, |
| 390 | boolean need_full_buffer); |
| 391 | EXTERN(void) jinit_input_controller (j_decompress_ptr cinfo); |
| 392 | EXTERN(void) jinit_marker_reader (j_decompress_ptr cinfo); |
| 393 | EXTERN(void) jinit_huff_decoder (j_decompress_ptr cinfo); |
| 394 | EXTERN(void) jinit_phuff_decoder (j_decompress_ptr cinfo); |
| 395 | EXTERN(void) jinit_arith_decoder (j_decompress_ptr cinfo); |
| 396 | EXTERN(void) jinit_inverse_dct (j_decompress_ptr cinfo); |
| 397 | EXTERN(void) jinit_upsampler (j_decompress_ptr cinfo); |
| 398 | EXTERN(void) jinit_color_deconverter (j_decompress_ptr cinfo); |
| 399 | EXTERN(void) jinit_1pass_quantizer (j_decompress_ptr cinfo); |
| 400 | EXTERN(void) jinit_2pass_quantizer (j_decompress_ptr cinfo); |
| 401 | EXTERN(void) jinit_merged_upsampler (j_decompress_ptr cinfo); |
| 402 | /* Memory manager initialization */ |
| 403 | EXTERN(void) jinit_memory_mgr (j_common_ptr cinfo); |
| 404 |
| 405 | #if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED) |
| 406 | EXTERN(void) |
| 407 | jpeg_mem_dest_internal (j_compress_ptr cinfo, |
| 408 | unsigned char **outbuffer, unsigned long *outsize, int pool_id); |
| 409 | #endif |
| 410 |
| 411 | /* Utility routines in jutils.c */ |
| 412 | EXTERN(long) jdiv_round_up (long a, long b); |
| 413 | EXTERN(long) jround_up (long a, long b); |
| 414 | EXTERN(void) jcopy_sample_rows (JSAMPARRAY input_array, int source_row, |
| 415 | JSAMPARRAY output_array, int dest_row, |
| 416 | int num_rows, JDIMENSION num_cols); |
| 417 | EXTERN(void) jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row, |
| 418 | JDIMENSION num_blocks); |
| 419 | EXTERN(void) jzero_far (void *target, size_t bytestozero); |
| 420 |
| 421 | #ifdef C_ARITH_CODING_SUPPORTED |
| 422 | EXTERN(void) jget_arith_rates (j_compress_ptr cinfo, int dc_tbl_no, int ac_tbl_no, arith_rates *r); |
| 423 |
| 424 | EXTERN(void) quantize_trellis_arith |
| 425 | (j_compress_ptr cinfo, arith_rates *r, JBLOCKROW coef_blocks, JBLOCKROW src, JDIMENSION num_blocks, |
| 426 | JQUANT_TBL * qtbl, double *norm_src, double *norm_coef, JCOEF *last_dc_val, |
| 427 | JBLOCKROW coef_blocks_above, JBLOCKROW src_above); |
| 428 | #endif |
| 429 |
| 430 | /* Constant tables in jutils.c */ |
| 431 | #if 0 /* This table is not actually needed in v6a */ |
| 432 | extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */ |
| 433 | #endif |
| 434 | extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */ |
| 435 |
| 436 | /* Arithmetic coding probability estimation tables in jaricom.c */ |
| 437 | extern const JLONG jpeg_aritab[]; |
| 438 |
| 439 | /* Suppress undefined-structure complaints if necessary. */ |
| 440 |
| 441 | #ifdef INCOMPLETE_TYPES_BROKEN |
| 442 | #ifndef AM_MEMORY_MANAGER /* only jmemmgr.c defines these */ |
| 443 | struct jvirt_sarray_control { long dummy; }; |
| 444 | struct jvirt_barray_control { long dummy; }; |
| 445 | #endif |
| 446 | #endif /* INCOMPLETE_TYPES_BROKEN */ |
| 447 |