FFmpeg
Data Structures | Macros | Typedefs | Functions
vlc.h File Reference
#include <stddef.h>
#include <stdint.h>
#include "libavutil/macros.h"

Go to the source code of this file.

Data Structures

struct   VLCElem
 
struct   VLC
 
struct   VLC_MULTI_ELEM
 
struct   VLC_MULTI
 
struct   RL_VLC_ELEM
 
struct   VLCInitState
  For static VLCs, the number of bits can often be hardcoded at each get_vlc2() callsite. More...
 

Macros

#define  VLC_MULTI_MAX_SYMBOLS   6
 
#define  vlc_init(vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)
 
#define  VLC_INIT_USE_STATIC   1
 
 
#define  VLC_INIT_INPUT_LE   4
 
#define  VLC_INIT_OUTPUT_LE   8
 
 
#define  VLC_INIT_STATE(_table)   { .table = (_table), .size = FF_ARRAY_ELEMS(_table) }
 
#define  VLC_INIT_STATIC_SPARSE_TABLE(vlc_table, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, symbols, symbols_wrap, symbols_size, flags)
 
#define  VLC_INIT_STATIC_TABLE(vlc_table, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)
 
#define  VLC_INIT_STATIC_TABLE_FROM_LENGTHS(vlc_table, nb_bits, nb_codes, lens, lens_wrap, syms, syms_wrap, syms_size, offset, flags)
 

Typedefs

typedef int16_t  VLCBaseType
 

Functions

int  ff_vlc_init_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)
  Build VLC decoding tables suitable for use with get_vlc2(). More...
 
int  ff_vlc_init_from_lengths (VLC *vlc, int nb_bits, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags, void *logctx)
  Build VLC decoding tables suitable for use with get_vlc2() More...
 
int  ff_vlc_init_multi_from_lengths (VLC *vlc, VLC_MULTI *multi, int nb_bits, int nb_elems, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags, void *logctx)
  Build VLC decoding tables suitable for use with get_vlc_multi() More...
 
 
void  ff_vlc_free (VLC *vlc)
 
void  ff_vlc_init_table_from_lengths (VLCElem table[], int table_size, int nb_bits, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags)
 
const VLCElemff_vlc_init_tables_from_lengths (VLCInitState *state, int nb_bits, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags)
 
void  ff_vlc_init_table_sparse (VLCElem table[], int table_size, 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)
 
const VLCElemff_vlc_init_tables_sparse (VLCInitState *state, 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)
 
static const VLCElemff_vlc_init_tables (VLCInitState *state, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, int flags)
 

Macro Definition Documentation

VLC_MULTI_MAX_SYMBOLS

#define VLC_MULTI_MAX_SYMBOLS   6

Definition at line 27 of file vlc.h.

vlc_init

#define vlc_init (   vlc,
  nb_bits,
  nb_codes,
  bits,
  bits_wrap,
  bits_size,
  codes,
  codes_wrap,
  codes_size,
  flags 
)
Value:
ff_vlc_init_sparse(vlc, nb_bits, nb_codes, \
bits, bits_wrap, bits_size, \
codes, codes_wrap, codes_size, \
NULL, 0, 0, flags)

Definition at line 62 of file vlc.h.

VLC_INIT_USE_STATIC

#define VLC_INIT_USE_STATIC   1

Definition at line 182 of file vlc.h.

VLC_INIT_STATIC_OVERLONG

#define VLC_INIT_STATIC_OVERLONG   (2 | VLC_INIT_USE_STATIC)

Definition at line 183 of file vlc.h.

VLC_INIT_INPUT_LE

#define VLC_INIT_INPUT_LE   4

Definition at line 186 of file vlc.h.

VLC_INIT_OUTPUT_LE

#define VLC_INIT_OUTPUT_LE   8

Definition at line 188 of file vlc.h.

VLC_INIT_LE

#define VLC_INIT_LE   (VLC_INIT_INPUT_LE | VLC_INIT_OUTPUT_LE)

Definition at line 189 of file vlc.h.

VLC_INIT_STATE

#define VLC_INIT_STATE (   _table )    { .table = (_table), .size = FF_ARRAY_ELEMS(_table) }

Definition at line 217 of file vlc.h.

VLC_INIT_STATIC_SPARSE_TABLE

