|
libxcoder
5.3.1
|
Utility definitions to operate on bits in a bitstream. More...
Go to the source code of this file.
Data Structures | |
| struct | ni_data_chunk_t |
| struct | _ni_bitstream_writer_t |
| struct | _ni_bitstream_reader_t |
Macros | |
| #define | NI_DATA_CHUNK_SIZE 4096 |
Typedefs | |
| typedef struct ni_data_chunk_t | ni_data_chunk_t |
| typedef struct _ni_bitstream_writer_t | ni_bitstream_writer_t |
| typedef struct _ni_bitstream_reader_t | ni_bitstream_reader_t |
Functions | |
| void | ni_bitstream_writer_init (ni_bitstream_writer_t *stream) |
| init a bitstream writer More... | |
| uint64_t | ni_bs_writer_tell (const ni_bitstream_writer_t *const stream) |
| return the number of bits written to bitstream so far More... | |
| void | ni_bs_writer_put (ni_bitstream_writer_t *stream, uint32_t data, uint8_t bits) |
| write a specified number (<= 32) of bits to bitstream, buffer individual bits until a full byte is made More... | |
| void | ni_bs_writer_put_ue (ni_bitstream_writer_t *stream, uint32_t data) |
| write unsigned Exp-Golomb bit string to bitstream, 2^32-2 at most. More... | |
| void | ni_bs_writer_put_se (ni_bitstream_writer_t *stream, int32_t data) |
| write signed Exp-Golomb bit string to bitstream More... | |
| void | ni_bs_writer_align_zero (ni_bitstream_writer_t *stream) |
| align the bitstream with zero More... | |
| void | ni_bs_writer_copy (uint8_t *dst, const ni_bitstream_writer_t *stream) |
| copy bitstream data to dst Note: caller must ensure sufficient space in dst More... | |
| void | ni_bs_writer_clear (ni_bitstream_writer_t *stream) |
| clear and reset bitstream More... | |
| LIB_API_BITSTREAM void | ni_bitstream_reader_init (ni_bitstream_reader_t *br, const uint8_t *data, int bit_size) |
| init a bitstream reader Note: bitstream_reader takes reading ownership of the data More... | |
| LIB_API_BITSTREAM int | ni_bs_reader_bits_count (ni_bitstream_reader_t *br) |
| return the number of bits already parsed in stream More... | |
| LIB_API_BITSTREAM int | ni_bs_reader_get_bits_left (ni_bitstream_reader_t *br) |
| return the number of bits left to parse in stream More... | |
| LIB_API_BITSTREAM void | ni_bs_reader_skip_bits (ni_bitstream_reader_t *br, int n) |
| skip a number of bits ahead in the bitstream reader More... | |
| LIB_API_BITSTREAM uint32_t | ni_bs_reader_get_bits (ni_bitstream_reader_t *br, int n) |
| read bits (up to 32) from the bitstream reader, after reader init More... | |
| LIB_API_BITSTREAM uint32_t | ni_bs_reader_get_ue (ni_bitstream_reader_t *br) |
| read an unsigned Exp-Golomb code ue(v) More... | |
| LIB_API_BITSTREAM int32_t | ni_bs_reader_get_se (ni_bitstream_reader_t *br) |
| read a signed Exp-Golomb code se(v) More... | |
| #define NI_DATA_CHUNK_SIZE 4096 |
Definition at line 60 of file ni_bitstream.h.
| typedef struct _ni_bitstream_reader_t ni_bitstream_reader_t |
| typedef struct _ni_bitstream_writer_t ni_bitstream_writer_t |
| typedef struct ni_data_chunk_t ni_data_chunk_t |
| LIB_API_BITSTREAM void ni_bitstream_reader_init | ( | ni_bitstream_reader_t * | br, |
| const uint8_t * | data, | ||
| int | bit_size | ||
| ) |
init a bitstream reader Note: bitstream_reader takes reading ownership of the data
| br | bitstream reader |
| data | data to be parsed |
| bit_size | number of bits in the data |
Definition at line 327 of file ni_bitstream.c.
| void ni_bitstream_writer_init | ( | ni_bitstream_writer_t * | stream | ) |
init a bitstream writer
| stream | bitstream |
Definition at line 158 of file ni_bitstream.c.
| LIB_API_BITSTREAM int ni_bs_reader_bits_count | ( | ni_bitstream_reader_t * | br | ) |
return the number of bits already parsed in stream
| br | bitstream reader |
Definition at line 348 of file ni_bitstream.c.
| LIB_API_BITSTREAM uint32_t ni_bs_reader_get_bits | ( | ni_bitstream_reader_t * | br, |
| int | n | ||
| ) |
read bits (up to 32) from the bitstream reader, after reader init
| br | bitstream reader |
| n | number of bits to read |
Definition at line 481 of file ni_bitstream.c.
| LIB_API_BITSTREAM int ni_bs_reader_get_bits_left | ( | ni_bitstream_reader_t * | br | ) |
return the number of bits left to parse in stream
| br | bitstream reader |
Definition at line 359 of file ni_bitstream.c.
| LIB_API_BITSTREAM int32_t ni_bs_reader_get_se | ( | ni_bitstream_reader_t * | br | ) |
read a signed Exp-Golomb code se(v)
| br | bitstream reader |
Definition at line 556 of file ni_bitstream.c.
| LIB_API_BITSTREAM uint32_t ni_bs_reader_get_ue | ( | ni_bitstream_reader_t * | br | ) |
read an unsigned Exp-Golomb code ue(v)
| br | bitstream reader |
Definition at line 532 of file ni_bitstream.c.
| LIB_API_BITSTREAM void ni_bs_reader_skip_bits | ( | ni_bitstream_reader_t * | br, |
| int | n | ||
| ) |
skip a number of bits ahead in the bitstream reader
| br | bitstream reader |
| n | number of bits to skip |
Definition at line 371 of file ni_bitstream.c.
| void ni_bs_writer_align_zero | ( | ni_bitstream_writer_t * | stream | ) |
align the bitstream with zero
| stream | bitstream |
Definition at line 276 of file ni_bitstream.c.
| void ni_bs_writer_clear | ( | ni_bitstream_writer_t * | stream | ) |
clear and reset bitstream
| stream | bitstream |
Definition at line 310 of file ni_bitstream.c.
| void ni_bs_writer_copy | ( | uint8_t * | dst, |
| const ni_bitstream_writer_t * | stream | ||
| ) |
copy bitstream data to dst Note: caller must ensure sufficient space in dst
| dst | copy destination |
| stream | bitstream |
Definition at line 292 of file ni_bitstream.c.
| void ni_bs_writer_put | ( | ni_bitstream_writer_t * | stream, |
| uint32_t | data, | ||
| uint8_t | bits | ||
| ) |
write a specified number (<= 32) of bits to bitstream, buffer individual bits until a full byte is made
| stream | bitstream |
| data | input data |
| bits | number of bits in data to write to stream, max 32 |
Definition at line 183 of file ni_bitstream.c.
| void ni_bs_writer_put_se | ( | ni_bitstream_writer_t * | stream, |
| int32_t | data | ||
| ) |
write signed Exp-Golomb bit string to bitstream
| stream | bitstream |
| data | input data |
Definition at line 263 of file ni_bitstream.c.
| void ni_bs_writer_put_ue | ( | ni_bitstream_writer_t * | stream, |
| uint32_t | data | ||
| ) |
write unsigned Exp-Golomb bit string to bitstream, 2^32-2 at most.
| stream | bitstream |
| data | input data |
Definition at line 225 of file ni_bitstream.c.
| uint64_t ni_bs_writer_tell | ( | const ni_bitstream_writer_t *const | stream | ) |
return the number of bits written to bitstream so far
| stream | bitstream |
Definition at line 169 of file ni_bitstream.c.