< prev index next >

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

Print this page


   1 /*
   2  * jdct.h
   3  *
   4  * Copyright (C) 1994-1996, Thomas G. Lane.

   5  * This file is part of the Independent JPEG Group's software.
   6  * For conditions of distribution and use, see the accompanying README file.
   7  *
   8  * This include file contains common declarations for the forward and
   9  * inverse DCT modules.  These declarations are private to the DCT managers
  10  * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms.
  11  * The individual DCT algorithms are kept in separate files to ease
  12  * machine-dependent tuning (e.g., assembly coding).
  13  */
  14 
  15 
  16 /*
  17  * A forward DCT routine is given a pointer to an input sample array and
  18  * a pointer to a work area of type DCTELEM[]; the DCT is to be performed
  19  * in-place in that buffer.  Type DCTELEM is int for 8-bit samples, INT32
  20  * for 12-bit samples.  (NOTE: Floating-point DCT implementations use an
  21  * array of type FAST_FLOAT, instead.)
  22  * The input data is to be fetched from the sample array starting at a
  23  * specified column.  (Any row offset needed will be applied to the array
  24  * pointer before it is passed to the FDCT code.)


  61 /*
  62  * Each IDCT routine has its own ideas about the best dct_table element type.
  63  */
  64 
  65 typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */
  66 #if BITS_IN_JSAMPLE == 8
  67 typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */
  68 #define IFAST_SCALE_BITS  2     /* fractional bits in scale factors */
  69 #else
  70 typedef INT32 IFAST_MULT_TYPE;  /* need 32 bits for scaled quantizers */
  71 #define IFAST_SCALE_BITS  13    /* fractional bits in scale factors */
  72 #endif
  73 typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
  74 
  75 
  76 /*
  77  * Each IDCT routine is responsible for range-limiting its results and
  78  * converting them to unsigned form (0..MAXJSAMPLE).  The raw outputs could
  79  * be quite far out of range if the input data is corrupt, so a bulletproof
  80  * range-limiting step is required.  We use a mask-and-table-lookup method
  81  * to do the combined operations quickly.  See the comments with

  82  * prepare_range_limit_table (in jdmaster.c) for more info.
  83  */
  84 
  85 #define IDCT_range_limit(cinfo)  ((cinfo)->sample_range_limit + CENTERJSAMPLE)

  86 
  87 #define RANGE_MASK  (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  88 
  89 
  90 /* Short forms of external names for systems with brain-damaged linkers. */
  91 
  92 #ifdef NEED_SHORT_EXTERNAL_NAMES
  93 #define jpeg_fdct_islow         jFDislow
  94 #define jpeg_fdct_ifast         jFDifast
  95 #define jpeg_fdct_float         jFDfloat
  96 #define jpeg_fdct_7x7           jFD7x7
  97 #define jpeg_fdct_6x6           jFD6x6
  98 #define jpeg_fdct_5x5           jFD5x5
  99 #define jpeg_fdct_4x4           jFD4x4
 100 #define jpeg_fdct_3x3           jFD3x3
 101 #define jpeg_fdct_2x2           jFD2x2
 102 #define jpeg_fdct_1x1           jFD1x1
 103 #define jpeg_fdct_9x9           jFD9x9
 104 #define jpeg_fdct_10x10         jFD10x10
 105 #define jpeg_fdct_11x11         jFD11x11
 106 #define jpeg_fdct_12x12         jFD12x12
 107 #define jpeg_fdct_13x13         jFD13x13


 373 
 374 #ifdef SHORTxSHORT_32           /* may work if 'int' is 32 bits */
 375 #define MULTIPLY16C16(var,const)  (((INT16) (var)) * ((INT16) (const)))
 376 #endif
 377 #ifdef SHORTxLCONST_32          /* known to work with Microsoft C 6.0 */
 378 #define MULTIPLY16C16(var,const)  (((INT16) (var)) * ((INT32) (const)))
 379 #endif
 380 
 381 #ifndef MULTIPLY16C16           /* default definition */
 382 #define MULTIPLY16C16(var,const)  ((var) * (const))
 383 #endif
 384 
 385 /* Same except both inputs are variables. */
 386 
 387 #ifdef SHORTxSHORT_32           /* may work if 'int' is 32 bits */
 388 #define MULTIPLY16V16(var1,var2)  (((INT16) (var1)) * ((INT16) (var2)))
 389 #endif
 390 
 391 #ifndef MULTIPLY16V16           /* default definition */
 392 #define MULTIPLY16V16(var1,var2)  ((var1) * (var2))




















 393 #endif
   1 /*
   2  * jdct.h
   3  *
   4  * Copyright (C) 1994-1996, Thomas G. Lane.
   5  * Modified 2002-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 include file contains common declarations for the forward and
  10  * inverse DCT modules.  These declarations are private to the DCT managers
  11  * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms.
  12  * The individual DCT algorithms are kept in separate files to ease 
  13  * machine-dependent tuning (e.g., assembly coding).
  14  */
  15 
  16 
  17 /*
  18  * A forward DCT routine is given a pointer to an input sample array and
  19  * a pointer to a work area of type DCTELEM[]; the DCT is to be performed
  20  * in-place in that buffer.  Type DCTELEM is int for 8-bit samples, INT32
  21  * for 12-bit samples.  (NOTE: Floating-point DCT implementations use an
  22  * array of type FAST_FLOAT, instead.)
  23  * The input data is to be fetched from the sample array starting at a
  24  * specified column.  (Any row offset needed will be applied to the array
  25  * pointer before it is passed to the FDCT code.)


  62 /*
  63  * Each IDCT routine has its own ideas about the best dct_table element type.
  64  */
  65 
  66 typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */
  67 #if BITS_IN_JSAMPLE == 8
  68 typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */
  69 #define IFAST_SCALE_BITS  2     /* fractional bits in scale factors */
  70 #else
  71 typedef INT32 IFAST_MULT_TYPE;  /* need 32 bits for scaled quantizers */
  72 #define IFAST_SCALE_BITS  13    /* fractional bits in scale factors */
  73 #endif
  74 typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
  75 
  76 
  77 /*
  78  * Each IDCT routine is responsible for range-limiting its results and
  79  * converting them to unsigned form (0..MAXJSAMPLE).  The raw outputs could
  80  * be quite far out of range if the input data is corrupt, so a bulletproof
  81  * range-limiting step is required.  We use a mask-and-table-lookup method
  82  * to do the combined operations quickly, assuming that RANGE_CENTER
  83  * (defined in jpegint.h) is a power of 2.  See the comments with
  84  * prepare_range_limit_table (in jdmaster.c) for more info.
  85  */
  86 
  87 #define RANGE_MASK  (RANGE_CENTER * 2 - 1)
  88 #define RANGE_SUBSET  (RANGE_CENTER - CENTERJSAMPLE)
  89 
  90 #define IDCT_range_limit(cinfo)  ((cinfo)->sample_range_limit - RANGE_SUBSET)
  91 
  92 
  93 /* Short forms of external names for systems with brain-damaged linkers. */
  94 
  95 #ifdef NEED_SHORT_EXTERNAL_NAMES
  96 #define jpeg_fdct_islow         jFDislow
  97 #define jpeg_fdct_ifast         jFDifast
  98 #define jpeg_fdct_float         jFDfloat
  99 #define jpeg_fdct_7x7           jFD7x7
 100 #define jpeg_fdct_6x6           jFD6x6
 101 #define jpeg_fdct_5x5           jFD5x5
 102 #define jpeg_fdct_4x4           jFD4x4
 103 #define jpeg_fdct_3x3           jFD3x3
 104 #define jpeg_fdct_2x2           jFD2x2
 105 #define jpeg_fdct_1x1           jFD1x1
 106 #define jpeg_fdct_9x9           jFD9x9
 107 #define jpeg_fdct_10x10         jFD10x10
 108 #define jpeg_fdct_11x11         jFD11x11
 109 #define jpeg_fdct_12x12         jFD12x12
 110 #define jpeg_fdct_13x13         jFD13x13


 376 
 377 #ifdef SHORTxSHORT_32           /* may work if 'int' is 32 bits */
 378 #define MULTIPLY16C16(var,const)  (((INT16) (var)) * ((INT16) (const)))
 379 #endif
 380 #ifdef SHORTxLCONST_32          /* known to work with Microsoft C 6.0 */
 381 #define MULTIPLY16C16(var,const)  (((INT16) (var)) * ((INT32) (const)))
 382 #endif
 383 
 384 #ifndef MULTIPLY16C16           /* default definition */
 385 #define MULTIPLY16C16(var,const)  ((var) * (const))
 386 #endif
 387 
 388 /* Same except both inputs are variables. */
 389 
 390 #ifdef SHORTxSHORT_32           /* may work if 'int' is 32 bits */
 391 #define MULTIPLY16V16(var1,var2)  (((INT16) (var1)) * ((INT16) (var2)))
 392 #endif
 393 
 394 #ifndef MULTIPLY16V16           /* default definition */
 395 #define MULTIPLY16V16(var1,var2)  ((var1) * (var2))
 396 #endif
 397 
 398 /* Like RIGHT_SHIFT, but applies to a DCTELEM.
 399  * We assume that int right shift is unsigned if INT32 right shift is.
 400  */
 401 
 402 #ifdef RIGHT_SHIFT_IS_UNSIGNED
 403 #define ISHIFT_TEMPS    DCTELEM ishift_temp;
 404 #if BITS_IN_JSAMPLE == 8
 405 #define DCTELEMBITS  16         /* DCTELEM may be 16 or 32 bits */
 406 #else
 407 #define DCTELEMBITS  32         /* DCTELEM must be 32 bits */
 408 #endif
 409 #define IRIGHT_SHIFT(x,shft)  \
 410     ((ishift_temp = (x)) < 0 ? \
 411      (ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \
 412      (ishift_temp >> (shft)))
 413 #else
 414 #define ISHIFT_TEMPS
 415 #define IRIGHT_SHIFT(x,shft)    ((x) >> (shft))
 416 #endif
< prev index next >