pub(crate) struct UnfilteringBuffer {
    data_stream: Vec<u8>,
    prev_start: usize,
    current_start: usize,
}Fields§
§data_stream: Vec<u8>Vec containing the uncompressed image data currently being processed.
prev_start: usizeIndex in data_stream where the previous row starts.
This excludes the filter type byte - it points at the first byte of actual pixel data.
The pixel data is already-unfilter-ed.
If prev_start == current_start then it means that there is no previous row.
current_start: usizeIndex in data_stream where the current row starts.
This points at the filter type byte of the current row (i.e. the actual pixel data starts at current_start + 1)
The pixel data is not-yet-unfilter-ed.
Implementations§
Source§impl UnfilteringBuffer
 
impl UnfilteringBuffer
Sourcefn debug_assert_invariants(&self)
 
fn debug_assert_invariants(&self)
Asserts in debug builds that all the invariants hold.  No-op in release
builds.  Intended to be called after creating or mutating self to
ensure that the final state preserves the invariants.
pub fn new() -> Self
Sourcepub fn reset_prev_row(&mut self)
 
pub fn reset_prev_row(&mut self)
Called to indicate that there is no previous row (e.g. when the current row is the first scanline of a given Adam7 pass).
Sourcepub fn curr_row_len(&self) -> usize
 
pub fn curr_row_len(&self) -> usize
Returns how many bytes of the current row are present in the buffer.
Sourcepub fn as_mut_vec(&mut self) -> &mut Vec<u8> ⓘ
 
pub fn as_mut_vec(&mut self) -> &mut Vec<u8> ⓘ
Returns a &mut Vec<u8> suitable for passing to
ReadDecoder.decode_image_data or StreamingDecoder.update.
Invariants of self depend on the assumption that the caller will only
append new bytes to the returned vector (which is indeed the behavior of
ReadDecoder and StreamingDecoder).  TODO: Consider protecting the
invariants by returning an append-only view of the vector
(FnMut(&[u8])??? or maybe std::io::Write???).
Sourcepub fn unfilter_curr_row(
    &mut self,
    rowlen: usize,
    bpp: BytesPerPixel,
) -> Result<(), DecodingError>
 
pub fn unfilter_curr_row( &mut self, rowlen: usize, bpp: BytesPerPixel, ) -> Result<(), DecodingError>
Runs unfilter on the current row, and then shifts rows so that the current row becomes the previous row.
Will panic if self.curr_row_len() < rowlen.