pub struct BitReader<'a> { /* private fields */ }Expand description
MSB-first bit reader over a borrowed byte slice.
Implementations§
Source§impl<'a> BitReader<'a>
impl<'a> BitReader<'a>
Sourcepub fn total_bits(&self) -> usize
pub fn total_bits(&self) -> usize
Total number of payload bits in the reader.
Sourcepub fn bits_remaining(&self) -> usize
pub fn bits_remaining(&self) -> usize
Number of unread bits (saturating at zero).
Sourcepub fn byte_aligned(&self) -> bool
pub fn byte_aligned(&self) -> bool
True if the reader is currently byte-aligned.
Sourcepub fn align_to_byte(&mut self)
pub fn align_to_byte(&mut self)
Skip forward to the next byte boundary if not already aligned.
Sourcepub fn u(&mut self, n: u32) -> u32
pub fn u(&mut self, n: u32) -> u32
Read n bits MSB first into a u32. Past-the-end bits are 0.
n must be ≤ 32 (the upper limit covers every fixed-width
field used by H.264 / HEVC / AV1 OBU headers).
Sourcepub fn u64(&mut self, n: u32) -> u64
pub fn u64(&mut self, n: u32) -> u64
Read n bits MSB first into a u64 (for AV1’s 64-bit
reference_frame_id-class fields).
Sourcepub fn ue(&mut self) -> Result<u32, BitstreamError>
pub fn ue(&mut self) -> Result<u32, BitstreamError>
Unsigned Exp-Golomb (ue(v)). H.264 9.1 / H.265 9.2.
Returns an error if more than 32 leading zeros are seen
(would overflow a u32).
Sourcepub fn se(&mut self) -> Result<i32, BitstreamError>
pub fn se(&mut self) -> Result<i32, BitstreamError>
Signed Exp-Golomb (se(v)). H.264 9.1.1 / H.265 9.2.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