pub struct SymbolEncoder { /* private fields */ }Expand description
Encoder for the AV1 symbol (range) coder.
Feed symbols with SymbolEncoder::encode_symbol (CDF-coded) and equiprobable bits with
SymbolEncoder::encode_literal, then call SymbolEncoder::finish to flush and obtain the
coded bytes. Those bytes are exactly what a decoder consumes via init_symbol(sz) (AV1 §8.2.2)
where sz is the returned length.
Implementations§
Source§impl SymbolEncoder
impl SymbolEncoder
Sourcepub fn encode_symbol(&mut self, symbol: usize, cdf: &[u16])
pub fn encode_symbol(&mut self, symbol: usize, cdf: &[u16])
Encodes symbol against a static cumulative cdf (cdf.len() symbols, cdf[last] == 32768).
§Panics
Debug builds assert symbol < cdf.len() and the CDF normalisation invariants.
Sourcepub fn encode_literal(&mut self, value: u32, n: u32)
pub fn encode_literal(&mut self, value: u32, n: u32)
Encodes the low n bits of value as equiprobable bits, most-significant bit first.
This is the inverse of the decoder’s read_literal(n) (AV1 §8.2.5), which itself calls
read_bool() (§8.2.3) with the fixed CDF {1 << 14, 1 << 15}.
Trait Implementations§
Source§impl Clone for SymbolEncoder
impl Clone for SymbolEncoder
Source§fn clone(&self) -> SymbolEncoder
fn clone(&self) -> SymbolEncoder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SymbolEncoder
impl Debug for SymbolEncoder
Auto Trait Implementations§
impl Freeze for SymbolEncoder
impl RefUnwindSafe for SymbolEncoder
impl Send for SymbolEncoder
impl Sync for SymbolEncoder
impl Unpin for SymbolEncoder
impl UnsafeUnpin for SymbolEncoder
impl UnwindSafe for SymbolEncoder
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