Commit 56d69eee authored by Davis King's avatar Davis King

Just removed some typedefs because they cause name conflicts in

visual studio 2010.  So I just replaced the uses of the typedef
with the actual type.
parent fa25ae78
...@@ -238,7 +238,7 @@ default_decompress_parms (j_decompress_ptr cinfo) ...@@ -238,7 +238,7 @@ default_decompress_parms (j_decompress_ptr cinfo)
*/ */
GLOBAL(int) GLOBAL(int)
jpeg_read_header (j_decompress_ptr cinfo, boolean require_image) jpeg_read_header (j_decompress_ptr cinfo, int require_image)
{ {
int retcode; int retcode;
...@@ -330,7 +330,7 @@ jpeg_consume_input (j_decompress_ptr cinfo) ...@@ -330,7 +330,7 @@ jpeg_consume_input (j_decompress_ptr cinfo)
* Have we finished reading the input file? * Have we finished reading the input file?
*/ */
GLOBAL(boolean) GLOBAL(int)
jpeg_input_complete (j_decompress_ptr cinfo) jpeg_input_complete (j_decompress_ptr cinfo)
{ {
/* Check for valid jpeg object */ /* Check for valid jpeg object */
...@@ -345,7 +345,7 @@ jpeg_input_complete (j_decompress_ptr cinfo) ...@@ -345,7 +345,7 @@ jpeg_input_complete (j_decompress_ptr cinfo)
* Is there more than one scan? * Is there more than one scan?
*/ */
GLOBAL(boolean) GLOBAL(int)
jpeg_has_multiple_scans (j_decompress_ptr cinfo) jpeg_has_multiple_scans (j_decompress_ptr cinfo)
{ {
/* Only valid after jpeg_read_header completes */ /* Only valid after jpeg_read_header completes */
...@@ -365,7 +365,7 @@ jpeg_has_multiple_scans (j_decompress_ptr cinfo) ...@@ -365,7 +365,7 @@ jpeg_has_multiple_scans (j_decompress_ptr cinfo)
* a suspending data source is used. * a suspending data source is used.
*/ */
GLOBAL(boolean) GLOBAL(int)
jpeg_finish_decompress (j_decompress_ptr cinfo) jpeg_finish_decompress (j_decompress_ptr cinfo)
{ {
if ((cinfo->global_state == DSTATE_SCANNING || if ((cinfo->global_state == DSTATE_SCANNING ||
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/* Forward declarations */ /* Forward declarations */
LOCAL(boolean) output_pass_setup JPP((j_decompress_ptr cinfo)); LOCAL(int) output_pass_setup JPP((j_decompress_ptr cinfo));
/* /*
...@@ -34,7 +34,7 @@ LOCAL(boolean) output_pass_setup JPP((j_decompress_ptr cinfo)); ...@@ -34,7 +34,7 @@ LOCAL(boolean) output_pass_setup JPP((j_decompress_ptr cinfo));
* a suspending data source is used. * a suspending data source is used.
*/ */
GLOBAL(boolean) GLOBAL(int)
jpeg_start_decompress (j_decompress_ptr cinfo) jpeg_start_decompress (j_decompress_ptr cinfo)
{ {
if (cinfo->global_state == DSTATE_READY) { if (cinfo->global_state == DSTATE_READY) {
...@@ -91,7 +91,7 @@ jpeg_start_decompress (j_decompress_ptr cinfo) ...@@ -91,7 +91,7 @@ jpeg_start_decompress (j_decompress_ptr cinfo)
* If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN. * If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN.
*/ */
LOCAL(boolean) LOCAL(int)
output_pass_setup (j_decompress_ptr cinfo) output_pass_setup (j_decompress_ptr cinfo)
{ {
if (cinfo->global_state != DSTATE_PRESCAN) { if (cinfo->global_state != DSTATE_PRESCAN) {
...@@ -224,7 +224,7 @@ jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data, ...@@ -224,7 +224,7 @@ jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
* Initialize for an output pass in buffered-image mode. * Initialize for an output pass in buffered-image mode.
*/ */
GLOBAL(boolean) GLOBAL(int)
jpeg_start_output (j_decompress_ptr cinfo, int scan_number) jpeg_start_output (j_decompress_ptr cinfo, int scan_number)
{ {
if (cinfo->global_state != DSTATE_BUFIMAGE && if (cinfo->global_state != DSTATE_BUFIMAGE &&
...@@ -249,7 +249,7 @@ jpeg_start_output (j_decompress_ptr cinfo, int scan_number) ...@@ -249,7 +249,7 @@ jpeg_start_output (j_decompress_ptr cinfo, int scan_number)
* a suspending data source is used. * a suspending data source is used.
*/ */
GLOBAL(boolean) GLOBAL(int)
jpeg_finish_output (j_decompress_ptr cinfo) jpeg_finish_output (j_decompress_ptr cinfo)
{ {
if ((cinfo->global_state == DSTATE_SCANNING || if ((cinfo->global_state == DSTATE_SCANNING ||
......
...@@ -27,7 +27,7 @@ typedef struct { ...@@ -27,7 +27,7 @@ typedef struct {
FILE * infile; /* source stream */ FILE * infile; /* source stream */
JOCTET * buffer; /* start of buffer */ JOCTET * buffer; /* start of buffer */
boolean start_of_file; /* have we gotten any data yet? */ int start_of_file; /* have we gotten any data yet? */
} my_source_mgr; } my_source_mgr;
typedef my_source_mgr * my_src_ptr; typedef my_source_mgr * my_src_ptr;
...@@ -86,7 +86,7 @@ init_source (j_decompress_ptr cinfo) ...@@ -86,7 +86,7 @@ init_source (j_decompress_ptr cinfo)
* the front of the buffer rather than discarding it. * the front of the buffer rather than discarding it.
*/ */
METHODDEF(boolean) METHODDEF(int)
fill_input_buffer (j_decompress_ptr cinfo) fill_input_buffer (j_decompress_ptr cinfo)
{ {
my_src_ptr src = (my_src_ptr) cinfo->src; my_src_ptr src = (my_src_ptr) cinfo->src;
......
...@@ -69,7 +69,7 @@ METHODDEF(int) decompress_data ...@@ -69,7 +69,7 @@ METHODDEF(int) decompress_data
JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
#endif #endif
#ifdef BLOCK_SMOOTHING_SUPPORTED #ifdef BLOCK_SMOOTHING_SUPPORTED
LOCAL(boolean) smoothing_ok JPP((j_decompress_ptr cinfo)); LOCAL(int) smoothing_ok JPP((j_decompress_ptr cinfo));
METHODDEF(int) decompress_smooth_data METHODDEF(int) decompress_smooth_data
JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
#endif #endif
...@@ -401,11 +401,11 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) ...@@ -401,11 +401,11 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
* more accurately than they really are. * more accurately than they really are.
*/ */
LOCAL(boolean) LOCAL(int)
smoothing_ok (j_decompress_ptr cinfo) smoothing_ok (j_decompress_ptr cinfo)
{ {
my_coef_ptr coef = (my_coef_ptr) cinfo->coef; my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
boolean smoothing_useful = FALSE; int smoothing_useful = FALSE;
int ci, coefi; int ci, coefi;
jpeg_component_info *compptr; jpeg_component_info *compptr;
JQUANT_TBL * qtable; JQUANT_TBL * qtable;
...@@ -470,11 +470,11 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) ...@@ -470,11 +470,11 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
JDIMENSION output_col; JDIMENSION output_col;
jpeg_component_info *compptr; jpeg_component_info *compptr;
inverse_DCT_method_ptr inverse_DCT; inverse_DCT_method_ptr inverse_DCT;
boolean first_row, last_row; int first_row, last_row;
JBLOCK workspace; JBLOCK workspace;
int *coef_bits; int *coef_bits;
JQUANT_TBL *quanttbl; JQUANT_TBL *quanttbl;
INT32 Q00,Q01,Q02,Q10,Q11,Q20, num; long 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;
...@@ -673,7 +673,7 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) ...@@ -673,7 +673,7 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
*/ */
GLOBAL(void) GLOBAL(void)
jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) jinit_d_coef_controller (j_decompress_ptr cinfo, int need_full_buffer)
{ {
my_coef_ptr coef; my_coef_ptr coef;
......
...@@ -21,8 +21,8 @@ typedef struct { ...@@ -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 */ long * Cr_g_tab; /* => table for Cr to G conversion */
INT32 * Cb_g_tab; /* => table for Cb to G conversion */ long * 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; ...@@ -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 ((long) 1 << (SCALEBITS-1))
#define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5)) #define FIX(x) ((long) ((x) * (1L<<SCALEBITS) + 0.5))
/* /*
...@@ -71,7 +71,7 @@ build_ycc_rgb_table (j_decompress_ptr cinfo) ...@@ -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; long 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) ...@@ -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 = (long *)
(*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(long));
cconvert->Cb_g_tab = (INT32 *) cconvert->Cb_g_tab = (long *)
(*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(long));
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, ...@@ -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 long * Crgtab = cconvert->Cr_g_tab;
register INT32 * Cbgtab = cconvert->Cb_g_tab; register long * Cbgtab = cconvert->Cb_g_tab;
SHIFT_TEMPS SHIFT_TEMPS
while (--num_rows >= 0) { while (--num_rows >= 0) {
...@@ -256,8 +256,8 @@ ycck_cmyk_convert (j_decompress_ptr cinfo, ...@@ -256,8 +256,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 long * Crgtab = cconvert->Cr_g_tab;
register INT32 * Cbgtab = cconvert->Cb_g_tab; register long * Cbgtab = cconvert->Cb_g_tab;
SHIFT_TEMPS SHIFT_TEMPS
while (--num_rows >= 0) { while (--num_rows >= 0) {
......
...@@ -16,7 +16,7 @@ ...@@ -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, long 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 @@ ...@@ -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 long 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 */ ...@@ -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 long 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 ...@@ -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 long.
* 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 ((long) 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 ...@@ -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) ((long) ((x) * CONST_SCALE + 0.5))
/* Descale and correctly round an INT32 value that's scaled by N bits. /* Descale and correctly round an long 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 long variable by an long constant to yield an long 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.
...@@ -155,10 +155,10 @@ EXTERN(void) jpeg_idct_1x1 ...@@ -155,10 +155,10 @@ EXTERN(void) jpeg_idct_1x1
*/ */
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ #ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
#define MULTIPLY16C16(var,const) (((INT16) (var)) * ((INT16) (const))) #define MULTIPLY16C16(var,const) (((short) (var)) * ((short) (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) (((short) (var)) * ((long) (const)))
#endif #endif
#ifndef MULTIPLY16C16 /* default definition */ #ifndef MULTIPLY16C16 /* default definition */
...@@ -168,7 +168,7 @@ EXTERN(void) jpeg_idct_1x1 ...@@ -168,7 +168,7 @@ EXTERN(void) jpeg_idct_1x1
/* Same except both inputs are variables. */ /* Same except both inputs are variables. */
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ #ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
#define MULTIPLY16V16(var1,var2) (((INT16) (var1)) * ((INT16) (var2))) #define MULTIPLY16V16(var1,var2) (((short) (var1)) * ((short) (var2)))
#endif #endif
#ifndef MULTIPLY16V16 /* default definition */ #ifndef MULTIPLY16V16 /* default definition */
......
...@@ -182,7 +182,7 @@ start_pass (j_decompress_ptr cinfo) ...@@ -182,7 +182,7 @@ start_pass (j_decompress_ptr cinfo)
*/ */
IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table; IFAST_MULT_TYPE * ifmtbl = (IFAST_MULT_TYPE *) compptr->dct_table;
#define CONST_BITS 14 #define CONST_BITS 14
static const INT16 aanscales[DCTSIZE2] = { static const short aanscales[DCTSIZE2] = {
/* precomputed values scaled up by 14 bits */ /* precomputed values scaled up by 14 bits */
16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520, 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270, 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270,
...@@ -197,8 +197,8 @@ start_pass (j_decompress_ptr cinfo) ...@@ -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[i], DESCALE(MULTIPLY16V16((long) qtbl->quantval[i],
(INT32) aanscales[i]), (long) aanscales[i]),
CONST_BITS-IFAST_SCALE_BITS); CONST_BITS-IFAST_SCALE_BITS);
} }
} }
......
...@@ -71,8 +71,8 @@ typedef struct { ...@@ -71,8 +71,8 @@ typedef struct {
d_derived_tbl * dc_cur_tbls[D_MAX_BLOCKS_IN_MCU]; d_derived_tbl * dc_cur_tbls[D_MAX_BLOCKS_IN_MCU];
d_derived_tbl * ac_cur_tbls[D_MAX_BLOCKS_IN_MCU]; d_derived_tbl * ac_cur_tbls[D_MAX_BLOCKS_IN_MCU];
/* Whether we care about the DC and AC coefficient values for each block */ /* Whether we care about the DC and AC coefficient values for each block */
boolean dc_needed[D_MAX_BLOCKS_IN_MCU]; int dc_needed[D_MAX_BLOCKS_IN_MCU];
boolean ac_needed[D_MAX_BLOCKS_IN_MCU]; int ac_needed[D_MAX_BLOCKS_IN_MCU];
} huff_entropy_decoder; } huff_entropy_decoder;
typedef huff_entropy_decoder * huff_entropy_ptr; typedef huff_entropy_decoder * huff_entropy_ptr;
...@@ -146,7 +146,7 @@ start_pass_huff_decoder (j_decompress_ptr cinfo) ...@@ -146,7 +146,7 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
*/ */
GLOBAL(void) GLOBAL(void)
jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, int isDC, int tblno,
d_derived_tbl ** pdtbl) d_derived_tbl ** pdtbl)
{ {
JHUFF_TBL *htbl; JHUFF_TBL *htbl;
...@@ -204,7 +204,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, ...@@ -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 /* 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. * it must still fit in si bits, since no code is allowed to be all ones.
*/ */
if (((INT32) code) >= (((INT32) 1) << si)) if (((long) code) >= (((long) 1) << si))
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
code <<= 1; code <<= 1;
si++; si++;
...@@ -218,7 +218,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, ...@@ -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, /* valoffset[l] = huffval[] index of 1st symbol of code length l,
* minus the minimum code of length l * minus the minimum code of length l
*/ */
dtbl->valoffset[l] = (INT32) p - (INT32) huffcode[p]; dtbl->valoffset[l] = (long) p - (long) huffcode[p];
p += htbl->bits[l]; p += htbl->bits[l];
dtbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */ dtbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */
} else { } else {
...@@ -288,7 +288,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, ...@@ -288,7 +288,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
#endif #endif
GLOBAL(boolean) GLOBAL(int)
jpeg_fill_bit_buffer (bitread_working_state * state, jpeg_fill_bit_buffer (bitread_working_state * state,
register bit_buf_type get_buffer, register int bits_left, register bit_buf_type get_buffer, register int bits_left,
int nbits) int nbits)
...@@ -400,7 +400,7 @@ jpeg_huff_decode (bitread_working_state * state, ...@@ -400,7 +400,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 long 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. */
...@@ -464,7 +464,7 @@ static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ ...@@ -464,7 +464,7 @@ static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
* Returns FALSE if must suspend. * Returns FALSE if must suspend.
*/ */
LOCAL(boolean) LOCAL(int)
process_restart (j_decompress_ptr cinfo) process_restart (j_decompress_ptr cinfo)
{ {
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
...@@ -513,7 +513,7 @@ process_restart (j_decompress_ptr cinfo) ...@@ -513,7 +513,7 @@ process_restart (j_decompress_ptr cinfo)
* this module, since we'll just re-assign them on the next call.) * this module, since we'll just re-assign them on the next call.)
*/ */
METHODDEF(boolean) METHODDEF(int)
decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
......
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
typedef struct { typedef struct {
/* Basic tables: (element [0] of each array is unused) */ /* Basic tables: (element [0] of each array is unused) */
INT32 maxcode[18]; /* largest code of length k (-1 if none) */ long 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) */
INT32 valoffset[17]; /* huffval[] offset for codes of length k */ long valoffset[17]; /* huffval[] offset for codes of length k */
/* valoffset[k] = huffval[] index of 1st symbol of code length k, less /* 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 * the smallest code of length k; so given a code of length k, the
* corresponding symbol is huffval[code + valoffset[k]] * corresponding symbol is huffval[code + valoffset[k]]
...@@ -42,12 +42,12 @@ typedef struct { ...@@ -42,12 +42,12 @@ typedef struct {
* the corresponding symbol directly from these tables. * the corresponding symbol directly from these tables.
*/ */
int look_nbits[1<<HUFF_LOOKAHEAD]; /* # bits, or 0 if too long */ int look_nbits[1<<HUFF_LOOKAHEAD]; /* # bits, or 0 if too long */
UINT8 look_sym[1<<HUFF_LOOKAHEAD]; /* symbol, or unused */ unsigned char look_sym[1<<HUFF_LOOKAHEAD]; /* symbol, or unused */
} d_derived_tbl; } d_derived_tbl;
/* Expand a Huffman table definition into the derived format */ /* Expand a Huffman table definition into the derived format */
EXTERN(void) jpeg_make_d_derived_tbl EXTERN(void) jpeg_make_d_derived_tbl
JPP((j_decompress_ptr cinfo, boolean isDC, int tblno, JPP((j_decompress_ptr cinfo, int isDC, int tblno,
d_derived_tbl ** pdtbl)); d_derived_tbl ** pdtbl));
...@@ -69,7 +69,7 @@ EXTERN(void) jpeg_make_d_derived_tbl ...@@ -69,7 +69,7 @@ EXTERN(void) jpeg_make_d_derived_tbl
* necessary. * necessary.
*/ */
typedef INT32 bit_buf_type; /* type of bit-extraction buffer */ typedef long 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
...@@ -151,7 +151,7 @@ typedef struct { /* Bitreading working state within an MCU */ ...@@ -151,7 +151,7 @@ typedef struct { /* Bitreading working state within an MCU */
(bits_left -= (nbits)) (bits_left -= (nbits))
/* Load up the bit buffer to a depth of at least nbits */ /* Load up the bit buffer to a depth of at least nbits */
EXTERN(boolean) jpeg_fill_bit_buffer EXTERN(int) jpeg_fill_bit_buffer
JPP((bitread_working_state * state, register bit_buf_type get_buffer, JPP((bitread_working_state * state, register bit_buf_type get_buffer,
register int bits_left, int nbits)); register int bits_left, int nbits));
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
typedef struct { typedef struct {
struct jpeg_input_controller pub; /* public fields */ struct jpeg_input_controller pub; /* public fields */
boolean inheaders; /* TRUE until first SOS is reached */ int inheaders; /* TRUE until first SOS is reached */
} my_input_controller; } my_input_controller;
typedef my_input_controller * my_inputctl_ptr; typedef my_input_controller * my_inputctl_ptr;
......
...@@ -117,7 +117,7 @@ typedef struct { ...@@ -117,7 +117,7 @@ typedef struct {
/* Pointer to allocated workspace (M or M+2 row groups). */ /* Pointer to allocated workspace (M or M+2 row groups). */
JSAMPARRAY buffer[MAX_COMPONENTS]; JSAMPARRAY buffer[MAX_COMPONENTS];
boolean buffer_full; /* Have we gotten an iMCU row from decoder? */ int buffer_full; /* Have we gotten an iMCU row from decoder? */
JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */ JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */
/* Remaining fields are only used in the context case. */ /* Remaining fields are only used in the context case. */
...@@ -473,7 +473,7 @@ process_data_crank_post (j_decompress_ptr cinfo, ...@@ -473,7 +473,7 @@ process_data_crank_post (j_decompress_ptr cinfo,
*/ */
GLOBAL(void) GLOBAL(void)
jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) jinit_d_main_controller (j_decompress_ptr cinfo, int need_full_buffer)
{ {
my_main_ptr main; my_main_ptr main;
int ci, rgroup, ngroups; int ci, rgroup, ngroups;
......
...@@ -151,7 +151,7 @@ typedef my_marker_reader * my_marker_ptr; ...@@ -151,7 +151,7 @@ typedef my_marker_reader * my_marker_ptr;
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 long.
*/ */
#define INPUT_2BYTES(cinfo,V,action) \ #define INPUT_2BYTES(cinfo,V,action) \
MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \ MAKESTMT( MAKE_BYTE_AVAIL(cinfo,action); \
...@@ -193,7 +193,7 @@ typedef my_marker_reader * my_marker_ptr; ...@@ -193,7 +193,7 @@ typedef my_marker_reader * my_marker_ptr;
*/ */
LOCAL(boolean) LOCAL(int)
get_soi (j_decompress_ptr cinfo) get_soi (j_decompress_ptr cinfo)
/* Process an SOI marker */ /* Process an SOI marker */
{ {
...@@ -233,11 +233,11 @@ get_soi (j_decompress_ptr cinfo) ...@@ -233,11 +233,11 @@ get_soi (j_decompress_ptr cinfo)
} }
LOCAL(boolean) LOCAL(int)
get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) get_sof (j_decompress_ptr cinfo, int is_prog, int is_arith)
/* Process a SOFn marker */ /* Process a SOFn marker */
{ {
INT32 length; long length;
int c, ci; int c, ci;
jpeg_component_info * compptr; jpeg_component_info * compptr;
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
...@@ -297,11 +297,11 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith) ...@@ -297,11 +297,11 @@ get_sof (j_decompress_ptr cinfo, boolean is_prog, boolean is_arith)
} }
LOCAL(boolean) LOCAL(int)
get_sos (j_decompress_ptr cinfo) get_sos (j_decompress_ptr cinfo)
/* Process a SOS marker */ /* Process a SOS marker */
{ {
INT32 length; long 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);
...@@ -369,11 +369,11 @@ get_sos (j_decompress_ptr cinfo) ...@@ -369,11 +369,11 @@ get_sos (j_decompress_ptr cinfo)
#ifdef D_ARITH_CODING_SUPPORTED #ifdef D_ARITH_CODING_SUPPORTED
LOCAL(boolean) LOCAL(int)
get_dac (j_decompress_ptr cinfo) get_dac (j_decompress_ptr cinfo)
/* Process a DAC marker */ /* Process a DAC marker */
{ {
INT32 length; long length;
int index, val; int index, val;
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
...@@ -392,10 +392,10 @@ get_dac (j_decompress_ptr cinfo) ...@@ -392,10 +392,10 @@ get_dac (j_decompress_ptr cinfo)
ERREXIT1(cinfo, JERR_DAC_INDEX, index); ERREXIT1(cinfo, JERR_DAC_INDEX, index);
if (index >= NUM_ARITH_TBLS) { /* define AC table */ if (index >= NUM_ARITH_TBLS) { /* define AC table */
cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = (UINT8) val; cinfo->arith_ac_K[index-NUM_ARITH_TBLS] = (unsigned char) val;
} else { /* define DC table */ } else { /* define DC table */
cinfo->arith_dc_L[index] = (UINT8) (val & 0x0F); cinfo->arith_dc_L[index] = (unsigned char) (val & 0x0F);
cinfo->arith_dc_U[index] = (UINT8) (val >> 4); cinfo->arith_dc_U[index] = (unsigned char) (val >> 4);
if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index]) if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
ERREXIT1(cinfo, JERR_DAC_VALUE, val); ERREXIT1(cinfo, JERR_DAC_VALUE, val);
} }
...@@ -415,13 +415,13 @@ get_dac (j_decompress_ptr cinfo) ...@@ -415,13 +415,13 @@ get_dac (j_decompress_ptr cinfo)
#endif /* D_ARITH_CODING_SUPPORTED */ #endif /* D_ARITH_CODING_SUPPORTED */
LOCAL(boolean) LOCAL(int)
get_dht (j_decompress_ptr cinfo) get_dht (j_decompress_ptr cinfo)
/* Process a DHT marker */ /* Process a DHT marker */
{ {
INT32 length; long length;
UINT8 bits[17]; unsigned char bits[17];
UINT8 huffval[256]; unsigned char huffval[256];
int i, index, count; int i, index, count;
JHUFF_TBL **htblptr; JHUFF_TBL **htblptr;
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
...@@ -453,7 +453,7 @@ get_dht (j_decompress_ptr cinfo) ...@@ -453,7 +453,7 @@ get_dht (j_decompress_ptr cinfo)
/* Here we just do minimal validation of the counts to avoid walking /* 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. * off the end of our table space. jdhuff.c will check more carefully.
*/ */
if (count > 256 || ((INT32) count) > length) if (count > 256 || ((long) count) > length)
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
...@@ -486,11 +486,11 @@ get_dht (j_decompress_ptr cinfo) ...@@ -486,11 +486,11 @@ get_dht (j_decompress_ptr cinfo)
} }
LOCAL(boolean) LOCAL(int)
get_dqt (j_decompress_ptr cinfo) get_dqt (j_decompress_ptr cinfo)
/* Process a DQT marker */ /* Process a DQT marker */
{ {
INT32 length; long length;
int n, i, prec; int n, i, prec;
unsigned int tmp; unsigned int tmp;
JQUANT_TBL *quant_ptr; JQUANT_TBL *quant_ptr;
...@@ -519,7 +519,7 @@ get_dqt (j_decompress_ptr cinfo) ...@@ -519,7 +519,7 @@ get_dqt (j_decompress_ptr cinfo)
else else
INPUT_BYTE(cinfo, tmp, return FALSE); INPUT_BYTE(cinfo, tmp, return FALSE);
/* We convert the zigzag-order table to natural array order. */ /* We convert the zigzag-order table to natural array order. */
quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16) tmp; quant_ptr->quantval[jpeg_natural_order[i]] = (unsigned short) tmp;
} }
if (cinfo->err->trace_level >= 2) { if (cinfo->err->trace_level >= 2) {
...@@ -544,11 +544,11 @@ get_dqt (j_decompress_ptr cinfo) ...@@ -544,11 +544,11 @@ get_dqt (j_decompress_ptr cinfo)
} }
LOCAL(boolean) LOCAL(int)
get_dri (j_decompress_ptr cinfo) get_dri (j_decompress_ptr cinfo)
/* Process a DRI marker */ /* Process a DRI marker */
{ {
INT32 length; long length;
unsigned int tmp; unsigned int tmp;
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
...@@ -582,13 +582,13 @@ get_dri (j_decompress_ptr cinfo) ...@@ -582,13 +582,13 @@ get_dri (j_decompress_ptr cinfo)
LOCAL(void) LOCAL(void)
examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data,
unsigned int datalen, INT32 remaining) unsigned int datalen, long remaining)
/* Examine first few bytes from an APP0. /* Examine first few bytes from an APP0.
* Take appropriate action if it is a JFIF marker. * Take appropriate action if it is a JFIF marker.
* datalen is # of bytes at data[], remaining is length of rest of marker data. * datalen is # of bytes at data[], remaining is length of rest of marker data.
*/ */
{ {
INT32 totallen = (INT32) datalen + remaining; long totallen = (long) datalen + remaining;
if (datalen >= APP0_DATA_LEN && if (datalen >= APP0_DATA_LEN &&
GETJOCTET(data[0]) == 0x4A && GETJOCTET(data[0]) == 0x4A &&
...@@ -622,7 +622,7 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, ...@@ -622,7 +622,7 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data,
GETJOCTET(data[12]), GETJOCTET(data[13])); GETJOCTET(data[12]), GETJOCTET(data[13]));
totallen -= APP0_DATA_LEN; totallen -= APP0_DATA_LEN;
if (totallen != if (totallen !=
((INT32)GETJOCTET(data[12]) * (INT32)GETJOCTET(data[13]) * (INT32) 3)) ((long)GETJOCTET(data[12]) * (long)GETJOCTET(data[13]) * (long) 3))
TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) totallen); TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int) totallen);
} else if (datalen >= 6 && } else if (datalen >= 6 &&
GETJOCTET(data[0]) == 0x4A && GETJOCTET(data[0]) == 0x4A &&
...@@ -658,7 +658,7 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data, ...@@ -658,7 +658,7 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data,
LOCAL(void) LOCAL(void)
examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data, examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data,
unsigned int datalen, INT32 remaining) unsigned int datalen, long remaining)
/* Examine first few bytes from an APP14. /* Examine first few bytes from an APP14.
* Take appropriate action if it is an Adobe marker. * Take appropriate action if it is an Adobe marker.
* datalen is # of bytes at data[], remaining is length of rest of marker data. * datalen is # of bytes at data[], remaining is length of rest of marker data.
...@@ -679,7 +679,7 @@ examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data, ...@@ -679,7 +679,7 @@ examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data,
transform = GETJOCTET(data[11]); transform = GETJOCTET(data[11]);
TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform); TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
cinfo->saw_Adobe_marker = TRUE; cinfo->saw_Adobe_marker = TRUE;
cinfo->Adobe_transform = (UINT8) transform; cinfo->Adobe_transform = (unsigned char) transform;
} else { } else {
/* Start of APP14 does not match "Adobe", or too short */ /* Start of APP14 does not match "Adobe", or too short */
TRACEMS1(cinfo, 1, JTRC_APP14, (int) (datalen + remaining)); TRACEMS1(cinfo, 1, JTRC_APP14, (int) (datalen + remaining));
...@@ -687,11 +687,11 @@ examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data, ...@@ -687,11 +687,11 @@ examine_app14 (j_decompress_ptr cinfo, JOCTET FAR * data,
} }
METHODDEF(boolean) METHODDEF(int)
get_interesting_appn (j_decompress_ptr cinfo) get_interesting_appn (j_decompress_ptr cinfo)
/* Process an APP0 or APP14 marker without saving it */ /* Process an APP0 or APP14 marker without saving it */
{ {
INT32 length; long length;
JOCTET b[APPN_DATA_LEN]; JOCTET b[APPN_DATA_LEN];
unsigned int i, numtoread; unsigned int i, numtoread;
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
...@@ -735,7 +735,7 @@ get_interesting_appn (j_decompress_ptr cinfo) ...@@ -735,7 +735,7 @@ get_interesting_appn (j_decompress_ptr cinfo)
#ifdef SAVE_MARKERS_SUPPORTED #ifdef SAVE_MARKERS_SUPPORTED
METHODDEF(boolean) METHODDEF(int)
save_marker (j_decompress_ptr cinfo) save_marker (j_decompress_ptr cinfo)
/* Save an APPn or COM marker into the marker list */ /* Save an APPn or COM marker into the marker list */
{ {
...@@ -743,7 +743,7 @@ save_marker (j_decompress_ptr cinfo) ...@@ -743,7 +743,7 @@ save_marker (j_decompress_ptr cinfo)
jpeg_saved_marker_ptr cur_marker = marker->cur_marker; jpeg_saved_marker_ptr cur_marker = marker->cur_marker;
unsigned int bytes_read, data_length; unsigned int bytes_read, data_length;
JOCTET FAR * data; JOCTET FAR * data;
INT32 length = 0; long length = 0;
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
if (cur_marker == NULL) { if (cur_marker == NULL) {
...@@ -764,7 +764,7 @@ save_marker (j_decompress_ptr cinfo) ...@@ -764,7 +764,7 @@ save_marker (j_decompress_ptr cinfo)
(*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(struct jpeg_marker_struct) + limit); SIZEOF(struct jpeg_marker_struct) + limit);
cur_marker->next = NULL; cur_marker->next = NULL;
cur_marker->marker = (UINT8) cinfo->unread_marker; cur_marker->marker = (unsigned char) cinfo->unread_marker;
cur_marker->original_length = (unsigned int) length; cur_marker->original_length = (unsigned int) length;
cur_marker->data_length = limit; cur_marker->data_length = limit;
/* data area is just beyond the jpeg_marker_struct */ /* data area is just beyond the jpeg_marker_struct */
...@@ -841,11 +841,11 @@ save_marker (j_decompress_ptr cinfo) ...@@ -841,11 +841,11 @@ save_marker (j_decompress_ptr cinfo)
#endif /* SAVE_MARKERS_SUPPORTED */ #endif /* SAVE_MARKERS_SUPPORTED */
METHODDEF(boolean) METHODDEF(int)
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; long length;
INPUT_VARS(cinfo); INPUT_VARS(cinfo);
INPUT_2BYTES(cinfo, length, return FALSE); INPUT_2BYTES(cinfo, length, return FALSE);
...@@ -870,7 +870,7 @@ skip_variable (j_decompress_ptr cinfo) ...@@ -870,7 +870,7 @@ skip_variable (j_decompress_ptr cinfo)
* but it will never be 0 or FF. * but it will never be 0 or FF.
*/ */
LOCAL(boolean) LOCAL(int)
next_marker (j_decompress_ptr cinfo) next_marker (j_decompress_ptr cinfo)
{ {
int c; int c;
...@@ -917,7 +917,7 @@ next_marker (j_decompress_ptr cinfo) ...@@ -917,7 +917,7 @@ next_marker (j_decompress_ptr cinfo)
} }
LOCAL(boolean) LOCAL(int)
first_marker (j_decompress_ptr cinfo) first_marker (j_decompress_ptr cinfo)
/* Like next_marker, but used to obtain the initial SOI marker. */ /* Like next_marker, but used to obtain the initial SOI marker. */
/* For this marker, we do not allow preceding garbage or fill; otherwise, /* For this marker, we do not allow preceding garbage or fill; otherwise,
...@@ -1109,7 +1109,7 @@ read_markers (j_decompress_ptr cinfo) ...@@ -1109,7 +1109,7 @@ read_markers (j_decompress_ptr cinfo)
* it holds a marker which the decoder will be unable to read past. * it holds a marker which the decoder will be unable to read past.
*/ */
METHODDEF(boolean) METHODDEF(int)
read_restart_marker (j_decompress_ptr cinfo) read_restart_marker (j_decompress_ptr cinfo)
{ {
/* Obtain a marker unless we already did. */ /* Obtain a marker unless we already did. */
...@@ -1188,7 +1188,7 @@ read_restart_marker (j_decompress_ptr cinfo) ...@@ -1188,7 +1188,7 @@ read_restart_marker (j_decompress_ptr cinfo)
* any other marker would have to be bogus data in that case. * any other marker would have to be bogus data in that case.
*/ */
GLOBAL(boolean) GLOBAL(int)
jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired) jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired)
{ {
int marker = cinfo->unread_marker; int marker = cinfo->unread_marker;
......
...@@ -23,7 +23,7 @@ typedef struct { ...@@ -23,7 +23,7 @@ typedef struct {
int pass_number; /* # of passes completed */ int pass_number; /* # of passes completed */
boolean using_merged_upsample; /* TRUE if using merged upsample/cconvert */ int using_merged_upsample; /* TRUE if using merged upsample/cconvert */
/* Saved references to initialized quantizer modules, /* Saved references to initialized quantizer modules,
* in case we need to switch modes. * in case we need to switch modes.
...@@ -40,7 +40,7 @@ typedef my_decomp_master * my_master_ptr; ...@@ -40,7 +40,7 @@ typedef my_decomp_master * my_master_ptr;
* CRUCIAL: this must match the actual capabilities of jdmerge.c! * CRUCIAL: this must match the actual capabilities of jdmerge.c!
*/ */
LOCAL(boolean) LOCAL(int)
use_merged_upsample (j_decompress_ptr cinfo) use_merged_upsample (j_decompress_ptr cinfo)
{ {
#ifdef UPSAMPLE_MERGING_SUPPORTED #ifdef UPSAMPLE_MERGING_SUPPORTED
...@@ -288,7 +288,7 @@ LOCAL(void) ...@@ -288,7 +288,7 @@ LOCAL(void)
master_selection (j_decompress_ptr cinfo) master_selection (j_decompress_ptr cinfo)
{ {
my_master_ptr master = (my_master_ptr) cinfo->master; my_master_ptr master = (my_master_ptr) cinfo->master;
boolean use_c_buffer; int use_c_buffer;
long samplesperrow; long samplesperrow;
JDIMENSION jd_samplesperrow; JDIMENSION jd_samplesperrow;
......
...@@ -52,8 +52,8 @@ typedef struct { ...@@ -52,8 +52,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 */ long * Cr_g_tab; /* => table for Cr to G conversion */
INT32 * Cb_g_tab; /* => table for Cb to G conversion */ long * Cb_g_tab; /* => table for Cb to G conversion */
/* For 2:1 vertical sampling, we produce two output rows at a time. /* 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 * We need a "spare" row buffer to hold the second output row if the
...@@ -61,7 +61,7 @@ typedef struct { ...@@ -61,7 +61,7 @@ typedef struct {
* to discard the dummy last row if the image height is odd. * to discard the dummy last row if the image height is odd.
*/ */
JSAMPROW spare_row; JSAMPROW spare_row;
boolean spare_full; /* T if spare buffer is occupied */ int spare_full; /* T if spare buffer is occupied */
JDIMENSION out_row_width; /* samples per output row */ JDIMENSION out_row_width; /* samples per output row */
JDIMENSION rows_to_go; /* counts rows remaining in image */ JDIMENSION rows_to_go; /* counts rows remaining in image */
...@@ -70,8 +70,8 @@ typedef struct { ...@@ -70,8 +70,8 @@ typedef struct {
typedef my_upsampler * my_upsample_ptr; typedef my_upsampler * my_upsample_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 ((long) 1 << (SCALEBITS-1))
#define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5)) #define FIX(x) ((long) ((x) * (1L<<SCALEBITS) + 0.5))
/* /*
...@@ -84,7 +84,7 @@ build_ycc_rgb_table (j_decompress_ptr cinfo) ...@@ -84,7 +84,7 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
{ {
my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
int i; int i;
INT32 x; long x;
SHIFT_TEMPS SHIFT_TEMPS
upsample->Cr_r_tab = (int *) upsample->Cr_r_tab = (int *)
...@@ -93,12 +93,12 @@ build_ycc_rgb_table (j_decompress_ptr cinfo) ...@@ -93,12 +93,12 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
upsample->Cb_b_tab = (int *) upsample->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));
upsample->Cr_g_tab = (INT32 *) upsample->Cr_g_tab = (long *)
(*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(long));
upsample->Cb_g_tab = (INT32 *) upsample->Cb_g_tab = (long *)
(*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(long));
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 */
...@@ -237,8 +237,8 @@ h2v1_merged_upsample (j_decompress_ptr cinfo, ...@@ -237,8 +237,8 @@ h2v1_merged_upsample (j_decompress_ptr cinfo,
register JSAMPLE * range_limit = cinfo->sample_range_limit; register JSAMPLE * range_limit = cinfo->sample_range_limit;
int * Crrtab = upsample->Cr_r_tab; int * Crrtab = upsample->Cr_r_tab;
int * Cbbtab = upsample->Cb_b_tab; int * Cbbtab = upsample->Cb_b_tab;
INT32 * Crgtab = upsample->Cr_g_tab; long * Crgtab = upsample->Cr_g_tab;
INT32 * Cbgtab = upsample->Cb_g_tab; long * Cbgtab = upsample->Cb_g_tab;
SHIFT_TEMPS SHIFT_TEMPS
inptr0 = input_buf[0][in_row_group_ctr]; inptr0 = input_buf[0][in_row_group_ctr];
...@@ -299,8 +299,8 @@ h2v2_merged_upsample (j_decompress_ptr cinfo, ...@@ -299,8 +299,8 @@ h2v2_merged_upsample (j_decompress_ptr cinfo,
register JSAMPLE * range_limit = cinfo->sample_range_limit; register JSAMPLE * range_limit = cinfo->sample_range_limit;
int * Crrtab = upsample->Cr_r_tab; int * Crrtab = upsample->Cr_r_tab;
int * Cbbtab = upsample->Cb_b_tab; int * Cbbtab = upsample->Cb_b_tab;
INT32 * Crgtab = upsample->Cr_g_tab; long * Crgtab = upsample->Cr_g_tab;
INT32 * Cbgtab = upsample->Cb_g_tab; long * Cbgtab = upsample->Cb_g_tab;
SHIFT_TEMPS SHIFT_TEMPS
inptr00 = input_buf[0][in_row_group_ctr*2]; inptr00 = input_buf[0][in_row_group_ctr*2];
......
...@@ -74,13 +74,13 @@ typedef struct { ...@@ -74,13 +74,13 @@ typedef struct {
typedef phuff_entropy_decoder * phuff_entropy_ptr; typedef phuff_entropy_decoder * phuff_entropy_ptr;
/* Forward declarations */ /* Forward declarations */
METHODDEF(boolean) decode_mcu_DC_first JPP((j_decompress_ptr cinfo, METHODDEF(int) decode_mcu_DC_first JPP((j_decompress_ptr cinfo,
JBLOCKROW *MCU_data)); JBLOCKROW *MCU_data));
METHODDEF(boolean) decode_mcu_AC_first JPP((j_decompress_ptr cinfo, METHODDEF(int) decode_mcu_AC_first JPP((j_decompress_ptr cinfo,
JBLOCKROW *MCU_data)); JBLOCKROW *MCU_data));
METHODDEF(boolean) decode_mcu_DC_refine JPP((j_decompress_ptr cinfo, METHODDEF(int) decode_mcu_DC_refine JPP((j_decompress_ptr cinfo,
JBLOCKROW *MCU_data)); JBLOCKROW *MCU_data));
METHODDEF(boolean) decode_mcu_AC_refine JPP((j_decompress_ptr cinfo, METHODDEF(int) decode_mcu_AC_refine JPP((j_decompress_ptr cinfo,
JBLOCKROW *MCU_data)); JBLOCKROW *MCU_data));
...@@ -92,7 +92,7 @@ METHODDEF(void) ...@@ -92,7 +92,7 @@ METHODDEF(void)
start_pass_phuff_decoder (j_decompress_ptr cinfo) start_pass_phuff_decoder (j_decompress_ptr cinfo)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
boolean is_DC_band, bad; int is_DC_band, bad;
int ci, coefi, tbl; int ci, coefi, tbl;
int *coef_bit_ptr; int *coef_bit_ptr;
jpeg_component_info * compptr; jpeg_component_info * compptr;
...@@ -224,7 +224,7 @@ static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ ...@@ -224,7 +224,7 @@ static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */
* Returns FALSE if must suspend. * Returns FALSE if must suspend.
*/ */
LOCAL(boolean) LOCAL(int)
process_restart (j_decompress_ptr cinfo) process_restart (j_decompress_ptr cinfo)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
...@@ -282,7 +282,7 @@ process_restart (j_decompress_ptr cinfo) ...@@ -282,7 +282,7 @@ process_restart (j_decompress_ptr cinfo)
* or first pass of successive approximation). * or first pass of successive approximation).
*/ */
METHODDEF(boolean) METHODDEF(int)
decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
...@@ -353,7 +353,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) ...@@ -353,7 +353,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
* or first pass of successive approximation). * or first pass of successive approximation).
*/ */
METHODDEF(boolean) METHODDEF(int)
decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
...@@ -438,7 +438,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) ...@@ -438,7 +438,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
* is not very clear on the point. * is not very clear on the point.
*/ */
METHODDEF(boolean) METHODDEF(int)
decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
...@@ -487,7 +487,7 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) ...@@ -487,7 +487,7 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
* MCU decoding for AC successive approximation refinement scan. * MCU decoding for AC successive approximation refinement scan.
*/ */
METHODDEF(boolean) METHODDEF(int)
decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{ {
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
......
...@@ -247,7 +247,7 @@ post_process_2pass (j_decompress_ptr cinfo, ...@@ -247,7 +247,7 @@ post_process_2pass (j_decompress_ptr cinfo,
*/ */
GLOBAL(void) GLOBAL(void)
jinit_d_post_controller (j_decompress_ptr cinfo, boolean need_full_buffer) jinit_d_post_controller (j_decompress_ptr cinfo, int need_full_buffer)
{ {
my_post_ptr post; my_post_ptr post;
......
...@@ -54,8 +54,8 @@ typedef struct { ...@@ -54,8 +54,8 @@ typedef struct {
/* These arrays save pixel expansion factors so that int_expand need not /* These arrays save pixel expansion factors so that int_expand need not
* recompute them each time. They are unused for other upsampling methods. * recompute them each time. They are unused for other upsampling methods.
*/ */
UINT8 h_expand[MAX_COMPONENTS]; unsigned char h_expand[MAX_COMPONENTS];
UINT8 v_expand[MAX_COMPONENTS]; unsigned char v_expand[MAX_COMPONENTS];
} my_upsampler; } my_upsampler;
typedef my_upsampler * my_upsample_ptr; typedef my_upsampler * my_upsample_ptr;
...@@ -350,7 +350,7 @@ h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, ...@@ -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 long thiscolsum, lastcolsum, nextcolsum;
#endif #endif
register JDIMENSION colctr; register JDIMENSION colctr;
int inrow, outrow, v; int inrow, outrow, v;
...@@ -401,7 +401,7 @@ jinit_upsampler (j_decompress_ptr cinfo) ...@@ -401,7 +401,7 @@ jinit_upsampler (j_decompress_ptr cinfo)
my_upsample_ptr upsample; my_upsample_ptr upsample;
int ci; int ci;
jpeg_component_info * compptr; jpeg_component_info * compptr;
boolean need_buffer, do_fancy; int need_buffer, do_fancy;
int h_in_group, v_in_group, h_out_group, v_out_group; int h_in_group, v_in_group, h_out_group, v_out_group;
upsample = (my_upsample_ptr) upsample = (my_upsample_ptr)
...@@ -463,8 +463,8 @@ jinit_upsampler (j_decompress_ptr cinfo) ...@@ -463,8 +463,8 @@ jinit_upsampler (j_decompress_ptr cinfo)
(v_out_group % v_in_group) == 0) { (v_out_group % v_in_group) == 0) {
/* Generic integral-factors upsampling method */ /* Generic integral-factors upsampling method */
upsample->methods[ci] = int_upsample; upsample->methods[ci] = int_upsample;
upsample->h_expand[ci] = (UINT8) (h_out_group / h_in_group); upsample->h_expand[ci] = (unsigned char) (h_out_group / h_in_group);
upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group); upsample->v_expand[ci] = (unsigned char) (v_out_group / v_in_group);
} else } else
ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
if (need_buffer) { if (need_buffer) {
......
...@@ -161,7 +161,7 @@ format_message (j_common_ptr cinfo, char * buffer) ...@@ -161,7 +161,7 @@ format_message (j_common_ptr cinfo, char * buffer)
const char * msgtext = NULL; const char * msgtext = NULL;
const char * msgptr; const char * msgptr;
char ch; char ch;
boolean isstring; int isstring;
/* Look up message string in proper table */ /* Look up message string in proper table */
if (msg_code > 0 && msg_code <= err->last_jpeg_message) { if (msg_code > 0 && msg_code <= err->last_jpeg_message) {
......
...@@ -218,21 +218,21 @@ jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr, ...@@ -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 */ /* 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((long) (tmp0 + tmp7), 3)
& RANGE_MASK]; & RANGE_MASK];
outptr[7] = range_limit[(int) DESCALE((INT32) (tmp0 - tmp7), 3) outptr[7] = range_limit[(int) DESCALE((long) (tmp0 - tmp7), 3)
& RANGE_MASK]; & RANGE_MASK];
outptr[1] = range_limit[(int) DESCALE((INT32) (tmp1 + tmp6), 3) outptr[1] = range_limit[(int) DESCALE((long) (tmp1 + tmp6), 3)
& RANGE_MASK]; & RANGE_MASK];
outptr[6] = range_limit[(int) DESCALE((INT32) (tmp1 - tmp6), 3) outptr[6] = range_limit[(int) DESCALE((long) (tmp1 - tmp6), 3)
& RANGE_MASK]; & RANGE_MASK];
outptr[2] = range_limit[(int) DESCALE((INT32) (tmp2 + tmp5), 3) outptr[2] = range_limit[(int) DESCALE((long) (tmp2 + tmp5), 3)
& RANGE_MASK]; & RANGE_MASK];
outptr[5] = range_limit[(int) DESCALE((INT32) (tmp2 - tmp5), 3) outptr[5] = range_limit[(int) DESCALE((long) (tmp2 - tmp5), 3)
& RANGE_MASK]; & RANGE_MASK];
outptr[4] = range_limit[(int) DESCALE((INT32) (tmp3 + tmp4), 3) outptr[4] = range_limit[(int) DESCALE((long) (tmp3 + tmp4), 3)
& RANGE_MASK]; & RANGE_MASK];
outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3) outptr[3] = range_limit[(int) DESCALE((long) (tmp3 - tmp4), 3)
& RANGE_MASK]; & RANGE_MASK];
wsptr += DCTSIZE; /* advance pointer to next row */ wsptr += DCTSIZE; /* advance pointer to next row */
......
...@@ -89,10 +89,10 @@ ...@@ -89,10 +89,10 @@
*/ */
#if CONST_BITS == 8 #if CONST_BITS == 8
#define FIX_1_082392200 ((INT32) 277) /* FIX(1.082392200) */ #define FIX_1_082392200 ((long) 277) /* FIX(1.082392200) */
#define FIX_1_414213562 ((INT32) 362) /* FIX(1.414213562) */ #define FIX_1_414213562 ((long) 362) /* FIX(1.414213562) */
#define FIX_1_847759065 ((INT32) 473) /* FIX(1.847759065) */ #define FIX_1_847759065 ((long) 473) /* FIX(1.847759065) */
#define FIX_2_613125930 ((INT32) 669) /* FIX(2.613125930) */ #define FIX_2_613125930 ((long) 669) /* FIX(2.613125930) */
#else #else
#define FIX_1_082392200 FIX(1.082392200) #define FIX_1_082392200 FIX(1.082392200)
#define FIX_1_414213562 FIX(1.414213562) #define FIX_1_414213562 FIX(1.414213562)
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
#endif #endif
/* Multiply a DCTELEM variable by an INT32 constant, and immediately /* Multiply a DCTELEM variable by an long constant, and immediately
* descale to yield a DCTELEM result. * descale to yield a DCTELEM result.
*/ */
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
/* Dequantize a coefficient by multiplying it by the multiplier-table /* Dequantize a coefficient by multiplying it by the multiplier-table
* entry; produce a DCTELEM result. For 8-bit data a 16x16->16 * entry; produce a DCTELEM result. For 8-bit data a 16x16->16
* multiplication will do. For 12-bit data, the multiplier table is * multiplication will do. For 12-bit data, the multiplier table is
* declared INT32, so a 32-bit multiply will be used. * declared long, so a 32-bit multiply will be used.
*/ */
#if BITS_IN_JSAMPLE == 8 #if BITS_IN_JSAMPLE == 8
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
/* Like DESCALE, but applies to a DCTELEM and produces an int. /* Like DESCALE, but applies to a DCTELEM and produces an int.
* We assume that int right shift is unsigned if INT32 right shift is. * We assume that int right shift is unsigned if long right shift is.
*/ */
#ifdef RIGHT_SHIFT_IS_UNSIGNED #ifdef RIGHT_SHIFT_IS_UNSIGNED
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
* they are represented to better-than-integral precision. These outputs * they are represented to better-than-integral precision. These outputs
* require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
* with the recommended scaling. (To scale up 12-bit sample data further, an * with the recommended scaling. (To scale up 12-bit sample data further, an
* intermediate INT32 array would be needed.) * intermediate long array would be needed.)
* *
* To avoid overflow of the 32-bit intermediate results in pass 2, we must * To avoid overflow of the 32-bit intermediate results in pass 2, we must
* have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis
...@@ -90,18 +90,18 @@ ...@@ -90,18 +90,18 @@
*/ */
#if CONST_BITS == 13 #if CONST_BITS == 13
#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */ #define FIX_0_298631336 ((long) 2446) /* FIX(0.298631336) */
#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */ #define FIX_0_390180644 ((long) 3196) /* FIX(0.390180644) */
#define FIX_0_541196100 ((INT32) 4433) /* FIX(0.541196100) */ #define FIX_0_541196100 ((long) 4433) /* FIX(0.541196100) */
#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ #define FIX_0_765366865 ((long) 6270) /* FIX(0.765366865) */
#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ #define FIX_0_899976223 ((long) 7373) /* FIX(0.899976223) */
#define FIX_1_175875602 ((INT32) 9633) /* FIX(1.175875602) */ #define FIX_1_175875602 ((long) 9633) /* FIX(1.175875602) */
#define FIX_1_501321110 ((INT32) 12299) /* FIX(1.501321110) */ #define FIX_1_501321110 ((long) 12299) /* FIX(1.501321110) */
#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ #define FIX_1_847759065 ((long) 15137) /* FIX(1.847759065) */
#define FIX_1_961570560 ((INT32) 16069) /* FIX(1.961570560) */ #define FIX_1_961570560 ((long) 16069) /* FIX(1.961570560) */
#define FIX_2_053119869 ((INT32) 16819) /* FIX(2.053119869) */ #define FIX_2_053119869 ((long) 16819) /* FIX(2.053119869) */
#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ #define FIX_2_562915447 ((long) 20995) /* FIX(2.562915447) */
#define FIX_3_072711026 ((INT32) 25172) /* FIX(3.072711026) */ #define FIX_3_072711026 ((long) 25172) /* FIX(3.072711026) */
#else #else
#define FIX_0_298631336 FIX(0.298631336) #define FIX_0_298631336 FIX(0.298631336)
#define FIX_0_390180644 FIX(0.390180644) #define FIX_0_390180644 FIX(0.390180644)
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
#endif #endif
/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. /* Multiply an long variable by an long constant to yield an long result.
* For 8-bit samples with the recommended scaling, all the variable * For 8-bit samples with the recommended scaling, all the variable
* and constant values involved are no more than 16 bits wide, so a * and constant values involved are no more than 16 bits wide, so a
* 16x16->32 bit multiply can be used instead of a full 32x32 multiply. * 16x16->32 bit multiply can be used instead of a full 32x32 multiply.
...@@ -149,9 +149,9 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, ...@@ -149,9 +149,9 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block,
JSAMPARRAY output_buf, JDIMENSION output_col) JSAMPARRAY output_buf, JDIMENSION output_col)
{ {
INT32 tmp0, tmp1, tmp2, tmp3; long tmp0, tmp1, tmp2, tmp3;
INT32 tmp10, tmp11, tmp12, tmp13; long tmp10, tmp11, tmp12, tmp13;
INT32 z1, z2, z3, z4, z5; long z1, z2, z3, z4, z5;
JCOEFPTR inptr; JCOEFPTR inptr;
ISLOW_MULT_TYPE * quantptr; ISLOW_MULT_TYPE * quantptr;
int * wsptr; int * wsptr;
...@@ -288,7 +288,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, ...@@ -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 && if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[(int) DESCALE((long) wsptr[0], PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
...@@ -308,15 +308,15 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, ...@@ -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. */ /* Even part: reverse the even part of the forward DCT. */
/* The rotator is sqrt(2)*c(-6). */ /* The rotator is sqrt(2)*c(-6). */
z2 = (INT32) wsptr[2]; z2 = (long) wsptr[2];
z3 = (INT32) wsptr[6]; z3 = (long) wsptr[6];
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065); tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865); tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
tmp0 = ((INT32) wsptr[0] + (INT32) wsptr[4]) << CONST_BITS; tmp0 = ((long) wsptr[0] + (long) wsptr[4]) << CONST_BITS;
tmp1 = ((INT32) wsptr[0] - (INT32) wsptr[4]) << CONST_BITS; tmp1 = ((long) wsptr[0] - (long) wsptr[4]) << CONST_BITS;
tmp10 = tmp0 + tmp3; tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3; tmp13 = tmp0 - tmp3;
...@@ -327,10 +327,10 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr, ...@@ -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. * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
*/ */
tmp0 = (INT32) wsptr[7]; tmp0 = (long) wsptr[7];
tmp1 = (INT32) wsptr[5]; tmp1 = (long) wsptr[5];
tmp2 = (INT32) wsptr[3]; tmp2 = (long) wsptr[3];
tmp3 = (INT32) wsptr[1]; tmp3 = (long) wsptr[1];
z1 = tmp0 + tmp3; z1 = tmp0 + tmp3;
z2 = tmp1 + tmp2; z2 = tmp1 + tmp2;
......
...@@ -55,20 +55,20 @@ ...@@ -55,20 +55,20 @@
*/ */
#if CONST_BITS == 13 #if CONST_BITS == 13
#define FIX_0_211164243 ((INT32) 1730) /* FIX(0.211164243) */ #define FIX_0_211164243 ((long) 1730) /* FIX(0.211164243) */
#define FIX_0_509795579 ((INT32) 4176) /* FIX(0.509795579) */ #define FIX_0_509795579 ((long) 4176) /* FIX(0.509795579) */
#define FIX_0_601344887 ((INT32) 4926) /* FIX(0.601344887) */ #define FIX_0_601344887 ((long) 4926) /* FIX(0.601344887) */
#define FIX_0_720959822 ((INT32) 5906) /* FIX(0.720959822) */ #define FIX_0_720959822 ((long) 5906) /* FIX(0.720959822) */
#define FIX_0_765366865 ((INT32) 6270) /* FIX(0.765366865) */ #define FIX_0_765366865 ((long) 6270) /* FIX(0.765366865) */
#define FIX_0_850430095 ((INT32) 6967) /* FIX(0.850430095) */ #define FIX_0_850430095 ((long) 6967) /* FIX(0.850430095) */
#define FIX_0_899976223 ((INT32) 7373) /* FIX(0.899976223) */ #define FIX_0_899976223 ((long) 7373) /* FIX(0.899976223) */
#define FIX_1_061594337 ((INT32) 8697) /* FIX(1.061594337) */ #define FIX_1_061594337 ((long) 8697) /* FIX(1.061594337) */
#define FIX_1_272758580 ((INT32) 10426) /* FIX(1.272758580) */ #define FIX_1_272758580 ((long) 10426) /* FIX(1.272758580) */
#define FIX_1_451774981 ((INT32) 11893) /* FIX(1.451774981) */ #define FIX_1_451774981 ((long) 11893) /* FIX(1.451774981) */
#define FIX_1_847759065 ((INT32) 15137) /* FIX(1.847759065) */ #define FIX_1_847759065 ((long) 15137) /* FIX(1.847759065) */
#define FIX_2_172734803 ((INT32) 17799) /* FIX(2.172734803) */ #define FIX_2_172734803 ((long) 17799) /* FIX(2.172734803) */
#define FIX_2_562915447 ((INT32) 20995) /* FIX(2.562915447) */ #define FIX_2_562915447 ((long) 20995) /* FIX(2.562915447) */
#define FIX_3_624509785 ((INT32) 29692) /* FIX(3.624509785) */ #define FIX_3_624509785 ((long) 29692) /* FIX(3.624509785) */
#else #else
#define FIX_0_211164243 FIX(0.211164243) #define FIX_0_211164243 FIX(0.211164243)
#define FIX_0_509795579 FIX(0.509795579) #define FIX_0_509795579 FIX(0.509795579)
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
#endif #endif
/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. /* Multiply an long variable by an long constant to yield an long result.
* For 8-bit samples with the recommended scaling, all the variable * For 8-bit samples with the recommended scaling, all the variable
* and constant values involved are no more than 16 bits wide, so a * and constant values involved are no more than 16 bits wide, so a
* 16x16->32 bit multiply can be used instead of a full 32x32 multiply. * 16x16->32 bit multiply can be used instead of a full 32x32 multiply.
...@@ -119,8 +119,8 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, ...@@ -119,8 +119,8 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block,
JSAMPARRAY output_buf, JDIMENSION output_col) JSAMPARRAY output_buf, JDIMENSION output_col)
{ {
INT32 tmp0, tmp2, tmp10, tmp12; long tmp0, tmp2, tmp10, tmp12;
INT32 z1, z2, z3, z4; long z1, z2, z3, z4;
JCOEFPTR inptr; JCOEFPTR inptr;
ISLOW_MULT_TYPE * quantptr; ISLOW_MULT_TYPE * quantptr;
int * wsptr; int * wsptr;
...@@ -202,7 +202,7 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, ...@@ -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 && if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 &&
wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[(int) DESCALE((long) wsptr[0], PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
...@@ -217,20 +217,20 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr, ...@@ -217,20 +217,20 @@ jpeg_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
/* Even part */ /* Even part */
tmp0 = ((INT32) wsptr[0]) << (CONST_BITS+1); tmp0 = ((long) wsptr[0]) << (CONST_BITS+1);
tmp2 = MULTIPLY((INT32) wsptr[2], FIX_1_847759065) tmp2 = MULTIPLY((long) wsptr[2], FIX_1_847759065)
+ MULTIPLY((INT32) wsptr[6], - FIX_0_765366865); + MULTIPLY((long) wsptr[6], - FIX_0_765366865);
tmp10 = tmp0 + tmp2; tmp10 = tmp0 + tmp2;
tmp12 = tmp0 - tmp2; tmp12 = tmp0 - tmp2;
/* Odd part */ /* Odd part */
z1 = (INT32) wsptr[7]; z1 = (long) wsptr[7];
z2 = (INT32) wsptr[5]; z2 = (long) wsptr[5];
z3 = (INT32) wsptr[3]; z3 = (long) wsptr[3];
z4 = (INT32) wsptr[1]; z4 = (long) wsptr[1];
tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */ tmp0 = MULTIPLY(z1, - FIX_0_211164243) /* sqrt(2) * (c3-c1) */
+ MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */ + MULTIPLY(z2, FIX_1_451774981) /* sqrt(2) * (c3+c7) */
...@@ -272,7 +272,7 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, ...@@ -272,7 +272,7 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
JCOEFPTR coef_block, JCOEFPTR coef_block,
JSAMPARRAY output_buf, JDIMENSION output_col) JSAMPARRAY output_buf, JDIMENSION output_col)
{ {
INT32 tmp0, tmp10, z1; long tmp0, tmp10, z1;
JCOEFPTR inptr; JCOEFPTR inptr;
ISLOW_MULT_TYPE * quantptr; ISLOW_MULT_TYPE * quantptr;
int * wsptr; int * wsptr;
...@@ -334,7 +334,7 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, ...@@ -334,7 +334,7 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
#ifndef NO_ZERO_ROW_TEST #ifndef NO_ZERO_ROW_TEST
if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) { if (wsptr[1] == 0 && wsptr[3] == 0 && wsptr[5] == 0 && wsptr[7] == 0) {
/* AC terms all zero */ /* AC terms all zero */
JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) JSAMPLE dcval = range_limit[(int) DESCALE((long) wsptr[0], PASS1_BITS+3)
& RANGE_MASK]; & RANGE_MASK];
outptr[0] = dcval; outptr[0] = dcval;
...@@ -347,14 +347,14 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr, ...@@ -347,14 +347,14 @@ jpeg_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
/* Even part */ /* Even part */
tmp10 = ((INT32) wsptr[0]) << (CONST_BITS+2); tmp10 = ((long) wsptr[0]) << (CONST_BITS+2);
/* Odd part */ /* Odd part */
tmp0 = MULTIPLY((INT32) wsptr[7], - FIX_0_720959822) /* sqrt(2) * (c7-c5+c3-c1) */ tmp0 = MULTIPLY((long) 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((long) 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((long) wsptr[3], - FIX_1_272758580) /* sqrt(2) * (-c1+c3-c5-c7) */
+ MULTIPLY((INT32) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */ + MULTIPLY((long) wsptr[1], FIX_3_624509785); /* sqrt(2) * (c1+c3+c5+c7) */
/* Final output stage */ /* Final output stage */
...@@ -390,7 +390,7 @@ jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr, ...@@ -390,7 +390,7 @@ jpeg_idct_1x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
*/ */
quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table;
dcval = DEQUANTIZE(coef_block[0], quantptr[0]); dcval = DEQUANTIZE(coef_block[0], quantptr[0]);
dcval = (int) DESCALE((INT32) dcval, 3); dcval = (int) DESCALE((long) dcval, 3);
output_buf[0][output_col] = range_limit[dcval & RANGE_MASK]; output_buf[0][output_col] = range_limit[dcval & RANGE_MASK];
} }
......
...@@ -156,9 +156,9 @@ struct jvirt_sarray_control { ...@@ -156,9 +156,9 @@ struct jvirt_sarray_control {
JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */ JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */
JDIMENSION cur_start_row; /* first logical row # in the buffer */ JDIMENSION cur_start_row; /* first logical row # in the buffer */
JDIMENSION first_undef_row; /* row # of first uninitialized row */ JDIMENSION first_undef_row; /* row # of first uninitialized row */
boolean pre_zero; /* pre-zero mode requested? */ int pre_zero; /* pre-zero mode requested? */
boolean dirty; /* do current buffer contents need written? */ int dirty; /* do current buffer contents need written? */
boolean b_s_open; /* is backing-store data valid? */ int b_s_open; /* is backing-store data valid? */
jvirt_sarray_ptr next; /* link to next virtual sarray control block */ jvirt_sarray_ptr next; /* link to next virtual sarray control block */
backing_store_info b_s_info; /* System-dependent control info */ backing_store_info b_s_info; /* System-dependent control info */
}; };
...@@ -172,9 +172,9 @@ struct jvirt_barray_control { ...@@ -172,9 +172,9 @@ struct jvirt_barray_control {
JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */ JDIMENSION rowsperchunk; /* allocation chunk size in mem_buffer */
JDIMENSION cur_start_row; /* first logical row # in the buffer */ JDIMENSION cur_start_row; /* first logical row # in the buffer */
JDIMENSION first_undef_row; /* row # of first uninitialized row */ JDIMENSION first_undef_row; /* row # of first uninitialized row */
boolean pre_zero; /* pre-zero mode requested? */ int pre_zero; /* pre-zero mode requested? */
boolean dirty; /* do current buffer contents need written? */ int dirty; /* do current buffer contents need written? */
boolean b_s_open; /* is backing-store data valid? */ int b_s_open; /* is backing-store data valid? */
jvirt_barray_ptr next; /* link to next virtual barray control block */ jvirt_barray_ptr next; /* link to next virtual barray control block */
backing_store_info b_s_info; /* System-dependent control info */ backing_store_info b_s_info; /* System-dependent control info */
}; };
...@@ -520,7 +520,7 @@ alloc_barray (j_common_ptr cinfo, int pool_id, ...@@ -520,7 +520,7 @@ alloc_barray (j_common_ptr cinfo, int pool_id,
METHODDEF(jvirt_sarray_ptr) METHODDEF(jvirt_sarray_ptr)
request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero, request_virt_sarray (j_common_ptr cinfo, int pool_id, int pre_zero,
JDIMENSION samplesperrow, JDIMENSION numrows, JDIMENSION samplesperrow, JDIMENSION numrows,
JDIMENSION maxaccess) JDIMENSION maxaccess)
/* Request a virtual 2-D sample array */ /* Request a virtual 2-D sample array */
...@@ -550,7 +550,7 @@ request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero, ...@@ -550,7 +550,7 @@ request_virt_sarray (j_common_ptr cinfo, int pool_id, boolean pre_zero,
METHODDEF(jvirt_barray_ptr) METHODDEF(jvirt_barray_ptr)
request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero, request_virt_barray (j_common_ptr cinfo, int pool_id, int pre_zero,
JDIMENSION blocksperrow, JDIMENSION numrows, JDIMENSION blocksperrow, JDIMENSION numrows,
JDIMENSION maxaccess) JDIMENSION maxaccess)
/* Request a virtual 2-D coefficient-block array */ /* Request a virtual 2-D coefficient-block array */
...@@ -687,7 +687,7 @@ realize_virt_arrays (j_common_ptr cinfo) ...@@ -687,7 +687,7 @@ realize_virt_arrays (j_common_ptr cinfo)
LOCAL(void) LOCAL(void)
do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing) do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, int writing)
/* Do backing store read or write of a virtual sample array */ /* Do backing store read or write of a virtual sample array */
{ {
long bytesperrow, file_offset, byte_count, rows, thisrow, i; long bytesperrow, file_offset, byte_count, rows, thisrow, i;
...@@ -720,7 +720,7 @@ do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing) ...@@ -720,7 +720,7 @@ do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing)
LOCAL(void) LOCAL(void)
do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing) do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, int writing)
/* Do backing store read or write of a virtual coefficient-block array */ /* Do backing store read or write of a virtual coefficient-block array */
{ {
long bytesperrow, file_offset, byte_count, rows, thisrow, i; long bytesperrow, file_offset, byte_count, rows, thisrow, i;
...@@ -755,7 +755,7 @@ do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing) ...@@ -755,7 +755,7 @@ do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing)
METHODDEF(JSAMPARRAY) METHODDEF(JSAMPARRAY)
access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
JDIMENSION start_row, JDIMENSION num_rows, JDIMENSION start_row, JDIMENSION num_rows,
boolean writable) int writable)
/* Access the part of a virtual sample array starting at start_row */ /* Access the part of a virtual sample array starting at start_row */
/* and extending for num_rows rows. writable is true if */ /* and extending for num_rows rows. writable is true if */
/* caller intends to modify the accessed area. */ /* caller intends to modify the accessed area. */
...@@ -840,7 +840,7 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr, ...@@ -840,7 +840,7 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
METHODDEF(JBLOCKARRAY) METHODDEF(JBLOCKARRAY)
access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr, access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr,
JDIMENSION start_row, JDIMENSION num_rows, JDIMENSION start_row, JDIMENSION num_rows,
boolean writable) int writable)
/* Access the part of a virtual block array starting at start_row */ /* Access the part of a virtual block array starting at start_row */
/* and extending for num_rows rows. writable is true if */ /* and extending for num_rows rows. writable is true if */
/* caller intends to modify the accessed area. */ /* caller intends to modify the accessed area. */
......
...@@ -129,37 +129,12 @@ typedef char JOCTET; ...@@ -129,37 +129,12 @@ typedef char JOCTET;
* typedefs live at a different point on the speed/space tradeoff curve.) * typedefs live at a different point on the speed/space tradeoff curve.)
*/ */
/* UINT8 must hold at least the values 0..255. */ /* unsigned char must hold at least the values 0..255. */
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char UINT8;
#else /* not HAVE_UNSIGNED_CHAR */
#ifdef CHAR_IS_UNSIGNED
typedef char UINT8;
#else /* not CHAR_IS_UNSIGNED */
typedef short UINT8;
#endif /* CHAR_IS_UNSIGNED */
#endif /* HAVE_UNSIGNED_CHAR */
/* UINT16 must hold at least the values 0..65535. */ /* unsigned short must hold at least the values 0..65535. */
#ifdef HAVE_UNSIGNED_SHORT
typedef unsigned short UINT16;
#else /* not HAVE_UNSIGNED_SHORT */
typedef unsigned int UINT16;
#endif /* HAVE_UNSIGNED_SHORT */
/* INT16 must hold at least the values -32768..32767. */
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
typedef short INT16;
#endif
/* INT32 must hold at least signed 32-bit values. */
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
typedef long INT32;
#endif
/* Datatype used for image dimensions. The JPEG standard only supports /* Datatype used for image dimensions. The JPEG standard only supports
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
...@@ -223,9 +198,6 @@ typedef unsigned int JDIMENSION; ...@@ -223,9 +198,6 @@ typedef unsigned int JDIMENSION;
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work. * Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
*/ */
#ifndef HAVE_BOOLEAN
typedef int boolean;
#endif
#ifndef FALSE /* in case these macros already exist */ #ifndef FALSE /* in case these macros already exist */
#define FALSE 0 /* values of boolean */ #define FALSE 0 /* values of boolean */
#endif #endif
......
...@@ -48,8 +48,8 @@ struct jpeg_comp_master { ...@@ -48,8 +48,8 @@ struct jpeg_comp_master {
JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
/* State variables made visible to other modules */ /* State variables made visible to other modules */
boolean call_pass_startup; /* True if pass_startup must be called */ int call_pass_startup; /* True if pass_startup must be called */
boolean is_last_pass; /* True during last pass */ int is_last_pass; /* True during last pass */
}; };
/* Main buffer control (downsampled-data buffer) */ /* Main buffer control (downsampled-data buffer) */
...@@ -75,7 +75,7 @@ struct jpeg_c_prep_controller { ...@@ -75,7 +75,7 @@ struct jpeg_c_prep_controller {
/* Coefficient buffer control */ /* Coefficient buffer control */
struct jpeg_c_coef_controller { struct jpeg_c_coef_controller {
JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode));
JMETHOD(boolean, compress_data, (j_compress_ptr cinfo, JMETHOD(int, compress_data, (j_compress_ptr cinfo,
JSAMPIMAGE input_buf)); JSAMPIMAGE input_buf));
}; };
...@@ -95,7 +95,7 @@ struct jpeg_downsampler { ...@@ -95,7 +95,7 @@ struct jpeg_downsampler {
JSAMPIMAGE output_buf, JSAMPIMAGE output_buf,
JDIMENSION out_row_group_index)); JDIMENSION out_row_group_index));
boolean need_context_rows; /* TRUE if need rows above & below */ int need_context_rows; /* TRUE if need rows above & below */
}; };
/* Forward DCT (also controls coefficient quantization) */ /* Forward DCT (also controls coefficient quantization) */
...@@ -111,8 +111,8 @@ struct jpeg_forward_dct { ...@@ -111,8 +111,8 @@ struct jpeg_forward_dct {
/* Entropy encoding */ /* Entropy encoding */
struct jpeg_entropy_encoder { struct jpeg_entropy_encoder {
JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics)); JMETHOD(void, start_pass, (j_compress_ptr cinfo, int gather_statistics));
JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data)); JMETHOD(int, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data));
JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); JMETHOD(void, finish_pass, (j_compress_ptr cinfo));
}; };
...@@ -139,7 +139,7 @@ struct jpeg_decomp_master { ...@@ -139,7 +139,7 @@ struct jpeg_decomp_master {
JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo)); JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo));
/* State variables made visible to other modules */ /* State variables made visible to other modules */
boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */ int is_dummy_pass; /* True during 1st pass for 2-pass quant */
}; };
/* Input control module */ /* Input control module */
...@@ -150,8 +150,8 @@ struct jpeg_input_controller { ...@@ -150,8 +150,8 @@ struct jpeg_input_controller {
JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo)); JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo));
/* State variables made visible to other modules */ /* State variables made visible to other modules */
boolean has_multiple_scans; /* True if file has multiple scans */ int has_multiple_scans; /* True if file has multiple scans */
boolean eoi_reached; /* True when EOI has been consumed */ int eoi_reached; /* True when EOI has been consumed */
}; };
/* Main buffer control (downsampled-data buffer) */ /* Main buffer control (downsampled-data buffer) */
...@@ -199,8 +199,8 @@ struct jpeg_marker_reader { ...@@ -199,8 +199,8 @@ struct jpeg_marker_reader {
/* State of marker reader --- nominally internal, but applications /* State of marker reader --- nominally internal, but applications
* supplying COM or APPn handlers might like to know the state. * supplying COM or APPn handlers might like to know the state.
*/ */
boolean saw_SOI; /* found SOI? */ int saw_SOI; /* found SOI? */
boolean saw_SOF; /* found SOF? */ int saw_SOF; /* found SOF? */
int next_restart_num; /* next restart number expected (0-7) */ int next_restart_num; /* next restart number expected (0-7) */
unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */ unsigned int discarded_bytes; /* # of bytes skipped looking for a marker */
}; };
...@@ -208,12 +208,12 @@ struct jpeg_marker_reader { ...@@ -208,12 +208,12 @@ struct jpeg_marker_reader {
/* Entropy decoding */ /* Entropy decoding */
struct jpeg_entropy_decoder { struct jpeg_entropy_decoder {
JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, JMETHOD(int, decode_mcu, (j_decompress_ptr cinfo,
JBLOCKROW *MCU_data)); JBLOCKROW *MCU_data));
/* This is here to share code between baseline and progressive decoders; */ /* This is here to share code between baseline and progressive decoders; */
/* other modules probably should not use it */ /* other modules probably should not use it */
boolean insufficient_data; /* set TRUE after emitting warning */ int insufficient_data; /* set TRUE after emitting warning */
}; };
/* Inverse DCT (also performs dequantization) */ /* Inverse DCT (also performs dequantization) */
...@@ -239,7 +239,7 @@ struct jpeg_upsampler { ...@@ -239,7 +239,7 @@ struct jpeg_upsampler {
JDIMENSION *out_row_ctr, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)); JDIMENSION out_rows_avail));
boolean need_context_rows; /* TRUE if need rows above & below */ int need_context_rows; /* TRUE if need rows above & below */
}; };
/* Colorspace conversion */ /* Colorspace conversion */
...@@ -252,7 +252,7 @@ struct jpeg_color_deconverter { ...@@ -252,7 +252,7 @@ struct jpeg_color_deconverter {
/* Color quantization or color precision reduction */ /* Color quantization or color precision reduction */
struct jpeg_color_quantizer { struct jpeg_color_quantizer {
JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan)); JMETHOD(void, start_pass, (j_decompress_ptr cinfo, int is_pre_scan));
JMETHOD(void, color_quantize, (j_decompress_ptr cinfo, JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
JSAMPARRAY input_buf, JSAMPARRAY output_buf, JSAMPARRAY input_buf, JSAMPARRAY output_buf,
int num_rows)); int num_rows));
...@@ -274,16 +274,16 @@ struct jpeg_color_quantizer { ...@@ -274,16 +274,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 long 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 long 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)) | ((~((long) 0)) << (32-(shft))) : \
(shift_temp >> (shft))) (shift_temp >> (shft)))
#else #else
#define SHIFT_TEMPS #define SHIFT_TEMPS
...@@ -333,13 +333,13 @@ struct jpeg_color_quantizer { ...@@ -333,13 +333,13 @@ struct jpeg_color_quantizer {
/* Compression module initialization routines */ /* Compression module initialization routines */
EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_compress_master JPP((j_compress_ptr cinfo));
EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo, EXTERN(void) jinit_c_master_control JPP((j_compress_ptr cinfo,
boolean transcode_only)); int transcode_only));
EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo, EXTERN(void) jinit_c_main_controller JPP((j_compress_ptr cinfo,
boolean need_full_buffer)); int need_full_buffer));
EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo, EXTERN(void) jinit_c_prep_controller JPP((j_compress_ptr cinfo,
boolean need_full_buffer)); int need_full_buffer));
EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo, EXTERN(void) jinit_c_coef_controller JPP((j_compress_ptr cinfo,
boolean need_full_buffer)); int need_full_buffer));
EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_color_converter JPP((j_compress_ptr cinfo));
EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_downsampler JPP((j_compress_ptr cinfo));
EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo)); EXTERN(void) jinit_forward_dct JPP((j_compress_ptr cinfo));
...@@ -349,11 +349,11 @@ EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo)); ...@@ -349,11 +349,11 @@ EXTERN(void) jinit_marker_writer JPP((j_compress_ptr cinfo));
/* Decompression module initialization routines */ /* Decompression module initialization routines */
EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_master_decompress JPP((j_decompress_ptr cinfo));
EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo, EXTERN(void) jinit_d_main_controller JPP((j_decompress_ptr cinfo,
boolean need_full_buffer)); int need_full_buffer));
EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo, EXTERN(void) jinit_d_coef_controller JPP((j_decompress_ptr cinfo,
boolean need_full_buffer)); int need_full_buffer));
EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo, EXTERN(void) jinit_d_post_controller JPP((j_decompress_ptr cinfo,
boolean need_full_buffer)); int need_full_buffer));
EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_input_controller JPP((j_decompress_ptr cinfo));
EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_marker_reader JPP((j_decompress_ptr cinfo));
EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo)); EXTERN(void) jinit_huff_decoder JPP((j_decompress_ptr cinfo));
......
This diff is collapsed.
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
typedef int ODITHER_MATRIX[ODITHER_SIZE][ODITHER_SIZE]; typedef int ODITHER_MATRIX[ODITHER_SIZE][ODITHER_SIZE];
typedef int (*ODITHER_MATRIX_PTR)[ODITHER_SIZE]; typedef int (*ODITHER_MATRIX_PTR)[ODITHER_SIZE];
static const UINT8 base_dither_matrix[ODITHER_SIZE][ODITHER_SIZE] = { static const unsigned char base_dither_matrix[ODITHER_SIZE][ODITHER_SIZE] = {
/* Bayer's order-4 dither array. Generated by the code given in /* Bayer's order-4 dither array. Generated by the code given in
* Stephen Hawley's article "Ordered Dithering" in Graphics Gems I. * Stephen Hawley's article "Ordered Dithering" in Graphics Gems I.
* The values in this array must range from 0 to ODITHER_CELLS-1. * The values in this array must range from 0 to ODITHER_CELLS-1.
...@@ -125,11 +125,11 @@ static const UINT8 base_dither_matrix[ODITHER_SIZE][ODITHER_SIZE] = { ...@@ -125,11 +125,11 @@ static const UINT8 base_dither_matrix[ODITHER_SIZE][ODITHER_SIZE] = {
*/ */
#if BITS_IN_JSAMPLE == 8 #if BITS_IN_JSAMPLE == 8
typedef INT16 FSERROR; /* 16 bits should be enough */ typedef short FSERROR; /* 16 bits should be enough */
typedef int LOCFSERROR; /* use 'int' for calculation temps */ typedef int LOCFSERROR; /* use 'int' for calculation temps */
#else #else
typedef INT32 FSERROR; /* may need more than 16 bits */ typedef long FSERROR; /* may need more than 16 bits */
typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */ typedef long LOCFSERROR; /* be sure calculation temps are big enough */
#endif #endif
typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */
...@@ -151,7 +151,7 @@ typedef struct { ...@@ -151,7 +151,7 @@ typedef struct {
* premultiplied as described above. Since colormap indexes must fit into * premultiplied as described above. Since colormap indexes must fit into
* JSAMPLEs, the entries of this array will too. * JSAMPLEs, the entries of this array will too.
*/ */
boolean is_padded; /* is the colorindex padded for odither? */ int is_padded; /* is the colorindex padded for odither? */
int Ncolors[MAX_Q_COMPS]; /* # of values alloced to each component */ int Ncolors[MAX_Q_COMPS]; /* # of values alloced to each component */
...@@ -161,7 +161,7 @@ typedef struct { ...@@ -161,7 +161,7 @@ typedef struct {
/* Variables for Floyd-Steinberg dithering */ /* Variables for Floyd-Steinberg dithering */
FSERRPTR fserrors[MAX_Q_COMPS]; /* accumulated errors */ FSERRPTR fserrors[MAX_Q_COMPS]; /* accumulated errors */
boolean on_odd_row; /* flag to remember which row we are on */ int on_odd_row; /* flag to remember which row we are on */
} my_cquantizer; } my_cquantizer;
typedef my_cquantizer * my_cquantize_ptr; typedef my_cquantizer * my_cquantize_ptr;
...@@ -191,7 +191,7 @@ select_ncolors (j_decompress_ptr cinfo, int Ncolors[]) ...@@ -191,7 +191,7 @@ select_ncolors (j_decompress_ptr cinfo, int Ncolors[])
int nc = cinfo->out_color_components; /* number of color components */ int nc = cinfo->out_color_components; /* number of color components */
int max_colors = cinfo->desired_number_of_colors; int max_colors = cinfo->desired_number_of_colors;
int total_colors, iroot, i, j; int total_colors, iroot, i, j;
boolean changed; int changed;
long temp; long temp;
static const int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE }; static const int RGB_order[3] = { RGB_GREEN, RGB_RED, RGB_BLUE };
...@@ -251,7 +251,7 @@ output_value (j_decompress_ptr , int , int j, int maxj) ...@@ -251,7 +251,7 @@ output_value (j_decompress_ptr , int , int j, int maxj)
* (Forcing the upper and lower values to the limits ensures that * (Forcing the upper and lower values to the limits ensures that
* dithering can't produce a color outside the selected gamut.) * dithering can't produce a color outside the selected gamut.)
*/ */
return (int) (((INT32) j * MAXJSAMPLE + maxj/2) / maxj); return (int) (((long) j * MAXJSAMPLE + maxj/2) / maxj);
} }
...@@ -261,7 +261,7 @@ largest_input_value (j_decompress_ptr , int , int j, int maxj) ...@@ -261,7 +261,7 @@ largest_input_value (j_decompress_ptr , int , int j, int maxj)
/* Must have largest(j=0) >= 0, and largest(j=maxj) >= MAXJSAMPLE */ /* Must have largest(j=0) >= 0, and largest(j=maxj) >= MAXJSAMPLE */
{ {
/* Breakpoints are halfway between values returned by output_value */ /* Breakpoints are halfway between values returned by output_value */
return (int) (((INT32) (2*j + 1) * MAXJSAMPLE + maxj) / (2*maxj)); return (int) (((long) (2*j + 1) * MAXJSAMPLE + maxj) / (2*maxj));
} }
...@@ -397,7 +397,7 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors) ...@@ -397,7 +397,7 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors)
{ {
ODITHER_MATRIX_PTR odither; ODITHER_MATRIX_PTR odither;
int j,k; int j,k;
INT32 num,den; long num,den;
odither = (ODITHER_MATRIX_PTR) odither = (ODITHER_MATRIX_PTR)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
...@@ -407,10 +407,10 @@ make_odither_array (j_decompress_ptr cinfo, int ncolors) ...@@ -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). * (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. * On 16-bit-int machine, be careful to avoid overflow.
*/ */
den = 2 * ODITHER_CELLS * ((INT32) (ncolors - 1)); den = 2 * ODITHER_CELLS * ((long) (ncolors - 1));
for (j = 0; j < ODITHER_SIZE; j++) { for (j = 0; j < ODITHER_SIZE; j++) {
for (k = 0; k < ODITHER_SIZE; k++) { for (k = 0; k < ODITHER_SIZE; k++) {
num = ((INT32) (ODITHER_CELLS-1 - 2*((int)base_dither_matrix[j][k]))) num = ((long) (ODITHER_CELLS-1 - 2*((int)base_dither_matrix[j][k])))
* MAXJSAMPLE; * MAXJSAMPLE;
/* Ensure round towards zero despite C's lack of consistency /* Ensure round towards zero despite C's lack of consistency
* about rounding negative values in integer division... * about rounding negative values in integer division...
...@@ -738,7 +738,7 @@ alloc_fs_workspace (j_decompress_ptr cinfo) ...@@ -738,7 +738,7 @@ alloc_fs_workspace (j_decompress_ptr cinfo)
*/ */
METHODDEF(void) METHODDEF(void)
start_pass_1_quant (j_decompress_ptr cinfo, boolean ) start_pass_1_quant (j_decompress_ptr cinfo, int )
{ {
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
size_t arraysize; size_t arraysize;
......
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
#define C2_SHIFT (BITS_IN_JSAMPLE-HIST_C2_BITS) #define C2_SHIFT (BITS_IN_JSAMPLE-HIST_C2_BITS)
typedef UINT16 histcell; /* histogram cell; prefer an unsigned type */ typedef unsigned short histcell; /* histogram cell; prefer an unsigned type */
typedef histcell FAR * histptr; /* for pointers to histogram cells */ typedef histcell FAR * histptr; /* for pointers to histogram cells */
...@@ -178,11 +178,11 @@ typedef hist2d * hist3d; /* type for top-level pointer */ ...@@ -178,11 +178,11 @@ typedef hist2d * hist3d; /* type for top-level pointer */
*/ */
#if BITS_IN_JSAMPLE == 8 #if BITS_IN_JSAMPLE == 8
typedef INT16 FSERROR; /* 16 bits should be enough */ typedef short FSERROR; /* 16 bits should be enough */
typedef int LOCFSERROR; /* use 'int' for calculation temps */ typedef int LOCFSERROR; /* use 'int' for calculation temps */
#else #else
typedef INT32 FSERROR; /* may need more than 16 bits */ typedef long FSERROR; /* may need more than 16 bits */
typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */ typedef long LOCFSERROR; /* be sure calculation temps are big enough */
#endif #endif
typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */ typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */
...@@ -200,11 +200,11 @@ typedef struct { ...@@ -200,11 +200,11 @@ typedef struct {
/* Variables for accumulating image statistics */ /* Variables for accumulating image statistics */
hist3d histogram; /* pointer to the histogram */ hist3d histogram; /* pointer to the histogram */
boolean needs_zeroed; /* TRUE if next pass must zero histogram */ int needs_zeroed; /* TRUE if next pass must zero histogram */
/* Variables for Floyd-Steinberg dithering */ /* Variables for Floyd-Steinberg dithering */
FSERRPTR fserrors; /* accumulated errors */ FSERRPTR fserrors; /* accumulated errors */
boolean on_odd_row; /* flag to remember which row we are on */ int on_odd_row; /* flag to remember which row we are on */
int * error_limiter; /* table for clamping the applied error */ int * error_limiter; /* table for clamping the applied error */
} my_cquantizer; } my_cquantizer;
...@@ -261,7 +261,7 @@ typedef struct { ...@@ -261,7 +261,7 @@ typedef struct {
int c1min, c1max; int c1min, c1max;
int c2min, c2max; int c2min, c2max;
/* The volume (actually 2-norm) of the box */ /* The volume (actually 2-norm) of the box */
INT32 volume; long volume;
/* The number of nonzero histogram cells within this box */ /* The number of nonzero histogram cells within this box */
long colorcount; long colorcount;
} box; } box;
...@@ -296,7 +296,7 @@ find_biggest_volume (boxptr boxlist, int numboxes) ...@@ -296,7 +296,7 @@ find_biggest_volume (boxptr boxlist, int numboxes)
{ {
register boxptr boxp; register boxptr boxp;
register int i; register int i;
register INT32 maxv = 0; register long maxv = 0;
boxptr which = NULL; boxptr which = NULL;
for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) { for (i = 0, boxp = boxlist; i < numboxes; i++, boxp++) {
...@@ -319,7 +319,7 @@ update_box (j_decompress_ptr cinfo, boxptr boxp) ...@@ -319,7 +319,7 @@ update_box (j_decompress_ptr cinfo, boxptr boxp)
histptr histp; histptr histp;
int c0,c1,c2; int c0,c1,c2;
int c0min,c0max,c1min,c1max,c2min,c2max; int c0min,c0max,c1min,c1max,c2min,c2max;
INT32 dist0,dist1,dist2; long dist0,dist1,dist2;
long ccount; long ccount;
c0min = boxp->c0min; c0max = boxp->c0max; c0min = boxp->c0min; c0max = boxp->c0max;
...@@ -658,8 +658,8 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, ...@@ -658,8 +658,8 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
int maxc0, maxc1, maxc2; int maxc0, maxc1, maxc2;
int centerc0, centerc1, centerc2; int centerc0, centerc1, centerc2;
int i, x, ncolors; int i, x, ncolors;
INT32 minmaxdist, min_dist, max_dist, tdist; long minmaxdist, min_dist, max_dist, tdist;
INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */ long mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */
/* Compute true coordinates of update box's upper corner and center. /* Compute true coordinates of update box's upper corner and center.
* Actually we compute the coordinates of the center of the upper-corner * 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, ...@@ -783,15 +783,15 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
{ {
int ic0, ic1, ic2; int ic0, ic1, ic2;
int i, icolor; int i, icolor;
register INT32 * bptr; /* pointer into bestdist[] array */ register long * bptr; /* pointer into bestdist[] array */
JSAMPLE * cptr; /* pointer into bestcolor[] array */ JSAMPLE * cptr; /* pointer into bestcolor[] array */
INT32 dist0, dist1; /* initial distance values */ long dist0, dist1; /* initial distance values */
register INT32 dist2; /* current distance in inner loop */ register long dist2; /* current distance in inner loop */
INT32 xx0, xx1; /* distance increments */ long xx0, xx1; /* distance increments */
register INT32 xx2; register long xx2;
INT32 inc0, inc1, inc2; /* initial values for increments */ long inc0, inc1, inc2; /* initial values for increments */
/* This array holds the distance to the nearest-so-far color for each cell */ /* 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]; long bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];
/* Initialize best-distance for each cell of the update box */ /* Initialize best-distance for each cell of the update box */
bptr = bestdist; bptr = bestdist;
...@@ -1164,7 +1164,7 @@ finish_pass2 (j_decompress_ptr ) ...@@ -1164,7 +1164,7 @@ finish_pass2 (j_decompress_ptr )
*/ */
METHODDEF(void) METHODDEF(void)
start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan) start_pass_2_quant (j_decompress_ptr cinfo, int is_pre_scan)
{ {
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
hist3d histogram = cquantize->histogram; hist3d histogram = cquantize->histogram;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment