< prev index next >

modules/javafx.graphics/src/main/native-iio/libjpeg7/jpegint.h

Print this page


   1 /*
   2  * jpegint.h
   3  *
   4  * Copyright (C) 1991-1997, Thomas G. Lane.
   5  * Modified 1997-2009 by Guido Vollbeding.
   6  * This file is part of the Independent JPEG Group's software.
   7  * For conditions of distribution and use, see the accompanying README file.
   8  *
   9  * This file provides common declarations for the various JPEG modules.
  10  * These declarations are considered internal to the JPEG library; most
  11  * applications using the library shouldn't need to include this file.
  12  */
  13 
  14 
  15 /* Declarations for both compression & decompression */
  16 
  17 typedef enum {                  /* Operating modes for buffer controllers */
  18         JBUF_PASS_THRU,         /* Plain stripwise operation */
  19         /* Remaining modes require a full-image buffer to have been created */
  20         JBUF_SAVE_SOURCE,       /* Run source subobject only, save output */
  21         JBUF_CRANK_DEST,        /* Run dest subobject only, using saved data */
  22         JBUF_SAVE_AND_PASS      /* Run both subobjects, save output */
  23 } J_BUF_MODE;
  24 
  25 /* Values of global_state field (jdapi.c has some dependencies on ordering!) */


 194   /* Read markers until SOS or EOI.
 195    * Returns same codes as are defined for jpeg_consume_input:
 196    * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
 197    */
 198   JMETHOD(int, read_markers, (j_decompress_ptr cinfo));
 199   /* Read a restart marker --- exported for use by entropy decoder only */
 200   jpeg_marker_parser_method read_restart_marker;
 201 
 202   /* State of marker reader --- nominally internal, but applications
 203    * supplying COM or APPn handlers might like to know the state.
 204    */
 205   boolean saw_SOI;              /* found SOI? */
 206   boolean saw_SOF;              /* found SOF? */
 207   int next_restart_num;         /* next restart number expected (0-7) */
 208   unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */
 209 };
 210 
 211 /* Entropy decoding */
 212 struct jpeg_entropy_decoder {
 213   JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
 214   JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo,
 215                                 JBLOCKROW *MCU_data));
 216 
 217   /* This is here to share code between baseline and progressive decoders; */
 218   /* other modules probably should not use it */
 219   boolean insufficient_data;    /* set TRUE after emitting warning */
 220 };
 221 
 222 /* Inverse DCT (also performs dequantization) */
 223 typedef JMETHOD(void, inverse_DCT_method_ptr,
 224                 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
 225                  JCOEFPTR coef_block,
 226                  JSAMPARRAY output_buf, JDIMENSION output_col));
 227 
 228 struct jpeg_inverse_dct {
 229   JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
 230   /* It is useful to allow each component to have a separate IDCT method. */
 231   inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS];
 232 };
 233 
 234 /* Upsampling (note that upsampler must also call color converter) */
 235 struct jpeg_upsampler {
 236   JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
 237   JMETHOD(void, upsample, (j_decompress_ptr cinfo,
 238                            JSAMPIMAGE input_buf,
 239                            JDIMENSION *in_row_group_ctr,


 247 
 248 /* Colorspace conversion */
 249 struct jpeg_color_deconverter {
 250   JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
 251   JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
 252                                 JSAMPIMAGE input_buf, JDIMENSION input_row,
 253                                 JSAMPARRAY output_buf, int num_rows));
 254 };
 255 
 256 /* Color quantization or color precision reduction */
 257 struct jpeg_color_quantizer {
 258   JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan));
 259   JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
 260                                  JSAMPARRAY input_buf, JSAMPARRAY output_buf,
 261                                  int num_rows));
 262   JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
 263   JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
 264 };
 265 
 266 













 267 /* Miscellaneous useful macros */
 268 
 269 #undef MAX
 270 #define MAX(a,b)        ((a) > (b) ? (a) : (b))
 271 #undef MIN
 272 #define MIN(a,b)        ((a) < (b) ? (a) : (b))
 273 
 274 
 275 /* We assume that right shift corresponds to signed division by 2 with
 276  * rounding towards minus infinity.  This is correct for typical "arithmetic
 277  * shift" instructions that shift in copies of the sign bit.  But some
 278  * C compilers implement >> with an unsigned shift.  For these machines you
 279  * must define RIGHT_SHIFT_IS_UNSIGNED.
 280  * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
 281  * It is only applied with constant shift counts.  SHIFT_TEMPS must be
 282  * included in the variables of any routine using RIGHT_SHIFT.
 283  */
 284 
 285 #ifdef RIGHT_SHIFT_IS_UNSIGNED
 286 #define SHIFT_TEMPS     INT32 shift_temp;


 308 #define jinit_huff_encoder      jIHEncoder
 309 #define jinit_arith_encoder     jIAEncoder
 310 #define jinit_marker_writer     jIMWriter
 311 #define jinit_master_decompress jIDMaster
 312 #define jinit_d_main_controller jIDMainC
 313 #define jinit_d_coef_controller jIDCoefC
 314 #define jinit_d_post_controller jIDPostC
 315 #define jinit_input_controller  jIInCtlr
 316 #define jinit_marker_reader     jIMReader
 317 #define jinit_huff_decoder      jIHDecoder
 318 #define jinit_arith_decoder     jIADecoder
 319 #define jinit_inverse_dct       jIIDCT
 320 #define jinit_upsampler         jIUpsampler
 321 #define jinit_color_deconverter jIDColor
 322 #define jinit_1pass_quantizer   jI1Quant
 323 #define jinit_2pass_quantizer   jI2Quant
 324 #define jinit_merged_upsampler  jIMUpsampler
 325 #define jinit_memory_mgr        jIMemMgr
 326 #define jdiv_round_up           jDivRound
 327 #define jround_up               jRound

 328 #define jcopy_sample_rows       jCopySamples
 329 #define jcopy_block_row         jCopyBlocks
 330 #define jzero_far               jZeroFar
 331 #define jpeg_zigzag_order       jZIGTable
 332 #define jpeg_natural_order      jZAGTable







 333 #endif /* NEED_SHORT_EXTERNAL_NAMES */
 334 
 335 




















 336 /* Compression module initialization routines */
 337 EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
 338 EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
 339                                          boolean transcode_only));
 340 EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo,
 341                                           boolean need_full_buffer));
 342 EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo,
 343                                           boolean need_full_buffer));
 344 EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo,
 345                                           boolean need_full_buffer));
 346 EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo));
 347 EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
 348 EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
 349 EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo));
 350 EXTERN(void) jinit_arith_encoder JPP((j_compress_ptr cinfo));
 351 EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
 352 /* Decompression module initialization routines */
 353 EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo));
 354 EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo,
 355                                           boolean need_full_buffer));


 361 EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
 362 EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
 363 EXTERN(void) jinit_arith_decoder JPP((j_decompress_ptr cinfo));
 364 EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo));
 365 EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo));
 366 EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo));
 367 EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo));
 368 EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo));
 369 EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo));
 370 /* Memory manager initialization */
 371 EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
 372 
 373 /* Utility routines in jutils.c */
 374 EXTERN(long) jdiv_round_up JPP((long a, long b));
 375 EXTERN(long) jround_up JPP((long a, long b));
 376 EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
 377                                     JSAMPARRAY output_array, int dest_row,
 378                                     int num_rows, JDIMENSION num_cols));
 379 EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
 380                                   JDIMENSION num_blocks));
 381 EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
 382 /* Constant tables in jutils.c */
 383 #if 0                           /* This table is not actually needed in v6a */
 384 extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
 385 #endif
 386 extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */









 387 
 388 /* Suppress undefined-structure complaints if necessary. */
 389 
 390 #ifdef INCOMPLETE_TYPES_BROKEN
 391 #ifndef AM_MEMORY_MANAGER       /* only jmemmgr.c defines these */
 392 struct jvirt_sarray_control { long dummy; };
 393 struct jvirt_barray_control { long dummy; };
 394 #endif
 395 #endif /* INCOMPLETE_TYPES_BROKEN */
   1 /*
   2  * jpegint.h
   3  *
   4  * Copyright (C) 1991-1997, Thomas G. Lane.
   5  * Modified 1997-2017 by Guido Vollbeding.
   6  * This file is part of the Independent JPEG Group's software.
   7  * For conditions of distribution and use, see the accompanying README file.
   8  *
   9  * This file provides common declarations for the various JPEG modules.
  10  * These declarations are considered internal to the JPEG library; most
  11  * applications using the library shouldn't need to include this file.
  12  */
  13 
  14 
  15 /* Declarations for both compression & decompression */
  16 
  17 typedef enum {                  /* Operating modes for buffer controllers */
  18         JBUF_PASS_THRU,         /* Plain stripwise operation */
  19         /* Remaining modes require a full-image buffer to have been created */
  20         JBUF_SAVE_SOURCE,       /* Run source subobject only, save output */
  21         JBUF_CRANK_DEST,        /* Run dest subobject only, using saved data */
  22         JBUF_SAVE_AND_PASS      /* Run both subobjects, save output */
  23 } J_BUF_MODE;
  24 
  25 /* Values of global_state field (jdapi.c has some dependencies on ordering!) */


 194   /* Read markers until SOS or EOI.
 195    * Returns same codes as are defined for jpeg_consume_input:
 196    * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
 197    */
 198   JMETHOD(int, read_markers, (j_decompress_ptr cinfo));
 199   /* Read a restart marker --- exported for use by entropy decoder only */
 200   jpeg_marker_parser_method read_restart_marker;
 201 
 202   /* State of marker reader --- nominally internal, but applications
 203    * supplying COM or APPn handlers might like to know the state.
 204    */
 205   boolean saw_SOI;              /* found SOI? */
 206   boolean saw_SOF;              /* found SOF? */
 207   int next_restart_num;         /* next restart number expected (0-7) */
 208   unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */
 209 };
 210 
 211 /* Entropy decoding */
 212 struct jpeg_entropy_decoder {
 213   JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
 214   JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, JBLOCKROW *MCU_data));
 215   JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));




 216 };
 217 
 218 /* Inverse DCT (also performs dequantization) */
 219 typedef JMETHOD(void, inverse_DCT_method_ptr,
 220                 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
 221                  JCOEFPTR coef_block,
 222                  JSAMPARRAY output_buf, JDIMENSION output_col));
 223 
 224 struct jpeg_inverse_dct {
 225   JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
 226   /* It is useful to allow each component to have a separate IDCT method. */
 227   inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS];
 228 };
 229 
 230 /* Upsampling (note that upsampler must also call color converter) */
 231 struct jpeg_upsampler {
 232   JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
 233   JMETHOD(void, upsample, (j_decompress_ptr cinfo,
 234                            JSAMPIMAGE input_buf,
 235                            JDIMENSION *in_row_group_ctr,


 243 
 244 /* Colorspace conversion */
 245 struct jpeg_color_deconverter {
 246   JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
 247   JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
 248                                 JSAMPIMAGE input_buf, JDIMENSION input_row,
 249                                 JSAMPARRAY output_buf, int num_rows));
 250 };
 251 
 252 /* Color quantization or color precision reduction */
 253 struct jpeg_color_quantizer {
 254   JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan));
 255   JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
 256                                  JSAMPARRAY input_buf, JSAMPARRAY output_buf,
 257                                  int num_rows));
 258   JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
 259   JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
 260 };
 261 
 262 
 263 /* Definition of range extension bits for decompression processes.
 264  * See the comments with prepare_range_limit_table (in jdmaster.c)
 265  * for more info.
 266  * The recommended default value for normal applications is 2.
 267  * Applications with special requirements may use a different value.
 268  * For example, Ghostscript wants to use 3 for proper handling of
 269  * wacky images with oversize coefficient values.
 270  */
 271 
 272 #define RANGE_BITS      2
 273 #define RANGE_CENTER    (CENTERJSAMPLE << RANGE_BITS)
 274 
 275 
 276 /* Miscellaneous useful macros */
 277 
 278 #undef MAX
 279 #define MAX(a,b)        ((a) > (b) ? (a) : (b))
 280 #undef MIN
 281 #define MIN(a,b)        ((a) < (b) ? (a) : (b))
 282 
 283 
 284 /* We assume that right shift corresponds to signed division by 2 with
 285  * rounding towards minus infinity.  This is correct for typical "arithmetic
 286  * shift" instructions that shift in copies of the sign bit.  But some
 287  * C compilers implement >> with an unsigned shift.  For these machines you
 288  * must define RIGHT_SHIFT_IS_UNSIGNED.
 289  * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
 290  * It is only applied with constant shift counts.  SHIFT_TEMPS must be
 291  * included in the variables of any routine using RIGHT_SHIFT.
 292  */
 293 
 294 #ifdef RIGHT_SHIFT_IS_UNSIGNED
 295 #define SHIFT_TEMPS     INT32 shift_temp;


 317 #define jinit_huff_encoder      jIHEncoder
 318 #define jinit_arith_encoder     jIAEncoder
 319 #define jinit_marker_writer     jIMWriter
 320 #define jinit_master_decompress jIDMaster
 321 #define jinit_d_main_controller jIDMainC
 322 #define jinit_d_coef_controller jIDCoefC
 323 #define jinit_d_post_controller jIDPostC
 324 #define jinit_input_controller  jIInCtlr
 325 #define jinit_marker_reader     jIMReader
 326 #define jinit_huff_decoder      jIHDecoder
 327 #define jinit_arith_decoder     jIADecoder
 328 #define jinit_inverse_dct       jIIDCT
 329 #define jinit_upsampler         jIUpsampler
 330 #define jinit_color_deconverter jIDColor
 331 #define jinit_1pass_quantizer   jI1Quant
 332 #define jinit_2pass_quantizer   jI2Quant
 333 #define jinit_merged_upsampler  jIMUpsampler
 334 #define jinit_memory_mgr        jIMemMgr
 335 #define jdiv_round_up           jDivRound
 336 #define jround_up               jRound
 337 #define jzero_far               jZeroFar
 338 #define jcopy_sample_rows       jCopySamples
 339 #define jcopy_block_row         jCopyBlocks

 340 #define jpeg_zigzag_order       jZIGTable
 341 #define jpeg_natural_order      jZAGTable
 342 #define jpeg_natural_order7     jZAG7Table
 343 #define jpeg_natural_order6     jZAG6Table
 344 #define jpeg_natural_order5     jZAG5Table
 345 #define jpeg_natural_order4     jZAG4Table
 346 #define jpeg_natural_order3     jZAG3Table
 347 #define jpeg_natural_order2     jZAG2Table
 348 #define jpeg_aritab             jAriTab
 349 #endif /* NEED_SHORT_EXTERNAL_NAMES */
 350 
 351 
 352 /* On normal machines we can apply MEMCOPY() and MEMZERO() to sample arrays
 353  * and coefficient-block arrays.  This won't work on 80x86 because the arrays
 354  * are FAR and we're assuming a small-pointer memory model.  However, some
 355  * DOS compilers provide far-pointer versions of memcpy() and memset() even
 356  * in the small-model libraries.  These will be used if USE_FMEM is defined.
 357  * Otherwise, the routines in jutils.c do it the hard way.
 358  */
 359 
 360 #ifndef NEED_FAR_POINTERS       /* normal case, same as regular macro */
 361 #define FMEMZERO(target,size)   MEMZERO(target,size)
 362 #else                           /* 80x86 case */
 363 #ifdef USE_FMEM
 364 #define FMEMZERO(target,size)   _fmemset((void FAR *)(target), 0, (size_t)(size))
 365 #else
 366 EXTERN(void) jzero_far JPP((void FAR * target, size_t bytestozero));
 367 #define FMEMZERO(target,size)   jzero_far(target, size)
 368 #endif
 369 #endif
 370 
 371 
 372 /* Compression module initialization routines */
 373 EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
 374 EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
 375                                          boolean transcode_only));
 376 EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo,
 377                                           boolean need_full_buffer));
 378 EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo,
 379                                           boolean need_full_buffer));
 380 EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo,
 381                                           boolean need_full_buffer));
 382 EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo));
 383 EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
 384 EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
 385 EXTERN(void) jinit_huff_encoder JPP((j_compress_ptr cinfo));
 386 EXTERN(void) jinit_arith_encoder JPP((j_compress_ptr cinfo));
 387 EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
 388 /* Decompression module initialization routines */
 389 EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo));
 390 EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo,
 391                                           boolean need_full_buffer));


 397 EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
 398 EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
 399 EXTERN(void) jinit_arith_decoder JPP((j_decompress_ptr cinfo));
 400 EXTERN(void) jinit_inverse_dct JPP((j_decompress_ptr cinfo));
 401 EXTERN(void) jinit_upsampler JPP((j_decompress_ptr cinfo));
 402 EXTERN(void) jinit_color_deconverter JPP((j_decompress_ptr cinfo));
 403 EXTERN(void) jinit_1pass_quantizer JPP((j_decompress_ptr cinfo));
 404 EXTERN(void) jinit_2pass_quantizer JPP((j_decompress_ptr cinfo));
 405 EXTERN(void) jinit_merged_upsampler JPP((j_decompress_ptr cinfo));
 406 /* Memory manager initialization */
 407 EXTERN(void) jinit_memory_mgr JPP((j_common_ptr cinfo));
 408 
 409 /* Utility routines in jutils.c */
 410 EXTERN(long) jdiv_round_up JPP((long a, long b));
 411 EXTERN(long) jround_up JPP((long a, long b));
 412 EXTERN(void) jcopy_sample_rows JPP((JSAMPARRAY input_array, int source_row,
 413                                     JSAMPARRAY output_array, int dest_row,
 414                                     int num_rows, JDIMENSION num_cols));
 415 EXTERN(void) jcopy_block_row JPP((JBLOCKROW input_row, JBLOCKROW output_row,
 416                                   JDIMENSION num_blocks));

 417 /* Constant tables in jutils.c */
 418 #if 0                           /* This table is not actually needed in v6a */
 419 extern const int jpeg_zigzag_order[]; /* natural coef order to zigzag order */
 420 #endif
 421 extern const int jpeg_natural_order[]; /* zigzag coef order to natural order */
 422 extern const int jpeg_natural_order7[]; /* zz to natural order for 7x7 block */
 423 extern const int jpeg_natural_order6[]; /* zz to natural order for 6x6 block */
 424 extern const int jpeg_natural_order5[]; /* zz to natural order for 5x5 block */
 425 extern const int jpeg_natural_order4[]; /* zz to natural order for 4x4 block */
 426 extern const int jpeg_natural_order3[]; /* zz to natural order for 3x3 block */
 427 extern const int jpeg_natural_order2[]; /* zz to natural order for 2x2 block */
 428 
 429 /* Arithmetic coding probability estimation tables in jaricom.c */
 430 extern const INT32 jpeg_aritab[];
 431 
 432 /* Suppress undefined-structure complaints if necessary. */
 433 
 434 #ifdef INCOMPLETE_TYPES_BROKEN
 435 #ifndef AM_MEMORY_MANAGER       /* only jmemmgr.c defines these */
 436 struct jvirt_sarray_control { long dummy; };
 437 struct jvirt_barray_control { long dummy; };
 438 #endif
 439 #endif /* INCOMPLETE_TYPES_BROKEN */
< prev index next >