Shoaib Ahmed / Mbed 2 deprecated uzairkhan

Dependencies:   uzair Camera_LS_Y201 F7_Ethernet LCD_DISCO_F746NG NetworkAPI SDFileSystem mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers jdct.h Source File

jdct.h

00001 /*
00002  * jdct.h
00003  *
00004  * Copyright (C) 1994-1996, Thomas G. Lane.
00005  * Modified 2002-2015 by Guido Vollbeding.
00006  * This file is part of the Independent JPEG Group's software.
00007  * For conditions of distribution and use, see the accompanying README file.
00008  *
00009  * This include file contains common declarations for the forward and
00010  * inverse DCT modules.  These declarations are private to the DCT managers
00011  * (jcdctmgr.c, jddctmgr.c) and the individual DCT algorithms.
00012  * The individual DCT algorithms are kept in separate files to ease 
00013  * machine-dependent tuning (e.g., assembly coding).
00014  */
00015 
00016 
00017 /*
00018  * A forward DCT routine is given a pointer to an input sample array and
00019  * a pointer to a work area of type DCTELEM[]; the DCT is to be performed
00020  * in-place in that buffer.  Type DCTELEM is int for 8-bit samples, INT32
00021  * for 12-bit samples.  (NOTE: Floating-point DCT implementations use an
00022  * array of type FAST_FLOAT, instead.)
00023  * The input data is to be fetched from the sample array starting at a
00024  * specified column.  (Any row offset needed will be applied to the array
00025  * pointer before it is passed to the FDCT code.)
00026  * Note that the number of samples fetched by the FDCT routine is
00027  * DCT_h_scaled_size * DCT_v_scaled_size.
00028  * The DCT outputs are returned scaled up by a factor of 8; they therefore
00029  * have a range of +-8K for 8-bit data, +-128K for 12-bit data.  This
00030  * convention improves accuracy in integer implementations and saves some
00031  * work in floating-point ones.
00032  * Quantization of the output coefficients is done by jcdctmgr.c.
00033  */
00034 
00035 #if BITS_IN_JSAMPLE == 8
00036 typedef int DCTELEM;        /* 16 or 32 bits is fine */
00037 #else
00038 typedef INT32 DCTELEM;      /* must have 32 bits */
00039 #endif
00040 
00041 typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data,
00042                            JSAMPARRAY sample_data,
00043                            JDIMENSION start_col));
00044 typedef JMETHOD(void, float_DCT_method_ptr, (FAST_FLOAT * data,
00045                          JSAMPARRAY sample_data,
00046                          JDIMENSION start_col));
00047 
00048 
00049 /*
00050  * An inverse DCT routine is given a pointer to the input JBLOCK and a pointer
00051  * to an output sample array.  The routine must dequantize the input data as
00052  * well as perform the IDCT; for dequantization, it uses the multiplier table
00053  * pointed to by compptr->dct_table.  The output data is to be placed into the
00054  * sample array starting at a specified column.  (Any row offset needed will
00055  * be applied to the array pointer before it is passed to the IDCT code.)
00056  * Note that the number of samples emitted by the IDCT routine is
00057  * DCT_h_scaled_size * DCT_v_scaled_size.
00058  */
00059 
00060 /* typedef inverse_DCT_method_ptr is declared in jpegint.h */
00061 
00062 /*
00063  * Each IDCT routine has its own ideas about the best dct_table element type.
00064  */
00065 
00066 typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */
00067 #if BITS_IN_JSAMPLE == 8
00068 typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */
00069 #define IFAST_SCALE_BITS  2 /* fractional bits in scale factors */
00070 #else
00071 typedef INT32 IFAST_MULT_TYPE;  /* need 32 bits for scaled quantizers */
00072 #define IFAST_SCALE_BITS  13    /* fractional bits in scale factors */
00073 #endif
00074 typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
00075 
00076 
00077 /*
00078  * Each IDCT routine is responsible for range-limiting its results and
00079  * converting them to unsigned form (0..MAXJSAMPLE).  The raw outputs could
00080  * be quite far out of range if the input data is corrupt, so a bulletproof
00081  * range-limiting step is required.  We use a mask-and-table-lookup method
00082  * to do the combined operations quickly, assuming that MAXJSAMPLE+1
00083  * is a power of 2.  See the comments with prepare_range_limit_table
00084  * (in jdmaster.c) for more info.
00085  */
00086 
00087 #define RANGE_MASK  (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
00088 #define RANGE_CENTER  (MAXJSAMPLE * 2 + 2)
00089 #define RANGE_SUBSET  (RANGE_CENTER - CENTERJSAMPLE)
00090 
00091 #define IDCT_range_limit(cinfo)  ((cinfo)->sample_range_limit - RANGE_SUBSET)
00092 
00093 
00094 /* Short forms of external names for systems with brain-damaged linkers. */
00095 
00096 #ifdef NEED_SHORT_EXTERNAL_NAMES
00097 #define jpeg_fdct_islow     jFDislow
00098 #define jpeg_fdct_ifast     jFDifast
00099 #define jpeg_fdct_float     jFDfloat
00100 #define jpeg_fdct_7x7       jFD7x7
00101 #define jpeg_fdct_6x6       jFD6x6
00102 #define jpeg_fdct_5x5       jFD5x5
00103 #define jpeg_fdct_4x4       jFD4x4
00104 #define jpeg_fdct_3x3       jFD3x3
00105 #define jpeg_fdct_2x2       jFD2x2
00106 #define jpeg_fdct_1x1       jFD1x1
00107 #define jpeg_fdct_9x9       jFD9x9
00108 #define jpeg_fdct_10x10     jFD10x10
00109 #define jpeg_fdct_11x11     jFD11x11
00110 #define jpeg_fdct_12x12     jFD12x12
00111 #define jpeg_fdct_13x13     jFD13x13
00112 #define jpeg_fdct_14x14     jFD14x14
00113 #define jpeg_fdct_15x15     jFD15x15
00114 #define jpeg_fdct_16x16     jFD16x16
00115 #define jpeg_fdct_16x8      jFD16x8
00116 #define jpeg_fdct_14x7      jFD14x7
00117 #define jpeg_fdct_12x6      jFD12x6
00118 #define jpeg_fdct_10x5      jFD10x5
00119 #define jpeg_fdct_8x4       jFD8x4
00120 #define jpeg_fdct_6x3       jFD6x3
00121 #define jpeg_fdct_4x2       jFD4x2
00122 #define jpeg_fdct_2x1       jFD2x1
00123 #define jpeg_fdct_8x16      jFD8x16
00124 #define jpeg_fdct_7x14      jFD7x14
00125 #define jpeg_fdct_6x12      jFD6x12
00126 #define jpeg_fdct_5x10      jFD5x10
00127 #define jpeg_fdct_4x8       jFD4x8
00128 #define jpeg_fdct_3x6       jFD3x6
00129 #define jpeg_fdct_2x4       jFD2x4
00130 #define jpeg_fdct_1x2       jFD1x2
00131 #define jpeg_idct_islow     jRDislow
00132 #define jpeg_idct_ifast     jRDifast
00133 #define jpeg_idct_float     jRDfloat
00134 #define jpeg_idct_7x7       jRD7x7
00135 #define jpeg_idct_6x6       jRD6x6
00136 #define jpeg_idct_5x5       jRD5x5
00137 #define jpeg_idct_4x4       jRD4x4
00138 #define jpeg_idct_3x3       jRD3x3
00139 #define jpeg_idct_2x2       jRD2x2
00140 #define jpeg_idct_1x1       jRD1x1
00141 #define jpeg_idct_9x9       jRD9x9
00142 #define jpeg_idct_10x10     jRD10x10
00143 #define jpeg_idct_11x11     jRD11x11
00144 #define jpeg_idct_12x12     jRD12x12
00145 #define jpeg_idct_13x13     jRD13x13
00146 #define jpeg_idct_14x14     jRD14x14
00147 #define jpeg_idct_15x15     jRD15x15
00148 #define jpeg_idct_16x16     jRD16x16
00149 #define jpeg_idct_16x8      jRD16x8
00150 #define jpeg_idct_14x7      jRD14x7
00151 #define jpeg_idct_12x6      jRD12x6
00152 #define jpeg_idct_10x5      jRD10x5
00153 #define jpeg_idct_8x4       jRD8x4
00154 #define jpeg_idct_6x3       jRD6x3
00155 #define jpeg_idct_4x2       jRD4x2
00156 #define jpeg_idct_2x1       jRD2x1
00157 #define jpeg_idct_8x16      jRD8x16
00158 #define jpeg_idct_7x14      jRD7x14
00159 #define jpeg_idct_6x12      jRD6x12
00160 #define jpeg_idct_5x10      jRD5x10
00161 #define jpeg_idct_4x8       jRD4x8
00162 #define jpeg_idct_3x6       jRD3x8
00163 #define jpeg_idct_2x4       jRD2x4
00164 #define jpeg_idct_1x2       jRD1x2
00165 #endif /* NEED_SHORT_EXTERNAL_NAMES */
00166 
00167 /* Extern declarations for the forward and inverse DCT routines. */
00168 
00169 EXTERN(void) jpeg_fdct_islow
00170     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00171 EXTERN(void) jpeg_fdct_ifast
00172     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00173 EXTERN(void) jpeg_fdct_float
00174     JPP((FAST_FLOAT * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00175 EXTERN(void) jpeg_fdct_7x7
00176     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00177 EXTERN(void) jpeg_fdct_6x6
00178     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00179 EXTERN(void) jpeg_fdct_5x5
00180     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00181 EXTERN(void) jpeg_fdct_4x4
00182     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00183 EXTERN(void) jpeg_fdct_3x3
00184     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00185 EXTERN(void) jpeg_fdct_2x2
00186     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00187 EXTERN(void) jpeg_fdct_1x1
00188     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00189 EXTERN(void) jpeg_fdct_9x9
00190     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00191 EXTERN(void) jpeg_fdct_10x10
00192     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00193 EXTERN(void) jpeg_fdct_11x11
00194     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00195 EXTERN(void) jpeg_fdct_12x12
00196     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00197 EXTERN(void) jpeg_fdct_13x13
00198     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00199 EXTERN(void) jpeg_fdct_14x14
00200     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00201 EXTERN(void) jpeg_fdct_15x15
00202     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00203 EXTERN(void) jpeg_fdct_16x16
00204     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00205 EXTERN(void) jpeg_fdct_16x8
00206     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00207 EXTERN(void) jpeg_fdct_14x7
00208     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00209 EXTERN(void) jpeg_fdct_12x6
00210     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00211 EXTERN(void) jpeg_fdct_10x5
00212     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00213 EXTERN(void) jpeg_fdct_8x4
00214     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00215 EXTERN(void) jpeg_fdct_6x3
00216     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00217 EXTERN(void) jpeg_fdct_4x2
00218     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00219 EXTERN(void) jpeg_fdct_2x1
00220     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00221 EXTERN(void) jpeg_fdct_8x16
00222     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00223 EXTERN(void) jpeg_fdct_7x14
00224     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00225 EXTERN(void) jpeg_fdct_6x12
00226     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00227 EXTERN(void) jpeg_fdct_5x10
00228     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00229 EXTERN(void) jpeg_fdct_4x8
00230     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00231 EXTERN(void) jpeg_fdct_3x6
00232     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00233 EXTERN(void) jpeg_fdct_2x4
00234     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00235 EXTERN(void) jpeg_fdct_1x2
00236     JPP((DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col));
00237 
00238 EXTERN(void) jpeg_idct_islow
00239     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00240      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00241 EXTERN(void) jpeg_idct_ifast
00242     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00243      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00244 EXTERN(void) jpeg_idct_float
00245     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00246      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00247 EXTERN(void) jpeg_idct_7x7
00248     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00249      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00250 EXTERN(void) jpeg_idct_6x6
00251     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00252      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00253 EXTERN(void) jpeg_idct_5x5
00254     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00255      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00256 EXTERN(void) jpeg_idct_4x4
00257     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00258      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00259 EXTERN(void) jpeg_idct_3x3
00260     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00261      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00262 EXTERN(void) jpeg_idct_2x2
00263     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00264      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00265 EXTERN(void) jpeg_idct_1x1
00266     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00267      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00268 EXTERN(void) jpeg_idct_9x9
00269     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00270      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00271 EXTERN(void) jpeg_idct_10x10
00272     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00273      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00274 EXTERN(void) jpeg_idct_11x11
00275     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00276      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00277 EXTERN(void) jpeg_idct_12x12
00278     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00279      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00280 EXTERN(void) jpeg_idct_13x13
00281     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00282      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00283 EXTERN(void) jpeg_idct_14x14
00284     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00285      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00286 EXTERN(void) jpeg_idct_15x15
00287     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00288      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00289 EXTERN(void) jpeg_idct_16x16
00290     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00291      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00292 EXTERN(void) jpeg_idct_16x8
00293     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00294      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00295 EXTERN(void) jpeg_idct_14x7
00296     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00297      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00298 EXTERN(void) jpeg_idct_12x6
00299     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00300      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00301 EXTERN(void) jpeg_idct_10x5
00302     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00303      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00304 EXTERN(void) jpeg_idct_8x4
00305     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00306      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00307 EXTERN(void) jpeg_idct_6x3
00308     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00309      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00310 EXTERN(void) jpeg_idct_4x2
00311     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00312      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00313 EXTERN(void) jpeg_idct_2x1
00314     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00315      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00316 EXTERN(void) jpeg_idct_8x16
00317     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00318      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00319 EXTERN(void) jpeg_idct_7x14
00320     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00321      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00322 EXTERN(void) jpeg_idct_6x12
00323     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00324      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00325 EXTERN(void) jpeg_idct_5x10
00326     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00327      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00328 EXTERN(void) jpeg_idct_4x8
00329     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00330      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00331 EXTERN(void) jpeg_idct_3x6
00332     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00333      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00334 EXTERN(void) jpeg_idct_2x4
00335     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00336      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00337 EXTERN(void) jpeg_idct_1x2
00338     JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
00339      JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
00340 
00341 
00342 /*
00343  * Macros for handling fixed-point arithmetic; these are used by many
00344  * but not all of the DCT/IDCT modules.
00345  *
00346  * All values are expected to be of type INT32.
00347  * Fractional constants are scaled left by CONST_BITS bits.
00348  * CONST_BITS is defined within each module using these macros,
00349  * and may differ from one module to the next.
00350  */
00351 
00352 #define ONE ((INT32) 1)
00353 #define CONST_SCALE (ONE << CONST_BITS)
00354 
00355 /* Convert a positive real constant to an integer scaled by CONST_SCALE.
00356  * Caution: some C compilers fail to reduce "FIX(constant)" at compile time,
00357  * thus causing a lot of useless floating-point operations at run time.
00358  */
00359 
00360 #define FIX(x)  ((INT32) ((x) * CONST_SCALE + 0.5))
00361 
00362 /* Descale and correctly round an INT32 value that's scaled by N bits.
00363  * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
00364  * the fudge factor is correct for either sign of X.
00365  */
00366 
00367 #define DESCALE(x,n)  RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
00368 
00369 /* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
00370  * This macro is used only when the two inputs will actually be no more than
00371  * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a
00372  * full 32x32 multiply.  This provides a useful speedup on many machines.
00373  * Unfortunately there is no way to specify a 16x16->32 multiply portably
00374  * in C, but some C compilers will do the right thing if you provide the
00375  * correct combination of casts.
00376  */
00377 
00378 #ifdef SHORTxSHORT_32       /* may work if 'int' is 32 bits */
00379 #define MULTIPLY16C16(var,const)  (((INT16) (var)) * ((INT16) (const)))
00380 #endif
00381 #ifdef SHORTxLCONST_32      /* known to work with Microsoft C 6.0 */
00382 #define MULTIPLY16C16(var,const)  (((INT16) (var)) * ((INT32) (const)))
00383 #endif
00384 
00385 #ifndef MULTIPLY16C16       /* default definition */
00386 #define MULTIPLY16C16(var,const)  ((var) * (const))
00387 #endif
00388 
00389 /* Same except both inputs are variables. */
00390 
00391 #ifdef SHORTxSHORT_32       /* may work if 'int' is 32 bits */
00392 #define MULTIPLY16V16(var1,var2)  (((INT16) (var1)) * ((INT16) (var2)))
00393 #endif
00394 
00395 #ifndef MULTIPLY16V16       /* default definition */
00396 #define MULTIPLY16V16(var1,var2)  ((var1) * (var2))
00397 #endif
00398 
00399 /* Like RIGHT_SHIFT, but applies to a DCTELEM.
00400  * We assume that int right shift is unsigned if INT32 right shift is.
00401  */
00402 
00403 #ifdef RIGHT_SHIFT_IS_UNSIGNED
00404 #define ISHIFT_TEMPS    DCTELEM ishift_temp;
00405 #if BITS_IN_JSAMPLE == 8
00406 #define DCTELEMBITS  16     /* DCTELEM may be 16 or 32 bits */
00407 #else
00408 #define DCTELEMBITS  32     /* DCTELEM must be 32 bits */
00409 #endif
00410 #define IRIGHT_SHIFT(x,shft)  \
00411     ((ishift_temp = (x)) < 0 ? \
00412      (ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \
00413      (ishift_temp >> (shft)))
00414 #else
00415 #define ISHIFT_TEMPS
00416 #define IRIGHT_SHIFT(x,shft)    ((x) >> (shft))
00417 #endif