#include <Syndicate/Data/Bitstream.h>
Public Member Functions | |
Bitstream (uint8_t const *data, unsigned data_size) | |
unsigned | get (unsigned nb_bits) |
void | get (unsigned nb_bytes, uint8_t *output) |
Private Member Functions | |
unsigned | pop (unsigned nb_bits) |
void | push (unsigned nb_bits, unsigned buffer) |
void | reload (unsigned nb_bits=16) |
Private Attributes | |
uint8_t const * | _data |
unsigned | _data_size |
unsigned | _data_offset |
uint32_t | _buffer |
unsigned | _count |
Static Private Attributes | |
static uint16_t const | _masks [16] |
Syndicate::Data::Bitstream::Bitstream | ( | uint8_t const * | data, | |
unsigned | data_size | |||
) |
Instanciate a bitstream on the given data.
[in] | data | the data |
[in] | data_size | the number of bytes in the data. |
unsigned Syndicate::Data::Bitstream::get | ( | unsigned | nb_bits | ) |
Extract somes bits from the stream.
[in] | nb_bits | numbers of bits to extract [1;16] |
void Syndicate::Data::Bitstream::get | ( | unsigned | nb_bytes, | |
uint8_t * | output | |||
) |
Extract somes bytes from the stream. This is different of extracting bits.
[in] | nb_bytes | numbers of bytes to extract [1;n] |
[out] | output | a pointer to a nb_bytes length buffer to stores the result |
unsigned Syndicate::Data::Bitstream::pop | ( | unsigned | nb_bits | ) | [private] |
Pop nb bytes from the stream.
[in] | nb_bits | numbers of bits to extract [1;16] |
void Syndicate::Data::Bitstream::push | ( | unsigned | nb_bits, | |
unsigned | buffer | |||
) | [private] |
Push nb bytes into the stream.
[in] | nb_bits | numbers of bits to insert [1;16] |
[in] | buffer | add the comment FIXME |
void Syndicate::Data::Bitstream::reload | ( | unsigned | nb_bits = 16 |
) | [private] |
Reload Push nb bytes into the stream.
[in] | nb_bits | numbers of bits to insert [1;16] |
uint16_t const Syndicate::Data::Bitstream::_masks[16] [static, private] |
Precomputed table of mask
uint8_t const* Syndicate::Data::Bitstream::_data [private] |
A pointer to the data array
unsigned Syndicate::Data::Bitstream::_data_size [private] |
The data array size
unsigned Syndicate::Data::Bitstream::_data_offset [private] |
The offset of the read pointer in the data array
uint32_t Syndicate::Data::Bitstream::_buffer [private] |
The buffer currently processed. The data are processed by batch of 16 bits
unsigned Syndicate::Data::Bitstream::_count [private] |
The number of fresh bits in the buffer