pub struct BitReader<'a> { /* private fields */ }Implementations§
Source§impl<'a> BitReader<'a>
impl<'a> BitReader<'a>
pub fn new(bytes: &'a [u8]) -> Self
pub fn bits_read(&self) -> usize
pub fn bits_remaining(&self) -> usize
pub fn read_bit(&mut self) -> Result<u8, CodecError>
Sourcepub fn read_bits(&mut self, n: u8) -> Result<u32, CodecError>
pub fn read_bits(&mut self, n: u8) -> Result<u32, CodecError>
Read up to 32 bits. Panics are impossible: oversize requests return
CodecError::GolombOverflow, underruns return
CodecError::EndOfStream.
pub fn skip_bits(&mut self, n: usize) -> Result<(), CodecError>
Sourcepub fn read_ue_v(&mut self) -> Result<u32, CodecError>
pub fn read_ue_v(&mut self) -> Result<u32, CodecError>
Exp-Golomb unsigned (ue(v) in the H.26x specs).
Encoding: k leading zero bits, then a 1 bit, then k value
bits. The decoded value is (1 << k) - 1 + suffix. Caps the leading
zero count at 32 since any code with 33+ leading zeros decodes to a
value that does not fit in u32.
Sourcepub fn read_se_v(&mut self) -> Result<i32, CodecError>
pub fn read_se_v(&mut self) -> Result<i32, CodecError>
Exp-Golomb signed (se(v) in the H.26x specs).
Decoded as ue(v) then mapped: 0 -> 0, 1 -> 1, 2 -> -1, 3 -> 2,
4 -> -2, …
Auto Trait Implementations§
impl<'a> Freeze for BitReader<'a>
impl<'a> RefUnwindSafe for BitReader<'a>
impl<'a> Send for BitReader<'a>
impl<'a> Sync for BitReader<'a>
impl<'a> Unpin for BitReader<'a>
impl<'a> UnsafeUnpin for BitReader<'a>
impl<'a> UnwindSafe for BitReader<'a>
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