From 39c2d6bde187994f45933a2ffa13435a31d12c02 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 26 May 2002 11:49:37 +0000 Subject: [PATCH] globally renamed INT32 to JPEG_INT32 to solve the [re]definition problems with cygwin/mingw32 headers which sometimes define INT32 and sometimes don't git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15672 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/jpeg/jccolor.c | 22 ++++++++-------- src/jpeg/jcdctmgr.c | 4 +-- src/jpeg/jchuff.c | 8 +++--- src/jpeg/jcphuff.c | 6 ++--- src/jpeg/jcsample.c | 8 +++--- src/jpeg/jdcoefct.c | 2 +- src/jpeg/jdcolor.c | 26 +++++++++--------- src/jpeg/jdct.h | 10 +++---- src/jpeg/jddctmgr.c | 4 +-- src/jpeg/jdhuff.c | 6 ++--- src/jpeg/jdhuff.h | 6 ++--- src/jpeg/jdmarker.c | 28 ++++++++++---------- src/jpeg/jdmerge.c | 26 +++++++++--------- src/jpeg/jdsample.c | 2 +- src/jpeg/jfdctfst.c | 8 +++--- src/jpeg/jfdctint.c | 30 ++++++++++----------- src/jpeg/jidctflt.c | 16 ++++++------ src/jpeg/jidctfst.c | 8 +++--- src/jpeg/jidctint.c | 48 +++++++++++++++++----------------- src/jpeg/jidctred.c | 64 ++++++++++++++++++++++----------------------- src/jpeg/jmorecfg.h | 42 ++++++++--------------------- src/jpeg/jpegint.h | 4 +-- src/jpeg/jquant1.c | 14 +++++----- src/jpeg/jquant2.c | 28 ++++++++++---------- 24 files changed, 200 insertions(+), 220 deletions(-) diff --git a/src/jpeg/jccolor.c b/src/jpeg/jccolor.c index 0a8a4b5d13..2f74cc2a39 100644 --- a/src/jpeg/jccolor.c +++ b/src/jpeg/jccolor.c @@ -19,7 +19,7 @@ typedef struct { struct jpeg_color_converter pub; /* public fields */ /* Private state for RGB->YCC conversion */ - INT32 * rgb_ycc_tab; /* => table for RGB to YCbCr conversion */ + JPEG_INT32 * rgb_ycc_tab; /* => table for RGB to YCbCr conversion */ } my_color_converter; typedef my_color_converter * my_cconvert_ptr; @@ -56,9 +56,9 @@ typedef my_color_converter * my_cconvert_ptr; */ #define SCALEBITS 16 /* speediest right-shift on some machines */ -#define CBCR_OFFSET ((INT32) CENTERJSAMPLE << SCALEBITS) -#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) -#define FIX(x) ((INT32) ((x) * (1L<cconvert; - INT32 * rgb_ycc_tab; - INT32 i; + JPEG_INT32 * rgb_ycc_tab; + JPEG_INT32 i; /* Allocate and fill in the conversion tables. */ - cconvert->rgb_ycc_tab = rgb_ycc_tab = (INT32 *) + cconvert->rgb_ycc_tab = rgb_ycc_tab = (JPEG_INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (TABLE_SIZE * SIZEOF(INT32))); + (TABLE_SIZE * SIZEOF(JPEG_INT32))); for (i = 0; i <= MAXJSAMPLE; i++) { rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i; @@ -133,7 +133,7 @@ rgb_ycc_convert (j_compress_ptr cinfo, { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; register int r, g, b; - register INT32 * ctab = cconvert->rgb_ycc_tab; + register JPEG_INT32 * ctab = cconvert->rgb_ycc_tab; register JSAMPROW inptr; register JSAMPROW outptr0, outptr1, outptr2; register JDIMENSION col; @@ -189,7 +189,7 @@ rgb_gray_convert (j_compress_ptr cinfo, { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; register int r, g, b; - register INT32 * ctab = cconvert->rgb_ycc_tab; + register JPEG_INT32 * ctab = cconvert->rgb_ycc_tab; register JSAMPROW inptr; register JSAMPROW outptr; register JDIMENSION col; @@ -228,7 +228,7 @@ cmyk_ycck_convert (j_compress_ptr cinfo, { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; register int r, g, b; - register INT32 * ctab = cconvert->rgb_ycc_tab; + register JPEG_INT32 * ctab = cconvert->rgb_ycc_tab; register JSAMPROW inptr; register JSAMPROW outptr0, outptr1, outptr2, outptr3; register JDIMENSION col; diff --git a/src/jpeg/jcdctmgr.c b/src/jpeg/jcdctmgr.c index 61fa79b9e6..03ffc8ae41 100644 --- a/src/jpeg/jcdctmgr.c +++ b/src/jpeg/jcdctmgr.c @@ -117,8 +117,8 @@ start_pass_fdctmgr (j_compress_ptr cinfo) dtbl = fdct->divisors[qtblno]; for (i = 0; i < DCTSIZE2; i++) { dtbl[i] = (DCTELEM) - DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], - (INT32) aanscales[i]), + DESCALE(MULTIPLY16V16((JPEG_INT32) qtbl->quantval[i], + (JPEG_INT32) aanscales[i]), CONST_BITS-3); } } diff --git a/src/jpeg/jchuff.c b/src/jpeg/jchuff.c index f235250548..c65310590a 100644 --- a/src/jpeg/jchuff.c +++ b/src/jpeg/jchuff.c @@ -27,7 +27,7 @@ */ typedef struct { - INT32 put_buffer; /* current bit-accumulation buffer */ + JPEG_INT32 put_buffer; /* current bit-accumulation buffer */ int put_bits; /* # of bits now in it */ int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ } savable_state; @@ -232,7 +232,7 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno, /* code is now 1 more than the last code used for codelength si; but * it must still fit in si bits, since no code is allowed to be all ones. */ - if (((INT32) code) >= (((INT32) 1) << si)) + if (((JPEG_INT32) code) >= (((JPEG_INT32) 1) << si)) ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); code <<= 1; si++; @@ -303,14 +303,14 @@ emit_bits (working_state * state, unsigned int code, int size) /* Emit some bits; return TRUE if successful, FALSE if must suspend */ { /* This routine is heavily used, so it's worth coding tightly. */ - register INT32 put_buffer = (INT32) code; + register JPEG_INT32 put_buffer = (JPEG_INT32) code; register int put_bits = state->cur.put_bits; /* if size is 0, caller used an invalid Huffman table entry */ if (size == 0) ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE); - put_buffer &= (((INT32) 1)< next byte to write in buffer */ size_t free_in_buffer; /* # of byte spaces remaining in buffer */ - INT32 put_buffer; /* current bit-accumulation buffer */ + JPEG_INT32 put_buffer; /* current bit-accumulation buffer */ int put_bits; /* # of bits now in it */ j_compress_ptr cinfo; /* link to cinfo (needed for dump_buffer) */ @@ -229,7 +229,7 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) /* Emit some bits, unless we are in gather mode */ { /* This routine is heavily used, so it's worth coding tightly. */ - register INT32 put_buffer = (INT32) code; + register JPEG_INT32 put_buffer = (JPEG_INT32) code; register int put_bits = entropy->put_bits; /* if size is 0, caller used an invalid Huffman table entry */ @@ -239,7 +239,7 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) if (entropy->gather_statistics) return; /* do nothing if we're only getting stats */ - put_buffer &= (((INT32) 1)<width_in_blocks * DCTSIZE; JSAMPROW inptr, outptr; - INT32 outvalue; + JPEG_INT32 outvalue; h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor; v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor; @@ -167,7 +167,7 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, for (v = 0; v < v_expand; v++) { inptr = input_data[inrow+v] + outcol_h; for (h = 0; h < h_expand; h++) { - outvalue += (INT32) GETJSAMPLE(*inptr++); + outvalue += (JPEG_INT32) GETJSAMPLE(*inptr++); } } *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix); @@ -296,7 +296,7 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr, JDIMENSION colctr; JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr; - INT32 membersum, neighsum, memberscale, neighscale; + JPEG_INT32 membersum, neighsum, memberscale, neighscale; /* Expand input data enough to let all the output samples be generated * by the standard loop. Special-casing padded output would be more @@ -396,7 +396,7 @@ fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr, JDIMENSION colctr; JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; register JSAMPROW inptr, above_ptr, below_ptr, outptr; - INT32 membersum, neighsum, memberscale, neighscale; + JPEG_INT32 membersum, neighsum, memberscale, neighscale; int colsum, lastcolsum, nextcolsum; /* Expand input data enough to let all the output samples be generated diff --git a/src/jpeg/jdcoefct.c b/src/jpeg/jdcoefct.c index 4938d20fcb..4b89b62d24 100644 --- a/src/jpeg/jdcoefct.c +++ b/src/jpeg/jdcoefct.c @@ -474,7 +474,7 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) JBLOCK workspace; int *coef_bits; JQUANT_TBL *quanttbl; - INT32 Q00,Q01,Q02,Q10,Q11,Q20, num; + JPEG_INT32 Q00,Q01,Q02,Q10,Q11,Q20, num; int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9; int Al, pred; diff --git a/src/jpeg/jdcolor.c b/src/jpeg/jdcolor.c index 6c04dfe8aa..c518544960 100644 --- a/src/jpeg/jdcolor.c +++ b/src/jpeg/jdcolor.c @@ -21,8 +21,8 @@ typedef struct { /* Private state for YCC->RGB conversion */ int * Cr_r_tab; /* => table for Cr to R conversion */ int * Cb_b_tab; /* => table for Cb to B conversion */ - INT32 * Cr_g_tab; /* => table for Cr to G conversion */ - INT32 * Cb_g_tab; /* => table for Cb to G conversion */ + JPEG_INT32 * Cr_g_tab; /* => table for Cr to G conversion */ + JPEG_INT32 * Cb_g_tab; /* => table for Cb to G conversion */ } my_color_deconverter; typedef my_color_deconverter * my_cconvert_ptr; @@ -58,8 +58,8 @@ typedef my_color_deconverter * my_cconvert_ptr; */ #define SCALEBITS 16 /* speediest right-shift on some machines */ -#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) -#define FIX(x) ((INT32) ((x) * (1L<cconvert; int i; - INT32 x; + JPEG_INT32 x; SHIFT_TEMPS cconvert->Cr_r_tab = (int *) @@ -80,12 +80,12 @@ build_ycc_rgb_table (j_decompress_ptr cinfo) cconvert->Cb_b_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int)); - cconvert->Cr_g_tab = (INT32 *) + cconvert->Cr_g_tab = (JPEG_INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(INT32)); - cconvert->Cb_g_tab = (INT32 *) + (MAXJSAMPLE+1) * SIZEOF(JPEG_INT32)); + cconvert->Cb_g_tab = (JPEG_INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(INT32)); + (MAXJSAMPLE+1) * SIZEOF(JPEG_INT32)); for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ @@ -131,8 +131,8 @@ ycc_rgb_convert (j_decompress_ptr cinfo, register JSAMPLE * range_limit = cinfo->sample_range_limit; register int * Crrtab = cconvert->Cr_r_tab; register int * Cbbtab = cconvert->Cb_b_tab; - register INT32 * Crgtab = cconvert->Cr_g_tab; - register INT32 * Cbgtab = cconvert->Cb_g_tab; + register JPEG_INT32 * Crgtab = cconvert->Cr_g_tab; + register JPEG_INT32 * Cbgtab = cconvert->Cb_g_tab; SHIFT_TEMPS while (--num_rows >= 0) { @@ -256,8 +256,8 @@ ycck_cmyk_convert (j_decompress_ptr cinfo, register JSAMPLE * range_limit = cinfo->sample_range_limit; register int * Crrtab = cconvert->Cr_r_tab; register int * Cbbtab = cconvert->Cb_b_tab; - register INT32 * Crgtab = cconvert->Cr_g_tab; - register INT32 * Cbgtab = cconvert->Cb_g_tab; + register JPEG_INT32 * Crgtab = cconvert->Cr_g_tab; + register JPEG_INT32 * Cbgtab = cconvert->Cb_g_tab; SHIFT_TEMPS while (--num_rows >= 0) { diff --git a/src/jpeg/jdct.h b/src/jpeg/jdct.h index 04192a266a..42180f390e 100644 --- a/src/jpeg/jdct.h +++ b/src/jpeg/jdct.h @@ -29,7 +29,7 @@ #if BITS_IN_JSAMPLE == 8 typedef int DCTELEM; /* 16 or 32 bits is fine */ #else -typedef INT32 DCTELEM; /* must have 32 bits */ +typedef JPEG_INT32 DCTELEM; /* must have 32 bits */ #endif typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data)); @@ -58,7 +58,7 @@ typedef MULTIPLIER ISLOW_MULT_TYPE; /* short or int, whichever is faster */ typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */ #define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */ #else -typedef INT32 IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */ +typedef JPEG_INT32 IFAST_MULT_TYPE; /* need 32 bits for scaled quantizers */ #define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */ #endif typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */ @@ -128,7 +128,7 @@ EXTERN(void) jpeg_idct_1x1 * and may differ from one module to the next. */ -#define ONE ((INT32) 1) +#define ONE ((JPEG_INT32) 1) #define CONST_SCALE (ONE << CONST_BITS) /* Convert a positive real constant to an integer scaled by CONST_SCALE. @@ -136,7 +136,7 @@ EXTERN(void) jpeg_idct_1x1 * thus causing a lot of useless floating-point operations at run time. */ -#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5)) +#define FIX(x) ((JPEG_INT32) ((x) * CONST_SCALE + 0.5)) /* Descale and correctly round an INT32 value that's scaled by N bits. * We assume RIGHT_SHIFT rounds towards minus infinity, so adding @@ -158,7 +158,7 @@ EXTERN(void) jpeg_idct_1x1 #define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT16) (const))) #endif #ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ -#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT32) (const))) +#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((JPEG_INT32) (const))) #endif #ifndef MULTIPLY16C16 /* default definition */ diff --git a/src/jpeg/jddctmgr.c b/src/jpeg/jddctmgr.c index bbf8d0e92f..e27cc3d511 100644 --- a/src/jpeg/jddctmgr.c +++ b/src/jpeg/jddctmgr.c @@ -197,8 +197,8 @@ start_pass (j_decompress_ptr cinfo) for (i = 0; i < DCTSIZE2; i++) { ifmtbl[i] = (IFAST_MULT_TYPE) - DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[i], - (INT32) aanscales[i]), + DESCALE(MULTIPLY16V16((JPEG_INT32) qtbl->quantval[i], + (JPEG_INT32) aanscales[i]), CONST_BITS-IFAST_SCALE_BITS); } } diff --git a/src/jpeg/jdhuff.c b/src/jpeg/jdhuff.c index b5ba39f736..03e4fea417 100644 --- a/src/jpeg/jdhuff.c +++ b/src/jpeg/jdhuff.c @@ -204,7 +204,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, /* code is now 1 more than the last code used for codelength si; but * it must still fit in si bits, since no code is allowed to be all ones. */ - if (((INT32) code) >= (((INT32) 1) << si)) + if (((JPEG_INT32) code) >= (((JPEG_INT32) 1) << si)) ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); code <<= 1; si++; @@ -218,7 +218,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, /* valoffset[l] = huffval[] index of 1st symbol of code length l, * minus the minimum code of length l */ - dtbl->valoffset[l] = (INT32) p - (INT32) huffcode[p]; + dtbl->valoffset[l] = (JPEG_INT32) p - (JPEG_INT32) huffcode[p]; p += htbl->bits[l]; dtbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */ } else { @@ -400,7 +400,7 @@ jpeg_huff_decode (bitread_working_state * state, d_derived_tbl * htbl, int min_bits) { register int l = min_bits; - register INT32 code; + register JPEG_INT32 code; /* HUFF_DECODE has determined that the code is at least min_bits */ /* bits long, so fetch that many bits in one swoop. */ diff --git a/src/jpeg/jdhuff.h b/src/jpeg/jdhuff.h index ae19b6cafd..e95ea05f8b 100644 --- a/src/jpeg/jdhuff.h +++ b/src/jpeg/jdhuff.h @@ -25,9 +25,9 @@ typedef struct { /* Basic tables: (element [0] of each array is unused) */ - INT32 maxcode[18]; /* largest code of length k (-1 if none) */ + JPEG_INT32 maxcode[18]; /* largest code of length k (-1 if none) */ /* (maxcode[17] is a sentinel to ensure jpeg_huff_decode terminates) */ - INT32 valoffset[17]; /* huffval[] offset for codes of length k */ + JPEG_INT32 valoffset[17]; /* huffval[] offset for codes of length k */ /* valoffset[k] = huffval[] index of 1st symbol of code length k, less * the smallest code of length k; so given a code of length k, the * corresponding symbol is huffval[code + valoffset[k]] @@ -69,7 +69,7 @@ EXTERN(void) jpeg_make_d_derived_tbl * necessary. */ -typedef INT32 bit_buf_type; /* type of bit-extraction buffer */ +typedef JPEG_INT32 bit_buf_type; /* type of bit-extraction buffer */ #define BIT_BUF_SIZE 32 /* size of buffer in bits */ /* If long is > 32 bits on your machine, and shifting/masking longs is diff --git a/src/jpeg/jdmarker.c b/src/jpeg/jdmarker.c index f4cca8cc83..e2163be96b 100644 --- a/src/jpeg/jdmarker.c +++ b/src/jpeg/jdmarker.c @@ -237,7 +237,7 @@ LOCAL(boolean) get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) /* Process a SOFn marker */ { - INT32 length; + JPEG_INT32 length; int c, ci; jpeg_component_info * compptr; INPUT_VARS(cinfo); @@ -301,7 +301,7 @@ LOCAL(boolean) get_sos (j_decompress_ptr cinfo) /* Process a SOS marker */ { - INT32 length; + JPEG_INT32 length; int i, ci, n, c, cc; jpeg_component_info * compptr; INPUT_VARS(cinfo); @@ -373,7 +373,7 @@ LOCAL(boolean) get_dac (j_decompress_ptr cinfo) /* Process a DAC marker */ { - INT32 length; + JPEG_INT32 length; int index, val; INPUT_VARS(cinfo); @@ -419,7 +419,7 @@ LOCAL(boolean) get_dht (j_decompress_ptr cinfo) /* Process a DHT marker */ { - INT32 length; + JPEG_INT32 length; UINT8 bits[17]; UINT8 huffval[256]; int i, index, count; @@ -453,7 +453,7 @@ get_dht (j_decompress_ptr cinfo) /* Here we just do minimal validation of the counts to avoid walking * off the end of our table space. jdhuff.c will check more carefully. */ - if (count > 256 || ((INT32) count) > length) + if (count > 256 || ((JPEG_INT32) count) > length) ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); for (i = 0; i < count; i++) @@ -490,7 +490,7 @@ LOCAL(boolean) get_dqt (j_decompress_ptr cinfo) /* Process a DQT marker */ { - INT32 length; + JPEG_INT32 length; int n, i, prec; unsigned int tmp; JQUANT_TBL *quant_ptr; @@ -548,7 +548,7 @@ LOCAL(boolean) get_dri (j_decompress_ptr cinfo) /* Process a DRI marker */ { - INT32 length; + JPEG_INT32 length; unsigned int tmp; INPUT_VARS(cinfo); @@ -582,13 +582,13 @@ get_dri (j_decompress_ptr cinfo) LOCAL(void) examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, - unsigned int datalen, INT32 remaining) + unsigned int datalen, JPEG_INT32 remaining) /* Examine first few bytes from an APP0. * Take appropriate action if it is a JFIF marker. * datalen is # of bytes at data[], remaining is length of rest of marker data. */ { - INT32 totallen = (INT32) datalen + remaining; + JPEG_INT32 totallen = (JPEG_INT32) datalen + remaining; if (datalen >= APP0_DATA_LEN && GETJOCTET(data[0]) == 0x4A && @@ -622,7 +622,7 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, GETJOCTET(data[12]), GETJOCTET(data[13])); totallen -= APP0_DATA_LEN; if (totallen != - ((INT32)GETJOCTET(data[12]) * (INT32)GETJOCTET(data[13]) * (INT32) 3)) + ((JPEG_INT32)GETJOCTET(data[12]) * (JPEG_INT32)GETJOCTET(data[13]) * (JPEG_INT32) 3)) TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) totallen); } else if (datalen >= 6 && GETJOCTET(data[0]) == 0x4A && @@ -658,7 +658,7 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, LOCAL(void) examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data, - unsigned int datalen, INT32 remaining) + unsigned int datalen, JPEG_INT32 remaining) /* Examine first few bytes from an APP14. * Take appropriate action if it is an Adobe marker. * datalen is # of bytes at data[], remaining is length of rest of marker data. @@ -691,7 +691,7 @@ METHODDEF(boolean) get_interesting_appn (j_decompress_ptr cinfo) /* Process an APP0 or APP14 marker without saving it */ { - INT32 length; + JPEG_INT32 length; JOCTET b[APPN_DATA_LEN]; unsigned int i, numtoread; INPUT_VARS(cinfo); @@ -743,7 +743,7 @@ save_marker (j_decompress_ptr cinfo) jpeg_saved_marker_ptr cur_marker = marker->cur_marker; unsigned int bytes_read, data_length; JOCTET FAR * data; - INT32 length = 0; + JPEG_INT32 length = 0; INPUT_VARS(cinfo); if (cur_marker == NULL) { @@ -845,7 +845,7 @@ METHODDEF(boolean) skip_variable (j_decompress_ptr cinfo) /* Skip over an unknown or uninteresting variable-length marker */ { - INT32 length; + JPEG_INT32 length; INPUT_VARS(cinfo); INPUT_2BYTES(cinfo, length, return FALSE); diff --git a/src/jpeg/jdmerge.c b/src/jpeg/jdmerge.c index 2d29195505..9792882144 100644 --- a/src/jpeg/jdmerge.c +++ b/src/jpeg/jdmerge.c @@ -52,8 +52,8 @@ typedef struct { /* Private state for YCC->RGB conversion */ int * Cr_r_tab; /* => table for Cr to R conversion */ int * Cb_b_tab; /* => table for Cb to B conversion */ - INT32 * Cr_g_tab; /* => table for Cr to G conversion */ - INT32 * Cb_g_tab; /* => table for Cb to G conversion */ + JPEG_INT32 * Cr_g_tab; /* => table for Cr to G conversion */ + JPEG_INT32 * Cb_g_tab; /* => table for Cb to G conversion */ /* For 2:1 vertical sampling, we produce two output rows at a time. * We need a "spare" row buffer to hold the second output row if the @@ -70,8 +70,8 @@ typedef struct { typedef my_upsampler * my_upsample_ptr; #define SCALEBITS 16 /* speediest right-shift on some machines */ -#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) -#define FIX(x) ((INT32) ((x) * (1L<upsample; int i; - INT32 x; + JPEG_INT32 x; SHIFT_TEMPS upsample->Cr_r_tab = (int *) @@ -93,12 +93,12 @@ build_ycc_rgb_table (j_decompress_ptr cinfo) upsample->Cb_b_tab = (int *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int)); - upsample->Cr_g_tab = (INT32 *) + upsample->Cr_g_tab = (JPEG_INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(INT32)); - upsample->Cb_g_tab = (INT32 *) + (MAXJSAMPLE+1) * SIZEOF(JPEG_INT32)); + upsample->Cb_g_tab = (JPEG_INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (MAXJSAMPLE+1) * SIZEOF(INT32)); + (MAXJSAMPLE+1) * SIZEOF(JPEG_INT32)); for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ @@ -237,8 +237,8 @@ h2v1_merged_upsample (j_decompress_ptr cinfo, register JSAMPLE * range_limit = cinfo->sample_range_limit; int * Crrtab = upsample->Cr_r_tab; int * Cbbtab = upsample->Cb_b_tab; - INT32 * Crgtab = upsample->Cr_g_tab; - INT32 * Cbgtab = upsample->Cb_g_tab; + JPEG_INT32 * Crgtab = upsample->Cr_g_tab; + JPEG_INT32 * Cbgtab = upsample->Cb_g_tab; SHIFT_TEMPS inptr0 = input_buf[0][in_row_group_ctr]; @@ -298,8 +298,8 @@ h2v2_merged_upsample (j_decompress_ptr cinfo, register JSAMPLE * range_limit = cinfo->sample_range_limit; int * Crrtab = upsample->Cr_r_tab; int * Cbbtab = upsample->Cb_b_tab; - INT32 * Crgtab = upsample->Cr_g_tab; - INT32 * Cbgtab = upsample->Cb_g_tab; + JPEG_INT32 * Crgtab = upsample->Cr_g_tab; + JPEG_INT32 * Cbgtab = upsample->Cb_g_tab; SHIFT_TEMPS inptr00 = input_buf[0][in_row_group_ctr*2]; diff --git a/src/jpeg/jdsample.c b/src/jpeg/jdsample.c index 80ffefb2a1..19e2e1072e 100644 --- a/src/jpeg/jdsample.c +++ b/src/jpeg/jdsample.c @@ -350,7 +350,7 @@ h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, #if BITS_IN_JSAMPLE == 8 register int thiscolsum, lastcolsum, nextcolsum; #else - register INT32 thiscolsum, lastcolsum, nextcolsum; + register JPEG_INT32 thiscolsum, lastcolsum, nextcolsum; #endif register JDIMENSION colctr; int inrow, outrow, v; diff --git a/src/jpeg/jfdctfst.c b/src/jpeg/jfdctfst.c index ccb378a3b4..37900ec90f 100644 --- a/src/jpeg/jfdctfst.c +++ b/src/jpeg/jfdctfst.c @@ -76,10 +76,10 @@ */ #if CONST_BITS == 8 -#define FIX_0_382683433 ((INT32) 98) /* FIX(0.382683433) */ -#define FIX_0_541196100 ((INT32) 139) /* FIX(0.541196100) */ -#define FIX_0_707106781 ((INT32) 181) /* FIX(0.707106781) */ -#define FIX_1_306562965 ((INT32) 334) /* FIX(1.306562965) */ +#define FIX_0_382683433 ((JPEG_INT32) 98) /* FIX(0.382683433) */ +#define FIX_0_541196100 ((JPEG_INT32) 139) /* FIX(0.541196100) */ +#define FIX_0_707106781 ((JPEG_INT32) 181) /* FIX(0.707106781) */ +#define FIX_1_306562965 ((JPEG_INT32) 334) /* FIX(1.306562965) */ #else #define FIX_0_382683433 FIX(0.382683433) #define FIX_0_541196100 FIX(0.541196100) diff --git a/src/jpeg/jfdctint.c b/src/jpeg/jfdctint.c index 0a78b64aee..4543b2e861 100644 --- a/src/jpeg/jfdctint.c +++ b/src/jpeg/jfdctint.c @@ -90,18 +90,18 @@ */ #if CONST_BITS == 13 -#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */ -#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */ -#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */ -#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ -#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ -#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */ -#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */ -#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ -#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */ -#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */ -#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ -#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */ +#define FIX_0_298631336 ((JPEG_INT32) 2446) /* FIX(0.298631336) */ +#define FIX_0_390180644 ((JPEG_INT32) 3196) /* FIX(0.390180644) */ +#define FIX_0_541196100 ((JPEG_INT32) 4433) /* FIX(0.541196100) */ +#define FIX_0_765366865 ((JPEG_INT32) 6270) /* FIX(0.765366865) */ +#define FIX_0_899976223 ((JPEG_INT32) 7373) /* FIX(0.899976223) */ +#define FIX_1_175875602 ((JPEG_INT32) 9633) /* FIX(1.175875602) */ +#define FIX_1_501321110 ((JPEG_INT32) 12299) /* FIX(1.501321110) */ +#define FIX_1_847759065 ((JPEG_INT32) 15137) /* FIX(1.847759065) */ +#define FIX_1_961570560 ((JPEG_INT32) 16069) /* FIX(1.961570560) */ +#define FIX_2_053119869 ((JPEG_INT32) 16819) /* FIX(2.053119869) */ +#define FIX_2_562915447 ((JPEG_INT32) 20995) /* FIX(2.562915447) */ +#define FIX_3_072711026 ((JPEG_INT32) 25172) /* FIX(3.072711026) */ #else #define FIX_0_298631336 FIX(0.298631336) #define FIX_0_390180644 FIX(0.390180644) @@ -139,9 +139,9 @@ GLOBAL(void) jpeg_fdct_islow (DCTELEM * data) { - INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; - INT32 tmp10, tmp11, tmp12, tmp13; - INT32 z1, z2, z3, z4, z5; + JPEG_INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; + JPEG_INT32 tmp10, tmp11, tmp12, tmp13; + JPEG_INT32 z1, z2, z3, z4, z5; DCTELEM *dataptr; int ctr; SHIFT_TEMPS diff --git a/src/jpeg/jidctflt.c b/src/jpeg/jidctflt.c index 0188ce3dfc..a0f22c295c 100644 --- a/src/jpeg/jidctflt.c +++ b/src/jpeg/jidctflt.c @@ -218,21 +218,21 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Final output stage: scale down by a factor of 8 and range-limit */ - outptr[0] = range_limit[(int) DESCALE((INT32) (tmp0 + tmp7), 3) + outptr[0] = range_limit[(int) DESCALE((JPEG_INT32) (tmp0 + tmp7), 3) & RANGE_MASK]; - outptr[7] = range_limit[(int) DESCALE((INT32) (tmp0 - tmp7), 3) + outptr[7] = range_limit[(int) DESCALE((JPEG_INT32) (tmp0 - tmp7), 3) & RANGE_MASK]; - outptr[1] = range_limit[(int) DESCALE((INT32) (tmp1 + tmp6), 3) + outptr[1] = range_limit[(int) DESCALE((JPEG_INT32) (tmp1 + tmp6), 3) & RANGE_MASK]; - outptr[6] = range_limit[(int) DESCALE((INT32) (tmp1 - tmp6), 3) + outptr[6] = range_limit[(int) DESCALE((JPEG_INT32) (tmp1 - tmp6), 3) & RANGE_MASK]; - outptr[2] = range_limit[(int) DESCALE((INT32) (tmp2 + tmp5), 3) + outptr[2] = range_limit[(int) DESCALE((JPEG_INT32) (tmp2 + tmp5), 3) & RANGE_MASK]; - outptr[5] = range_limit[(int) DESCALE((INT32) (tmp2 - tmp5), 3) + outptr[5] = range_limit[(int) DESCALE((JPEG_INT32) (tmp2 - tmp5), 3) & RANGE_MASK]; - outptr[4] = range_limit[(int) DESCALE((INT32) (tmp3 + tmp4), 3) + outptr[4] = range_limit[(int) DESCALE((JPEG_INT32) (tmp3 + tmp4), 3) & RANGE_MASK]; - outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3) + outptr[3] = range_limit[(int) DESCALE((JPEG_INT32) (tmp3 - tmp4), 3) & RANGE_MASK]; wsptr += DCTSIZE; /* advance pointer to next row */ diff --git a/src/jpeg/jidctfst.c b/src/jpeg/jidctfst.c index dba4216fb9..d388b61783 100644 --- a/src/jpeg/jidctfst.c +++ b/src/jpeg/jidctfst.c @@ -89,10 +89,10 @@ */ #if CONST_BITS == 8 -#define FIX_1_082392200 ((INT32) 277) /* FIX(1.082392200) */ -#define FIX_1_414213562 ((INT32) 362) /* FIX(1.414213562) */ -#define FIX_1_847759065 ((INT32) 473) /* FIX(1.847759065) */ -#define FIX_2_613125930 ((INT32) 669) /* FIX(2.613125930) */ +#define FIX_1_082392200 ((JPEG_INT32) 277) /* FIX(1.082392200) */ +#define FIX_1_414213562 ((JPEG_INT32) 362) /* FIX(1.414213562) */ +#define FIX_1_847759065 ((JPEG_INT32) 473) /* FIX(1.847759065) */ +#define FIX_2_613125930 ((JPEG_INT32) 669) /* FIX(2.613125930) */ #else #define FIX_1_082392200 FIX(1.082392200) #define FIX_1_414213562 FIX(1.414213562) diff --git a/src/jpeg/jidctint.c b/src/jpeg/jidctint.c index a72b3207ca..2783c23027 100644 --- a/src/jpeg/jidctint.c +++ b/src/jpeg/jidctint.c @@ -90,18 +90,18 @@ */ #if CONST_BITS == 13 -#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */ -#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */ -#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */ -#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ -#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ -#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */ -#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */ -#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ -#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */ -#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */ -#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ -#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */ +#define FIX_0_298631336 ((JPEG_INT32) 2446) /* FIX(0.298631336) */ +#define FIX_0_390180644 ((JPEG_INT32) 3196) /* FIX(0.390180644) */ +#define FIX_0_541196100 ((JPEG_INT32) 4433) /* FIX(0.541196100) */ +#define FIX_0_765366865 ((JPEG_INT32) 6270) /* FIX(0.765366865) */ +#define FIX_0_899976223 ((JPEG_INT32) 7373) /* FIX(0.899976223) */ +#define FIX_1_175875602 ((JPEG_INT32) 9633) /* FIX(1.175875602) */ +#define FIX_1_501321110 ((JPEG_INT32) 12299) /* FIX(1.501321110) */ +#define FIX_1_847759065 ((JPEG_INT32) 15137) /* FIX(1.847759065) */ +#define FIX_1_961570560 ((JPEG_INT32) 16069) /* FIX(1.961570560) */ +#define FIX_2_053119869 ((JPEG_INT32) 16819) /* FIX(2.053119869) */ +#define FIX_2_562915447 ((JPEG_INT32) 20995) /* FIX(2.562915447) */ +#define FIX_3_072711026 ((JPEG_INT32) 25172) /* FIX(3.072711026) */ #else #define FIX_0_298631336 FIX(0.298631336) #define FIX_0_390180644 FIX(0.390180644) @@ -149,9 +149,9 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - INT32 tmp0, tmp1, tmp2, tmp3; - INT32 tmp10, tmp11, tmp12, tmp13; - INT32 z1, z2, z3, z4, z5; + JPEG_INT32 tmp0, tmp1, tmp2, tmp3; + JPEG_INT32 tmp10, tmp11, tmp12, tmp13; + JPEG_INT32 z1, z2, z3, z4, z5; JCOEFPTR inptr; ISLOW_MULT_TYPE * quantptr; int * wsptr; @@ -288,7 +288,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { /* AC terms all zero */ - JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) + JSAMPLE dcval = range_limit[(int) DESCALE((JPEG_INT32) wsptr[0], PASS1_BITS+3) & RANGE_MASK]; outptr[0] = dcval; @@ -308,15 +308,15 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Even part: reverse the even part of the forward DCT. */ /* The rotator is sqrt(2)*c(-6). */ - z2 = (INT32) wsptr[2]; - z3 = (INT32) wsptr[6]; + z2 = (JPEG_INT32) wsptr[2]; + z3 = (JPEG_INT32) wsptr[6]; z1 = MULTIPLY(z2 + z3, FIX_0_541196100); tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); - tmp0 = ((INT32) wsptr[0] + (INT32) wsptr[4]) << CONST_BITS; - tmp1 = ((INT32) wsptr[0] - (INT32) wsptr[4]) << CONST_BITS; + tmp0 = ((JPEG_INT32) wsptr[0] + (JPEG_INT32) wsptr[4]) << CONST_BITS; + tmp1 = ((JPEG_INT32) wsptr[0] - (JPEG_INT32) wsptr[4]) << CONST_BITS; tmp10 = tmp0 + tmp3; tmp13 = tmp0 - tmp3; @@ -327,10 +327,10 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. */ - tmp0 = (INT32) wsptr[7]; - tmp1 = (INT32) wsptr[5]; - tmp2 = (INT32) wsptr[3]; - tmp3 = (INT32) wsptr[1]; + tmp0 = (JPEG_INT32) wsptr[7]; + tmp1 = (JPEG_INT32) wsptr[5]; + tmp2 = (JPEG_INT32) wsptr[3]; + tmp3 = (JPEG_INT32) wsptr[1]; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; diff --git a/src/jpeg/jidctred.c b/src/jpeg/jidctred.c index 421f3c7ca1..efda35aeb5 100644 --- a/src/jpeg/jidctred.c +++ b/src/jpeg/jidctred.c @@ -55,20 +55,20 @@ */ #if CONST_BITS == 13 -#define FIX_0_211164243 ((INT32) 1730) /* FIX(0.211164243) */ -#define FIX_0_509795579 ((INT32) 4176) /* FIX(0.509795579) */ -#define FIX_0_601344887 ((INT32) 4926) /* FIX(0.601344887) */ -#define FIX_0_720959822 ((INT32) 5906) /* FIX(0.720959822) */ -#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ -#define FIX_0_850430095 ((INT32) 6967) /* FIX(0.850430095) */ -#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ -#define FIX_1_061594337 ((INT32) 8697) /* FIX(1.061594337) */ -#define FIX_1_272758580 ((INT32) 10426) /* FIX(1.272758580) */ -#define FIX_1_451774981 ((INT32) 11893) /* FIX(1.451774981) */ -#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ -#define FIX_2_172734803 ((INT32) 17799) /* FIX(2.172734803) */ -#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ -#define FIX_3_624509785 ((INT32) 29692) /* FIX(3.624509785) */ +#define FIX_0_211164243 ((JPEG_INT32) 1730) /* FIX(0.211164243) */ +#define FIX_0_509795579 ((JPEG_INT32) 4176) /* FIX(0.509795579) */ +#define FIX_0_601344887 ((JPEG_INT32) 4926) /* FIX(0.601344887) */ +#define FIX_0_720959822 ((JPEG_INT32) 5906) /* FIX(0.720959822) */ +#define FIX_0_765366865 ((JPEG_INT32) 6270) /* FIX(0.765366865) */ +#define FIX_0_850430095 ((JPEG_INT32) 6967) /* FIX(0.850430095) */ +#define FIX_0_899976223 ((JPEG_INT32) 7373) /* FIX(0.899976223) */ +#define FIX_1_061594337 ((JPEG_INT32) 8697) /* FIX(1.061594337) */ +#define FIX_1_272758580 ((JPEG_INT32) 10426) /* FIX(1.272758580) */ +#define FIX_1_451774981 ((JPEG_INT32) 11893) /* FIX(1.451774981) */ +#define FIX_1_847759065 ((JPEG_INT32) 15137) /* FIX(1.847759065) */ +#define FIX_2_172734803 ((JPEG_INT32) 17799) /* FIX(2.172734803) */ +#define FIX_2_562915447 ((JPEG_INT32) 20995) /* FIX(2.562915447) */ +#define FIX_3_624509785 ((JPEG_INT32) 29692) /* FIX(3.624509785) */ #else #define FIX_0_211164243 FIX(0.211164243) #define FIX_0_509795579 FIX(0.509795579) @@ -119,8 +119,8 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - INT32 tmp0, tmp2, tmp10, tmp12; - INT32 z1, z2, z3, z4; + JPEG_INT32 tmp0, tmp2, tmp10, tmp12; + JPEG_INT32 z1, z2, z3, z4; JCOEFPTR inptr; ISLOW_MULT_TYPE * quantptr; int * wsptr; @@ -202,7 +202,7 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { /* AC terms all zero */ - JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) + JSAMPLE dcval = range_limit[(int) DESCALE((JPEG_INT32) wsptr[0], PASS1_BITS+3) & RANGE_MASK]; outptr[0] = dcval; @@ -217,20 +217,20 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Even part */ - tmp0 = ((INT32) wsptr[0]) << (CONST_BITS+1); + tmp0 = ((JPEG_INT32) wsptr[0]) << (CONST_BITS+1); - tmp2 = MULTIPLY((INT32) wsptr[2], FIX_1_847759065) - + MULTIPLY((INT32) wsptr[6], - FIX_0_765366865); + tmp2 = MULTIPLY((JPEG_INT32) wsptr[2], FIX_1_847759065) + + MULTIPLY((JPEG_INT32) wsptr[6], - FIX_0_765366865); tmp10 = tmp0 + tmp2; tmp12 = tmp0 - tmp2; /* Odd part */ - z1 = (INT32) wsptr[7]; - z2 = (INT32) wsptr[5]; - z3 = (INT32) wsptr[3]; - z4 = (INT32) wsptr[1]; + z1 = (JPEG_INT32) wsptr[7]; + z2 = (JPEG_INT32) wsptr[5]; + z3 = (JPEG_INT32) wsptr[3]; + z4 = (JPEG_INT32) wsptr[1]; tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ @@ -272,7 +272,7 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - INT32 tmp0, tmp10, z1; + JPEG_INT32 tmp0, tmp10, z1; JCOEFPTR inptr; ISLOW_MULT_TYPE * quantptr; int * wsptr; @@ -334,7 +334,7 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, #ifndef NO_ZERO_ROW_TEST if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) { /* AC terms all zero */ - JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) + JSAMPLE dcval = range_limit[(int) DESCALE((JPEG_INT32) wsptr[0], PASS1_BITS+3) & RANGE_MASK]; outptr[0] = dcval; @@ -347,14 +347,14 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, /* Even part */ - tmp10 = ((INT32) wsptr[0]) << (CONST_BITS+2); + tmp10 = ((JPEG_INT32) wsptr[0]) << (CONST_BITS+2); /* Odd part */ - tmp0 = MULTIPLY((INT32) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */ - + MULTIPLY((INT32) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */ - + MULTIPLY((INT32) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */ - + MULTIPLY((INT32) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ + tmp0 = MULTIPLY((JPEG_INT32) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */ + + MULTIPLY((JPEG_INT32) wsptr[5], FIX_0_850430095) /* sqrt(2) * (-c1+c3+c5+c7) */ + + MULTIPLY((JPEG_INT32) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */ + + MULTIPLY((JPEG_INT32) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ /* Final output stage */ @@ -390,7 +390,7 @@ jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr, */ quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; dcval = DEQUANTIZE(coef_block[0], quantptr[0]); - dcval = (int) DESCALE((INT32) dcval, 3); + dcval = (int) DESCALE((JPEG_INT32) dcval, 3); output_buf[0][output_col] = range_limit[dcval & RANGE_MASK]; } diff --git a/src/jpeg/jmorecfg.h b/src/jpeg/jmorecfg.h index 29b33d0235..898c2570e9 100644 --- a/src/jpeg/jmorecfg.h +++ b/src/jpeg/jmorecfg.h @@ -155,39 +155,19 @@ typedef unsigned int UINT16; typedef short INT16; #endif -#if defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || defined( __CYGWIN__ ) -#include -#else -#undef wxCHECK_W32API_VERSION -#define wxCHECK_W32API_VERSION(maj, min) (0) -#endif - /* INT32 must hold at least signed 32-bit values. */ -/* you may define INT32_DEFINED if it is already defined somewhere */ -#ifndef INT32_DEFINED -#ifdef XMD_H -/* X11/xmd.h correctly defines INT32 */ -#define INT32_DEFINED -/* Note: GnuPRO 00r1 should be tested because it does NOT define INT32 in windows.h */ -/* For this compiler, set the following test to 0. */ -#elif (_MSC_VER >= 1200) || (__BORLANDC__ >= 0x550) \ - || wxCHECK_W32API_VERSION( 0, 5 ) \ - || ((defined(__MINGW32__) || defined(__CYGWIN__)) \ - && ((__GNUC__>2) || ((__GNUC__==2) && (__GNUC_MINOR__>=95)))) \ - || (defined(__MWERKS__) && defined(__WXMSW__)) - -/* INT32 is defined in windows.h for these compilers */ -#define INT32_DEFINED -#include -#endif -#endif /* !INT32_DEFINED */ - -#ifndef INT32_DEFINED -typedef long INT32; -#endif - -#undef INT32_DEFINED +/* + VZ: due to the horrible mess resulting in INT32 being defined in windows.h + for some compilers but not for the other ones, I have globally replace + INT32 with JPEG_INT32 in libjpeg code to avoid the eight level ifdef + which used to be here. The problem is that, of course, now we'll have + conflicts when upgrading to the next libjpeg release -- however + considering their frequency (1 in the last 5 years) it seems that + it is not too high a price to pay for the clean compilation with all + versions of mingw32 and cygwin + */ +typedef long JPEG_INT32; /* Datatype used for image dimensions. The JPEG standard only supports * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore diff --git a/src/jpeg/jpegint.h b/src/jpeg/jpegint.h index 95b00d405c..51aa6c1f29 100644 --- a/src/jpeg/jpegint.h +++ b/src/jpeg/jpegint.h @@ -280,10 +280,10 @@ struct jpeg_color_quantizer { */ #ifdef RIGHT_SHIFT_IS_UNSIGNED -#define SHIFT_TEMPS INT32 shift_temp; +#define SHIFT_TEMPS JPEG_INT32 shift_temp; #define RIGHT_SHIFT(x,shft) \ ((shift_temp = (x)) < 0 ? \ - (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \ + (shift_temp >> (shft)) | ((~((JPEG_INT32) 0)) << (32-(shft))) : \ (shift_temp >> (shft))) #else #define SHIFT_TEMPS diff --git a/src/jpeg/jquant1.c b/src/jpeg/jquant1.c index b2f96aa15d..b395a20c72 100644 --- a/src/jpeg/jquant1.c +++ b/src/jpeg/jquant1.c @@ -128,8 +128,8 @@ static const UINT8 base_dither_matrix[ODITHER_SIZE][ODITHER_SIZE] = { typedef INT16 FSERROR; /* 16 bits should be enough */ typedef int LOCFSERROR; /* use 'int' for calculation temps */ #else -typedef INT32 FSERROR; /* may need more than 16 bits */ -typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */ +typedef JPEG_INT32 FSERROR; /* may need more than 16 bits */ +typedef JPEG_INT32 LOCFSERROR; /* be sure calculation temps are big enough */ #endif typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ @@ -251,7 +251,7 @@ output_value (j_decompress_ptr cinfo, int ci, int j, int maxj) * (Forcing the upper and lower values to the limits ensures that * dithering can't produce a color outside the selected gamut.) */ - return (int) (((INT32) j * MAXJSAMPLE + maxj/2) / maxj); + return (int) (((JPEG_INT32) j * MAXJSAMPLE + maxj/2) / maxj); } @@ -261,7 +261,7 @@ largest_input_value (j_decompress_ptr cinfo, int ci, int j, int maxj) /* Must have largest(j=0) >= 0, and largest(j=maxj) >= MAXJSAMPLE */ { /* Breakpoints are halfway between values returned by output_value */ - return (int) (((INT32) (2*j + 1) * MAXJSAMPLE + maxj) / (2*maxj)); + return (int) (((JPEG_INT32) (2*j + 1) * MAXJSAMPLE + maxj) / (2*maxj)); } @@ -397,7 +397,7 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors) { ODITHER_MATRIX_PTR odither; int j,k; - INT32 num,den; + JPEG_INT32 num,den; odither = (ODITHER_MATRIX_PTR) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, @@ -407,10 +407,10 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors) * (f=0..N-1) should be (N-1-2*f)/(2*N) * MAXJSAMPLE/(ncolors-1). * On 16-bit-int machine, be careful to avoid overflow. */ - den = 2 * ODITHER_CELLS * ((INT32) (ncolors - 1)); + den = 2 * ODITHER_CELLS * ((JPEG_INT32) (ncolors - 1)); for (j = 0; j < ODITHER_SIZE; j++) { for (k = 0; k < ODITHER_SIZE; k++) { - num = ((INT32) (ODITHER_CELLS-1 - 2*((int)base_dither_matrix[j][k]))) + num = ((JPEG_INT32) (ODITHER_CELLS-1 - 2*((int)base_dither_matrix[j][k]))) * MAXJSAMPLE; /* Ensure round towards zero despite C's lack of consistency * about rounding negative values in integer division... diff --git a/src/jpeg/jquant2.c b/src/jpeg/jquant2.c index af601e334b..570bc990a8 100644 --- a/src/jpeg/jquant2.c +++ b/src/jpeg/jquant2.c @@ -181,8 +181,8 @@ typedef hist2d * hist3d; /* type for top-level pointer */ typedef INT16 FSERROR; /* 16 bits should be enough */ typedef int LOCFSERROR; /* use 'int' for calculation temps */ #else -typedef INT32 FSERROR; /* may need more than 16 bits */ -typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */ +typedef JPEG_INT32 FSERROR; /* may need more than 16 bits */ +typedef JPEG_INT32 LOCFSERROR; /* be sure calculation temps are big enough */ #endif typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ @@ -261,7 +261,7 @@ typedef struct { int c1min, c1max; int c2min, c2max; /* The volume (actually 2-norm) of the box */ - INT32 volume; + JPEG_INT32 volume; /* The number of nonzero histogram cells within this box */ long colorcount; } box; @@ -296,7 +296,7 @@ find_biggest_volume (boxptr boxlist, int numboxes) { register boxptr boxp; register int i; - register INT32 maxv = 0; + register JPEG_INT32 maxv = 0; boxptr which = NULL; for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { @@ -319,7 +319,7 @@ update_box (j_decompress_ptr cinfo, boxptr boxp) histptr histp; int c0,c1,c2; int c0min,c0max,c1min,c1max,c2min,c2max; - INT32 dist0,dist1,dist2; + JPEG_INT32 dist0,dist1,dist2; long ccount; c0min = boxp->c0min; c0max = boxp->c0max; @@ -658,8 +658,8 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, int maxc0, maxc1, maxc2; int centerc0, centerc1, centerc2; int i, x, ncolors; - INT32 minmaxdist, min_dist, max_dist, tdist; - INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */ + JPEG_INT32 minmaxdist, min_dist, max_dist, tdist; + JPEG_INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */ /* Compute true coordinates of update box's upper corner and center. * Actually we compute the coordinates of the center of the upper-corner @@ -783,15 +783,15 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, { int ic0, ic1, ic2; int i, icolor; - register INT32 * bptr; /* pointer into bestdist[] array */ + register JPEG_INT32 * bptr; /* pointer into bestdist[] array */ JSAMPLE * cptr; /* pointer into bestcolor[] array */ - INT32 dist0, dist1; /* initial distance values */ - register INT32 dist2; /* current distance in inner loop */ - INT32 xx0, xx1; /* distance increments */ - register INT32 xx2; - INT32 inc0, inc1, inc2; /* initial values for increments */ + JPEG_INT32 dist0, dist1; /* initial distance values */ + register JPEG_INT32 dist2; /* current distance in inner loop */ + JPEG_INT32 xx0, xx1; /* distance increments */ + register JPEG_INT32 xx2; + JPEG_INT32 inc0, inc1, inc2; /* initial values for increments */ /* This array holds the distance to the nearest-so-far color for each cell */ - INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; + JPEG_INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; /* Initialize best-distance for each cell of the update box */ bptr = bestdist; -- 2.45.2