pub struct BitReader<'a> { /* private fields */ }Expand description
A big-endian, MSB-first bit reader.
Implementations§
Source§impl<'a> BitReader<'a>
impl<'a> BitReader<'a>
Sourcepub fn data(&self) -> &'a [u8] ⓘ
pub fn data(&self) -> &'a [u8] ⓘ
The underlying RBSP buffer (for handing off to the CABAC engine).
Sourcepub fn more_rbsp_data(&self) -> bool
pub fn more_rbsp_data(&self) -> bool
more_rbsp_data() (spec §7.2): true while the read position is before the
rbsp_stop_one_bit (the last set bit in the buffer). Used to detect the
end of slice_data() when a picture is split into multiple slices.
Sourcepub fn is_byte_aligned(&self) -> bool
pub fn is_byte_aligned(&self) -> bool
true if the read position sits on a byte boundary.
Sourcepub fn align_to_byte(&mut self) -> Result<(), OutOfData>
pub fn align_to_byte(&mut self) -> Result<(), OutOfData>
Advances to the next byte boundary, consuming the intervening bits (e.g.
pcm_alignment_zero_bits before an I_PCM payload).
Sourcepub fn read_bits(&mut self, n: u32) -> Result<u32, OutOfData>
pub fn read_bits(&mut self, n: u32) -> Result<u32, OutOfData>
Reads n bits (n <= 32) as an unsigned value, MSB first. u(n).
Sourcepub fn peek_bits(&self, n: u32) -> u32
pub fn peek_bits(&self, n: u32) -> u32
Peeks the next n bits (n ≤ 24) as an MSB-first value without
consuming, zero-filling past the end of the buffer. O(1): loads up to 4
bytes. The zero-fill lets a VLC/Exp-Golomb table match be attempted at the
stream end; the caller then skip_bitss the matched
length, which rejects (OutOfData) if those bits ran past the buffer.