pub struct HuffmanTable {
pub(crate) maxcode: [i32; 18],
pub(crate) offset: [i32; 18],
pub(crate) lookup: [i32; 512],
pub(crate) ac_lookup: Option<[i16; 512]>,
pub(crate) values: [u8; 256],
}
Expand description
A struct which contains necessary tables for decoding a JPEG huffman encoded bitstream
Fields§
§maxcode: [i32; 18]
largest code of length k
offset: [i32; 18]
offset for codes of length k Answers the question, where do code-lengths of length k end Element 0 is unused
lookup: [i32; 512]
lookup table for fast decoding
top bits above HUFF_LOOKAHEAD contain the code length.
Lower (8) bits contain the symbol in order of increasing code length.
ac_lookup: Option<[i16; 512]>
A table which can be used to decode small AC coefficients and do an equivalent of receive_extend
values: [u8; 256]
Directly represent contents of a JPEG DHT marker
# number of symbols with codes of length k
bits
Symbols in order of increasing code length
Implementations§
Source§impl HuffmanTable
impl HuffmanTable
pub fn new( codes: &[u8; 17], values: [u8; 256], is_dc: bool, is_progressive: bool, ) -> Result<HuffmanTable, DecodeErrors>
Sourcepub fn new_unfilled(
codes: &[u8; 17],
values: &[u8],
is_dc: bool,
is_progressive: bool,
) -> Result<HuffmanTable, DecodeErrors>
pub fn new_unfilled( codes: &[u8; 17], values: &[u8], is_dc: bool, is_progressive: bool, ) -> Result<HuffmanTable, DecodeErrors>
Create a new huffman tables with values that aren’t fixed used by fill_mjpeg_tables
Sourcefn make_derived_table(
&mut self,
is_dc: bool,
_is_progressive: bool,
bits: &[u8; 17],
) -> Result<(), DecodeErrors>
fn make_derived_table( &mut self, is_dc: bool, _is_progressive: bool, bits: &[u8; 17], ) -> Result<(), DecodeErrors>
Compute derived values for a Huffman table
This routine performs some validation checks on the table