Struct image::codecs::webp::lossless::LosslessDecoder

source ·
pub(crate) struct LosslessDecoder<R> {
    r: R,
    bit_reader: BitReader,
    frame: LosslessFrame,
    transforms: [Option<TransformType>; 4],
    transform_order: Vec<u8>,
}

Fields§

§r: R§bit_reader: BitReader§frame: LosslessFrame§transforms: [Option<TransformType>; 4]§transform_order: Vec<u8>

Implementations§

source§

impl<R: Read> LosslessDecoder<R>

source

pub(crate) fn new(r: R) -> LosslessDecoder<R>

Create a new decoder

source

pub(crate) fn decode_frame(&mut self) -> ImageResult<&LosslessFrame>

Reads the frame

source

pub(crate) fn decode_frame_implicit_dims( &mut self, width: u16, height: u16, ) -> ImageResult<&LosslessFrame>

source

fn decode_image_stream( &mut self, xsize: u16, ysize: u16, is_argb_img: bool, ) -> ImageResult<Vec<u32>>

Reads Image data from the bitstream Can be in any of the 5 roles described in the Specification ARGB Image role has different behaviour to the other 4 xsize and ysize describe the size of the blocks where each block has its own entropy code

source

fn read_transforms(&mut self) -> ImageResult<u16>

Reads transforms and their data from the bitstream

source

fn adjust_color_map(color_map: &mut [u32])

Adjusts the color map since it’s subtraction coded

source

fn read_huffman_codes( &mut self, read_meta: bool, xsize: u16, ysize: u16, color_cache: Option<ColorCache>, ) -> ImageResult<HuffmanInfo>

Reads huffman codes associated with an image

source

fn read_huffman_code(&mut self, alphabet_size: u16) -> ImageResult<HuffmanTree>

Decodes and returns a single huffman tree

source

fn read_huffman_code_lengths( &mut self, code_length_code_lengths: Vec<u16>, num_symbols: u16, ) -> ImageResult<Vec<u16>>

Reads huffman code lengths

source

fn decode_image_data( &mut self, width: u16, height: u16, huffman_info: HuffmanInfo, ) -> ImageResult<Vec<u32>>

Decodes the image data using the huffman trees and either of the 3 methods of decoding

source

fn read_color_cache(&mut self) -> ImageResult<Option<u8>>

Reads color cache data from the bitstream

source

fn get_copy_distance( bit_reader: &mut BitReader, prefix_code: u16, ) -> ImageResult<usize>

Gets the copy distance from the prefix code and bitstream

source

fn plane_code_to_distance(xsize: u16, plane_code: usize) -> usize

Gets distance to pixel

Trait Implementations§

source§

impl<R: Debug> Debug for LosslessDecoder<R>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> Freeze for LosslessDecoder<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for LosslessDecoder<R>
where R: RefUnwindSafe,

§

impl<R> Send for LosslessDecoder<R>
where R: Send,

§

impl<R> Sync for LosslessDecoder<R>
where R: Sync,

§

impl<R> Unpin for LosslessDecoder<R>
where R: Unpin,

§

impl<R> UnwindSafe for LosslessDecoder<R>
where R: UnwindSafe,

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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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>,

§

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.