23#ifdef D_PROGRESSIVE_SUPPORTED
42#ifndef NO_STRUCT_ASSIGN
43#define ASSIGN_STATE(dest,src) ((dest) = (src))
45#if MAX_COMPS_IN_SCAN == 4
46#define ASSIGN_STATE(dest,src) \
47 ((dest).EOBRUN = (src).EOBRUN, \
48 (dest).last_dc_val[0] = (src).last_dc_val[0], \
49 (dest).last_dc_val[1] = (src).last_dc_val[1], \
50 (dest).last_dc_val[2] = (src).last_dc_val[2], \
51 (dest).last_dc_val[3] = (src).last_dc_val[3])
95 boolean is_DC_band, bad;
100 is_DC_band = (cinfo->Ss == 0);
109 if (cinfo->Ss > cinfo->Se || cinfo->Se >=
DCTSIZE2)
112 if (cinfo->comps_in_scan != 1)
115 if (cinfo->Ah != 0) {
117 if (cinfo->Al != cinfo->Ah-1)
129 ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
130 cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
135 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
136 int cindex = cinfo->cur_comp_info[ci]->component_index;
137 coef_bit_ptr = & cinfo->coef_bits[cindex][0];
138 if (!is_DC_band && coef_bit_ptr[0] < 0)
139 WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
140 for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
141 int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
142 if (cinfo->Ah != expected)
143 WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
144 coef_bit_ptr[coefi] = cinfo->Al;
149 if (cinfo->Ah == 0) {
161 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
162 compptr = cinfo->cur_comp_info[ci];
167 if (cinfo->Ah == 0) {
170 & entropy->derived_tbls[tbl]);
175 & entropy->derived_tbls[tbl]);
177 entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
180 entropy->saved.last_dc_val[ci] = 0;
184 entropy->bitstate.bits_left = 0;
185 entropy->bitstate.get_buffer = 0;
186 entropy->pub.insufficient_data =
FALSE;
189 entropy->saved.EOBRUN = 0;
192 entropy->restarts_to_go = cinfo->restart_interval;
213 if (! (*cinfo->marker->read_restart_marker) (cinfo))
217 for (ci = 0; ci < cinfo->comps_in_scan; ci++)
230 if (cinfo->unread_marker == 0)
273 if (cinfo->restart_interval) {
274 if (entropy->restarts_to_go == 0)
275 if (! process_restartp(cinfo))
285 BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
286 ASSIGN_STATE(state, entropy->saved);
290 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
291 block = MCU_data[blkn];
292 ci = cinfo->MCU_membership[blkn];
293 compptr = cinfo->cur_comp_info[ci];
294 tbl = entropy->derived_tbls[compptr->dc_tbl_no];
299 HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
301 CHECK_BIT_BUFFER(br_state, s, return FALSE);
303 s = HUFF_EXTEND(r, s);
307 s += state.last_dc_val[ci];
308 state.last_dc_val[ci] = s;
310 (*block)[0] = (JCOEF) (s << Al);
319 entropy->restarts_to_go--;
343 if (cinfo->restart_interval) {
344 if (entropy->restarts_to_go == 0)
345 if (! process_restartp(cinfo))
357 EOBRUN = entropy->saved.EOBRUN;
364 BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
366 tbl = entropy->ac_derived_tbl;
368 for (k = cinfo->Ss; k <= Se; k++) {
369 HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
374 CHECK_BIT_BUFFER(br_state, s, return FALSE);
376 s = HUFF_EXTEND(r, s);
378 (*block)[jpeg_natural_order[k]] = (JCOEF) (s << Al);
385 CHECK_BIT_BUFFER(br_state, r, return FALSE);
395 BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
403 entropy->restarts_to_go--;
419 int p1 = 1 << cinfo->Al;
425 if (cinfo->restart_interval) {
426 if (entropy->restarts_to_go == 0)
427 if (! process_restartp(cinfo))
440 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
441 block = MCU_data[blkn];
469 int p1 = 1 << cinfo->Al;
470 int m1 = (-1) << cinfo->Al;
481 if (cinfo->restart_interval) {
482 if (entropy->restarts_to_go == 0)
483 if (! process_restartp(cinfo))
492 BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
493 EOBRUN = entropy->saved.EOBRUN;
497 tbl = entropy->ac_derived_tbl;
511 for (; k <= Se; k++) {
512 HUFF_DECODE(s, br_state, tbl, goto undoit, label3);
517 WARNMS(cinfo, JWRN_HUFF_BAD_CODE);
518 CHECK_BIT_BUFFER(br_state, 1, goto undoit);
527 CHECK_BIT_BUFFER(br_state, r, goto undoit);
540 thiscoef = *block + jpeg_natural_order[k];
541 if (*thiscoef != 0) {
542 CHECK_BIT_BUFFER(br_state, 1, goto undoit);
544 if ((*thiscoef & p1) == 0) {
558 int pos = jpeg_natural_order[k];
560 (*block)[pos] = (JCOEF) s;
562 newnz_pos[num_newnz++] = pos;
573 for (;
k <= Se;
k++) {
575 if (*thiscoef != 0) {
578 if ((*thiscoef & p1) == 0) {
597 entropy->restarts_to_go--;
603 while (num_newnz > 0)
604 (*block)[newnz_pos[--num_newnz]] = 0;
625 entropy->
pub.start_pass = start_pass_phuff_decoder;
636 coef_bit_ptr = & cinfo->coef_bits[0][0];
637 for (ci = 0; ci < cinfo->num_components; ci++)
639 *coef_bit_ptr++ = -1;
register unsigned k
Definition inflate.c:946
register unsigned i
Definition inflate.c:1575
unsigned s
Definition inflate.c:1555
#define ASSIGN_STATE(dest, src)
Definition jchuff.c:41
jpeg_component_info * compptr
Definition jdct.h:105
jpeg_make_d_derived_tbl(j_decompress_ptr cinfo, boolean isDC, int tblno, d_derived_tbl **pdtbl)
Definition jdhuff.c:149
#define GET_BITS(nbits)
Definition jdhuff.h:147
#define BITREAD_STATE_VARS
Definition jdhuff.h:105
#define BITREAD_LOAD_STATE(cinfop, permstate)
Definition jdhuff.h:110
#define CHECK_BIT_BUFFER(state, nbits, action)
Definition jdhuff.h:141
#define BITREAD_SAVE_STATE(cinfop, permstate)
Definition jdhuff.h:117
decode_mcu_DC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
Definition jdphuff.c:416
jinit_phuff_decoder(j_decompress_ptr cinfo)
Definition jdphuff.c:615
decode_mcu_AC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
Definition jdphuff.c:465
process_restartp(j_decompress_ptr cinfo)
Definition jdphuff.c:202
phuff_entropy_decoder * phuff_entropy_ptr2
Definition jdphuff.c:74
decode_mcu_AC_first(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
Definition jdphuff.c:331
decode_mcu_DC_first(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
Definition jdphuff.c:260
#define WARNMS2(cinfo, code, p1, p2)
Definition jerror.h:245
#define ERREXIT4(cinfo, code, p1, p2, p3, p4)
Definition jerror.h:223
#define SIZEOF(object)
Definition jinclude.h:83
#define LOCAL(type)
Definition jmorecfg.h:186
#define METHODDEF(type)
Definition jmorecfg.h:184
const int jpeg_natural_order[]
Definition jutils.c:53
struct jpeg_decompress_struct * j_decompress_ptr
Definition jpeglib.h:263
JBLOCK FAR * JBLOCKROW
Definition jpeglib.h:71
struct jpeg_common_struct * j_common_ptr
Definition jpeglib.h:261
#define JPP(arglist)
Definition jpeglib.h:818
#define NUM_HUFF_TBLS
Definition jpeglib.h:44
JCOEF FAR * JCOEFPTR
Definition jpeglib.h:75
#define JPOOL_IMAGE
Definition jpeglib.h:749
#define MAX_COMPS_IN_SCAN
Definition jpeglib.h:46
#define DCTSIZE2
Definition jpeglib.h:42
int bits_left
Definition jdhuff.h:87
struct jpeg_entropy_decoder * entropy
Definition jpeglib.h:625
boolean insufficient_data
Definition jpegint.h:216
bitread_perm_state bitstate
Definition jdphuff.c:62
unsigned int restarts_to_go
Definition jdphuff.c:66
d_derived_tbl * ac_derived_tbl
Definition jdphuff.c:71
struct jpeg_entropy_decoder pub
Definition jdphuff.c:57
d_derived_tbl * derived_tbls[NUM_HUFF_TBLS]
Definition jdphuff.c:69
savable_state3 saved
Definition jdphuff.c:63
int last_dc_val[MAX_COMPS_IN_SCAN]
Definition jdphuff.c:34
unsigned int EOBRUN
Definition jdphuff.c:33
#define GLOBAL(g)
Definition crypt.c:87
for(n=0;n< RAND_HEAD_LEN;n++)
Definition crypt.c:467
int r
Definition crypt.c:458
if(GLOBAL(newzip))
Definition crypt.c:475
typedef int(UZ_EXP MsgFn)()
#define TRUE
Definition unzpriv.h:1295
#define FALSE
Definition unzpriv.h:1298