15 #ifdef NEED_SHORT_EXTERNAL_NAMES
16 #define jpeg_make_d_derived_tbl jMkDDerived
17 #define jpeg_fill_bit_buffer jFilBitBuf
18 #define jpeg_huff_decode jHufDecode
24 #define HUFF_LOOKAHEAD 8
69 #define BIT_BUF_SIZE 32
100 #define BITREAD_STATE_VARS \
101 register bit_buf_type get_buffer; \
102 register int bits_left; \
103 bitread_working_state br_state
105 #define BITREAD_LOAD_STATE(cinfop,permstate) \
106 br_state.cinfo = cinfop; \
107 br_state.next_input_byte = cinfop->src->next_input_byte; \
108 br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
109 br_state.unread_marker = cinfop->unread_marker; \
110 get_buffer = permstate.get_buffer; \
111 bits_left = permstate.bits_left; \
112 br_state.printed_eod_ptr = & permstate.printed_eod
114 #define BITREAD_SAVE_STATE(cinfop,permstate) \
115 cinfop->src->next_input_byte = br_state.next_input_byte; \
116 cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
117 cinfop->unread_marker = br_state.unread_marker; \
118 permstate.get_buffer = get_buffer; \
119 permstate.bits_left = bits_left
139 #define CHECK_BIT_BUFFER(state,nbits,action) \
140 { if (bits_left < (nbits)) { \
141 if (! jpeg_fill_bit_buffer(&(state),get_buffer,bits_left,nbits)) \
143 get_buffer = (state).get_buffer; bits_left = (state).bits_left; } }
145 #define GET_BITS(nbits) \
146 (((int) (get_buffer >> (bits_left -= (nbits)))) & ((1<<(nbits))-1))
148 #define PEEK_BITS(nbits) \
149 (((int) (get_buffer >> (bits_left - (nbits)))) & ((1<<(nbits))-1))
151 #define DROP_BITS(nbits) \
152 (bits_left -= (nbits))
156 register bit_buf_type get_buffer,
register int bits_left,
177 #define HUFF_DECODE(result,state,htbl,failaction,slowlabel) \
178 { register int nb, look; \
179 if (bits_left < HUFF_LOOKAHEAD) { \
180 if (! jpeg_fill_bit_buffer(&state,get_buffer,bits_left, 0)) {failaction;} \
181 get_buffer = state.get_buffer; bits_left = state.bits_left; \
182 if (bits_left < HUFF_LOOKAHEAD) { \
183 nb = 1; goto slowlabel; \
186 look = PEEK_BITS(HUFF_LOOKAHEAD); \
187 if ((nb = htbl->look_nbits[look]) != 0) { \
189 result = htbl->look_sym[look]; \
191 nb = HUFF_LOOKAHEAD+1; \
193 if ((result=jpeg_huff_decode(&state,get_buffer,bits_left,htbl,nb)) < 0) \
195 get_buffer = state.get_buffer; bits_left = state.bits_left; \
201 register bit_buf_type get_buffer,
register int bits_left,
const JOCTET * next_input_byte
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)
EXTERN void jpeg_make_d_derived_tbl JPP((j_decompress_ptr cinfo, JHUFF_TBL *htbl, d_derived_tbl **pdtbl))
GLOBAL void jpeg_make_d_derived_tbl(j_decompress_ptr cinfo, JHUFF_TBL *htbl, d_derived_tbl **pdtbl)
boolean * printed_eod_ptr
GLOBAL boolean jpeg_fill_bit_buffer(bitread_working_state *state, register bit_buf_type get_buffer, register int bits_left, int nbits)