C++ conversion: fixed compilation errors for jpeg library (INT32 name conflict).

This commit is contained in:
Artem Kharytoniuk 2014-05-11 11:19:08 +03:00
parent f83912ec54
commit e1d1891e39
16 changed files with 82 additions and 82 deletions

View File

@ -19,7 +19,7 @@ typedef struct {
struct jpeg_color_converter pub; /* public fields */ struct jpeg_color_converter pub; /* public fields */
/* Private state for RGB->YCC conversion */ /* 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; } my_color_converter;
typedef my_color_converter * my_cconvert_ptr; 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 SCALEBITS 16 /* speediest right-shift on some machines */
#define CBCR_OFFSET ((INT32) CENTERJSAMPLE << SCALEBITS) #define CBCR_OFFSET ((JPEG_INT32) CENTERJSAMPLE << SCALEBITS)
#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) #define ONE_HALF ((JPEG_INT32) 1 << (SCALEBITS-1))
#define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5)) #define FIX(x) ((JPEG_INT32) ((x) * (1L<<SCALEBITS) + 0.5))
/* We allocate one big table and divide it up into eight parts, instead of /* 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 * doing eight alloc_small requests. This lets us use a single table base
@ -86,13 +86,13 @@ METHODDEF void
rgb_ycc_start (j_compress_ptr cinfo) rgb_ycc_start (j_compress_ptr cinfo)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
INT32 * rgb_ycc_tab; JPEG_INT32 * rgb_ycc_tab;
INT32 i; JPEG_INT32 i;
/* Allocate and fill in the conversion tables. */ /* 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, (*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++) { for (i = 0; i <= MAXJSAMPLE; i++) {
rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * 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; my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
register int r, g, b; 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 inptr;
register JSAMPROW outptr0, outptr1, outptr2; register JSAMPROW outptr0, outptr1, outptr2;
register JDIMENSION col; register JDIMENSION col;
@ -189,7 +189,7 @@ rgb_gray_convert (j_compress_ptr cinfo,
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
register int r, g, b; 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 inptr;
register JSAMPROW outptr; register JSAMPROW outptr;
register JDIMENSION col; register JDIMENSION col;
@ -228,7 +228,7 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
register int r, g, b; 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 inptr;
register JSAMPROW outptr0, outptr1, outptr2, outptr3; register JSAMPROW outptr0, outptr1, outptr2, outptr3;
register JDIMENSION col; register JDIMENSION col;

View File

@ -120,8 +120,8 @@ start_pass_fdctmgr (j_compress_ptr cinfo)
dtbl = fdct->divisors[qtblno]; dtbl = fdct->divisors[qtblno];
for (i = 0; i < DCTSIZE2; i++) { for (i = 0; i < DCTSIZE2; i++) {
dtbl[i] = (DCTELEM) dtbl[i] = (DCTELEM)
DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[jpeg_zigzag_order[i]], DESCALE(MULTIPLY16V16((JPEG_INT32) qtbl->quantval[jpeg_zigzag_order[i]],
(INT32) aanscales[i]), (JPEG_INT32) aanscales[i]),
CONST_BITS-3); CONST_BITS-3);
} }
} }

View File

@ -27,7 +27,7 @@
*/ */
typedef struct { 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 put_bits; /* # of bits now in it */
int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
} savable_state; } savable_state;
@ -272,14 +272,14 @@ emit_bits (working_state * state, unsigned int code, int size)
/* Emit some bits; return TRUE if successful, FALSE if must suspend */ /* Emit some bits; return TRUE if successful, FALSE if must suspend */
{ {
/* This routine is heavily used, so it's worth coding tightly. */ /* 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; register int put_bits = state->cur.put_bits;
/* if size is 0, caller used an invalid Huffman table entry */ /* if size is 0, caller used an invalid Huffman table entry */
if (size == 0) if (size == 0)
ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE); 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 */ put_bits += size; /* new number of bits in buffer */

View File

@ -32,7 +32,7 @@ typedef struct {
*/ */
JOCTET * next_output_byte; /* => next byte to write in buffer */ JOCTET * next_output_byte; /* => next byte to write in buffer */
size_t free_in_buffer; /* # of byte spaces remaining 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 */ int put_bits; /* # of bits now in it */
j_compress_ptr cinfo; /* link to cinfo (needed for dump_buffer) */ j_compress_ptr cinfo; /* link to cinfo (needed for dump_buffer) */
@ -69,8 +69,8 @@ typedef phuff_entropy_encoder * phuff_entropy_ptr;
#define MAX_CORR_BITS 1000 /* Max # of correction bits I can buffer */ #define MAX_CORR_BITS 1000 /* Max # of correction bits I can buffer */
/* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than INT32. /* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than JPEG_INT32.
* We assume that int right shift is unsigned if INT32 right shift is, * We assume that int right shift is unsigned if JPEG_INT32 right shift is,
* which should be safe. * which should be safe.
*/ */
@ -236,7 +236,7 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size)
/* Emit some bits, unless we are in gather mode */ /* Emit some bits, unless we are in gather mode */
{ {
/* This routine is heavily used, so it's worth coding tightly. */ /* 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; register int put_bits = entropy->put_bits;
/* if size is 0, caller used an invalid Huffman table entry */ /* if size is 0, caller used an invalid Huffman table entry */
@ -246,7 +246,7 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size)
if (entropy->gather_statistics) if (entropy->gather_statistics)
return; /* do nothing if we're only getting stats */ 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 */ put_bits += size; /* new number of bits in buffer */

View File

@ -144,7 +144,7 @@ int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */ JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */
JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
JSAMPROW inptr, outptr; JSAMPROW inptr, outptr;
INT32 outvalue; JPEG_INT32 outvalue;
h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor; h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor;
v_expand = cinfo->max_v_samp_factor / compptr->v_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++) { for (v = 0; v < v_expand; v++) {
inptr = input_data[inrow+v] + outcol_h; inptr = input_data[inrow+v] + outcol_h;
for (h = 0; h < h_expand; h++) { for (h = 0; h < h_expand; h++) {
outvalue += (INT32) GETJSAMPLE(*inptr++); outvalue += (JPEG_INT32) GETJSAMPLE(*inptr++);
} }
} }
*outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix); *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix);
@ -296,7 +296,7 @@ h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
JDIMENSION colctr; JDIMENSION colctr;
JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr; 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 /* Expand input data enough to let all the output samples be generated
* by the standard loop. Special-casing padded output would be more * 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 colctr;
JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE; JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
register JSAMPROW inptr, above_ptr, below_ptr, outptr; register JSAMPROW inptr, above_ptr, below_ptr, outptr;
INT32 membersum, neighsum, memberscale, neighscale; JPEG_INT32 membersum, neighsum, memberscale, neighscale;
int colsum, lastcolsum, nextcolsum; int colsum, lastcolsum, nextcolsum;
/* Expand input data enough to let all the output samples be generated /* Expand input data enough to let all the output samples be generated

View File

@ -463,7 +463,7 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
JBLOCK workspace; JBLOCK workspace;
int *coef_bits; int *coef_bits;
JQUANT_TBL *quanttbl; 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 DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9;
int Al, pred; int Al, pred;

View File

@ -21,8 +21,8 @@ typedef struct {
/* Private state for YCC->RGB conversion */ /* Private state for YCC->RGB conversion */
int * Cr_r_tab; /* => table for Cr to R conversion */ int * Cr_r_tab; /* => table for Cr to R conversion */
int * Cb_b_tab; /* => table for Cb to B conversion */ int * Cb_b_tab; /* => table for Cb to B conversion */
INT32 * Cr_g_tab; /* => table for Cr to G conversion */ JPEG_INT32 * Cr_g_tab; /* => table for Cr to G conversion */
INT32 * Cb_g_tab; /* => table for Cb to G conversion */ JPEG_INT32 * Cb_g_tab; /* => table for Cb to G conversion */
} my_color_deconverter; } my_color_deconverter;
typedef my_color_deconverter * my_cconvert_ptr; 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 SCALEBITS 16 /* speediest right-shift on some machines */
#define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) #define ONE_HALF ((JPEG_INT32) 1 << (SCALEBITS-1))
#define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5)) #define FIX(x) ((JPEG_INT32) ((x) * (1L<<SCALEBITS) + 0.5))
/* /*
@ -71,7 +71,7 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
{ {
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
int i; int i;
INT32 x; JPEG_INT32 x;
SHIFT_TEMPS SHIFT_TEMPS
cconvert->Cr_r_tab = (int *) cconvert->Cr_r_tab = (int *)
@ -80,12 +80,12 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
cconvert->Cb_b_tab = (int *) cconvert->Cb_b_tab = (int *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
(MAXJSAMPLE+1) * SIZEOF(int)); (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, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
(MAXJSAMPLE+1) * SIZEOF(INT32)); (MAXJSAMPLE+1) * SIZEOF(JPEG_INT32));
cconvert->Cb_g_tab = (INT32 *) cconvert->Cb_g_tab = (JPEG_INT32 *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*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++) { for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
/* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ /* 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 JSAMPLE * range_limit = cinfo->sample_range_limit;
register int * Crrtab = cconvert->Cr_r_tab; register int * Crrtab = cconvert->Cr_r_tab;
register int * Cbbtab = cconvert->Cb_b_tab; register int * Cbbtab = cconvert->Cb_b_tab;
register INT32 * Crgtab = cconvert->Cr_g_tab; register JPEG_INT32 * Crgtab = cconvert->Cr_g_tab;
register INT32 * Cbgtab = cconvert->Cb_g_tab; register JPEG_INT32 * Cbgtab = cconvert->Cb_g_tab;
SHIFT_TEMPS SHIFT_TEMPS
while (--num_rows >= 0) { while (--num_rows >= 0) {
@ -229,8 +229,8 @@ ycck_cmyk_convert (j_decompress_ptr cinfo,
register JSAMPLE * range_limit = cinfo->sample_range_limit; register JSAMPLE * range_limit = cinfo->sample_range_limit;
register int * Crrtab = cconvert->Cr_r_tab; register int * Crrtab = cconvert->Cr_r_tab;
register int * Cbbtab = cconvert->Cb_b_tab; register int * Cbbtab = cconvert->Cb_b_tab;
register INT32 * Crgtab = cconvert->Cr_g_tab; register JPEG_INT32 * Crgtab = cconvert->Cr_g_tab;
register INT32 * Cbgtab = cconvert->Cb_g_tab; register JPEG_INT32 * Cbgtab = cconvert->Cb_g_tab;
SHIFT_TEMPS SHIFT_TEMPS
while (--num_rows >= 0) { while (--num_rows >= 0) {

View File

@ -16,7 +16,7 @@
/* /*
* A forward DCT routine is given a pointer to a work area of type DCTELEM[]; * A forward DCT routine is given a pointer to a work area of type DCTELEM[];
* the DCT is to be performed in-place in that buffer. Type DCTELEM is int * the DCT is to be performed in-place in that buffer. Type DCTELEM is int
* for 8-bit samples, INT32 for 12-bit samples. (NOTE: Floating-point DCT * for 8-bit samples, JPEG_INT32 for 12-bit samples. (NOTE: Floating-point DCT
* implementations use an array of type FAST_FLOAT, instead.) * implementations use an array of type FAST_FLOAT, instead.)
* The DCT inputs are expected to be signed (range +-CENTERJSAMPLE). * The DCT inputs are expected to be signed (range +-CENTERJSAMPLE).
* The DCT outputs are returned scaled up by a factor of 8; they therefore * The DCT outputs are returned scaled up by a factor of 8; they therefore
@ -29,7 +29,7 @@
#if BITS_IN_JSAMPLE == 8 #if BITS_IN_JSAMPLE == 8
typedef int DCTELEM; /* 16 or 32 bits is fine */ typedef int DCTELEM; /* 16 or 32 bits is fine */
#else #else
typedef INT32 DCTELEM; /* must have 32 bits */ typedef JPEG_INT32 DCTELEM; /* must have 32 bits */
#endif #endif
typedef JMETHOD(void, forward_DCT_method_ptr, (DCTELEM * data)); 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 */ typedef MULTIPLIER IFAST_MULT_TYPE; /* 16 bits is OK, use short if faster */
#define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */ #define IFAST_SCALE_BITS 2 /* fractional bits in scale factors */
#else #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 */ #define IFAST_SCALE_BITS 13 /* fractional bits in scale factors */
#endif #endif
typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
@ -122,13 +122,13 @@ EXTERN void jpeg_idct_1x1
* Macros for handling fixed-point arithmetic; these are used by many * Macros for handling fixed-point arithmetic; these are used by many
* but not all of the DCT/IDCT modules. * but not all of the DCT/IDCT modules.
* *
* All values are expected to be of type INT32. * All values are expected to be of type JPEG_INT32.
* Fractional constants are scaled left by CONST_BITS bits. * Fractional constants are scaled left by CONST_BITS bits.
* CONST_BITS is defined within each module using these macros, * CONST_BITS is defined within each module using these macros,
* and may differ from one module to the next. * and may differ from one module to the next.
*/ */
#define ONE ((INT32) 1) #define ONE ((JPEG_INT32) 1)
#define CONST_SCALE (ONE << CONST_BITS) #define CONST_SCALE (ONE << CONST_BITS)
/* Convert a positive real constant to an integer scaled by CONST_SCALE. /* Convert a positive real constant to an integer scaled by CONST_SCALE.
@ -136,16 +136,16 @@ EXTERN void jpeg_idct_1x1
* thus causing a lot of useless floating-point operations at run time. * 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. /* Descale and correctly round an JPEG_INT32 value that's scaled by N bits.
* We assume RIGHT_SHIFT rounds towards minus infinity, so adding * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
* the fudge factor is correct for either sign of X. * the fudge factor is correct for either sign of X.
*/ */
#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n) #define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. /* Multiply an JPEG_INT32 variable by an JPEG_INT32 constant to yield an JPEG_INT32 result.
* This macro is used only when the two inputs will actually be no more than * This macro is used only when the two inputs will actually be no more than
* 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a * 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a
* full 32x32 multiply. This provides a useful speedup on many machines. * full 32x32 multiply. This provides a useful speedup on many machines.
@ -158,7 +158,7 @@ EXTERN void jpeg_idct_1x1
#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT16) (const))) #define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT16) (const)))
#endif #endif
#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ #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 #endif
#ifndef MULTIPLY16C16 /* default definition */ #ifndef MULTIPLY16C16 /* default definition */

