pub struct RangeCoder {
pub range: u32,
pub code: u32,
}Expand description
Simplified range coder (decoder side).
Range coding is a generalisation of arithmetic coding used in many modern codecs (VP8, VP9, AV1, …).
Fields§
§range: u32Current range (normalised to [128, 256)).
code: u32Current code word.
Implementations§
Source§impl RangeCoder
impl RangeCoder
Sourcepub fn normalize(&mut self) -> u32
pub fn normalize(&mut self) -> u32
Normalises the range back into [128, 256) by doubling, returning
the number of bits consumed from the bitstream.
Sourcepub fn decode_symbol(&mut self, prob: u32) -> bool
pub fn decode_symbol(&mut self, prob: u32) -> bool
Decodes one symbol given a split probability prob ∈ [0, 256).
Returns true for the high partition (code ≥ split), false otherwise.
Trait Implementations§
Source§impl Clone for RangeCoder
impl Clone for RangeCoder
Source§fn clone(&self) -> RangeCoder
fn clone(&self) -> RangeCoder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RangeCoder
impl RefUnwindSafe for RangeCoder
impl Send for RangeCoder
impl Sync for RangeCoder
impl Unpin for RangeCoder
impl UnsafeUnpin for RangeCoder
impl UnwindSafe for RangeCoder
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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