pub(crate) struct ArithmeticDecoder {
chunks: Box<[[u8; 4]]>,
state: State,
final_bytes: [u8; 3],
final_bytes_remaining: i8,
}
Fields§
§chunks: Box<[[u8; 4]]>
§state: State
§final_bytes: [u8; 3]
§final_bytes_remaining: i8
Implementations§
Source§impl ArithmeticDecoder
impl ArithmeticDecoder
const FINAL_BYTES_REMAINING_EOF: i8 = -14i8
pub(crate) fn new() -> ArithmeticDecoder
pub(crate) fn init( &mut self, buf: Vec<[u8; 4]>, len: usize, ) -> Result<(), DecodingError>
Sourcepub(crate) fn start_accumulated_result(&mut self) -> BitResultAccumulator
pub(crate) fn start_accumulated_result(&mut self) -> BitResultAccumulator
Start a span of reading operations from the buffer, without stopping when the buffer runs out. For all valid webp images, the buffer will not run out prematurely. Conversely if the buffer ends early, the webp image cannot be correctly decoded and any intermediate results need to be discarded anyway.
Each call to start_accumulated_result
must be followed by a call to
check
on the same ArithmeticDecoder
.
Sourcepub(crate) fn check<T>(
&self,
acc: BitResultAccumulator,
value_if_not_past_eof: T,
) -> Result<T, DecodingError>
pub(crate) fn check<T>( &self, acc: BitResultAccumulator, value_if_not_past_eof: T, ) -> Result<T, DecodingError>
Check that the read operations done so far were all valid.
fn keep_accumulating<T>( &self, acc: BitResultAccumulator, value_if_not_past_eof: T, ) -> BitResult<T>
pub(crate) fn read_bool(&mut self, probability: u8) -> BitResult<bool>
pub(crate) fn read_flag(&mut self) -> BitResult<bool>
pub(crate) fn read_literal(&mut self, n: u8) -> BitResult<u8>
pub(crate) fn read_optional_signed_value(&mut self, n: u8) -> BitResult<i32>
pub(crate) fn read_with_tree<const N: usize>( &mut self, tree: &[TreeNode; N], ) -> BitResult<i8>
pub(crate) fn read_with_tree_with_first_node( &mut self, tree: &[TreeNode], first_node: TreeNode, ) -> BitResult<i8>
fn fast(&mut self) -> FastDecoder<'_>
fn load_from_final_bytes(&mut self)
fn is_past_eof(&self) -> bool
fn cold_read_bit(&mut self, probability: u8) -> BitResult<bool>
fn cold_read_bool(&mut self, probability: u8) -> BitResult<bool>
fn cold_read_flag(&mut self) -> BitResult<bool>
fn cold_read_literal(&mut self, n: u8) -> BitResult<u8>
fn cold_read_optional_signed_value(&mut self, n: u8) -> BitResult<i32>
fn cold_read_with_tree( &mut self, tree: &[TreeNode], start: usize, ) -> BitResult<i8>
Auto Trait Implementations§
impl Freeze for ArithmeticDecoder
impl RefUnwindSafe for ArithmeticDecoder
impl Send for ArithmeticDecoder
impl Sync for ArithmeticDecoder
impl Unpin for ArithmeticDecoder
impl UnwindSafe for ArithmeticDecoder
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