View File

@ -197,8 +197,8 @@ start_pass (j_decompress_ptr cinfo)
for (i = 0; i < DCTSIZE2; i++) { for (i = 0; i < DCTSIZE2; i++) {
ifmtbl[i] = (IFAST_MULT_TYPE) ifmtbl[i] = (IFAST_MULT_TYPE)
DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[jpeg_zigzag_order[i]], DESCALE(MULTIPLY16V16((JPEG_INT32) qtbl->quantval[jpeg_zigzag_order[i]],
(INT32) aanscales[i]), (JPEG_INT32) aanscales[i]),
CONST_BITS-IFAST_SCALE_BITS); CONST_BITS-IFAST_SCALE_BITS);
} }
} }

View File

@ -324,7 +324,7 @@ jpeg_huff_decode (bitread_working_state * state,
d_derived_tbl * htbl, int min_bits) d_derived_tbl * htbl, int min_bits)
{ {
register int l = 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 */ /* HUFF_DECODE has determined that the code is at least min_bits */
/* bits long, so fetch that many bits in one swoop. */ /* bits long, so fetch that many bits in one swoop. */

View File

@ -25,8 +25,8 @@
typedef struct { typedef struct {
/* Basic tables: (element [0] of each array is unused) */ /* Basic tables: (element [0] of each array is unused) */
INT32 mincode[17]; /* smallest code of length k */ JPEG_INT32 mincode[17]; /* smallest code of length k */
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) */ /* (maxcode[17] is a sentinel to ensure jpeg_huff_decode terminates) */
int valptr[17]; /* huffval[] index of 1st symbol of length k */ int valptr[17]; /* huffval[] index of 1st symbol of length k */
@ -65,7 +65,7 @@ EXTERN void jpeg_make_d_derived_tbl JPP((j_decompress_ptr cinfo,
* necessary. * 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 */ #define BIT_BUF_SIZE 32 /* size of buffer in bits */
/* If long is > 32 bits on your machine, and shifting/masking longs is /* If long is > 32 bits on your machine, and shifting/masking longs is

View File

@ -129,7 +129,7 @@ typedef enum { /* JPEG marker codes */
V = GETJOCTET(*next_input_byte++); ) V = GETJOCTET(*next_input_byte++); )
/* As above, but read two bytes interpreted as an unsigned 16-bit integer. /* As above, but read two bytes interpreted as an unsigned 16-bit integer.
* V should be declared unsigned int or perhaps INT32. * V should be declared unsigned int or perhaps JPEG_INT32.
*/ */
#define INPUT_2BYTES(cinfo,V,action) \ #define INPUT_2BYTES(cinfo,V,action) \
MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
@ -204,7 +204,7 @@ LOCAL boolean
get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
/* Process a SOFn marker */ /* Process a SOFn marker */
{ {
INT32 length; JPEG_INT32 length;
int c, ci; int c, ci;
jpeg_component_info * compptr; jpeg_component_info * compptr;
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
@ -268,7 +268,7 @@ LOCAL boolean
get_sos (j_decompress_ptr cinfo) get_sos (j_decompress_ptr cinfo)
/* Process a SOS marker */ /* Process a SOS marker */
{ {
INT32 length; JPEG_INT32 length;
int i, ci, n, c, cc; int i, ci, n, c, cc;
jpeg_component_info * compptr; jpeg_component_info * compptr;
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
@ -339,7 +339,7 @@ get_app0 (j_decompress_ptr cinfo)
/* Process an APP0 marker */ /* Process an APP0 marker */
{ {
#define JFIF_LEN 14 #define JFIF_LEN 14
INT32 length; JPEG_INT32 length;
UINT8 b[JFIF_LEN]; UINT8 b[JFIF_LEN];
int buffp; int buffp;
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
@ -374,7 +374,7 @@ get_app0 (j_decompress_ptr cinfo)
cinfo->X_density, cinfo->Y_density, cinfo->density_unit); cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
if (b[12] | b[13]) if (b[12] | b[13])
TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, b[12], b[13]); TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, b[12], b[13]);
if (length != ((INT32) b[12] * (INT32) b[13] * (INT32) 3)) if (length != ((JPEG_INT32) b[12] * (JPEG_INT32) b[13] * (JPEG_INT32) 3))
TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) length); TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) length);
} else { } else {
/* Start of APP0 does not match "JFIF" */ /* Start of APP0 does not match "JFIF" */
@ -398,7 +398,7 @@ get_app14 (j_decompress_ptr cinfo)
/* Process an APP14 marker */ /* Process an APP14 marker */
{ {
#define ADOBE_LEN 12 #define ADOBE_LEN 12
INT32 length; JPEG_INT32 length;
UINT8 b[ADOBE_LEN]; UINT8 b[ADOBE_LEN];
int buffp; int buffp;
unsigned int version, flags0, flags1, transform; unsigned int version, flags0, flags1, transform;
@ -444,7 +444,7 @@ LOCAL boolean
get_dac (j_decompress_ptr cinfo) get_dac (j_decompress_ptr cinfo)
/* Process a DAC marker */ /* Process a DAC marker */
{ {
INT32 length; JPEG_INT32 length;
int index, val; int index, val;
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
@ -481,7 +481,7 @@ LOCAL boolean
get_dht (j_decompress_ptr cinfo) get_dht (j_decompress_ptr cinfo)
/* Process a DHT marker */ /* Process a DHT marker */
{ {
INT32 length; JPEG_INT32 length;
UINT8 bits[17]; UINT8 bits[17];
UINT8 huffval[256]; UINT8 huffval[256];
int i, index, count; int i, index, count;
@ -512,7 +512,7 @@ get_dht (j_decompress_ptr cinfo)
bits[9], bits[10], bits[11], bits[12], bits[9], bits[10], bits[11], bits[12],
bits[13], bits[14], bits[15], bits[16]); bits[13], bits[14], bits[15], bits[16]);
if (count > 256 || ((INT32) count) > length) if (count > 256 || ((JPEG_INT32) count) > length)
ERREXIT(cinfo, JERR_DHT_COUNTS); ERREXIT(cinfo, JERR_DHT_COUNTS);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
@ -546,7 +546,7 @@ LOCAL boolean
get_dqt (j_decompress_ptr cinfo) get_dqt (j_decompress_ptr cinfo)
/* Process a DQT marker */ /* Process a DQT marker */
{ {
INT32 length; JPEG_INT32 length;
int n, i, prec; int n, i, prec;
unsigned int tmp; unsigned int tmp;
JQUANT_TBL *quant_ptr; JQUANT_TBL *quant_ptr;
@ -598,7 +598,7 @@ LOCAL boolean
get_dri (j_decompress_ptr cinfo) get_dri (j_decompress_ptr cinfo)
/* Process a DRI marker */ /* Process a DRI marker */
{ {
INT32 length; JPEG_INT32 length;
unsigned int tmp; unsigned int tmp;
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
@ -622,7 +622,7 @@ METHODDEF boolean
skip_variable (j_decompress_ptr cinfo) skip_variable (j_decompress_ptr cinfo)
/* Skip over an unknown or uninteresting variable-length marker */ /* Skip over an unknown or uninteresting variable-length marker */
{ {
INT32 length; JPEG_INT32 length;
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
INPUT_2BYTES(cinfo, length, return FALSE); INPUT_2BYTES(cinfo, length, return FALSE);

View File

@ -350,7 +350,7 @@ h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr,
#if BITS_IN_JSAMPLE == 8 #if BITS_IN_JSAMPLE == 8
register int thiscolsum, lastcolsum, nextcolsum; register int thiscolsum, lastcolsum, nextcolsum;
#else #else
register INT32 thiscolsum, lastcolsum, nextcolsum; register JPEG_INT32 thiscolsum, lastcolsum, nextcolsum;
#endif #endif
register JDIMENSION colctr; register JDIMENSION colctr;
int inrow, outrow, v; int inrow, outrow, v;

View File

@ -217,21 +217,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 */ /* 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]; & 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]; & 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]; & 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]; & 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]; & 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]; & 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]; & 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]; & RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */

View File

@ -149,7 +149,7 @@ typedef unsigned short UINT16;
typedef unsigned int UINT16; typedef unsigned int UINT16;
#endif /* HAVE_UNSIGNED_SHORT */ #endif /* HAVE_UNSIGNED_SHORT */
typedef long INT32; typedef long JPEG_INT32;
/* INT16 must hold at least the values -32768..32767. */ /* INT16 must hold at least the values -32768..32767. */
@ -157,10 +157,10 @@ typedef long INT32;
typedef short INT16; typedef short INT16;
#endif #endif
/* INT32 must hold at least signed 32-bit values. */ /* JPEG_INT32 must hold at least signed 32-bit values. */
//#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ //#ifndef XMD_H /* X11/xmd.h correctly defines JPEG_INT32 */
//typedef long INT32; //typedef long JPEG_INT32;
//#endif //#endif
/* Datatype used for image dimensions. The JPEG standard only supports /* Datatype used for image dimensions. The JPEG standard only supports

View File

@ -272,16 +272,16 @@ struct jpeg_color_quantizer {
* shift" instructions that shift in copies of the sign bit. But some * shift" instructions that shift in copies of the sign bit. But some
* C compilers implement >> with an unsigned shift. For these machines you * C compilers implement >> with an unsigned shift. For these machines you
* must define RIGHT_SHIFT_IS_UNSIGNED. * must define RIGHT_SHIFT_IS_UNSIGNED.
* RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity. * RIGHT_SHIFT provides a proper signed right shift of an JPEG_INT32 quantity.
* It is only applied with constant shift counts. SHIFT_TEMPS must be * It is only applied with constant shift counts. SHIFT_TEMPS must be
* included in the variables of any routine using RIGHT_SHIFT. * included in the variables of any routine using RIGHT_SHIFT.
*/ */
#ifdef RIGHT_SHIFT_IS_UNSIGNED #ifdef RIGHT_SHIFT_IS_UNSIGNED
#define SHIFT_TEMPS INT32 shift_temp; #define SHIFT_TEMPS JPEG_INT32 shift_temp;
#define RIGHT_SHIFT(x,shft) \ #define RIGHT_SHIFT(x,shft) \
((shift_temp = (x)) < 0 ? \ ((shift_temp = (x)) < 0 ? \
(shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \ (shift_temp >> (shft)) | ((~((JPEG_INT32) 0)) << (32-(shft))) : \
(shift_temp >> (shft))) (shift_temp >> (shft)))
#else #else
#define SHIFT_TEMPS #define SHIFT_TEMPS