#define VLC_INIT_STATIC_SPARSE_TABLE (   vlc_table,
  nb_bits,
  nb_codes,
  bits,
  bits_wrap,
  bits_size,
  codes,
  codes_wrap,
  codes_size,
  symbols,
  symbols_wrap,
  symbols_size,
  flags 
)
Value:
ff_vlc_init_table_sparse(vlc_table, FF_ARRAY_ELEMS(vlc_table), \
(nb_bits), (nb_codes), \
(bits), (bits_wrap), (bits_size), \
(codes), (codes_wrap), (codes_size), \
(symbols), (symbols_wrap), (symbols_size), \
(flags))

Definition at line 258 of file vlc.h.

VLC_INIT_STATIC_TABLE

#define VLC_INIT_STATIC_TABLE (   vlc_table,
  nb_bits,
  nb_codes,
  bits,
  bits_wrap,
  bits_size,
  codes,
  codes_wrap,
  codes_size,
  flags 
)
Value:
ff_vlc_init_table_sparse(vlc_table, FF_ARRAY_ELEMS(vlc_table), \
(nb_bits), (nb_codes), \
(bits), (bits_wrap), (bits_size), \
(codes), (codes_wrap), (codes_size), \
NULL, 0, 0, (flags))

Definition at line 270 of file vlc.h.

VLC_INIT_STATIC_TABLE_FROM_LENGTHS

#define VLC_INIT_STATIC_TABLE_FROM_LENGTHS (   vlc_table,
  nb_bits,
  nb_codes,
  lens,
  lens_wrap,
  syms,
  syms_wrap,
  syms_size,
  offset,
  flags 
)
Value:
(nb_bits), (nb_codes), \
(lens), (lens_wrap), \
(syms), (syms_wrap), (syms_size), \
(offset), (flags))

Definition at line 280 of file vlc.h.

Typedef Documentation

VLCBaseType

typedef int16_t VLCBaseType

Definition at line 30 of file vlc.h.

Function Documentation

ff_vlc_init_sparse()

int ff_vlc_init_sparse ( VLCvlc,
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 
)

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

Parameters
[in,out] vlc The VLC to be initialized; table and table_allocated must have been set when initializing a static VLC, otherwise this will be treated as uninitialized.
[in] nb_bits The number of bits to use for the VLC table; higher values take up more memory and cache, but allow to read codes with fewer reads. Corresponds to the bits parameter of get_vlc2().
[in] nb_codes The number of provided bits, codes and (if supplied) symbol entries.
[in] bits The lengths (in bits) of the codes. Entries > 0 correspond to valid codes; entries == 0 will be skipped.
[in] bits_wrap Stride (in bytes) of the bits table.
[in] codes_size Size of the bits. 1, 2 and 4 are supported.
[in] codes Table which gives the bit pattern of of each vlc code.
[in] codes_wrap Stride (in bytes) of the codes table.
[in] codes_size Size of the codes. 1, 2 and 4 are supported.
[in] symbols The symbols, i.e. what is returned from get_vlc2() when the corresponding code is encountered. May be NULL, then 0, 1, 2, 3, 4,... will be used.
[in] symbols_wrap Stride (in bytes) of the symbols table.
[in] symbols_size Size of the symbols. 1 and 2 are supported.
[in] flags A combination of the VLC_INIT_* flags.

'wrap' and 'size' make it possible to use any memory configuration and types (byte/word/int) to store the 'bits', 'codes', and 'symbols' tables.

Definition at line 250 of file vlc.c.

Referenced by build_huff(), build_huff_tree(), build_vlc(), dnxhd_init_vlc(), ff_vlc_init_table_sparse(), ff_vlc_init_tables_sparse(), generate_joint_tables(), huf_build_dec_table(), init_ralf_vlc(), read_hufftable(), and rv34_gen_vlc_ext().

ff_vlc_init_from_lengths()

int ff_vlc_init_from_lengths ( VLCvlc,
int  nb_bits,
int  nb_codes,
const int8_t *  lens,
int  lens_wrap,
const void *  symbols,
int  symbols_wrap,
int  symbols_size,
int  offset,
int  flags,
void *  logctx 
)

Build VLC decoding tables suitable for use with get_vlc2()

This function takes lengths and symbols and calculates the codes from them. For this the input lengths and symbols have to be sorted according to "left nodes in the corresponding tree first".

