Unit JdHuff |
Classes |
Functions |
jinit_huff_decoder - Module initialization routine for Huffman entropy decoding.
jpeg_fill_bit_buffer - Load up the bit buffer to a depth of at least nbits
GLOBAL
jpeg_huff_decode - GLOBAL
Out-of-line code for Huffman code decoding.
jpeg_make_d_derived_tbl - Compute the derived values for a Huffman table.
Types |
bitread_perm_state
bitread_working_state
bit_buf_type
d_derived_tbl
d_derived_tbl_ptr
Constants |
Variables |
Functions |
Module initialization routine for Huffman entropy decoding. } {GLOBAL
Out-of-line code for Huffman code decoding. See jdhuff.h for info about usage. } {GLOBAL
Compute the derived values for a Huffman table. Note this is also used by jdphuff.c. } {GLOBAL
Types |
bitread_perm_state = recordsize of buffer in bits } { If long is > 32 bits on your machine, and shifting/masking longs is reasonably fast, making bit_buf_type be long and setting BIT_BUF_SIZE appropriately should be a win. Unfortunately we can't do this with something like #define BIT_BUF_SIZE (sizeof(bit_buf_type)*8) because not all machines measure sizeof in 8-bit bytes.
get_buffer : bit_buf_type;
bits_left : int;
printed_eod : boolean;
end;
bitread_working_state = recordflag to suppress multiple warning msgs
next_input_byte : JOCTETptr;
bytes_in_buffer : size_t;
unread_marker : int;
get_buffer : bit_buf_type;
bits_left : int;
cinfo : j_decompress_ptr;
printed_eod_ptr : ^boolean;
end;
bit_buf_type = INT32Fetching the next N bits from the input stream is a time-critical operation for the Huffman decoders. We implement it with a combination of inline macros and out-of-line subroutines. Note that N (the number of bits demanded at one time) never exceeds 15 for JPEG use. We read source bytes into get_buffer and dole out bits as needed. If get_buffer already contains enough bits, they are fetched in-line by the macros CHECK_BIT_BUFFER and GET_BITS. When there aren't enough bits, jpeg_fill_bit_buffer is called; it will attempt to fill get_buffer as full as possible (not just to the number of bits needed; this prefetching reduces the overhead cost of calling jpeg_fill_bit_buffer). Note that jpeg_fill_bit_buffer may return FALSE to indicate suspension. On TRUE return, jpeg_fill_bit_buffer guarantees that get_buffer contains at least the requested number of bits --- dummy zeroes are inserted if necessary.
d_derived_tbl = record
mincode : array[0..17-1] of INT32;
maxcode : array[0..18-1] of INT32;
valptr : array[0..17-1] of int;
pub : JHUFF_TBL_PTR;
look_nbits : array[0..(1 shl HUFF_LOOKAHEAD)-1] of int;
look_sym : array[0..(1 shl HUFF_LOOKAHEAD)-1] of UINT8;
end;
d_derived_tbl_ptr = ^d_derived_tbl# of bits of lookahead
Constants |
Variables |