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;
*/
#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<<SCALEBITS) + 0.5))
+#define CBCR_OFFSET ((JPEG_INT32) CENTERJSAMPLE << SCALEBITS)
+#define ONE_HALF ((JPEG_INT32) 1 << (SCALEBITS-1))
+#define FIX(x) ((JPEG_INT32) ((x) * (1L<<SCALEBITS) + 0.5))
/* We allocate one big table and divide it up into eight parts, instead of
* doing eight alloc_small requests. This lets us use a single table base
rgb_ycc_start (j_compress_ptr cinfo)
{
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->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;
{
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;
{
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;
{
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;
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);
}
}
*/
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;
/* 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++;
/* 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)<<size) - 1; /* mask off any extra bits in code */
+ put_buffer &= (((JPEG_INT32) 1)<<size) - 1; /* mask off any extra bits in code */
put_bits += size; /* new number of bits in buffer */
*/
JOCTET * next_output_byte; /* => 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) */
/* 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 */
if (entropy->gather_statistics)
return; /* do nothing if we're only getting stats */
- put_buffer &= (((INT32) 1)<<size) - 1; /* mask off any extra bits in code */
+ put_buffer &= (((JPEG_INT32) 1)<<size) - 1; /* mask off any extra bits in code */
put_bits += size; /* new number of bits in buffer */
JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */
JDIMENSION output_cols = compptr->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;
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);
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
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
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;
/* 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;
*/
#define SCALEBITS 16 /* speediest right-shift on some machines */
-#define ONE_HALF ((INT32) 1 << (SCALEBITS-1))
-#define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
+#define ONE_HALF ((JPEG_INT32) 1 << (SCALEBITS-1))
+#define FIX(x) ((JPEG_INT32) ((x) * (1L<<SCALEBITS) + 0.5))
/*
{
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
int i;
- INT32 x;
+ JPEG_INT32 x;
SHIFT_TEMPS
cconvert->Cr_r_tab = (int *)
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 */
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) {
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) {
#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));
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 */
* 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.
* 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
#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 */
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);
}
}
/* 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++;
/* 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 {
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. */
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]]
* 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
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);
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);
get_dac (j_decompress_ptr cinfo)
/* Process a DAC marker */
{
- INT32 length;
+ JPEG_INT32 length;
int index, val;
INPUT_VARS(cinfo);
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;
/* 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++)
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;
get_dri (j_decompress_ptr cinfo)
/* Process a DRI marker */
{
- INT32 length;
+ JPEG_INT32 length;
unsigned int tmp;
INPUT_VARS(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 &&
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 &&
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.
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);
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) {
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);
/* 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
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<<SCALEBITS) + 0.5))
+#define ONE_HALF ((JPEG_INT32) 1 << (SCALEBITS-1))
+#define FIX(x) ((JPEG_INT32) ((x) * (1L<<SCALEBITS) + 0.5))
/*
{
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
int i;
- INT32 x;
+ JPEG_INT32 x;
SHIFT_TEMPS
upsample->Cr_r_tab = (int *)
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 */
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];
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];
#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;
*/
#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)
*/
#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)
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
/* 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 */
*/
#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)
*/
#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)
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;
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;
/* 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;
* 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;
*/
#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)
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;
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;
/* 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) */
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;
#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;
/* 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 */
*/
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];
}
typedef short INT16;
#endif
-#if defined( __GNUWIN32__ ) || defined( __MINGW32__ ) || defined( __CYGWIN__ )
-#include <wx/msw/gccpriv.h>
-#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 <windows.h>
-#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
*/
#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
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!) */
* (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);
}
/* 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));
}
{
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,
* (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...
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!) */
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;
{
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++) {
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;
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
{
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;