1 /* license:BSD-3-Clause
2 * copyright-holders:Aaron Giles
3 ***************************************************************************
7 Helper classes for reading/writing at the bit level.
9 ***************************************************************************/
13 #ifndef __BITSTREAM_H__
14 #define __BITSTREAM_H__
18 /***************************************************************************
20 ***************************************************************************
23 /* helper class for reading from a bit buffer */
26 uint32_t buffer; /* current bit accumulator */
27 int bits; /* number of bits in the accumulator */
28 const uint8_t * read; /* read pointer */
29 uint32_t doffset; /* byte offset within the data */
30 uint32_t dlength; /* length of the data */
33 struct bitstream* create_bitstream(const void *src, uint32_t srclength);
34 int bitstream_overflow(struct bitstream* bitstream);
35 uint32_t bitstream_read_offset(struct bitstream* bitstream);
37 uint32_t bitstream_read(struct bitstream* bitstream, int numbits);
38 uint32_t bitstream_peek(struct bitstream* bitstream, int numbits);
39 void bitstream_remove(struct bitstream* bitstream, int numbits);
40 uint32_t bitstream_flush(struct bitstream* bitstream);