pub struct BoolEncoder { /* private fields */ }Expand description
VP8/VP9 boolean-range encoder (libvpx vpx_writer / RFC 6386 §7.3).
Implementations§
Source§impl BoolEncoder
impl BoolEncoder
Sourcepub fn new() -> Self
pub fn new() -> Self
A fresh encoder primed like libvpx vpx_start_encode: range = 255,
bottom = 0, and one leading equiprobable 0 so the first emitted byte
lines up with a libvpx/ffmpeg bool decoder.
Sourcepub fn put_bool(&mut self, prob: u8, bit: bool)
pub fn put_bool(&mut self, prob: u8, bit: bool)
Encode one boolean bit whose probability of being 0 is prob/256
(RFC 6386 write_bool).
Sourcepub fn put_bit(&mut self, bit: bool)
pub fn put_bit(&mut self, bit: bool)
Encode one equiprobable bit (probability 128, i.e. a literal bit).
Sourcepub fn put_literal(&mut self, value: u32, n: u32)
pub fn put_literal(&mut self, value: u32, n: u32)
Encode the n low bits of value, MSB first, as literals.
Sourcepub fn finish(self) -> Vec<u8> ⓘ
pub fn finish(self) -> Vec<u8> ⓘ
Flush like libvpx vpx_stop_encode: thirty-two equiprobable 0s so the
pending interval is fully emitted, then return the coded bytes.
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Forget for BoolEncoder
impl Freeze for BoolEncoder
impl Move for BoolEncoder
impl RefUnwindSafe for BoolEncoder
impl Send for BoolEncoder
impl Sync for BoolEncoder
impl Unpin for BoolEncoder
impl UnsafeUnpin for BoolEncoder
impl UnwindSafe for BoolEncoder
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