libavcodec/bitstream.c File Reference

bitstream api. More...

#include "avcodec.h"
#include "get_bits.h"
#include "put_bits.h"

Go to the source code of this file.

Data Structures

struct  VLCcode

Defines

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

Functions

void align_put_bits (PutBitContext *s)
 Pad the bitstream with zeros up to the next byte boundary.
void ff_put_string (PutBitContext *pb, const char *string, int terminate_string)
 Put the string string in the bitstream.
void ff_copy_bits (PutBitContext *pb, const uint8_t *src, int length)
 Copy the content of src to the bitstream.
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().
int 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 free_vlc (VLC *vlc)

Variables

const uint8_t ff_log2_run [41]


Detailed Description

bitstream api.

Definition in file bitstream.c.


Define 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))\
            continue;\
        GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size);\
        if (flags & INIT_VLC_LE)\
            buf[j].code = bitswap_32(buf[j].code);\
        else\
            buf[j].code <<= 32 - buf[j].bits;\
        if (symbols)\
            GET_DATA(buf[j].symbol, symbols, i, symbols_wrap, symbols_size)\
        else\
            buf[j].symbol = i;\
        j++;\
    }

Referenced by avfilter_register_all(), backup_duplicate_context(), idct_put_altivec(), init_vlc_sparse(), and update_duplicate_context_after_me().

#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;\
    default:\
        v = *(const uint32_t *)ptr;\
        break;\
    }\
}

Definition at line 86 of file bitstream.c.


Function Documentation

void align_put_bits ( PutBitContext s  ) 

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

Definition at line 103 of file bitstream.c.

Referenced by build_table(), and mp_decode_layer2().

static av_always_inline uint32_t bitswap_32 ( uint32_t  x  )  [static]

Definition at line 120 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:
vlc the context to be initted
table_nb_bits max length of vlc codes to store directly in this table (Longer codes are delegated to subtables.)
nb_codes number of elements in codes[]
codes descriptions 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 155 of file bitstream.c.

Referenced by init_vlc_sparse().

static int compare_vlcspec ( const void *  a,
const void *  b 
) [static]

Definition at line 135 of file bitstream.c.

Referenced by init_vlc_sparse().

void ff_copy_bits ( PutBitContext pb,
const uint8_t *  src,
int  length 
)

Copy the content of src to the bitstream.

Parameters:
length the number of bits of src to copy

Definition at line 63 of file bitstream.c.

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

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

Put the string string in the bitstream.

Parameters:
terminate_string 0-terminates the written string if value is 1

Definition at line 53 of file bitstream.c.

Referenced by jpeg_put_comments(), and mpeg4_encode_vol_header().

void free_vlc ( VLC vlc  ) 

int 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 35 of file bitstream.c.

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


Generated on Fri Oct 26 02:39:44 2012 for FFmpeg by  doxygen 1.5.8