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>
impl<R: Read> LosslessDecoder<R>
sourcepub(crate) fn new(r: R) -> LosslessDecoder<R>
pub(crate) fn new(r: R) -> LosslessDecoder<R>
Create a new decoder
sourcepub(crate) fn decode_frame(&mut self) -> ImageResult<&LosslessFrame>
pub(crate) fn decode_frame(&mut self) -> ImageResult<&LosslessFrame>
Reads the frame
pub(crate) fn decode_frame_implicit_dims( &mut self, width: u16, height: u16, ) -> ImageResult<&LosslessFrame>
sourcefn decode_image_stream(
&mut self,
xsize: u16,
ysize: u16,
is_argb_img: bool,
) -> ImageResult<Vec<u32>>
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
sourcefn read_transforms(&mut self) -> ImageResult<u16>
fn read_transforms(&mut self) -> ImageResult<u16>
Reads transforms and their data from the bitstream
sourcefn adjust_color_map(color_map: &mut [u32])
fn adjust_color_map(color_map: &mut [u32])
Adjusts the color map since it’s subtraction coded
sourcefn read_huffman_codes(
&mut self,
read_meta: bool,
xsize: u16,
ysize: u16,
color_cache: Option<ColorCache>,
) -> ImageResult<HuffmanInfo>
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
sourcefn read_huffman_code(&mut self, alphabet_size: u16) -> ImageResult<HuffmanTree>
fn read_huffman_code(&mut self, alphabet_size: u16) -> ImageResult<HuffmanTree>
Decodes and returns a single huffman tree
sourcefn read_huffman_code_lengths(
&mut self,
code_length_code_lengths: Vec<u16>,
num_symbols: u16,
) -> ImageResult<Vec<u16>>
fn read_huffman_code_lengths( &mut self, code_length_code_lengths: Vec<u16>, num_symbols: u16, ) -> ImageResult<Vec<u16>>
Reads huffman code lengths
sourcefn decode_image_data(
&mut self,
width: u16,
height: u16,
huffman_info: HuffmanInfo,
) -> ImageResult<Vec<u32>>
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
sourcefn read_color_cache(&mut self) -> ImageResult<Option<u8>>
fn read_color_cache(&mut self) -> ImageResult<Option<u8>>
Reads color cache data from the bitstream
sourcefn get_copy_distance(
bit_reader: &mut BitReader,
prefix_code: u16,
) -> ImageResult<usize>
fn get_copy_distance( bit_reader: &mut BitReader, prefix_code: u16, ) -> ImageResult<usize>
Gets the copy distance from the prefix code and bitstream
sourcefn plane_code_to_distance(xsize: u16, plane_code: usize) -> usize
fn plane_code_to_distance(xsize: u16, plane_code: usize) -> usize
Gets distance to pixel
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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