Lines Matching refs:vlc

38 #include "vlc.h"
59 static int alloc_table(VLC *vlc, int size, int use_static)
61 int index = vlc->table_size;
63 vlc->table_size += size;
64 if (vlc->table_size > vlc->table_allocated) {
67 vlc->table_allocated += (1 << vlc->bits);
68 vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(*vlc->table));
69 if (!vlc->table) {
70 vlc->table_allocated = 0;
71 vlc->table_size = 0;
74 memset(vlc->table + vlc->table_allocated - (1 << vlc->bits), 0, sizeof(*vlc->table) << vlc->bits);
97 static int vlc_common_init(VLC *vlc, int nb_bits, int nb_codes,
100 vlc->bits = nb_bits;
101 vlc->table_size = 0;
105 vlc->table = NULL;
106 vlc->table_allocated = 0;
126 * @param vlc the context to be initialized
128 * @param table_nb_bits max length of vlc codes to store directly in this table
133 * @param codes descriptions of the vlc codes
137 static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
146 table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
150 table = &vlc->table[table_index];
206 index = build_table(vlc, subtable_bits, k-i, codes+i, flags);
210 table = &vlc->table[table_index];
228 static int vlc_common_end(VLC *vlc, int nb_bits, int nb_codes, VLCcode *codes,
231 int ret = build_table(vlc, nb_bits, nb_codes, codes, flags);
234 if (vlc->table_size != vlc->table_allocated &&
236 av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated);
242 av_freep(&vlc->table);
257 'bits' : table which gives the size (in bits) of each vlc code.
259 'codes' : table which gives the bit pattern of of each vlc code.
272 int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
281 ret = vlc_common_init(vlc, nb_bits, nb_codes, &buf, flags);
324 return vlc_common_end(vlc, nb_bits, nb_codes, buf,
328 int ff_init_vlc_from_lengths(VLC *vlc, int nb_bits, int nb_codes,
337 ret = vlc_common_init(vlc, nb_bits, nb_codes, &buf, flags);
368 return vlc_common_end(vlc, nb_bits, j, buf, flags, localbuf);
375 void ff_free_vlc(VLC *vlc)
377 av_freep(&vlc->table);