pub struct ZpEncoder { /* private fields */ }Expand description
ZP adaptive binary arithmetic encoder.
All internal registers (a, subend) are u32 to match DjVuLibre’s
unsigned int types. They hold u16-range values but intermediate
arithmetic can exceed 0xFFFF, which is critical for correct carry
propagation in zemit.
Implementations§
Source§impl ZpEncoder
impl ZpEncoder
pub fn new() -> Self
Sourcepub fn encode_bit(&mut self, ctx: &mut u8, bit: bool)
pub fn encode_bit(&mut self, ctx: &mut u8, bit: bool)
Encode one bit using an adaptive probability context.
Matches DjVuLibre’s inline encoder(int bit, BitContext &ctx):
- LPS always calls encode_lps
- MPS with z >= 0x8000 calls encode_mps
- MPS with z < 0x8000 takes fast path (a = z, no shift)
Sourcepub fn encode_passthrough_iw44(&mut self, bit: bool)
pub fn encode_passthrough_iw44(&mut self, bit: bool)
Encode one bit in IW44 passthrough mode (threshold z = 0x8000 + 3a/8).
Counterpart to [ZpDecoder::decode_passthrough_iw44]; must produce a
stream that it correctly decodes.
pub fn encode_passthrough(&mut self, bit: bool)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ZpEncoder
impl RefUnwindSafe for ZpEncoder
impl Send for ZpEncoder
impl Sync for ZpEncoder
impl Unpin for ZpEncoder
impl UnsafeUnpin for ZpEncoder
impl UnwindSafe for ZpEncoder
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