Skip to main content

PrefixCodeGroup

Struct PrefixCodeGroup 

Source
pub struct PrefixCodeGroup {
    pub green: PrefixCode,
    pub red: PrefixCode,
    pub blue: PrefixCode,
    pub alpha: PrefixCode,
    pub distance: PrefixCode,
}
Expand description

The five prefix codes that make up one §6.2 “prefix code group”.

In bitstream order: green-channel + backref-length + color-cache (channel 1), red (2), blue (3), alpha (4), backref-distance (5). Each pixel is decoded with exactly one group; which group applies to which pixel block is selected by the §6.2.2 meta-prefix layer.

Fields§

§green: PrefixCode

Prefix code #1: green channel + length-prefix + color-cache. Alphabet size is 256 + 24 + color_cache_size per §6.2.3.

§red: PrefixCode

Prefix code #2: red channel, alphabet 256.

§blue: PrefixCode

Prefix code #3: blue channel, alphabet 256.

§alpha: PrefixCode

Prefix code #4: alpha channel, alphabet 256.

§distance: PrefixCode

Prefix code #5: backref distance, alphabet 40.

Implementations§

Source§

impl PrefixCodeGroup

Source

pub fn green_alphabet_size(color_cache_size: usize) -> usize

The size-of-alphabet for prefix code #1 (green / length / color-cache) for a stream whose color-cache holds color_cache_size entries (0 when the cache is disabled, 1 << color_cache_code_bits when it is enabled). Per §6.2.3: 256 + 24 + color_cache_size.

Source

pub fn read( reader: &mut BitReader<'_>, color_cache_size: usize, ) -> Result<Self, MetaPrefixError>

Read one prefix-code group (five canonical prefix codes) from the bitstream in §6.2 order.

Trait Implementations§

Source§

impl Clone for PrefixCodeGroup

Source§

fn clone(&self) -> PrefixCodeGroup

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PrefixCodeGroup

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PrefixCodeGroup

Source§

impl PartialEq for PrefixCodeGroup

Source§

fn eq(&self, other: &PrefixCodeGroup) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for PrefixCodeGroup

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.