Doxygen Source Code Documentation
jdphuff.c File Reference
#include "jinclude.h"#include "jpeglib.h"#include "jdhuff.h"Go to the source code of this file.
Data Structures | |
| struct | phuff_entropy_decoder |
| struct | savable_state |
Defines | |
| #define | JPEG_INTERNALS |
| #define | ASSIGN_STATE(dest, src) ((dest) = (src)) |
| #define | HUFF_EXTEND(x, s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) |
Typedefs | |
| typedef phuff_entropy_decoder * | phuff_entropy_ptr |
Functions | |
| METHODDEF (boolean) decode_mcu_DC_first JPP((j_decompress_ptr cinfo | |
| start_pass_phuff_decoder (j_decompress_ptr cinfo) | |
| process_restart (j_decompress_ptr cinfo) | |
| decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |
| decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |
| decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |
| decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |
| jinit_phuff_decoder (j_decompress_ptr cinfo) | |
Variables | |
| JBLOCKROW * | MCU_data |
| const int | extend_test [16] |
| const int | extend_offset [16] |
Define Documentation
|
|
|
|
|
|
|
|
|
Typedef Documentation
|
|
|
Function Documentation
|
||||||||||||
|
Definition at line 357 of file jdphuff.c. References phuff_entropy_decoder::ac_derived_tbl, jpeg_decompress_struct::Al, BITREAD_LOAD_STATE, BITREAD_SAVE_STATE, BITREAD_STATE_VARS, phuff_entropy_decoder::bitstate, CHECK_BIT_BUFFER, jpeg_decompress_struct::entropy, savable_state::EOBRUN, GET_BITS, HUFF_DECODE, HUFF_EXTEND, jpeg_entropy_decoder::insufficient_data, JBLOCKROW, MCU_data, process_restart(), phuff_entropy_decoder::pub, r, jpeg_decompress_struct::restart_interval, phuff_entropy_decoder::restarts_to_go, phuff_entropy_decoder::saved, jpeg_decompress_struct::Se, and jpeg_decompress_struct::Ss. Referenced by start_pass_phuff_decoder().
00358 {
00359 phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
00360 int Se = cinfo->Se;
00361 int Al = cinfo->Al;
00362 register int s, k, r;
00363 unsigned int EOBRUN;
00364 JBLOCKROW block;
00365 BITREAD_STATE_VARS;
00366 d_derived_tbl * tbl;
00367
00368 /* Process restart marker if needed; may have to suspend */
00369 if (cinfo->restart_interval) {
00370 if (entropy->restarts_to_go == 0)
00371 if (! process_restart(cinfo))
00372 return FALSE;
00373 }
00374
00375 /* If we've run out of data, just leave the MCU set to zeroes.
00376 * This way, we return uniform gray for the remainder of the segment.
00377 */
00378 if (! entropy->pub.insufficient_data) {
00379
00380 /* Load up working state.
00381 * We can avoid loading/saving bitread state if in an EOB run.
00382 */
00383 EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
00384
00385 /* There is always only one block per MCU */
00386
00387 if (EOBRUN > 0) /* if it's a band of zeroes... */
00388 EOBRUN--; /* ...process it now (we do nothing) */
00389 else {
00390 BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
00391 block = MCU_data[0];
00392 tbl = entropy->ac_derived_tbl;
00393
00394 for (k = cinfo->Ss; k <= Se; k++) {
00395 HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
00396 r = s >> 4;
00397 s &= 15;
00398 if (s) {
00399 k += r;
00400 CHECK_BIT_BUFFER(br_state, s, return FALSE);
00401 r = GET_BITS(s);
00402 s = HUFF_EXTEND(r, s);
00403 /* Scale and output coefficient in natural (dezigzagged) order */
00404 (*block)[jpeg_natural_order[k]] = (JCOEF) (s << Al);
00405 } else {
00406 if (r == 15) { /* ZRL */
00407 k += 15; /* skip 15 zeroes in band */
00408 } else { /* EOBr, run length is 2^r + appended bits */
00409 EOBRUN = 1 << r;
00410 if (r) { /* EOBr, r > 0 */
00411 CHECK_BIT_BUFFER(br_state, r, return FALSE);
00412 r = GET_BITS(r);
00413 EOBRUN += r;
00414 }
00415 EOBRUN--; /* this band is processed at this moment */
00416 break; /* force end-of-band */
00417 }
00418 }
00419 }
00420
00421 BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
00422 }
00423
00424 /* Completed MCU, so update state */
00425 entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
00426 }
00427
00428 /* Account for restart interval (no-op if not using restarts) */
00429 entropy->restarts_to_go--;
00430
00431 return TRUE;
00432 }
|
|
||||||||||||
|
Definition at line 491 of file jdphuff.c. References phuff_entropy_decoder::ac_derived_tbl, jpeg_decompress_struct::Al, BITREAD_LOAD_STATE, BITREAD_SAVE_STATE, BITREAD_STATE_VARS, phuff_entropy_decoder::bitstate, CHECK_BIT_BUFFER, jpeg_decompress_struct::entropy, savable_state::EOBRUN, GET_BITS, HUFF_DECODE, jpeg_entropy_decoder::insufficient_data, JBLOCKROW, JCOEFPTR, m1, MCU_data, process_restart(), phuff_entropy_decoder::pub, r, jpeg_decompress_struct::restart_interval, phuff_entropy_decoder::restarts_to_go, phuff_entropy_decoder::saved, jpeg_decompress_struct::Se, jpeg_decompress_struct::Ss, and WARNMS. Referenced by start_pass_phuff_decoder().
00492 {
00493 phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
00494 int Se = cinfo->Se;
00495 int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
00496 int m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */
00497 register int s, k, r;
00498 unsigned int EOBRUN;
00499 JBLOCKROW block;
00500 JCOEFPTR thiscoef;
00501 BITREAD_STATE_VARS;
00502 d_derived_tbl * tbl;
00503 int num_newnz;
00504 int newnz_pos[DCTSIZE2];
00505
00506 /* Process restart marker if needed; may have to suspend */
00507 if (cinfo->restart_interval) {
00508 if (entropy->restarts_to_go == 0)
00509 if (! process_restart(cinfo))
00510 return FALSE;
00511 }
00512
00513 /* If we've run out of data, don't modify the MCU.
00514 */
00515 if (! entropy->pub.insufficient_data) {
00516
00517 /* Load up working state */
00518 BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
00519 EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
00520
00521 /* There is always only one block per MCU */
00522 block = MCU_data[0];
00523 tbl = entropy->ac_derived_tbl;
00524
00525 /* If we are forced to suspend, we must undo the assignments to any newly
00526 * nonzero coefficients in the block, because otherwise we'd get confused
00527 * next time about which coefficients were already nonzero.
00528 * But we need not undo addition of bits to already-nonzero coefficients;
00529 * instead, we can test the current bit to see if we already did it.
00530 */
00531 num_newnz = 0;
00532
00533 /* initialize coefficient loop counter to start of band */
00534 k = cinfo->Ss;
00535
00536 if (EOBRUN == 0) {
00537 for (; k <= Se; k++) {
00538 HUFF_DECODE(s, br_state, tbl, goto undoit, label3);
00539 r = s >> 4;
00540 s &= 15;
00541 if (s) {
00542 if (s != 1) /* size of new coef should always be 1 */
00543 WARNMS(cinfo, JWRN_HUFF_BAD_CODE);
00544 CHECK_BIT_BUFFER(br_state, 1, goto undoit);
00545 if (GET_BITS(1))
00546 s = p1; /* newly nonzero coef is positive */
00547 else
00548 s = m1; /* newly nonzero coef is negative */
00549 } else {
00550 if (r != 15) {
00551 EOBRUN = 1 << r; /* EOBr, run length is 2^r + appended bits */
00552 if (r) {
00553 CHECK_BIT_BUFFER(br_state, r, goto undoit);
00554 r = GET_BITS(r);
00555 EOBRUN += r;
00556 }
00557 break; /* rest of block is handled by EOB logic */
00558 }
00559 /* note s = 0 for processing ZRL */
00560 }
00561 /* Advance over already-nonzero coefs and r still-zero coefs,
00562 * appending correction bits to the nonzeroes. A correction bit is 1
00563 * if the absolute value of the coefficient must be increased.
00564 */
00565 do {
00566 thiscoef = *block + jpeg_natural_order[k];
00567 if (*thiscoef != 0) {
00568 CHECK_BIT_BUFFER(br_state, 1, goto undoit);
00569 if (GET_BITS(1)) {
00570 if ((*thiscoef & p1) == 0) { /* do nothing if already set it */
00571 if (*thiscoef >= 0)
00572 *thiscoef += p1;
00573 else
00574 *thiscoef += m1;
00575 }
00576 }
00577 } else {
00578 if (--r < 0)
00579 break; /* reached target zero coefficient */
00580 }
00581 k++;
00582 } while (k <= Se);
00583 if (s) {
00584 int pos = jpeg_natural_order[k];
00585 /* Output newly nonzero coefficient */
00586 (*block)[pos] = (JCOEF) s;
00587 /* Remember its position in case we have to suspend */
00588 newnz_pos[num_newnz++] = pos;
00589 }
00590 }
00591 }
00592
00593 if (EOBRUN > 0) {
00594 /* Scan any remaining coefficient positions after the end-of-band
00595 * (the last newly nonzero coefficient, if any). Append a correction
00596 * bit to each already-nonzero coefficient. A correction bit is 1
00597 * if the absolute value of the coefficient must be increased.
00598 */
00599 for (; k <= Se; k++) {
00600 thiscoef = *block + jpeg_natural_order[k];
00601 if (*thiscoef != 0) {
00602 CHECK_BIT_BUFFER(br_state, 1, goto undoit);
00603 if (GET_BITS(1)) {
00604 if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */
00605 if (*thiscoef >= 0)
00606 *thiscoef += p1;
00607 else
00608 *thiscoef += m1;
00609 }
00610 }
00611 }
00612 }
00613 /* Count one block completed in EOB run */
00614 EOBRUN--;
00615 }
00616
00617 /* Completed MCU, so update state */
00618 BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
00619 entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
00620 }
00621
00622 /* Account for restart interval (no-op if not using restarts) */
00623 entropy->restarts_to_go--;
00624
00625 return TRUE;
00626
00627 undoit:
00628 /* Re-zero any output coefficients that we made newly nonzero */
00629 while (num_newnz > 0)
00630 (*block)[newnz_pos[--num_newnz]] = 0;
00631
00632 return FALSE;
00633 }
|
|
||||||||||||
|
Definition at line 286 of file jdphuff.c. References jpeg_decompress_struct::Al, ASSIGN_STATE, BITREAD_LOAD_STATE, BITREAD_SAVE_STATE, BITREAD_STATE_VARS, phuff_entropy_decoder::bitstate, jpeg_decompress_struct::blocks_in_MCU, CHECK_BIT_BUFFER, compptr, jpeg_decompress_struct::cur_comp_info, jpeg_component_info::dc_tbl_no, phuff_entropy_decoder::derived_tbls, jpeg_decompress_struct::entropy, GET_BITS, HUFF_DECODE, HUFF_EXTEND, jpeg_entropy_decoder::insufficient_data, JBLOCKROW, savable_state::last_dc_val, MCU_data, jpeg_decompress_struct::MCU_membership, process_restart(), phuff_entropy_decoder::pub, r, jpeg_decompress_struct::restart_interval, phuff_entropy_decoder::restarts_to_go, and phuff_entropy_decoder::saved. Referenced by start_pass_phuff_decoder().
00287 {
00288 phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
00289 int Al = cinfo->Al;
00290 register int s, r;
00291 int blkn, ci;
00292 JBLOCKROW block;
00293 BITREAD_STATE_VARS;
00294 savable_state state;
00295 d_derived_tbl * tbl;
00296 jpeg_component_info * compptr;
00297
00298 /* Process restart marker if needed; may have to suspend */
00299 if (cinfo->restart_interval) {
00300 if (entropy->restarts_to_go == 0)
00301 if (! process_restart(cinfo))
00302 return FALSE;
00303 }
00304
00305 /* If we've run out of data, just leave the MCU set to zeroes.
00306 * This way, we return uniform gray for the remainder of the segment.
00307 */
00308 if (! entropy->pub.insufficient_data) {
00309
00310 /* Load up working state */
00311 BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
00312 ASSIGN_STATE(state, entropy->saved);
00313
00314 /* Outer loop handles each block in the MCU */
00315
00316 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
00317 block = MCU_data[blkn];
00318 ci = cinfo->MCU_membership[blkn];
00319 compptr = cinfo->cur_comp_info[ci];
00320 tbl = entropy->derived_tbls[compptr->dc_tbl_no];
00321
00322 /* Decode a single block's worth of coefficients */
00323
00324 /* Section F.2.2.1: decode the DC coefficient difference */
00325 HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
00326 if (s) {
00327 CHECK_BIT_BUFFER(br_state, s, return FALSE);
00328 r = GET_BITS(s);
00329 s = HUFF_EXTEND(r, s);
00330 }
00331
00332 /* Convert DC difference to actual value, update last_dc_val */
00333 s += state.last_dc_val[ci];
00334 state.last_dc_val[ci] = s;
00335 /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
00336 (*block)[0] = (JCOEF) (s << Al);
00337 }
00338
00339 /* Completed MCU, so update state */
00340 BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
00341 ASSIGN_STATE(entropy->saved, state);
00342 }
00343
00344 /* Account for restart interval (no-op if not using restarts) */
00345 entropy->restarts_to_go--;
00346
00347 return TRUE;
00348 }
|
|
||||||||||||
|
Definition at line 442 of file jdphuff.c. References jpeg_decompress_struct::Al, BITREAD_LOAD_STATE, BITREAD_SAVE_STATE, BITREAD_STATE_VARS, phuff_entropy_decoder::bitstate, jpeg_decompress_struct::blocks_in_MCU, CHECK_BIT_BUFFER, jpeg_decompress_struct::entropy, GET_BITS, JBLOCKROW, MCU_data, process_restart(), jpeg_decompress_struct::restart_interval, and phuff_entropy_decoder::restarts_to_go. Referenced by start_pass_phuff_decoder().
00443 {
00444 phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
00445 int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
00446 int blkn;
00447 JBLOCKROW block;
00448 BITREAD_STATE_VARS;
00449
00450 /* Process restart marker if needed; may have to suspend */
00451 if (cinfo->restart_interval) {
00452 if (entropy->restarts_to_go == 0)
00453 if (! process_restart(cinfo))
00454 return FALSE;
00455 }
00456
00457 /* Not worth the cycles to check insufficient_data here,
00458 * since we will not change the data anyway if we read zeroes.
00459 */
00460
00461 /* Load up working state */
00462 BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
00463
00464 /* Outer loop handles each block in the MCU */
00465
00466 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
00467 block = MCU_data[blkn];
00468
00469 /* Encoded data is simply the next bit of the two's-complement DC value */
00470 CHECK_BIT_BUFFER(br_state, 1, return FALSE);
00471 if (GET_BITS(1))
00472 (*block)[0] |= p1;
00473 /* Note: since we use |=, repeating the assignment later is safe */
00474 }
00475
00476 /* Completed MCU, so update state */
00477 BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
00478
00479 /* Account for restart interval (no-op if not using restarts) */
00480 entropy->restarts_to_go--;
00481
00482 return TRUE;
00483 }
|
|
|
Definition at line 641 of file jdphuff.c. References i, JPOOL_IMAGE, NUM_HUFF_TBLS, SIZEOF, and start_pass_phuff_decoder(). Referenced by master_selection(), and transdecode_master_selection().
00642 {
00643 phuff_entropy_ptr entropy;
00644 int *coef_bit_ptr;
00645 int ci, i;
00646
00647 entropy = (phuff_entropy_ptr)
00648 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
00649 SIZEOF(phuff_entropy_decoder));
00650 cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;
00651 entropy->pub.start_pass = start_pass_phuff_decoder;
00652
00653 /* Mark derived tables unallocated */
00654 for (i = 0; i < NUM_HUFF_TBLS; i++) {
00655 entropy->derived_tbls[i] = NULL;
00656 }
00657
00658 /* Create progression status table */
00659 cinfo->coef_bits = (int (*)[DCTSIZE2])
00660 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
00661 cinfo->num_components*DCTSIZE2*SIZEOF(int));
00662 coef_bit_ptr = & cinfo->coef_bits[0][0];
00663 for (ci = 0; ci < cinfo->num_components; ci++)
00664 for (i = 0; i < DCTSIZE2; i++)
00665 *coef_bit_ptr++ = -1;
00666 }
|
|
|
|
|
|
Definition at line 228 of file jdphuff.c. References bitread_perm_state::bits_left, phuff_entropy_decoder::bitstate, jpeg_decompress_struct::comps_in_scan, jpeg_marker_reader::discarded_bytes, jpeg_decompress_struct::entropy, savable_state::EOBRUN, jpeg_entropy_decoder::insufficient_data, savable_state::last_dc_val, jpeg_decompress_struct::marker, phuff_entropy_decoder::pub, jpeg_marker_reader::read_restart_marker, jpeg_decompress_struct::restart_interval, phuff_entropy_decoder::restarts_to_go, phuff_entropy_decoder::saved, and jpeg_decompress_struct::unread_marker. Referenced by decode_mcu(), decode_mcu_AC_first(), decode_mcu_AC_refine(), decode_mcu_DC_first(), and decode_mcu_DC_refine().
00229 {
00230 phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
00231 int ci;
00232
00233 /* Throw away any unused bits remaining in bit buffer; */
00234 /* include any full bytes in next_marker's count of discarded bytes */
00235 cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
00236 entropy->bitstate.bits_left = 0;
00237
00238 /* Advance past the RSTn marker */
00239 if (! (*cinfo->marker->read_restart_marker) (cinfo))
00240 return FALSE;
00241
00242 /* Re-initialize DC predictions to 0 */
00243 for (ci = 0; ci < cinfo->comps_in_scan; ci++)
00244 entropy->saved.last_dc_val[ci] = 0;
00245 /* Re-init EOB run count, too */
00246 entropy->saved.EOBRUN = 0;
00247
00248 /* Reset restart counter */
00249 entropy->restarts_to_go = cinfo->restart_interval;
00250
00251 /* Reset out-of-data flag, unless read_restart_marker left us smack up
00252 * against a marker. In that case we will end up treating the next data
00253 * segment as empty, and we can avoid producing bogus output pixels by
00254 * leaving the flag set.
00255 */
00256 if (cinfo->unread_marker == 0)
00257 entropy->pub.insufficient_data = FALSE;
00258
00259 return TRUE;
00260 }
|
|
|
Definition at line 92 of file jdphuff.c. References phuff_entropy_decoder::ac_derived_tbl, jpeg_component_info::ac_tbl_no, jpeg_decompress_struct::Ah, jpeg_decompress_struct::Al, bitread_perm_state::bits_left, phuff_entropy_decoder::bitstate, jpeg_decompress_struct::coef_bits, jpeg_component_info::component_index, compptr, jpeg_decompress_struct::comps_in_scan, jpeg_decompress_struct::cur_comp_info, jpeg_component_info::dc_tbl_no, decode_mcu_AC_first(), decode_mcu_AC_refine(), decode_mcu_DC_first(), decode_mcu_DC_refine(), phuff_entropy_decoder::derived_tbls, jpeg_decompress_struct::entropy, savable_state::EOBRUN, ERREXIT4, bitread_perm_state::get_buffer, jpeg_entropy_decoder::insufficient_data, JERR_BAD_PROGRESSION, jpeg_make_d_derived_tbl(), JWRN_BOGUS_PROGRESSION, savable_state::last_dc_val, phuff_entropy_decoder::pub, jpeg_decompress_struct::restart_interval, phuff_entropy_decoder::restarts_to_go, phuff_entropy_decoder::saved, jpeg_decompress_struct::Se, jpeg_decompress_struct::Ss, and WARNMS2. Referenced by jinit_phuff_decoder().
00093 {
00094 phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
00095 boolean is_DC_band, bad;
00096 int ci, coefi, tbl;
00097 int *coef_bit_ptr;
00098 jpeg_component_info * compptr;
00099
00100 is_DC_band = (cinfo->Ss == 0);
00101
00102 /* Validate scan parameters */
00103 bad = FALSE;
00104 if (is_DC_band) {
00105 if (cinfo->Se != 0)
00106 bad = TRUE;
00107 } else {
00108 /* need not check Ss/Se < 0 since they came from unsigned bytes */
00109 if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2)
00110 bad = TRUE;
00111 /* AC scans may have only one component */
00112 if (cinfo->comps_in_scan != 1)
00113 bad = TRUE;
00114 }
00115 if (cinfo->Ah != 0) {
00116 /* Successive approximation refinement scan: must have Al = Ah-1. */
00117 if (cinfo->Al != cinfo->Ah-1)
00118 bad = TRUE;
00119 }
00120 if (cinfo->Al > 13) /* need not check for < 0 */
00121 bad = TRUE;
00122 /* Arguably the maximum Al value should be less than 13 for 8-bit precision,
00123 * but the spec doesn't say so, and we try to be liberal about what we
00124 * accept. Note: large Al values could result in out-of-range DC
00125 * coefficients during early scans, leading to bizarre displays due to
00126 * overflows in the IDCT math. But we won't crash.
00127 */
00128 if (bad)
00129 ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
00130 cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
00131 /* Update progression status, and verify that scan order is legal.
00132 * Note that inter-scan inconsistencies are treated as warnings
00133 * not fatal errors ... not clear if this is right way to behave.
00134 */
00135 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
00136 int cindex = cinfo->cur_comp_info[ci]->component_index;
00137 coef_bit_ptr = & cinfo->coef_bits[cindex][0];
00138 if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
00139 WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
00140 for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
00141 int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
00142 if (cinfo->Ah != expected)
00143 WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
00144 coef_bit_ptr[coefi] = cinfo->Al;
00145 }
00146 }
00147
00148 /* Select MCU decoding routine */
00149 if (cinfo->Ah == 0) {
00150 if (is_DC_band)
00151 entropy->pub.decode_mcu = decode_mcu_DC_first;
00152 else
00153 entropy->pub.decode_mcu = decode_mcu_AC_first;
00154 } else {
00155 if (is_DC_band)
00156 entropy->pub.decode_mcu = decode_mcu_DC_refine;
00157 else
00158 entropy->pub.decode_mcu = decode_mcu_AC_refine;
00159 }
00160
00161 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
00162 compptr = cinfo->cur_comp_info[ci];
00163 /* Make sure requested tables are present, and compute derived tables.
00164 * We may build same derived table more than once, but it's not expensive.
00165 */
00166 if (is_DC_band) {
00167 if (cinfo->Ah == 0) { /* DC refinement needs no table */
00168 tbl = compptr->dc_tbl_no;
00169 jpeg_make_d_derived_tbl(cinfo, TRUE, tbl,
00170 & entropy->derived_tbls[tbl]);
00171 }
00172 } else {
00173 tbl = compptr->ac_tbl_no;
00174 jpeg_make_d_derived_tbl(cinfo, FALSE, tbl,
00175 & entropy->derived_tbls[tbl]);
00176 /* remember the single active table */
00177 entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
00178 }
00179 /* Initialize DC predictions to 0 */
00180 entropy->saved.last_dc_val[ci] = 0;
00181 }
00182
00183 /* Initialize bitread state variables */
00184 entropy->bitstate.bits_left = 0;
00185 entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
00186 entropy->pub.insufficient_data = FALSE;
00187
00188 /* Initialize private state variables */
00189 entropy->saved.EOBRUN = 0;
00190
00191 /* Initialize restart counter */
00192 entropy->restarts_to_go = cinfo->restart_interval;
00193 }
|
Variable Documentation
|
|
Initial value:
{ 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 } |
|
|
Initial value:
{ 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 } |
|
|
|