Struct HuffmanTable

Source
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

Source

pub fn new( codes: &[u8; 17], values: [u8; 256], is_dc: bool, is_progressive: bool, ) -> Result<HuffmanTable, DecodeErrors>

Source

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

Source

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.