Go to the documentation of this file.
27 #define VLC_MULTI_MAX_SYMBOLS 6
59 #define vlc_init(vlc, nb_bits, nb_codes, \
60 bits, bits_wrap, bits_size, \
61 codes, codes_wrap, codes_size, \
63 ff_vlc_init_sparse(vlc, nb_bits, nb_codes, \
64 bits, bits_wrap, bits_size, \
65 codes, codes_wrap, codes_size, \
99 const void *codes,
int codes_wrap,
int codes_size,
100 const void *symbols,
int symbols_wrap,
int symbols_size,
133 const int8_t *lens,
int lens_wrap,
134 const void *symbols,
int symbols_wrap,
int symbols_size,
171 int nb_codes,
const int8_t *lens,
int lens_wrap,
172 const void *symbols,
int symbols_wrap,
int symbols_size,
179 #define VLC_INIT_USE_STATIC 1
180 #define VLC_INIT_STATIC_OVERLONG (2 | VLC_INIT_USE_STATIC)
183 #define VLC_INIT_INPUT_LE 4
185 #define VLC_INIT_OUTPUT_LE 8
186 #define VLC_INIT_LE (VLC_INIT_INPUT_LE | VLC_INIT_OUTPUT_LE)
188 #define VLC_INIT_CUSTOM_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \
189 h, i, j, flags, static_size) \
191 static VLCElem table[static_size]; \
192 (vlc)->table = table; \
193 (vlc)->table_allocated = static_size; \
194 ff_vlc_init_sparse(vlc, bits, a, b, c, d, e, f, g, h, i, j, \
195 flags | VLC_INIT_USE_STATIC); \
198 #define VLC_INIT_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, h, i, j, static_size) \
199 VLC_INIT_CUSTOM_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \
200 h, i, j, 0, static_size)
202 #define VLC_INIT_LE_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, h, i, j, static_size) \
203 VLC_INIT_CUSTOM_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \
204 h, i, j, VLC_INIT_LE, static_size)
206 #define VLC_INIT_CUSTOM_STATIC(vlc, bits, a, b, c, d, e, f, g, flags, static_size) \
207 VLC_INIT_CUSTOM_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \
208 NULL, 0, 0, flags, static_size)
210 #define VLC_INIT_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \
211 VLC_INIT_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, NULL, 0, 0, static_size)
213 #define VLC_INIT_LE_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \
214 VLC_INIT_LE_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, NULL, 0, 0, static_size)
216 #define VLC_INIT_STATIC_FROM_LENGTHS(vlc, bits, nb_codes, lens, len_wrap, \
217 symbols, symbols_wrap, symbols_size, \
218 offset, flags, static_size) \
220 static VLCElem table[static_size]; \
221 (vlc)->table = table; \
222 (vlc)->table_allocated = static_size; \
223 ff_vlc_init_from_lengths(vlc, bits, nb_codes, lens, len_wrap, \
224 symbols, symbols_wrap, symbols_size, \
225 offset, flags | VLC_INIT_USE_STATIC, \
255 #define VLC_INIT_STATE(_table) { .table = (_table), .size = FF_ARRAY_ELEMS(_table) }
258 int nb_bits,
int nb_codes,
259 const int8_t *lens,
int lens_wrap,
260 const void *symbols,
int symbols_wrap,
int symbols_size,
264 int nb_bits,
int nb_codes,
265 const int8_t *lens,
int lens_wrap,
266 const void *symbols,
int symbols_wrap,
int symbols_size,
270 int nb_bits,
int nb_codes,
272 const void *codes,
int codes_wrap,
int codes_size,
273 const void *symbols,
int symbols_wrap,
int symbols_size,
277 int nb_bits,
int nb_codes,
279 const void *codes,
int codes_wrap,
int codes_size,
280 const void *symbols,
int symbols_wrap,
int symbols_size,
285 int nb_bits,
int nb_codes,
287 const void *codes,
int codes_wrap,
int codes_size,
292 codes, codes_wrap, codes_size,
296 #define VLC_INIT_STATIC_SPARSE_TABLE(vlc_table, nb_bits, nb_codes, \
297 bits, bits_wrap, bits_size, \
298 codes, codes_wrap, codes_size, \
299 symbols, symbols_wrap, symbols_size, \
301 ff_vlc_init_table_sparse(vlc_table, FF_ARRAY_ELEMS(vlc_table), \
302 (nb_bits), (nb_codes), \
303 (bits), (bits_wrap), (bits_size), \
304 (codes), (codes_wrap), (codes_size), \
305 (symbols), (symbols_wrap), (symbols_size), \
308 #define VLC_INIT_STATIC_TABLE(vlc_table, nb_bits, nb_codes, \
309 bits, bits_wrap, bits_size, \
310 codes, codes_wrap, codes_size, \
312 ff_vlc_init_table_sparse(vlc_table, FF_ARRAY_ELEMS(vlc_table), \
313 (nb_bits), (nb_codes), \
314 (bits), (bits_wrap), (bits_size), \
315 (codes), (codes_wrap), (codes_size), \
318 #define VLC_INIT_STATIC_TABLE_FROM_LENGTHS(vlc_table, nb_bits, nb_codes, \
320 syms, syms_wrap, syms_size, \
322 ff_vlc_init_table_from_lengths(vlc_table, FF_ARRAY_ELEMS(vlc_table), \
323 (nb_bits), (nb_codes), \
324 (lens), (lens_wrap), \
325 (syms), (syms_wrap), (syms_size), \
VLCElem * table
points to where the next VLC table will be placed
static const uint16_t table[]
void ff_vlc_free_multi(VLC_MULTI *vlc)
For static VLCs, the number of bits can often be hardcoded at each get_vlc2() callsite.
void ff_vlc_free(VLC *vlc)
uint8_t val[VLC_MULTI_MAX_SYMBOLS]
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()
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()
const VLCElem * ff_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)
#define VLC_MULTI_MAX_SYMBOLS
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
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 VLCElem * ff_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 VLCElem * ff_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)
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().
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)
#define flags(name, subs,...)
unsigned size
remaining number of elements in table