|
libxcoder
5.3.1
|
Utility definitions to operate on bits in a bitstream. More...
#include <stdio.h>#include <string.h>#include <assert.h>#include "ni_util.h"#include "ni_bitstream.h"Go to the source code of this file.
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... | |
| 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... | |
| int | ni_bs_reader_bits_count (ni_bitstream_reader_t *br) |
| return the number of bits already parsed in stream More... | |
| int | ni_bs_reader_get_bits_left (ni_bitstream_reader_t *br) |
| return the number of bits left to parse in stream More... | |
| void | ni_bs_reader_skip_bits (ni_bitstream_reader_t *br, int n) |
| skip a number of bits ahead in the bitstream reader More... | |
| uint8_t | ni_bitstream_get_1bit (ni_bitstream_reader_t *br) |
| uint8_t | ni_bitstream_get_u8 (ni_bitstream_reader_t *br) |
| uint16_t | ni_bitstream_get_u16 (ni_bitstream_reader_t *br) |
| uint8_t | ni_bitstream_get_8bits_or_less (ni_bitstream_reader_t *br, int n) |
| 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... | |
| uint32_t | ni_bs_reader_get_ue (ni_bitstream_reader_t *br) |
| read an unsigned Exp-Golomb code ue(v) More... | |
| int32_t | ni_bs_reader_get_se (ni_bitstream_reader_t *br) |
| read a signed Exp-Golomb code se(v) More... | |
Variables | |
| const uint32_t | ni_bit_set_mask [] |
| uint8_t ni_bitstream_get_1bit | ( | ni_bitstream_reader_t * | br | ) |
Definition at line 388 of file ni_bitstream.c.
| uint8_t ni_bitstream_get_8bits_or_less | ( | ni_bitstream_reader_t * | br, |
| int | n | ||
| ) |
Definition at line 456 of file ni_bitstream.c.
| uint16_t ni_bitstream_get_u16 | ( | ni_bitstream_reader_t * | br | ) |
Definition at line 429 of file ni_bitstream.c.
| uint8_t ni_bitstream_get_u8 | ( | ni_bitstream_reader_t * | br | ) |
Definition at line 413 of file ni_bitstream.c.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| const uint32_t ni_bit_set_mask[] |
Definition at line 47 of file ni_bitstream.c.