pub struct BitstreamWriter {
pub data: Box<[u8]>,
pub data_size: i32,
pub data_position: i32,
pub cache: u32,
pub cache_bits: i32,
}Expand description
Bitstream writer structure (matches shine’s bitstream_t exactly) (ref/shine/src/lib/bitstream.h:4-10)
Fields§
§data: Box<[u8]>Processed data
data_size: i32Total data size
data_position: i32Data position
cache: u32Bit stream cache
cache_bits: i32Free bits in cache
Implementations§
Source§impl BitstreamWriter
impl BitstreamWriter
Sourcepub fn new(size: i32) -> Self
pub fn new(size: i32) -> Self
Open the bitstream for writing (matches shine_open_bit_stream) (ref/shine/src/lib/bitstream.c:15-22)
Sourcepub fn put_bits(&mut self, val: u32, n: i32) -> EncodingResult<()>
pub fn put_bits(&mut self, val: u32, n: i32) -> EncodingResult<()>
Write N bits into the bit stream (matches shine_putbits exactly) (ref/shine/src/lib/bitstream.c:30-58)
§Arguments
val- value to write into the buffern- number of bits of val
Sourcepub fn get_bits_count(&self) -> i32
pub fn get_bits_count(&self) -> i32
Get the current bit count (matches shine_get_bits_count exactly) (ref/shine/src/lib/bitstream.c:60-62)
Sourcepub fn flush(&mut self) -> EncodingResult<()>
pub fn flush(&mut self) -> EncodingResult<()>
Flush any remaining bits in the cache This matches shine’s behavior when there are remaining bits in cache
Sourcepub fn byte_align(&mut self) -> EncodingResult<()>
pub fn byte_align(&mut self) -> EncodingResult<()>
Align to byte boundary by flushing partial bytes This matches shine’s byte alignment behavior
Trait Implementations§
Source§impl Debug for BitstreamWriter
impl Debug for BitstreamWriter
Auto Trait Implementations§
impl Freeze for BitstreamWriter
impl RefUnwindSafe for BitstreamWriter
impl Send for BitstreamWriter
impl Sync for BitstreamWriter
impl Unpin for BitstreamWriter
impl UnwindSafe for BitstreamWriter
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