bitstream.c File Reference

bitstream api. More...

#include "libavutil/avassert.h"
#include "avcodec.h"
#include "mathops.h"
#include "get_bits.h"
#include "put_bits.h"
Include dependency graph for bitstream.c:

Go to the source code of this file.

Data Structures

struct  VLCcode
 

Macros

#define GET_DATA(v, table, i, wrap, size)
 
#define COPY(condition)
 

Functions

void avpriv_align_put_bits (PutBitContext *s)
 Pad the bitstream with zeros up to the next byte boundary. More...
 
void avpriv_put_string (PutBitContext *pb, const char *string, int terminate_string)
 Put the string string in the bitstream. More...
 
void avpriv_copy_bits (PutBitContext *pb, const uint8_t *src, int length)
 Copy the content of src to the bitstream. More...
 
static int alloc_table (VLC *vlc, int size, int use_static)
 
static av_always_inline uint32_t bitswap_32 (uint32_t x)
 
static int compare_vlcspec (const void *a, const void *b)
 
static int build_table (VLC *vlc, int table_nb_bits, int nb_codes, VLCcode *codes, int flags)
 Build VLC decoding tables suitable for use with get_vlc(). More...
 
int ff_init_vlc_sparse (VLC *vlc, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, const void *symbols, int symbols_wrap, int symbols_size, int flags)
 
void ff_free_vlc (VLC *vlc)
 

Variables

const uint8_t ff_log2_run [41]
 

Detailed Description

bitstream api.

Definition in file bitstream.c.

Macro Definition Documentation

#define COPY (   condition)
Value:
for (i = 0; i < nb_codes; i++) {\
GET_DATA(buf[j].bits, bits, i, bits_wrap, bits_size);\
if (!(condition))\
if (buf[j].bits > 3*nb_bits || buf[j].bits>32) {\
av_log(NULL, AV_LOG_ERROR, "Too long VLC in init_vlc\n");\
return -1;\
}\
GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size);\
if (buf[j].code >= (1LL<<buf[j].bits)) {\
av_log(NULL, AV_LOG_ERROR, "Invalid code in init_vlc\n");\
return -1;\
}\
buf[j].code = bitswap_32(buf[j].code);\
buf[j].code <<= 32 - buf[j].bits;\
if (symbols)\
GET_DATA(buf[j].symbol, symbols, i, symbols_wrap, symbols_size)\
buf[j].symbol = i;\
j++;\
}
#define GET_DATA(v, table, i, wrap, size)
Definition: bitstream.c:84
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks
uint8_t bits
Definition: crc.c:216
static av_always_inline uint32_t bitswap_32(uint32_t x)
Definition: bitstream.c:118
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:246
loc<=1||loc >=hN-1 continue()
NULL
Definition: eval.c:55
or the Software in violation of any applicable export control laws in any jurisdiction Except as provided by mandatorily applicable UPF has no obligation to provide you with source code to the Software In the event Software contains any source code
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:148
void * buf
Definition: avisynth_c.h:594
#define INIT_VLC_LE
Definition: get_bits.h:442
synthesis window for stochastic i
static int flags
Definition: cpu.c:23
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame This method is called when a frame is wanted on an output For an it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return it should return

Referenced by avfilter_register_all(), and ff_init_vlc_sparse().

#define GET_DATA (   v,
  table,
  i,
  wrap,
  size 
)
Value:
{\
const uint8_t *ptr = (const uint8_t *)table + i * wrap;\
switch(size) {\
case 1:\
v = *(const uint8_t *)ptr;\
break;\
case 2:\
v = *(const uint16_t *)ptr;\
break;\
v = *(const uint32_t *)ptr;\
break;\
}\
}
float v
#define wrap(func)
Definition: w64xmmtest.h:70
uint8_t
static const struct endianess table[]
int size
synthesis window for stochastic i
default
Definition: start.py:60

Definition at line 84 of file bitstream.c.

Function Documentation

static int alloc_table ( VLC vlc,
int  size,
int  use_static 
)
static

Definition at line 101 of file bitstream.c.

Referenced by build_table(), and mp_decode_layer2().

void avpriv_copy_bits ( PutBitContext pb,
const uint8_t src,
int  length 
)

Copy the content of src to the bitstream.

Parameters
lengththe number of bits of src to copy

Definition at line 61 of file bitstream.c.

Referenced by copy_bits(), encode_thread(), ff_mpeg4_merge_partitions(), flush_put_bits(), latm_write_frame_header(), latm_write_packet(), merge_context_after_encode(), save_bits(), and svq1_encode_plane().

void avpriv_put_string ( PutBitContext pb,
const char *  string,
int  terminate_string 
)

Put the string string in the bitstream.

Parameters
terminate_string0-terminates the written string if value is 1

Definition at line 51 of file bitstream.c.

Referenced by flush_put_bits(), jpeg_put_comments(), and mpeg4_encode_vol_header().

static av_always_inline uint32_t bitswap_32 ( uint32_t  x)
static

Definition at line 118 of file bitstream.c.

Referenced by build_table().

static int build_table ( VLC vlc,
int  table_nb_bits,
int  nb_codes,
VLCcode codes,
int  flags 
)
static

Build VLC decoding tables suitable for use with get_vlc().

Parameters
vlcthe context to be initted
table_nb_bitsmax length of vlc codes to store directly in this table (Longer codes are delegated to subtables.)
nb_codesnumber of elements in codes[]
codesdescriptions of the vlc codes These must be ordered such that codes going into the same subtable are contiguous. Sorting by VLCcode.code is sufficient, though not necessary.

Definition at line 153 of file bitstream.c.

Referenced by ff_init_vlc_sparse().

static int compare_vlcspec ( const void a,
const void b 
)
static

Definition at line 133 of file bitstream.c.

Referenced by ff_init_vlc_sparse().

int ff_init_vlc_sparse ( VLC vlc,
int  nb_bits,
int  nb_codes,
const void bits,
int  bits_wrap,
int  bits_size,
const void codes,
int  codes_wrap,
int  codes_size,
const void symbols,
int  symbols_wrap,
int  symbols_size,
int  flags 
)

Variable Documentation

const uint8_t ff_log2_run[41]
Initial value:
={
0, 0, 0, 0, 1, 1, 1, 1,
2, 2, 2, 2, 3, 3, 3, 3,
4, 4, 5, 5, 6, 6, 7, 7,
8, 9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,
24,
}

Definition at line 37 of file bitstream.c.

Referenced by decode_line(), encode_line(), ls_decode_line(), ls_encode_line(), and ls_encode_run().