diff options
Diffstat (limited to 'media/libjpeg/jdhuff.c')
-rw-r--r-- | media/libjpeg/jdhuff.c | 223 |
1 files changed, 117 insertions, 106 deletions
diff --git a/media/libjpeg/jdhuff.c b/media/libjpeg/jdhuff.c index fa78e2962a..679d221685 100644 --- a/media/libjpeg/jdhuff.c +++ b/media/libjpeg/jdhuff.c @@ -4,7 +4,8 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1991-1997, Thomas G. Lane. * libjpeg-turbo Modifications: - * Copyright (C) 2009-2011, 2016, D. R. Commander. + * Copyright (C) 2009-2011, 2016, 2018-2019, D. R. Commander. + * Copyright (C) 2018, Matthias Räncker. * For conditions of distribution and use, see the accompanying README.ijg * file. * @@ -15,6 +16,9 @@ * up to the start of the current MCU. To do this, we copy state variables * into local working storage, and update them back to the permanent * storage only upon successful completion of an MCU. + * + * NOTE: All referenced figures are from + * Recommendation ITU-T T.81 (1992) | ISO/IEC 10918-1:1994. */ #define JPEG_INTERNALS @@ -36,24 +40,6 @@ typedef struct { int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ } savable_state; -/* This macro is to work around compilers with missing or broken - * structure assignment. You'll need to fix this code if you have - * such a compiler and you change MAX_COMPS_IN_SCAN. - */ - -#ifndef NO_STRUCT_ASSIGN -#define ASSIGN_STATE(dest,src) ((dest) = (src)) -#else -#if MAX_COMPS_IN_SCAN == 4 -#define ASSIGN_STATE(dest,src) \ - ((dest).last_dc_val[0] = (src).last_dc_val[0], \ - (dest).last_dc_val[1] = (src).last_dc_val[1], \ - (dest).last_dc_val[2] = (src).last_dc_val[2], \ - (dest).last_dc_val[3] = (src).last_dc_val[3]) -#endif -#endif - - typedef struct { struct jpeg_entropy_decoder pub; /* public fields */ @@ -88,9 +74,9 @@ typedef huff_entropy_decoder *huff_entropy_ptr; */ METHODDEF(void) -start_pass_huff_decoder (j_decompress_ptr cinfo) +start_pass_huff_decoder(j_decompress_ptr cinfo) { - huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; + huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy; int ci, blkn, dctbl, actbl; d_derived_tbl **pdtbl; jpeg_component_info *compptr; @@ -99,7 +85,7 @@ start_pass_huff_decoder (j_decompress_ptr cinfo) * This ought to be an error condition, but we make it a warning because * there are some baseline files out there with all zeroes in these bytes. */ - if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 || + if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 || cinfo->Ah != 0 || cinfo->Al != 0) WARNMS(cinfo, JWRN_NOT_SEQUENTIAL); @@ -152,8 +138,8 @@ start_pass_huff_decoder (j_decompress_ptr cinfo) */ GLOBAL(void) -jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, - d_derived_tbl **pdtbl) +jpeg_make_d_derived_tbl(j_decompress_ptr cinfo, boolean isDC, int tblno, + d_derived_tbl **pdtbl) { JHUFF_TBL *htbl; d_derived_tbl *dtbl; @@ -178,7 +164,7 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, /* Allocate a workspace if we haven't already done so. */ if (*pdtbl == NULL) *pdtbl = (d_derived_tbl *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, sizeof(d_derived_tbl)); dtbl = *pdtbl; dtbl->pub = htbl; /* fill in back link */ @@ -187,11 +173,11 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, p = 0; for (l = 1; l <= 16; l++) { - i = (int) htbl->bits[l]; + i = (int)htbl->bits[l]; if (i < 0 || p + i > 256) /* protect against table overrun */ ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); while (i--) - huffsize[p++] = (char) l; + huffsize[p++] = (char)l; } huffsize[p] = 0; numsymbols = p; @@ -203,14 +189,14 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, si = huffsize[0]; p = 0; while (huffsize[p]) { - while (((int) huffsize[p]) == si) { + while (((int)huffsize[p]) == si) { huffcode[p++] = code; code++; } /* code is now 1 more than the last code used for codelength si; but * it must still fit in si bits, since no code is allowed to be all ones. */ - if (((JLONG) code) >= (((JLONG) 1) << si)) + if (((JLONG)code) >= (((JLONG)1) << si)) ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); code <<= 1; si++; @@ -224,9 +210,9 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, /* valoffset[l] = huffval[] index of 1st symbol of code length l, * minus the minimum code of length l */ - dtbl->valoffset[l] = (JLONG) p - (JLONG) huffcode[p]; + dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p]; 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 { dtbl->maxcode[l] = -1; /* -1 if no codes of this length */ } @@ -241,16 +227,16 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, * with that code. */ - for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++) - dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD; + for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++) + dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD; p = 0; for (l = 1; l <= HUFF_LOOKAHEAD; l++) { - for (i = 1; i <= (int) htbl->bits[l]; i++, p++) { + for (i = 1; i <= (int)htbl->bits[l]; i++, p++) { /* l = current code's length, p = its index in huffcode[] & huffval[]. */ /* Generate left-justified code followed by all possible bit sequences */ - lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l); - for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) { + lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l); + for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) { dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p]; lookbits++; } @@ -291,14 +277,14 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, #ifdef SLOW_SHIFT_32 #define MIN_GET_BITS 15 /* minimum allowable value */ #else -#define MIN_GET_BITS (BIT_BUF_SIZE-7) +#define MIN_GET_BITS (BIT_BUF_SIZE - 7) #endif GLOBAL(boolean) -jpeg_fill_bit_buffer (bitread_working_state *state, - register bit_buf_type get_buffer, register int bits_left, - int nbits) +jpeg_fill_bit_buffer(bitread_working_state *state, + register bit_buf_type get_buffer, register int bits_left, + int nbits) /* Load up the bit buffer to a depth of at least nbits */ { /* Copy heavily used state fields into locals (hopefully registers) */ @@ -316,13 +302,13 @@ jpeg_fill_bit_buffer (bitread_working_state *state, /* Attempt to read a byte */ if (bytes_in_buffer == 0) { - if (! (*cinfo->src->fill_input_buffer) (cinfo)) + if (!(*cinfo->src->fill_input_buffer) (cinfo)) return FALSE; next_input_byte = cinfo->src->next_input_byte; bytes_in_buffer = cinfo->src->bytes_in_buffer; } bytes_in_buffer--; - c = GETJOCTET(*next_input_byte++); + c = *next_input_byte++; /* If it's 0xFF, check and discard stuffed zero byte */ if (c == 0xFF) { @@ -333,13 +319,13 @@ jpeg_fill_bit_buffer (bitread_working_state *state, */ do { if (bytes_in_buffer == 0) { - if (! (*cinfo->src->fill_input_buffer) (cinfo)) + if (!(*cinfo->src->fill_input_buffer) (cinfo)) return FALSE; next_input_byte = cinfo->src->next_input_byte; bytes_in_buffer = cinfo->src->bytes_in_buffer; } bytes_in_buffer--; - c = GETJOCTET(*next_input_byte++); + c = *next_input_byte++; } while (c == 0xFF); if (c == 0) { @@ -365,7 +351,7 @@ jpeg_fill_bit_buffer (bitread_working_state *state, bits_left += 8; } /* end while */ } else { - no_more_bytes: +no_more_bytes: /* We get here if we've read the marker that terminates the compressed * data segment. There should be enough bits in the buffer register * to satisfy the request; if so, no problem. @@ -376,7 +362,7 @@ jpeg_fill_bit_buffer (bitread_working_state *state, * We use a nonvolatile flag to ensure that only one warning message * appears per data segment. */ - if (! cinfo->entropy->insufficient_data) { + if (!cinfo->entropy->insufficient_data) { WARNMS(cinfo, JWRN_HIT_MARKER); cinfo->entropy->insufficient_data = TRUE; } @@ -400,11 +386,10 @@ jpeg_fill_bit_buffer (bitread_working_state *state, handle markers. We have to hand off any blocks with markers to the slower routines. */ -#define GET_BYTE \ -{ \ +#define GET_BYTE { \ register int c0, c1; \ - c0 = GETJOCTET(*buffer++); \ - c1 = GETJOCTET(*buffer); \ + c0 = *buffer++; \ + c1 = *buffer; \ /* Pre-execute most common case */ \ get_buffer = (get_buffer << 8) | c0; \ bits_left += 8; \ @@ -421,7 +406,7 @@ jpeg_fill_bit_buffer (bitread_working_state *state, } \ } -#if SIZEOF_SIZE_T==8 || defined(_WIN64) +#if SIZEOF_SIZE_T == 8 || defined(_WIN64) || (defined(__x86_64__) && defined(__ILP32__)) /* Pre-fetch 48 bytes, because the holding register is 64-bit */ #define FILL_BIT_BUFFER_FAST \ @@ -446,9 +431,9 @@ jpeg_fill_bit_buffer (bitread_working_state *state, */ GLOBAL(int) -jpeg_huff_decode (bitread_working_state *state, - register bit_buf_type get_buffer, register int bits_left, - d_derived_tbl *htbl, int min_bits) +jpeg_huff_decode(bitread_working_state *state, + register bit_buf_type get_buffer, register int bits_left, + d_derived_tbl *htbl, int min_bits) { register int l = min_bits; register JLONG code; @@ -460,7 +445,7 @@ jpeg_huff_decode (bitread_working_state *state, code = GET_BITS(l); /* Collect the rest of the Huffman code one bit at a time. */ - /* This is per Figure F.16 in the JPEG spec. */ + /* This is per Figure F.16. */ while (code > htbl->maxcode[l]) { code <<= 1; @@ -480,7 +465,7 @@ jpeg_huff_decode (bitread_working_state *state, return 0; /* fake a zero as the safest result */ } - return htbl->pub->huffval[ (int) (code + htbl->valoffset[l]) ]; + return htbl->pub->huffval[(int)(code + htbl->valoffset[l])]; } @@ -492,22 +477,26 @@ jpeg_huff_decode (bitread_working_state *state, #define AVOID_TABLES #ifdef AVOID_TABLES -#define NEG_1 ((unsigned int)-1) -#define HUFF_EXTEND(x,s) ((x) + ((((x) - (1<<((s)-1))) >> 31) & (((NEG_1)<<(s)) + 1))) +#define NEG_1 ((unsigned int)-1) +#define HUFF_EXTEND(x, s) \ + ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1))) #else -#define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) +#define HUFF_EXTEND(x, s) \ + ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) -static const int extend_test[16] = /* entry n is 2**(n-1) */ - { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, - 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; +static const int extend_test[16] = { /* entry n is 2**(n-1) */ + 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, + 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 +}; -static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ - { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, - ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, - ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, - ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; +static const int extend_offset[16] = { /* entry n is (-1 << n) + 1 */ + 0, ((-1) << 1) + 1, ((-1) << 2) + 1, ((-1) << 3) + 1, ((-1) << 4) + 1, + ((-1) << 5) + 1, ((-1) << 6) + 1, ((-1) << 7) + 1, ((-1) << 8) + 1, + ((-1) << 9) + 1, ((-1) << 10) + 1, ((-1) << 11) + 1, ((-1) << 12) + 1, + ((-1) << 13) + 1, ((-1) << 14) + 1, ((-1) << 15) + 1 +}; #endif /* AVOID_TABLES */ @@ -518,9 +507,9 @@ static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ */ LOCAL(boolean) -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; int ci; /* Throw away any unused bits remaining in bit buffer; */ @@ -529,7 +518,7 @@ process_restart (j_decompress_ptr cinfo) entropy->bitstate.bits_left = 0; /* Advance past the RSTn marker */ - if (! (*cinfo->marker->read_restart_marker) (cinfo)) + if (!(*cinfo->marker->read_restart_marker) (cinfo)) return FALSE; /* Re-initialize DC predictions to 0 */ @@ -551,18 +540,24 @@ process_restart (j_decompress_ptr cinfo) } +#if defined(__has_feature) +#if __has_feature(undefined_behavior_sanitizer) +__attribute__((no_sanitize("signed-integer-overflow"), + no_sanitize("unsigned-integer-overflow"))) +#endif +#endif LOCAL(boolean) -decode_mcu_slow (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) +decode_mcu_slow(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; BITREAD_STATE_VARS; int blkn; savable_state state; /* Outer loop handles each block in the MCU */ /* Load up working state */ - BITREAD_LOAD_STATE(cinfo,entropy->bitstate); - ASSIGN_STATE(state, entropy->saved); + BITREAD_LOAD_STATE(cinfo, entropy->bitstate); + state = entropy->saved; for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL; @@ -583,11 +578,19 @@ decode_mcu_slow (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) if (entropy->dc_needed[blkn]) { /* Convert DC difference to actual value, update last_dc_val */ int ci = cinfo->MCU_membership[blkn]; + /* Certain malformed JPEG images produce repeated DC coefficient + * differences of 2047 or -2047, which causes state.last_dc_val[ci] to + * grow until it overflows or underflows a 32-bit signed integer. This + * behavior is, to the best of our understanding, innocuous, and it is + * unclear how to work around it without potentially affecting + * performance. Thus, we (hopefully temporarily) suppress UBSan integer + * overflow errors for this function and decode_mcu_fast(). + */ s += state.last_dc_val[ci]; state.last_dc_val[ci] = s; if (block) { /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */ - (*block)[0] = (JCOEF) s; + (*block)[0] = (JCOEF)s; } } @@ -610,7 +613,7 @@ decode_mcu_slow (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) * Note: the extra entries in jpeg_natural_order[] will save us * if k >= DCTSIZE2, which could happen if the data is corrupted. */ - (*block)[jpeg_natural_order[k]] = (JCOEF) s; + (*block)[jpeg_natural_order[k]] = (JCOEF)s; } else { if (r != 15) break; @@ -642,16 +645,22 @@ decode_mcu_slow (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) } /* Completed MCU, so update state */ - BITREAD_SAVE_STATE(cinfo,entropy->bitstate); - ASSIGN_STATE(entropy->saved, state); + BITREAD_SAVE_STATE(cinfo, entropy->bitstate); + entropy->saved = state; return TRUE; } +#if defined(__has_feature) +#if __has_feature(undefined_behavior_sanitizer) +__attribute__((no_sanitize("signed-integer-overflow"), + no_sanitize("unsigned-integer-overflow"))) +#endif +#endif LOCAL(boolean) -decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) +decode_mcu_fast(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; BITREAD_STATE_VARS; JOCTET *buffer; int blkn; @@ -659,9 +668,9 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) /* Outer loop handles each block in the MCU */ /* Load up working state */ - BITREAD_LOAD_STATE(cinfo,entropy->bitstate); - buffer = (JOCTET *) br_state.next_input_byte; - ASSIGN_STATE(state, entropy->saved); + BITREAD_LOAD_STATE(cinfo, entropy->bitstate); + buffer = (JOCTET *)br_state.next_input_byte; + state = entropy->saved; for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL; @@ -669,7 +678,7 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn]; register int s, k, r, l; - HUFF_DECODE_FAST(s, l, dctbl, slow_decode_mcu); + HUFF_DECODE_FAST(s, l, dctbl); if (s) { FILL_BIT_BUFFER_FAST r = GET_BITS(s); @@ -678,16 +687,19 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) if (entropy->dc_needed[blkn]) { int ci = cinfo->MCU_membership[blkn]; + /* Refer to the comment in decode_mcu_slow() regarding the supression of + * a UBSan integer overflow error in this line of code. + */ s += state.last_dc_val[ci]; state.last_dc_val[ci] = s; if (block) - (*block)[0] = (JCOEF) s; + (*block)[0] = (JCOEF)s; } if (entropy->ac_needed[blkn] && block) { for (k = 1; k < DCTSIZE2; k++) { - HUFF_DECODE_FAST(s, l, actbl, slow_decode_mcu); + HUFF_DECODE_FAST(s, l, actbl); r = s >> 4; s &= 15; @@ -696,7 +708,7 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) FILL_BIT_BUFFER_FAST r = GET_BITS(s); s = HUFF_EXTEND(r, s); - (*block)[jpeg_natural_order[k]] = (JCOEF) s; + (*block)[jpeg_natural_order[k]] = (JCOEF)s; } else { if (r != 15) break; k += 15; @@ -706,7 +718,7 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) } else { for (k = 1; k < DCTSIZE2; k++) { - HUFF_DECODE_FAST(s, l, actbl, slow_decode_mcu); + HUFF_DECODE_FAST(s, l, actbl); r = s >> 4; s &= 15; @@ -723,15 +735,14 @@ decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) } if (cinfo->unread_marker != 0) { -slow_decode_mcu: cinfo->unread_marker = 0; return FALSE; } br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte); br_state.next_input_byte = buffer; - BITREAD_SAVE_STATE(cinfo,entropy->bitstate); - ASSIGN_STATE(entropy->saved, state); + BITREAD_SAVE_STATE(cinfo, entropy->bitstate); + entropy->saved = state; return TRUE; } @@ -751,43 +762,43 @@ slow_decode_mcu: * this module, since we'll just re-assign them on the next call.) */ -#define BUFSIZE (DCTSIZE2 * 8) +#define BUFSIZE (DCTSIZE2 * 8) METHODDEF(boolean) -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; int usefast = 1; /* Process restart marker if needed; may have to suspend */ if (cinfo->restart_interval) { if (entropy->restarts_to_go == 0) - if (! process_restart(cinfo)) + if (!process_restart(cinfo)) return FALSE; usefast = 0; } - if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU - || cinfo->unread_marker != 0) + if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU || + cinfo->unread_marker != 0) usefast = 0; /* If we've run out of data, just leave the MCU set to zeroes. * This way, we return uniform gray for the remainder of the segment. */ - if (! entropy->pub.insufficient_data) { + if (!entropy->pub.insufficient_data) { if (usefast) { if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow; - } - else { - use_slow: + } else { +use_slow: if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE; } } /* Account for restart interval (no-op if not using restarts) */ - entropy->restarts_to_go--; + if (cinfo->restart_interval) + entropy->restarts_to_go--; return TRUE; } @@ -798,7 +809,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) */ GLOBAL(void) -jinit_huff_decoder (j_decompress_ptr cinfo) +jinit_huff_decoder(j_decompress_ptr cinfo) { huff_entropy_ptr entropy; int i; @@ -807,12 +818,12 @@ jinit_huff_decoder (j_decompress_ptr cinfo) are the default tables. Thus, if the tables are not set by the time the Huffman decoder is initialized (usually within the body of jpeg_start_decompress()), we set them to default values. */ - std_huff_tables((j_common_ptr) cinfo); + std_huff_tables((j_common_ptr)cinfo); entropy = (huff_entropy_ptr) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE, sizeof(huff_entropy_decoder)); - cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; + cinfo->entropy = (struct jpeg_entropy_decoder *)entropy; entropy->pub.start_pass = start_pass_huff_decoder; entropy->pub.decode_mcu = decode_mcu; |