Go to the documentation of this file.
   21 #ifdef BITSTREAM_TEMPLATE_LE 
   22 #   define BS_SUFFIX_LOWER _le 
   23 #   define BS_SUFFIX_UPPER LE 
   25 #   define BS_SUFFIX_LOWER _be 
   26 #   define BS_SUFFIX_UPPER BE 
   29 #define BS_JOIN(x, y, z) x ## y ## z 
   30 #define BS_JOIN3(x, y, z) BS_JOIN(x, y, z) 
   31 #define BS_FUNC(x) BS_JOIN3(bits_, x, BS_SUFFIX_LOWER) 
   33 #define BSCTX BS_JOIN3(Bitstream, Context, BS_SUFFIX_UPPER) 
   52 #if !UNCHECKED_BITSTREAM_READER 
   53     if (bc->ptr >= bc->buffer_end)
 
   57 #ifdef BITSTREAM_TEMPLATE_LE 
   77 #if !UNCHECKED_BITSTREAM_READER 
   78     if (bc->ptr >= bc->buffer_end)
 
   82 #ifdef BITSTREAM_TEMPLATE_LE 
   83     bc->bits      |= (uint64_t)
AV_RL32(bc->ptr) << bc->bits_valid;
 
   85     bc->bits      |= (uint64_t)
