17 #define JPEG_INTERNALS
39 #ifndef NO_STRUCT_ASSIGN
40 #define ASSIGN_STATE(dest,src) ((dest) = (src))
42 #if MAX_COMPS_IN_SCAN == 4
43 #define ASSIGN_STATE(dest,src) \
44 ((dest).last_dc_val[0] = (src).last_dc_val[0], \
45 (dest).last_dc_val[1] = (src).last_dc_val[1], \
46 (dest).last_dc_val[2] = (src).last_dc_val[2], \
47 (dest).last_dc_val[3] = (src).last_dc_val[3])
88 cinfo->
Ah != 0 || cinfo->
Al != 0)
89 WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
94 actbl = compptr->ac_tbl_no;
98 ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
101 ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl);
113 entropy->bitstate.bits_left = 0;
114 entropy->bitstate.get_buffer = 0;
115 entropy->bitstate.printed_eod =
FALSE;
135 unsigned int huffcode[257];
150 for (l = 1; l <= 16; l++) {
151 for (i = 1; i <= (
int) htbl->
bits[l]; i++)
152 huffsize[p++] = (char) l;
162 while (huffsize[p]) {
163 while (((
int) huffsize[
p]) == si) {
164 huffcode[p++] = code;
174 for (l = 1; l <= 16; l++) {
197 for (i = 1; i <= (
int) htbl->
bits[l]; i++, p++) {
227 #define MIN_GET_BITS 15
229 #define MIN_GET_BITS (BIT_BUF_SIZE-7)
235 register bit_buf_type get_buffer,
register int bits_left,
252 if (bytes_in_buffer == 0) {
253 if (! (*state->
cinfo->
src->fill_input_buffer) (state->
cinfo))
264 if (bytes_in_buffer == 0) {
265 if (! (*state->
cinfo->
src->fill_input_buffer) (state->
cinfo))
285 if (bits_left >= nbits)
302 get_buffer = (get_buffer << 8) | c;
323 register bit_buf_type get_buffer,
register int bits_left,
326 register int l = min_bits;
338 while (code > htbl->
maxcode[l]) {
368 #define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x))
372 #define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x))
374 static const int extend_test[16] =
375 { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
376 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 };
378 static const int extend_offset[16] =
379 { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1,
380 ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1,
381 ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1,
382 ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 };
401 entropy->bitstate.bits_left = 0;
415 entropy->bitstate.printed_eod =
FALSE;
440 register int s, k,
r;
463 block = MCU_data[blkn];
480 if (! compptr->component_needed)
484 s += state.last_dc_val[ci];
485 state.last_dc_val[ci] =
s;
487 (*block)[0] = (
JCOEF) s;
490 if (compptr->DCT_scaled_size > 1) {
495 HUFF_DECODE(s, br_state, actbl,
return FALSE, label2);
523 HUFF_DECODE(s, br_state, actbl,
return FALSE, label3);
#define BITREAD_STATE_VARS
unsigned int restarts_to_go
#define HUFF_EXTEND(x, s)
UINT8 look_sym[1<< HUFF_LOOKAHEAD]
unsigned int discarded_bytes
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN]
int look_nbits[1<< HUFF_LOOKAHEAD]
JHUFF_TBL * dc_huff_tbl_ptrs[NUM_HUFF_TBLS]
const int jpeg_natural_order[]
struct jpeg_common_struct * j_common_ptr
struct jpeg_marker_reader * marker
const JOCTET * next_input_byte
huff_entropy_decoder * huff_entropy_ptr
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)
#define HUFF_DECODE(result, state, htbl, failaction, slowlabel)
bitread_perm_state bitstate
c_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS]
unsigned int restart_interval
GLOBAL void jpeg_make_d_derived_tbl(j_decompress_ptr cinfo, JHUFF_TBL *htbl, d_derived_tbl **pdtbl)
#define CHECK_BIT_BUFFER(state, nbits, action)
struct jpeg_entropy_encoder pub
METHODDEF boolean decode_mcu(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
#define WARNMS(cinfo, code)
#define ERREXIT1(cinfo, code, p1)
#define BITREAD_SAVE_STATE(cinfop, permstate)
#define ASSIGN_STATE(dest, src)
JHUFF_TBL * ac_huff_tbl_ptrs[NUM_HUFF_TBLS]
GLOBAL void jinit_huff_decoder(j_decompress_ptr cinfo)
struct jpeg_source_mgr * src
GLdouble GLdouble GLdouble r
METHODDEF void start_pass_huff_decoder(j_decompress_ptr cinfo)
int MCU_membership[D_MAX_BLOCKS_IN_MCU]
boolean * printed_eod_ptr
int last_dc_val[MAX_COMPS_IN_SCAN]
LOCAL boolean process_restart(j_decompress_ptr cinfo)
#define BITREAD_LOAD_STATE(cinfop, permstate)
GLOBAL boolean jpeg_fill_bit_buffer(bitread_working_state *state, register bit_buf_type get_buffer, register int bits_left, int nbits)
unsigned int restarts_to_go
if(!ValidDisplayID(prefInfo.prefDisplayID)) prefInfo.prefDisplayID
const JOCTET * next_input_byte
c_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS]
jpeg_marker_parser_method read_restart_marker
struct jpeg_entropy_decoder * entropy
#define MAX_COMPS_IN_SCAN
#define MEMZERO(target, size)