Parameters
[in,out] vlc The VLC to be initialized; table and table_allocated must have been set when initializing a static VLC, otherwise this will be treated as uninitialized.
[in] nb_bits The number of bits to use for the VLC table; higher values take up more memory and cache, but allow to read codes with fewer reads.
[in] nb_codes The number of provided length and (if supplied) symbol entries.
[in] lens The lengths of the codes. Entries > 0 correspond to valid codes; entries == 0 will be skipped and entries with len < 0 indicate that the tree is incomplete and has an open end of length -len at this position.
[in] lens_wrap Stride (in bytes) of the lengths.
[in] symbols The symbols, i.e. what is returned from get_vlc2() when the corresponding code is encountered. May be NULL, then 0, 1, 2, 3, 4,... will be used.
[in] symbols_wrap Stride (in bytes) of the symbols.
[in] symbols_size Size of the symbols. 1 and 2 are supported.
[in] offset An offset to apply to all the valid symbols.
[in] flags A combination of the VLC_INIT_* flags; notice that VLC_INIT_INPUT_LE is pointless and ignored.

Definition at line 306 of file vlc.c.

Referenced by atrac3_init_static_data(), build_canonical_huff(), build_vlc(), cfhd_init_vlc(), dv_init_static(), ff_mjpeg_build_vlc(), ff_vlc_init_table_from_lengths(), ff_vlc_init_tables_from_lengths(), mp_decode_frame(), mss4_init_vlc(), on2avc_decode_init(), qdmc_init_static_data(), read_code_table(), read_simple_vlc_prefix(), read_vlc_prefix(), rv10_build_vlc(), smacker_decode_header_tree(), smka_decode_frame(), tm2_build_huff_table(), tscc2_init_vlc(), vp3_decode_init(), and wma_decode_init().

ff_vlc_init_multi_from_lengths()

int ff_vlc_init_multi_from_lengths ( VLCvlc,
VLC_MULTImulti,
int  nb_bits,
int  nb_elems,
int  nb_codes,
const int8_t *  lens,
int  lens_wrap,
const void *  symbols,
int  symbols_wrap,
int  symbols_size,
int  offset,
int  flags,
void *  logctx 
)

Build VLC decoding tables suitable for use with get_vlc_multi()

This function takes lengths and symbols and calculates the codes from them. For this the input lengths and symbols have to be sorted according to "left nodes in the corresponding tree first".

Parameters
[in,out] vlc The VLC to be initialized; table and table_allocated must have been set when initializing a static VLC, otherwise this will be treated as uninitialized.
[in,out] multi The VLC_MULTI to be initialized; table and table_allocated must have been set when initializing a static VLC, otherwise this will be treated as uninitialized.
[in] nb_bits The number of bits to use for the VLC table; higher values take up more memory and cache, but allow to read codes with fewer reads.
[in] nb_elems The max possible number of elements.
[in] nb_codes The number of provided length and (if supplied) symbol entries.
[in] lens The lengths of the codes. Entries > 0 correspond to valid codes; entries == 0 will be skipped and entries with len < 0 indicate that the tree is incomplete and has an open end of length -len at this position.
[in] lens_wrap Stride (in bytes) of the lengths.
[in] symbols The symbols, i.e. what is returned from get_vlc2() when the corresponding code is encountered. May be NULL, then 0, 1, 2, 3, 4,... will be used.
[in] symbols_wrap Stride (in bytes) of the symbols.
[in] symbols_size Size of the symbols. 1 and 2 are supported.
[in] offset An offset to apply to all the valid symbols.
[in] flags A combination of the VLC_INIT_* flags; notice that VLC_INIT_INPUT_LE is pointless and ignored.

Definition at line 517 of file vlc.c.

Referenced by build_huff(), and huff_build().

ff_vlc_free_multi()

void ff_vlc_free_multi ( VLC_MULTIvlc )

Definition at line 575 of file vlc.c.

Referenced by decode_plane(), decode_plane10(), ff_vlc_init_multi_from_lengths(), huff_build(), and magy_decode_end().

ff_vlc_free()

void ff_vlc_free ( VLCvlc )

Definition at line 580 of file vlc.c.