AV_RB32(bc->ptr) << (32 - bc->bits_valid);
 
  102                                      unsigned int bit_size)
 
  104     unsigned int buffer_size;
 
  106     if (bit_size > INT_MAX - 7 || !
buffer) {
 
  113     buffer_size = (bit_size + 7) >> 3;
 
  116     bc->buffer_end   = 
buffer + buffer_size;
 
  117     bc->ptr          = bc->buffer;
 
  118     bc->size_in_bits = bit_size;
 
  136                                       unsigned int byte_size)
 
  138     if (byte_size > INT_MAX / 8)
 
  148     return (bc->ptr - bc->buffer) * 8 - bc->bits_valid;
 
  156     return bc->size_in_bits;
 
  164     return (bc->buffer - bc->ptr) * 8 + bc->size_in_bits + bc->bits_valid;
 
  171 #ifdef BITSTREAM_TEMPLATE_LE 
  172     return bc->bits & (UINT64_MAX >> (64 - n));
 
  174     return bc->bits >> (64 - n);
 
  180 #ifdef BITSTREAM_TEMPLATE_LE 
  220     if (n > bc->bits_valid) {
 
  254     if (n > bc->bits_valid) {
 
  255         left = bc->bits_valid;
 
  266 #ifdef BITSTREAM_TEMPLATE_LE 
  284 #ifdef BITSTREAM_TEMPLATE_LE 
  326     if (n > bc->bits_valid)
 
  377     if (n < bc->bits_valid)
 
  385             unsigned int skip = n / 8;
 
  401     bc->ptr        = bc->buffer;
 
  427     int sign = ~cache >> 31;
 
  430     return ((((uint32_t)(sign ^ cache)) >> (32 - n)) ^ sign) - sign;
 
  459     return (
val ^ sign) - sign;
 
  488     return table[idx].sym;
 
  503                                          int bits, 
int max_depth)
 
  508     int n        = 
table[idx].len;
 
  510     if (max_depth > 1 && n < 0) {
 
  513         if (max_depth > 2 && n < 0) {
 
  539                                           const int bits, 
const int max_depth,
 
  540                                           const int symbols_size)
 
  543     int ret, nb_bits, 
code, n = Jtable[idx].len;
 
  544     if (Jtable[idx].num) {
 
  546         ret = Jtable[idx].num;
 
  550         if (max_depth > 1 && n < 0) {
 
  553             if (max_depth > 2 && n < 0) {
 
  558         if (symbols_size == 1)
 
  573 #undef BS_SUFFIX_UPPER 
  574 #undef BS_SUFFIX_LOWER 
  
static uint64_t BS_FUNC() read_64(BSCTX *bc, unsigned int n)
Return n bits from the buffer, n has to be in the 0-64 range.
static int BS_FUNC() size(const BSCTX *bc)
Return buffer size in bits.
static uint32_t BS_FUNC() read_nz(BSCTX *bc, unsigned int n)
Return n bits from the buffer, n has to be in the 1-32 range.
static int BS_FUNC() decode210(BSCTX *bc)
Return decoded truncated unary code for the values 2, 1, 0.
static const uint16_t table[]
static int BS_FUNC() init(BSCTX *bc, const uint8_t *buffer, unsigned int bit_size)
Initialize BitstreamContext.
static int BS_FUNC() priv_refill_64(BSCTX *bc)
static uint32_t BS_FUNC() peek(BSCTX *bc, unsigned int n)
Return n bits from the buffer but do not change the buffer state.
static int BS_FUNC() peek_signed(BSCTX *bc, unsigned int n)
Return n bits from the buffer as a signed integer, do not change the buffer state.
static int32_t BS_FUNC() read_signed_nz(BSCTX *bc, unsigned int n)
Return n bits from the buffer as a signed integer, n has to be in the 1-32 range.
static int BS_FUNC() read_xbits(BSCTX *bc, unsigned int n)
Read MPEG-1 dc-style VLC (sign bit + mantissa with no MSB).
static int BS_FUNC() left(const BSCTX *bc)
Return the number of the bits left in a buffer.
static uint32_t BS_FUNC() peek_nz(BSCTX *bc, unsigned int n)
Return n bits from the buffer but do not change the buffer state.
static double val(void *priv, double ch)
static int BS_FUNC() read_vlc_multi(BSCTX *bc, uint8_t dst[8], const VLC_MULTI_ELEM *const Jtable, const VLCElem *const table, const int bits, const int max_depth, const int symbols_size)
Parse a vlc / vlc_multi code.
static uint64_t BS_FUNC() read_63(BSCTX *bc, unsigned int n)
Return n bits from the buffer, n has to be in the 0-63 range.
static unsigned int BS_FUNC() read_bit(BSCTX *bc)
Return one bit from the buffer.
static int32_t BS_FUNC() read_signed(BSCTX *bc, unsigned int n)
Return n bits from the buffer as a signed integer.
static int BS_FUNC() tell(const BSCTX *bc)
Return number of bits already read.
static void BS_FUNC() seek(BSCTX *bc, unsigned pos)
Seek to the given bit position.
static uint64_t BS_FUNC() priv_val_get(BSCTX *bc, unsigned int n)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
static const uint8_t *BS_FUNC() align(BSCTX *bc)
Skip bits to a byte boundary.
static uint64_t BS_FUNC() priv_val_show(BSCTX *bc, unsigned int n)
static int BS_FUNC() peek_signed_nz(BSCTX *bc, unsigned int n)
Return n bits from the buffer as a signed integer, do not change the buffer state.
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
const uint8_t * buffer_end
static int BS_FUNC() skip_1stop_8data(BSCTX *s)
static int BS_FUNC() priv_set_idx(BSCTX *bc, int code, int *n, int *nb_bits, const VLCElem *table)
Return the LUT element for the given bitstream configuration.
static int BS_FUNC() decode012(BSCTX *bc)
Return decoded truncated unary code for the values 0, 1, 2.
static int BS_FUNC() apply_sign(BSCTX *bc, int val)
static void BS_FUNC() priv_skip_remaining(BSCTX *bc, unsigned int n)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
static av_const int sign_extend(int val, unsigned bits)
static int BS_FUNC() init8(BSCTX *bc, const uint8_t *buffer, unsigned int byte_size)
Initialize BitstreamContext.
static int BS_FUNC() priv_refill_32(BSCTX *bc)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_RB64
static uint32_t BS_FUNC() read(BSCTX *bc, unsigned int n)
Return n bits from the buffer, n has to be in the 0-32 range.
static int BS_FUNC() read_vlc(BSCTX *bc, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.