Doxygen Source Code Documentation
jdhuff.c File Reference
#include "jinclude.h"#include "jpeglib.h"#include "jdhuff.h"Go to the source code of this file.
Data Structures | |
| struct | huff_entropy_decoder |
| struct | savable_state |
Defines | |
| #define | JPEG_INTERNALS |
| #define | ASSIGN_STATE(dest, src) ((dest) = (src)) |
| #define | MIN_GET_BITS (BIT_BUF_SIZE-7) |
| #define | HUFF_EXTEND(x, s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) |
Typedefs | |
| typedef huff_entropy_decoder * | huff_entropy_ptr |
Functions | |
| start_pass_huff_decoder (j_decompress_ptr cinfo) | |
| jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno, d_derived_tbl **pdtbl) | |
| jpeg_fill_bit_buffer (bitread_working_state *state, register bit_buf_type get_buffer, register int bits_left, int nbits) | |
| jpeg_huff_decode (bitread_working_state *state, register bit_buf_type get_buffer, register int bits_left, d_derived_tbl *htbl, int min_bits) | |
| process_restart (j_decompress_ptr cinfo) | |
| decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |
| jinit_huff_decoder (j_decompress_ptr cinfo) | |
Variables | |
| const int | extend_test [16] |
| const int | extend_offset [16] |
Define Documentation
|
|
|
|
|
Definition at line 447 of file jdhuff.c. Referenced by decode_mcu(), decode_mcu_AC_first(), and decode_mcu_DC_first(). |
|
|
|
|
|
Definition at line 287 of file jdhuff.c. Referenced by jpeg_fill_bit_buffer(). |
Typedef Documentation
|
|
|
Function Documentation
|
||||||||||||
|
Definition at line 517 of file jdhuff.c. References huff_entropy_decoder::ac_cur_tbls, huff_entropy_decoder::ac_needed, ASSIGN_STATE, BITREAD_LOAD_STATE, BITREAD_SAVE_STATE, BITREAD_STATE_VARS, huff_entropy_decoder::bitstate, jpeg_decompress_struct::blocks_in_MCU, CHECK_BIT_BUFFER, huff_entropy_decoder::dc_cur_tbls, huff_entropy_decoder::dc_needed, DROP_BITS, jpeg_decompress_struct::entropy, GET_BITS, HUFF_DECODE, HUFF_EXTEND, jpeg_entropy_decoder::insufficient_data, JBLOCKROW, savable_state::last_dc_val, jpeg_decompress_struct::MCU_membership, process_restart(), huff_entropy_decoder::pub, r, jpeg_decompress_struct::restart_interval, huff_entropy_decoder::restarts_to_go, and huff_entropy_decoder::saved. Referenced by jinit_huff_decoder().
00518 {
00519 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
00520 int blkn;
00521 BITREAD_STATE_VARS;
00522 savable_state state;
00523
00524 /* Process restart marker if needed; may have to suspend */
00525 if (cinfo->restart_interval) {
00526 if (entropy->restarts_to_go == 0)
00527 if (! process_restart(cinfo))
00528 return FALSE;
00529 }
00530
00531 /* If we've run out of data, just leave the MCU set to zeroes.
00532 * This way, we return uniform gray for the remainder of the segment.
00533 */
00534 if (! entropy->pub.insufficient_data) {
00535
00536 /* Load up working state */
00537 BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
00538 ASSIGN_STATE(state, entropy->saved);
00539
00540 /* Outer loop handles each block in the MCU */
00541
00542 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
00543 JBLOCKROW block = MCU_data[blkn];
00544 d_derived_tbl * dctbl = entropy->dc_cur_tbls[blkn];
00545 d_derived_tbl * actbl = entropy->ac_cur_tbls[blkn];
00546 register int s, k, r;
00547
00548 /* Decode a single block's worth of coefficients */
00549
00550 /* Section F.2.2.1: decode the DC coefficient difference */
00551 HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
00552 if (s) {
00553 CHECK_BIT_BUFFER(br_state, s, return FALSE);
00554 r = GET_BITS(s);
00555 s = HUFF_EXTEND(r, s);
00556 }
00557
00558 if (entropy->dc_needed[blkn]) {
00559 /* Convert DC difference to actual value, update last_dc_val */
00560 int ci = cinfo->MCU_membership[blkn];
00561 s += state.last_dc_val[ci];
00562 state.last_dc_val[ci] = s;
00563 /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
00564 (*block)[0] = (JCOEF) s;
00565 }
00566
00567 if (entropy->ac_needed[blkn]) {
00568
00569 /* Section F.2.2.2: decode the AC coefficients */
00570 /* Since zeroes are skipped, output area must be cleared beforehand */
00571 for (k = 1; k < DCTSIZE2; k++) {
00572 HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
00573
00574 r = s >> 4;
00575 s &= 15;
00576
00577 if (s) {
00578 k += r;
00579 CHECK_BIT_BUFFER(br_state, s, return FALSE);
00580 r = GET_BITS(s);
00581 s = HUFF_EXTEND(r, s);
00582 /* Output coefficient in natural (dezigzagged) order.
00583 * Note: the extra entries in jpeg_natural_order[] will save us
00584 * if k >= DCTSIZE2, which could happen if the data is corrupted.
00585 */
00586 (*block)[jpeg_natural_order[k]] = (JCOEF) s;
00587 } else {
00588 if (r != 15)
00589 break;
00590 k += 15;
00591 }
00592 }
00593
00594 } else {
00595
00596 /* Section F.2.2.2: decode the AC coefficients */
00597 /* In this path we just discard the values */
00598 for (k = 1; k < DCTSIZE2; k++) {
00599 HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
00600
00601 r = s >> 4;
00602 s &= 15;
00603
00604 if (s) {
00605 k += r;
00606 CHECK_BIT_BUFFER(br_state, s, return FALSE);
00607 DROP_BITS(s);
00608 } else {
00609 if (r != 15)
00610 break;
00611 k += 15;
00612 }
00613 }
00614
00615 }
00616 }
00617
00618 /* Completed MCU, so update state */
00619 BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
00620 ASSIGN_STATE(entropy->saved, state);
00621 }
00622
00623 /* Account for restart interval (no-op if not using restarts) */
00624 entropy->restarts_to_go--;
00625
00626 return TRUE;
00627 }
|
|
|
Definition at line 635 of file jdhuff.c. References decode_mcu(), i, JPOOL_IMAGE, NUM_HUFF_TBLS, SIZEOF, and start_pass_huff_decoder(). Referenced by master_selection(), and transdecode_master_selection().
00636 {
00637 huff_entropy_ptr entropy;
00638 int i;
00639
00640 entropy = (huff_entropy_ptr)
00641 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
00642 SIZEOF(huff_entropy_decoder));
00643 cinfo->entropy = (struct jpeg_entropy_decoder *) entropy;
00644 entropy->pub.start_pass = start_pass_huff_decoder;
00645 entropy->pub.decode_mcu = decode_mcu;
00646
00647 /* Mark tables unallocated */
00648 for (i = 0; i < NUM_HUFF_TBLS; i++) {
00649 entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
00650 }
00651 }
|
|
||||||||||||||||||||
|
Definition at line 292 of file jdhuff.c. References bit_buf_type, bitread_working_state::bits_left, bits_left, jpeg_source_mgr::bytes_in_buffer, bitread_working_state::bytes_in_buffer, c, bitread_working_state::cinfo, jpeg_decompress_struct::entropy, bitread_working_state::get_buffer, get_buffer, GETJOCTET, jpeg_entropy_decoder::insufficient_data, JOCTET, MIN_GET_BITS, jpeg_source_mgr::next_input_byte, bitread_working_state::next_input_byte, jpeg_decompress_struct::src, jpeg_decompress_struct::unread_marker, and WARNMS.
00296 {
00297 /* Copy heavily used state fields into locals (hopefully registers) */
00298 register const JOCTET * next_input_byte = state->next_input_byte;
00299 register size_t bytes_in_buffer = state->bytes_in_buffer;
00300 j_decompress_ptr cinfo = state->cinfo;
00301
00302 /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */
00303 /* (It is assumed that no request will be for more than that many bits.) */
00304 /* We fail to do so only if we hit a marker or are forced to suspend. */
00305
00306 if (cinfo->unread_marker == 0) { /* cannot advance past a marker */
00307 while (bits_left < MIN_GET_BITS) {
00308 register int c;
00309
00310 /* Attempt to read a byte */
00311 if (bytes_in_buffer == 0) {
00312 if (! (*cinfo->src->fill_input_buffer) (cinfo))
00313 return FALSE;
00314 next_input_byte = cinfo->src->next_input_byte;
00315 bytes_in_buffer = cinfo->src->bytes_in_buffer;
00316 }
00317 bytes_in_buffer--;
00318 c = GETJOCTET(*next_input_byte++);
00319
00320 /* If it's 0xFF, check and discard stuffed zero byte */
00321 if (c == 0xFF) {
00322 /* Loop here to discard any padding FF's on terminating marker,
00323 * so that we can save a valid unread_marker value. NOTE: we will
00324 * accept multiple FF's followed by a 0 as meaning a single FF data
00325 * byte. This data pattern is not valid according to the standard.
00326 */
00327 do {
00328 if (bytes_in_buffer == 0) {
00329 if (! (*cinfo->src->fill_input_buffer) (cinfo))
00330 return FALSE;
00331 next_input_byte = cinfo->src->next_input_byte;
00332 bytes_in_buffer = cinfo->src->bytes_in_buffer;
00333 }
00334 bytes_in_buffer--;
00335 c = GETJOCTET(*next_input_byte++);
00336 } while (c == 0xFF);
00337
00338 if (c == 0) {
00339 /* Found FF/00, which represents an FF data byte */
00340 c = 0xFF;
00341 } else {
00342 /* Oops, it's actually a marker indicating end of compressed data.
00343 * Save the marker code for later use.
00344 * Fine point: it might appear that we should save the marker into
00345 * bitread working state, not straight into permanent state. But
00346 * once we have hit a marker, we cannot need to suspend within the
00347 * current MCU, because we will read no more bytes from the data
00348 * source. So it is OK to update permanent state right away.
00349 */
00350 cinfo->unread_marker = c;
00351 /* See if we need to insert some fake zero bits. */
00352 goto no_more_bytes;
00353 }
00354 }
00355
00356 /* OK, load c into get_buffer */
00357 get_buffer = (get_buffer << 8) | c;
00358 bits_left += 8;
00359 } /* end while */
00360 } else {
00361 no_more_bytes:
00362 /* We get here if we've read the marker that terminates the compressed
00363 * data segment. There should be enough bits in the buffer register
00364 * to satisfy the request; if so, no problem.
00365 */
00366 if (nbits > bits_left) {
00367 /* Uh-oh. Report corrupted data to user and stuff zeroes into
00368 * the data stream, so that we can produce some kind of image.
00369 * We use a nonvolatile flag to ensure that only one warning message
00370 * appears per data segment.
00371 */
00372 if (! cinfo->entropy->insufficient_data) {
00373 WARNMS(cinfo, JWRN_HIT_MARKER);
00374 cinfo->entropy->insufficient_data = TRUE;
00375 }
00376 /* Fill the buffer with zero bits */
00377 get_buffer <<= MIN_GET_BITS - bits_left;
00378 bits_left = MIN_GET_BITS;
00379 }
00380 }
00381
00382 /* Unload the local registers */
00383 state->next_input_byte = next_input_byte;
00384 state->bytes_in_buffer = bytes_in_buffer;
00385 state->get_buffer = get_buffer;
00386 state->bits_left = bits_left;
00387
00388 return TRUE;
00389 }
|
|
||||||||||||||||||||||||
|
Definition at line 398 of file jdhuff.c. References bit_buf_type, bitread_working_state::bits_left, bits_left, CHECK_BIT_BUFFER, bitread_working_state::cinfo, GET_BITS, bitread_working_state::get_buffer, get_buffer, JHUFF_TBL::huffval, INT32, l, d_derived_tbl::maxcode, min_bits, d_derived_tbl::pub, d_derived_tbl::valoffset, and WARNMS.
00401 {
00402 register int l = min_bits;
00403 register INT32 code;
00404
00405 /* HUFF_DECODE has determined that the code is at least min_bits */
00406 /* bits long, so fetch that many bits in one swoop. */
00407
00408 CHECK_BIT_BUFFER(*state, l, return -1);
00409 code = GET_BITS(l);
00410
00411 /* Collect the rest of the Huffman code one bit at a time. */
00412 /* This is per Figure F.16 in the JPEG spec. */
00413
00414 while (code > htbl->maxcode[l]) {
00415 code <<= 1;
00416 CHECK_BIT_BUFFER(*state, 1, return -1);
00417 code |= GET_BITS(1);
00418 l++;
00419 }
00420
00421 /* Unload the local registers */
00422 state->get_buffer = get_buffer;
00423 state->bits_left = bits_left;
00424
00425 /* With garbage input we may reach the sentinel value l = 17. */
00426
00427 if (l > 16) {
00428 WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
00429 return 0; /* fake a zero as the safest result */
00430 }
00431
00432 return htbl->pub->huffval[ (int) (code + htbl->valoffset[l]) ];
00433 }
|
|
||||||||||||||||||||
|
Definition at line 149 of file jdhuff.c. References jpeg_decompress_struct::ac_huff_tbl_ptrs, JHUFF_TBL::bits, jpeg_decompress_struct::dc_huff_tbl_ptrs, ERREXIT, ERREXIT1, HUFF_LOOKAHEAD, JHUFF_TBL::huffval, i, JPOOL_IMAGE, L, l, d_derived_tbl::look_nbits, d_derived_tbl::look_sym, d_derived_tbl::maxcode, MEMZERO, NUM_HUFF_TBLS, p, d_derived_tbl::pub, SIZEOF, and d_derived_tbl::valoffset. Referenced by start_pass_huff_decoder(), and start_pass_phuff_decoder().
00151 {
00152 JHUFF_TBL *htbl;
00153 d_derived_tbl *dtbl;
00154 int p, i, l, si, numsymbols;
00155 int lookbits, ctr;
00156 char huffsize[257];
00157 unsigned int huffcode[257];
00158 unsigned int code;
00159
00160 /* Note that huffsize[] and huffcode[] are filled in code-length order,
00161 * paralleling the order of the symbols themselves in htbl->huffval[].
00162 */
00163
00164 /* Find the input Huffman table */
00165 if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
00166 ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
00167 htbl =
00168 isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
00169 if (htbl == NULL)
00170 ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
00171
00172 /* Allocate a workspace if we haven't already done so. */
00173 if (*pdtbl == NULL)
00174 *pdtbl = (d_derived_tbl *)
00175 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
00176 SIZEOF(d_derived_tbl));
00177 dtbl = *pdtbl;
00178 dtbl->pub = htbl; /* fill in back link */
00179
00180 /* Figure C.1: make table of Huffman code length for each symbol */
00181
00182 p = 0;
00183 for (l = 1; l <= 16; l++) {
00184 i = (int) htbl->bits[l];
00185 if (i < 0 || p + i > 256) /* protect against table overrun */
00186 ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
00187 while (i--)
00188 huffsize[p++] = (char) l;
00189 }
00190 huffsize[p] = 0;
00191 numsymbols = p;
00192
00193 /* Figure C.2: generate the codes themselves */
00194 /* We also validate that the counts represent a legal Huffman code tree. */
00195
00196 code = 0;
00197 si = huffsize[0];
00198 p = 0;
00199 while (huffsize[p]) {
00200 while (((int) huffsize[p]) == si) {
00201 huffcode[p++] = code;
00202 code++;
00203 }
00204 /* code is now 1 more than the last code used for codelength si; but
00205 * it must still fit in si bits, since no code is allowed to be all ones.
00206 */
00207 if (((INT32) code) >= (((INT32) 1) << si))
00208 ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
00209 code <<= 1;
00210 si++;
00211 }
00212
00213 /* Figure F.15: generate decoding tables for bit-sequential decoding */
00214
00215 p = 0;
00216 for (l = 1; l <= 16; l++) {
00217 if (htbl->bits[l]) {
00218 /* valoffset[l] = huffval[] index of 1st symbol of code length l,
00219 * minus the minimum code of length l
00220 */
00221 dtbl->valoffset[l] = (INT32) p - (INT32) huffcode[p];
00222 p += htbl->bits[l];
00223 dtbl->maxcode[l] = huffcode[p-1]; /* maximum code of length l */
00224 } else {
00225 dtbl->maxcode[l] = -1; /* -1 if no codes of this length */
00226 }
00227 }
00228 dtbl->maxcode[17] = 0xFFFFFL; /* ensures jpeg_huff_decode terminates */
00229
00230 /* Compute lookahead tables to speed up decoding.
00231 * First we set all the table entries to 0, indicating "too long";
00232 * then we iterate through the Huffman codes that are short enough and
00233 * fill in all the entries that correspond to bit sequences starting
00234 * with that code.
00235 */
00236
00237 MEMZERO(dtbl->look_nbits, SIZEOF(dtbl->look_nbits));
00238
00239 p = 0;
00240 for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
00241 for (i = 1; i <= (int) htbl->bits[l]; i++, p++) {
00242 /* l = current code's length, p = its index in huffcode[] & huffval[]. */
00243 /* Generate left-justified code followed by all possible bit sequences */
00244 lookbits = huffcode[p] << (HUFF_LOOKAHEAD-l);
00245 for (ctr = 1 << (HUFF_LOOKAHEAD-l); ctr > 0; ctr--) {
00246 dtbl->look_nbits[lookbits] = l;
00247 dtbl->look_sym[lookbits] = htbl->huffval[p];
00248 lookbits++;
00249 }
00250 }
00251 }
00252
00253 /* Validate symbols as being reasonable.
00254 * For AC tables, we make no check, but accept all byte values 0..255.
00255 * For DC tables, we require the symbols to be in range 0..15.
00256 * (Tighter bounds could be applied depending on the data depth and mode,
00257 * but this is sufficient to ensure safe decoding.)
00258 */
00259 if (isDC) {
00260 for (i = 0; i < numsymbols; i++) {
00261 int sym = htbl->huffval[i];
00262 if (sym < 0 || sym > 15)
00263 ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
00264 }
00265 }
00266 }
|
|
|
Definition at line 468 of file jdhuff.c. References bitread_perm_state::bits_left, huff_entropy_decoder::bitstate, jpeg_decompress_struct::comps_in_scan, jpeg_marker_reader::discarded_bytes, jpeg_decompress_struct::entropy, jpeg_entropy_decoder::insufficient_data, savable_state::last_dc_val, jpeg_decompress_struct::marker, huff_entropy_decoder::pub, jpeg_marker_reader::read_restart_marker, jpeg_decompress_struct::restart_interval, huff_entropy_decoder::restarts_to_go, huff_entropy_decoder::saved, and jpeg_decompress_struct::unread_marker.
00469 {
00470 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
00471 int ci;
00472
00473 /* Throw away any unused bits remaining in bit buffer; */
00474 /* include any full bytes in next_marker's count of discarded bytes */
00475 cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
00476 entropy->bitstate.bits_left = 0;
00477
00478 /* Advance past the RSTn marker */
00479 if (! (*cinfo->marker->read_restart_marker) (cinfo))
00480 return FALSE;
00481
00482 /* Re-initialize DC predictions to 0 */
00483 for (ci = 0; ci < cinfo->comps_in_scan; ci++)
00484 entropy->saved.last_dc_val[ci] = 0;
00485
00486 /* Reset restart counter */
00487 entropy->restarts_to_go = cinfo->restart_interval;
00488
00489 /* Reset out-of-data flag, unless read_restart_marker left us smack up
00490 * against a marker. In that case we will end up treating the next data
00491 * segment as empty, and we can avoid producing bogus output pixels by
00492 * leaving the flag set.
00493 */
00494 if (cinfo->unread_marker == 0)
00495 entropy->pub.insufficient_data = FALSE;
00496
00497 return TRUE;
00498 }
|
|
|
Definition at line 86 of file jdhuff.c. References huff_entropy_decoder::ac_cur_tbls, huff_entropy_decoder::ac_derived_tbls, huff_entropy_decoder::ac_needed, jpeg_component_info::ac_tbl_no, jpeg_decompress_struct::Ah, jpeg_decompress_struct::Al, bitread_perm_state::bits_left, huff_entropy_decoder::bitstate, jpeg_decompress_struct::blocks_in_MCU, jpeg_component_info::component_needed, compptr, jpeg_decompress_struct::comps_in_scan, jpeg_decompress_struct::cur_comp_info, huff_entropy_decoder::dc_cur_tbls, huff_entropy_decoder::dc_derived_tbls, huff_entropy_decoder::dc_needed, jpeg_component_info::dc_tbl_no, jpeg_component_info::DCT_scaled_size, jpeg_decompress_struct::entropy, bitread_perm_state::get_buffer, jpeg_entropy_decoder::insufficient_data, jpeg_make_d_derived_tbl(), savable_state::last_dc_val, jpeg_decompress_struct::MCU_membership, huff_entropy_decoder::pub, jpeg_decompress_struct::restart_interval, huff_entropy_decoder::restarts_to_go, huff_entropy_decoder::saved, jpeg_decompress_struct::Se, jpeg_decompress_struct::Ss, and WARNMS. Referenced by jinit_huff_decoder().
00087 {
00088 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
00089 int ci, blkn, dctbl, actbl;
00090 jpeg_component_info * compptr;
00091
00092 /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
00093 * This ought to be an error condition, but we make it a warning because
00094 * there are some baseline files out there with all zeroes in these bytes.
00095 */
00096 if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2-1 ||
00097 cinfo->Ah != 0 || cinfo->Al != 0)
00098 WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
00099
00100 for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
00101 compptr = cinfo->cur_comp_info[ci];
00102 dctbl = compptr->dc_tbl_no;
00103 actbl = compptr->ac_tbl_no;
00104 /* Compute derived values for Huffman tables */
00105 /* We may do this more than once for a table, but it's not expensive */
00106 jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl,
00107 & entropy->dc_derived_tbls[dctbl]);
00108 jpeg_make_d_derived_tbl(cinfo, FALSE, actbl,
00109 & entropy->ac_derived_tbls[actbl]);
00110 /* Initialize DC predictions to 0 */
00111 entropy->saved.last_dc_val[ci] = 0;
00112 }
00113
00114 /* Precalculate decoding info for each block in an MCU of this scan */
00115 for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
00116 ci = cinfo->MCU_membership[blkn];
00117 compptr = cinfo->cur_comp_info[ci];
00118 /* Precalculate which table to use for each block */
00119 entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
00120 entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
00121 /* Decide whether we really care about the coefficient values */
00122 if (compptr->component_needed) {
00123 entropy->dc_needed[blkn] = TRUE;
00124 /* we don't need the ACs if producing a 1/8th-size image */
00125 entropy->ac_needed[blkn] = (compptr->DCT_scaled_size > 1);
00126 } else {
00127 entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
00128 }
00129 }
00130
00131 /* Initialize bitread state variables */
00132 entropy->bitstate.bits_left = 0;
00133 entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
00134 entropy->pub.insufficient_data = FALSE;
00135
00136 /* Initialize restart counter */
00137 entropy->restarts_to_go = cinfo->restart_interval;
00138 }
|
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 } |