Referenced by build_huff(), build_vlc(), cfhd_init_vlc(), cook_decode_close(), decode_argb_frame(), decode_close(), decode_end(), decode_plane(), decode_plane10(), decode_rgb24_frame(), decode_rle(), decode_yuv_frame(), dist_bundle_close(), dnxhd_decode_close(), dnxhd_init_vlc(), ff_ivi_dec_huff_desc(), ff_ivi_decode_close(), ff_mjpeg_decode_dht(), ff_mjpeg_decode_end(), ff_wma_end(), fraps2_decode_plane(), free_vlc_tables(), generate_joint_tables(), hqx_decode_close(), huf_build_dec_table(), huff_build(), image_ctx_free(), init_default_huffman_tables(), ivi_free_buffers(), jpg_free_context(), magy_decode_end(), mp_decode_frame(), on2avc_free_vlcs(), photocd_decode_close(), read_huffman_code_normal(), read_huffman_tables(), read_hufftable(), read_old_huffman_tables(), read_vlc_prefix(), smacker_decode_header_tree(), smka_decode_frame(), tm2_free_codes(), vorbis_free(), vp6_build_huff_tree(), and vp6_decode_free_context().

ff_vlc_init_table_from_lengths()

void ff_vlc_init_table_from_lengths ( VLCElem  table[],
int  table_size,
int  nb_bits,
int  nb_codes,
const int8_t *  lens,
int  lens_wrap,
const void *  symbols,
int  symbols_wrap,
int  symbols_size,
int  offset,
int  flags 
)

Definition at line 353 of file vlc.c.

ff_vlc_init_tables_from_lengths()

const VLCElem* ff_vlc_init_tables_from_lengths ( VLCInitStatestate,
int  nb_bits,
int  nb_codes,
const int8_t *  lens,
int  lens_wrap,
const void *  symbols,
int  symbols_wrap,
int  symbols_size,
int  offset,
int  flags 
)

Definition at line 366 of file vlc.c.

Referenced by aacdec_common_init(), atrac9_init_vlc(), build_vlc(), clv_init_static(), decode_init_static(), imc_init_static(), init_tables_once(), mobiclip_init_static(), mpc7_init_static(), mpegaudiodec_common_init_static(), rv40_init_table(), rv40_init_tables(), and x8_init_vlc().

ff_vlc_init_table_sparse()

void ff_vlc_init_table_sparse ( VLCElem  table[],
int  table_size,
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 
)

Definition at line 384 of file vlc.c.

Referenced by init_vlcs().

ff_vlc_init_tables_sparse()

const VLCElem* ff_vlc_init_tables_sparse ( VLCInitStatestate,
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 
)

Definition at line 400 of file vlc.c.

Referenced by aacdec_common_init(), ccitt_unpack_init(), ff_vlc_init_tables(), and msmpeg4_decode_init_static().

ff_vlc_init_tables()

static const VLCElem* ff_vlc_init_tables ( VLCInitStatestate,
int  nb_bits,
int  nb_codes,
const void *  bits,
int  bits_wrap,
int  bits_size,
const void *  codes,
int  codes_wrap,
int  codes_size,
int  flags 
)
inlinestatic

Definition at line 246 of file vlc.h.

Referenced by ccitt_unpack_init(), ff_h264_decode_init_vlc(), init_tables_once(), msmp4_vc1_vlcs_init(), svq1_static_init(), and vc1_init_static().

FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
bits
uint8_t bits
Definition: vp3data.h:128
NULL
#define NULL
Definition: coverity.c:32
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
ff_vlc_init_table_from_lengths
void ff_vlc_init_table_from_lengths(VLCElem table[], int table_size, int nb_bits, int nb_codes, const int8_t *lens, int lens_wrap, const void *symbols, int symbols_wrap, int symbols_size, int offset, int flags)
Definition: vlc.c:353
bits_size
#define bits_size
Definition: bitstream.h:113
ff_vlc_init_sparse
int ff_vlc_init_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)
Build VLC decoding tables suitable for use with get_vlc2().
Definition: vlc.c:250
ff_vlc_init_table_sparse
void ff_vlc_init_table_sparse(VLCElem table[], int table_size, 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)
Definition: vlc.c:384
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482

Generated on Fri Aug 22 2025 14:00:00 for FFmpeg by   doxygen 1.8.17

AltStyle によって変換されたページ (->オリジナル) /