Struct weezl::decode::Decoder [−][src]
pub struct Decoder { /* fields omitted */ }
The state for decoding data with an LZW algorithm.
The same structure can be utilized with streams as well as your own buffers and driver logic. It may even be possible to mix them if you are sufficiently careful not to lose or skip any already decode data in the process.
Implementations
impl Decoder
[src]
impl Decoder
[src]pub fn new(order: BitOrder, size: u8) -> Self
[src]
Create a new decoder with the specified bit order and symbol size.
The algorithm for dynamically increasing the code symbol bit width is compatible with the
original specification. In particular you will need to specify an Lsb
bit oder to decode
the data portion of a compressed gif
image.
Panics
The size
needs to be in the interval 0..=12
.
pub fn with_tiff_size_switch(order: BitOrder, size: u8) -> Self
[src]
Create a TIFF compatible decoder with the specified bit order and symbol size.
The algorithm for dynamically increasing the code symbol bit width is compatible with the TIFF specification, which is a misinterpretation of the original algorithm for increasing the code size. It switches one symbol sooner.
Panics
The size
needs to be in the interval 0..=12
.
pub fn decode_bytes(&mut self, inp: &[u8], out: &mut [u8]) -> BufferResult
[src]
Decode some bytes from inp
and write result to out
.
This will consume a prefix of the input buffer and write decoded output into a prefix of the output buffer. See the respective fields of the return value for the count of consumed and written bytes. For the next call You should have adjusted the inputs accordingly.
The call will try to decode and write as many bytes of output as available. It will be much more optimized (and avoid intermediate buffering) if it is allowed to write a large contiguous chunk at once.
See into_stream
for high-level functions (that are only available with the std
feature).
pub fn into_stream<W: Write>(&mut self, writer: W) -> IntoStream<'_, W>
[src]
Construct a decoder into a writer.
pub fn has_ended(&self) -> bool
[src]
Check if the decoding has finished.
No more output is produced beyond the end code that marked the finish of the stream. The decoder may have read additional bytes, including padding bits beyond the last code word but also excess bytes provided.
pub fn reset(&mut self)
[src]
Reset all internal state.
This produce a decoder as if just constructed with new
but taking slightly less work. In
particular it will not deallocate any internal allocations. It will also avoid some
duplicate setup work.