Slim numerical data compression 1.0
|
Input bit stream. More...
Public Member Functions | |
ibitstream (FILE *file, int buffersize=DEFAULT_IOBUFFER_SIZE) | |
Start ibitstream using a FILE ptr to an open file. | |
ibitstream (const char *filename, int buffersize=DEFAULT_IOBUFFER_SIZE) | |
Start inputbitstream by filename. | |
~ibitstream () | |
Destructor only uses base class destructor. | |
void | setupstream () |
Allocate a buffer and set up all pointers, then fill buffer. | |
void | windup () |
Put the current word to the buffer with upper 0 bits as needed. | |
virtual void | print () const |
Print buffer contents. | |
virtual int | get_bytes_used () |
Return the number of bytes used so far in this stream. | |
Word_t | readbits (int nbits) |
Read data from the buffer as unsigned ints. | |
int32_t | readbits_int (int nbits) |
Read data from the buffer as (signed) ints. | |
Word_t | read_unary () |
Read a single unary-coded value. | |
int | readstring (char *s, int count=-1) |
Read a null-terminated string of 8-bit characters from the bit stream. | |
Private Member Functions | |
void | next_word () |
Move to next word in buffer, refilling it if needed. | |
int | fill () |
Fill the read buffer and reset for more data. | |
Private Attributes | |
Word_t | partial_word |
int | partial_word_bitptr |
Input bit stream.
Allows you to read data N bits at a time with buffered reading.
int ibitstream::fill | ( | ) | [private] |
Fill the read buffer and reset for more data.
References bitstream::beyondbuffer, bitstream::bitptr, bitstream::buf_used, bitstream::buffer_base, bitstream::buffptr, bitstream::bufsize, and bitstream::fp.
Referenced by next_word(), and setupstream().
Word_t ibitstream::read_unary | ( | ) |
Read a single unary-coded value.
References readbits().
Referenced by mexp_golomb_read_u32().
Word_t ibitstream::readbits | ( | int | n_bits | ) |
Read data from the buffer as unsigned ints.
n_bits | Number of bits to use |
References bitstream::bitptr, bitstream::Bits_per_word, bitstream::buffptr, and next_word().
Referenced by mexp_golomb_read_u32(), read_unary(), readbits_int(), readstring(), and windup().
int ibitstream::readbits_int | ( | int | n_bits | ) |
Read data from the buffer as (signed) ints.
n_bits | Number of bits to read. |
References readbits().
int ibitstream::readstring | ( | char * | s, |
int | count = -1 |
||
) |
Read a null-terminated string of 8-bit characters from the bit stream.
s | Pointer to the string (must be available memory). |
count | Maximum size of the string. |
References readbits().