mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
avcodec/vlc: Use proper namespace
Therefore use a proper prefix for this API, e.g.
ff_init_vlc_sparse -> ff_vlc_init_sparse
ff_free_vlc -> ff_vlc_free
INIT_VLC_LE -> VLC_INIT_LE
INIT_VLC_USE_NEW_STATIC -> VLC_INIT_USE_STATIC
(The ancient INIT_VLC_USE_STATIC has been removed
in 595324e143
, so that
the NEW has been dropped.)
Finally, reorder the flags and change their values
accordingly.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
95e876f069
commit
9cdf82c2c2
@ -257,10 +257,10 @@ static av_cold void init_vlcs(void)
|
||||
for (j = 0; j < 4; j++) {
|
||||
block_type_vlc[i][j].table = table[i][j];
|
||||
block_type_vlc[i][j].table_allocated = 32;
|
||||
init_vlc(&block_type_vlc[i][j], BLOCK_TYPE_VLC_BITS, 7,
|
||||
vlc_init(&block_type_vlc[i][j], BLOCK_TYPE_VLC_BITS, 7,
|
||||
&block_type_tab[i][j][0][1], 2, 1,
|
||||
&block_type_tab[i][j][0][0], 2, 1,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
VLC_INIT_USE_STATIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -706,8 +706,8 @@ static const uint8_t *read_huffman_tables(FourXContext *f,
|
||||
len_tab[j] = len;
|
||||
}
|
||||
|
||||
ff_free_vlc(&f->pre_vlc);
|
||||
if (init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257, len_tab, 1, 1,
|
||||
ff_vlc_free(&f->pre_vlc);
|
||||
if (vlc_init(&f->pre_vlc, ACDC_VLC_BITS, 257, len_tab, 1, 1,
|
||||
bits_tab, 4, 4, 0))
|
||||
return NULL;
|
||||
|
||||
@ -985,7 +985,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
|
||||
av_freep(&f->cfrm[i].data);
|
||||
f->cfrm[i].allocated_size = 0;
|
||||
}
|
||||
ff_free_vlc(&f->pre_vlc);
|
||||
ff_vlc_free(&f->pre_vlc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1133,14 +1133,14 @@ static av_cold void aac_static_table_init(void)
|
||||
for (unsigned i = 0, offset = 0; i < 11; i++) {
|
||||
vlc_spectral[i].table = &vlc_buf[offset];
|
||||
vlc_spectral[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset;
|
||||
ff_init_vlc_sparse(&vlc_spectral[i], 8, ff_aac_spectral_sizes[i],
|
||||
ff_vlc_init_sparse(&vlc_spectral[i], 8, ff_aac_spectral_sizes[i],
|
||||
ff_aac_spectral_bits[i], sizeof(ff_aac_spectral_bits[i][0]),
|
||||
sizeof(ff_aac_spectral_bits[i][0]),
|
||||
ff_aac_spectral_codes[i], sizeof(ff_aac_spectral_codes[i][0]),
|
||||
sizeof(ff_aac_spectral_codes[i][0]),
|
||||
ff_aac_codebook_vector_idx[i], sizeof(ff_aac_codebook_vector_idx[i][0]),
|
||||
sizeof(ff_aac_codebook_vector_idx[i][0]),
|
||||
INIT_VLC_STATIC_OVERLONG);
|
||||
VLC_INIT_STATIC_OVERLONG);
|
||||
offset += vlc_spectral[i].table_size;
|
||||
}
|
||||
|
||||
@ -1148,7 +1148,7 @@ static av_cold void aac_static_table_init(void)
|
||||
|
||||
ff_aac_tableinit();
|
||||
|
||||
INIT_VLC_STATIC(&vlc_scalefactors, 7,
|
||||
VLC_INIT_STATIC(&vlc_scalefactors, 7,
|
||||
FF_ARRAY_ELEMS(ff_aac_scalefactor_code),
|
||||
ff_aac_scalefactor_bits,
|
||||
sizeof(ff_aac_scalefactor_bits[0]),
|
||||
|
@ -290,7 +290,7 @@ err:
|
||||
}
|
||||
|
||||
#define PS_INIT_VLC_STATIC(num, nb_bits, size) \
|
||||
INIT_VLC_STATIC(&vlc_ps[num], nb_bits, ps_tmp[num].table_size / ps_tmp[num].elem_size, \
|
||||
VLC_INIT_STATIC(&vlc_ps[num], nb_bits, ps_tmp[num].table_size / ps_tmp[num].elem_size, \
|
||||
ps_tmp[num].ps_bits, 1, 1, \
|
||||
ps_tmp[num].ps_codes, ps_tmp[num].elem_size, ps_tmp[num].elem_size, \
|
||||
size);
|
||||
|
@ -70,7 +70,7 @@ static const int8_t vlc_sbr_lav[10] =
|
||||
{ 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 };
|
||||
|
||||
#define SBR_INIT_VLC_STATIC(num, size) \
|
||||
INIT_VLC_STATIC(&vlc_sbr[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \
|
||||
VLC_INIT_STATIC(&vlc_sbr[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \
|
||||
sbr_tmp[num].sbr_bits , 1, 1, \
|
||||
sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, sbr_tmp[num].elem_size, \
|
||||
size)
|
||||
|
@ -1015,12 +1015,12 @@ static int build_huff(const uint8_t *bitlen, VLC *vlc)
|
||||
}
|
||||
}
|
||||
|
||||
ff_free_vlc(vlc);
|
||||
return ff_init_vlc_sparse(vlc, 13, nb_codes,
|
||||
ff_vlc_free(vlc);
|
||||
return ff_vlc_init_sparse(vlc, 13, nb_codes,
|
||||
bits, 1, 1,
|
||||
codes, 4, 4,
|
||||
symbols, 1, 1,
|
||||
INIT_VLC_LE);
|
||||
VLC_INIT_LE);
|
||||
}
|
||||
|
||||
static int decode_huffman2(AVCodecContext *avctx, int header, int size)
|
||||
@ -1255,7 +1255,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
|
||||
{
|
||||
AGMContext *s = avctx->priv_data;
|
||||
|
||||
ff_free_vlc(&s->vlc);
|
||||
ff_vlc_free(&s->vlc);
|
||||
av_frame_free(&s->prev_frame);
|
||||
av_freep(&s->mvectors);
|
||||
s->mvectors_size = 0;
|
||||
|
@ -67,19 +67,19 @@ typedef struct ASVDecContext {
|
||||
|
||||
static av_cold void init_vlcs(void)
|
||||
{
|
||||
INIT_VLC_STATIC(&ccp_vlc, CCP_VLC_BITS, 17,
|
||||
VLC_INIT_STATIC(&ccp_vlc, CCP_VLC_BITS, 17,
|
||||
&ff_asv_ccp_tab[0][1], 2, 1,
|
||||
&ff_asv_ccp_tab[0][0], 2, 1, 32);
|
||||
INIT_LE_VLC_STATIC(&dc_ccp_vlc, DC_CCP_VLC_BITS, 8,
|
||||
VLC_INIT_LE_STATIC(&dc_ccp_vlc, DC_CCP_VLC_BITS, 8,
|
||||
&ff_asv_dc_ccp_tab[0][1], 2, 1,
|
||||
&ff_asv_dc_ccp_tab[0][0], 2, 1, 16);
|
||||
INIT_LE_VLC_STATIC(&ac_ccp_vlc, AC_CCP_VLC_BITS, 16,
|
||||
VLC_INIT_LE_STATIC(&ac_ccp_vlc, AC_CCP_VLC_BITS, 16,
|
||||
&ff_asv_ac_ccp_tab[0][1], 2, 1,
|
||||
&ff_asv_ac_ccp_tab[0][0], 2, 1, 64);
|
||||
INIT_VLC_STATIC(&level_vlc, ASV1_LEVEL_VLC_BITS, 7,
|
||||
VLC_INIT_STATIC(&level_vlc, ASV1_LEVEL_VLC_BITS, 7,
|
||||
&ff_asv_level_tab[0][1], 2, 1,
|
||||
&ff_asv_level_tab[0][0], 2, 1, 16);
|
||||
INIT_LE_VLC_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63,
|
||||
VLC_INIT_LE_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63,
|
||||
&ff_asv2_level_tab[0][1], 4, 2,
|
||||
&ff_asv2_level_tab[0][0], 4, 2, 1024);
|
||||
}
|
||||
|
@ -863,10 +863,10 @@ static av_cold void atrac3_init_static_data(void)
|
||||
for (i = 0; i < 7; i++) {
|
||||
spectral_coeff_tab[i].table = table;
|
||||
spectral_coeff_tab[i].table_allocated = 256;
|
||||
ff_init_vlc_from_lengths(&spectral_coeff_tab[i], ATRAC3_VLC_BITS, huff_tab_sizes[i],
|
||||
ff_vlc_init_from_lengths(&spectral_coeff_tab[i], ATRAC3_VLC_BITS, huff_tab_sizes[i],
|
||||
&hufftabs[0][1], 2,
|
||||
&hufftabs[0][0], 2, 1,
|
||||
-31, INIT_VLC_USE_NEW_STATIC, NULL);
|
||||
-31, VLC_INIT_USE_STATIC, NULL);
|
||||
hufftabs += huff_tab_sizes[i];
|
||||
table += 256;
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ static av_cold void build_canonical_huff(const uint8_t *cb, const uint8_t **xlat
|
||||
out_vlc->table = &tables_data[*tab_offset];
|
||||
out_vlc->table_allocated = 1 << max_len;
|
||||
|
||||
ff_init_vlc_from_lengths(out_vlc, max_len, index, bits, 1,
|
||||
*xlat, 1, 1, 0, INIT_VLC_USE_NEW_STATIC, NULL);
|
||||
ff_vlc_init_from_lengths(out_vlc, max_len, index, bits, 1,
|
||||
*xlat, 1, 1, 0, VLC_INIT_USE_STATIC, NULL);
|
||||
|
||||
*tab_offset += 1 << max_len;
|
||||
*xlat += index;
|
||||
|
@ -849,9 +849,9 @@ static av_cold void atrac9_init_vlc(VLC *vlc, int nb_bits, int nb_codes,
|
||||
|
||||
vlc->table = &vlc_buf[*buf_offset];
|
||||
vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *buf_offset;
|
||||
ff_init_vlc_from_lengths(vlc, nb_bits, nb_codes,
|
||||
ff_vlc_init_from_lengths(vlc, nb_bits, nb_codes,
|
||||
&(*tab)[0][1], 2, &(*tab)[0][0], 2, 1,
|
||||
offset, INIT_VLC_STATIC_OVERLONG, NULL);
|
||||
offset, VLC_INIT_STATIC_OVERLONG, NULL);
|
||||
*buf_offset += vlc->table_size;
|
||||
*tab += nb_codes;
|
||||
}
|
||||
|
@ -1318,9 +1318,9 @@ static av_cold void bink_init_vlcs(void)
|
||||
bink_trees[i].table = table + offset;
|
||||
bink_trees[i].table_allocated = 1 << maxbits;
|
||||
offset += bink_trees[i].table_allocated;
|
||||
init_vlc(&bink_trees[i], maxbits, 16,
|
||||
vlc_init(&bink_trees[i], maxbits, 16,
|
||||
bink_tree_lens[i], 1, 1,
|
||||
bink_tree_bits[i], 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
|
||||
bink_tree_bits[i], 1, 1, VLC_INIT_USE_STATIC | VLC_INIT_LE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -491,7 +491,7 @@ static inline int BS_FUNC(priv_set_idx)(BSCTX *bc, int code, int *n,
|
||||
/**
|
||||
* Parse a vlc code.
|
||||
* @param bits is the number of bits which will be read at once, must be
|
||||
* identical to nb_bits in init_vlc()
|
||||
* identical to nb_bits in vlc_init()
|
||||
* @param max_depth is the number of times bits bits must be read to completely
|
||||
* read the longest vlc code
|
||||
* = (max_vlc_length + bits - 1) / bits
|
||||
|
@ -150,7 +150,7 @@ static av_cold int cfhd_init_vlc(CFHD_RL_VLC_ELEM out[], unsigned out_size,
|
||||
}
|
||||
}
|
||||
|
||||
ret = ff_init_vlc_from_lengths(&vlc, VLC_BITS, j,
|
||||
ret = ff_vlc_init_from_lengths(&vlc, VLC_BITS, j,
|
||||
&tmp[0].len, sizeof(tmp[0]),
|
||||
NULL, 0, 0, 0, 0, logctx);
|
||||
if (ret < 0)
|
||||
@ -173,7 +173,7 @@ static av_cold int cfhd_init_vlc(CFHD_RL_VLC_ELEM out[], unsigned out_size,
|
||||
out[i].level = level;
|
||||
out[i].run = run;
|
||||
}
|
||||
ff_free_vlc(&vlc);
|
||||
ff_vlc_free(&vlc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -637,8 +637,8 @@ static av_cold void build_vlc(VLC *vlc, const uint8_t counts[16],
|
||||
}
|
||||
vlc->table = &vlc_buf[*offset];
|
||||
vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *offset;
|
||||
ff_init_vlc_from_lengths(vlc, CLV_VLC_BITS, num, lens, 1,
|
||||
*syms, 2, 2, 0, INIT_VLC_STATIC_OVERLONG, NULL);
|
||||
ff_vlc_init_from_lengths(vlc, CLV_VLC_BITS, num, lens, 1,
|
||||
*syms, 2, 2, 0, VLC_INIT_STATIC_OVERLONG, NULL);
|
||||
*syms += num;
|
||||
*offset += vlc->table_size;
|
||||
}
|
||||
@ -647,10 +647,10 @@ static av_cold void clv_init_static(void)
|
||||
{
|
||||
const uint16_t *mv_syms = clv_mv_syms, *bias_syms = clv_bias_syms;
|
||||
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&dc_vlc, CLV_VLC_BITS, NUM_DC_CODES,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&dc_vlc, CLV_VLC_BITS, NUM_DC_CODES,
|
||||
clv_dc_lens, 1,
|
||||
clv_dc_syms, 1, 1, -63, 0, 1104);
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&ac_vlc, CLV_VLC_BITS, NUM_AC_CODES,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&ac_vlc, CLV_VLC_BITS, NUM_AC_CODES,
|
||||
clv_ac_bits, 1,
|
||||
clv_ac_syms, 2, 2, 0, 0, 554);
|
||||
for (unsigned i = 0, j = 0, k = 0, offset = 0;; i++) {
|
||||
@ -663,10 +663,10 @@ static av_cold void clv_init_static(void)
|
||||
if (0x1B7 & (1 << i)) {
|
||||
lev[i].flags_cb.table = &vlc_buf[offset];
|
||||
lev[i].flags_cb.table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset;
|
||||
ff_init_vlc_from_lengths(&lev[i].flags_cb, CLV_VLC_BITS, 16,
|
||||
ff_vlc_init_from_lengths(&lev[i].flags_cb, CLV_VLC_BITS, 16,
|
||||
clv_flags_bits[j], 1,
|
||||
clv_flags_syms[j], 1, 1,
|
||||
0, INIT_VLC_STATIC_OVERLONG, NULL);
|
||||
0, VLC_INIT_STATIC_OVERLONG, NULL);
|
||||
offset += lev[i].flags_cb.table_size;
|
||||
|
||||
build_vlc(&lev[i + 1].bias_cb, clv_bias_len_counts[j],
|
||||
|
@ -77,7 +77,7 @@ static int read_code_table(CLLCContext *ctx, GetBitContext *gb, VLC *vlc)
|
||||
}
|
||||
}
|
||||
|
||||
return ff_init_vlc_from_lengths(vlc, VLC_BITS, count, bits, 1,
|
||||
return ff_vlc_init_from_lengths(vlc, VLC_BITS, count, bits, 1,
|
||||
symbols, 1, 1, 0, 0, ctx->avctx);
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ static int decode_argb_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic)
|
||||
ret = read_code_table(ctx, gb, &vlc[i]);
|
||||
if (ret < 0) {
|
||||
for (j = 0; j < i; j++)
|
||||
ff_free_vlc(&vlc[j]);
|
||||
ff_vlc_free(&vlc[j]);
|
||||
|
||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||
"Could not read code table %d.\n", i);
|
||||
@ -251,7 +251,7 @@ static int decode_argb_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic)
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
ff_free_vlc(&vlc[i]);
|
||||
ff_vlc_free(&vlc[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -278,7 +278,7 @@ static int decode_rgb24_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic)
|
||||
ret = read_code_table(ctx, gb, &vlc[i]);
|
||||
if (ret < 0) {
|
||||
for (j = 0; j < i; j++)
|
||||
ff_free_vlc(&vlc[j]);
|
||||
ff_vlc_free(&vlc[j]);
|
||||
|
||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||
"Could not read code table %d.\n", i);
|
||||
@ -295,7 +295,7 @@ static int decode_rgb24_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic)
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
ff_free_vlc(&vlc[i]);
|
||||
ff_vlc_free(&vlc[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -331,7 +331,7 @@ static int decode_yuv_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic)
|
||||
ret = read_code_table(ctx, gb, &vlc[i]);
|
||||
if (ret < 0) {
|
||||
for (j = 0; j < i; j++)
|
||||
ff_free_vlc(&vlc[j]);
|
||||
ff_vlc_free(&vlc[j]);
|
||||
|
||||
av_log(ctx->avctx, AV_LOG_ERROR,
|
||||
"Could not read code table %d.\n", i);
|
||||
@ -350,7 +350,7 @@ static int decode_yuv_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic)
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
ff_free_vlc(&vlc[i]);
|
||||
ff_vlc_free(&vlc[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ static av_cold int build_vlc(VLC *vlc, int nb_bits, const uint8_t counts[16],
|
||||
for (unsigned count = num + counts[i]; num < count; num++)
|
||||
lens[num] = i + 1;
|
||||
|
||||
return ff_init_vlc_from_lengths(vlc, nb_bits, num, lens, 1,
|
||||
return ff_vlc_init_from_lengths(vlc, nb_bits, num, lens, 1,
|
||||
syms, symbol_size, symbol_size,
|
||||
offset, 0, logctx);
|
||||
}
|
||||
@ -341,11 +341,11 @@ static av_cold int cook_decode_close(AVCodecContext *avctx)
|
||||
|
||||
/* Free the VLC tables. */
|
||||
for (i = 0; i < 13; i++)
|
||||
ff_free_vlc(&q->envelope_quant_index[i]);
|
||||
ff_vlc_free(&q->envelope_quant_index[i]);
|
||||
for (i = 0; i < 7; i++)
|
||||
ff_free_vlc(&q->sqvh[i]);
|
||||
ff_vlc_free(&q->sqvh[i]);
|
||||
for (i = 0; i < q->num_subpackets; i++)
|
||||
ff_free_vlc(&q->subpacket[i].channel_coupling);
|
||||
ff_vlc_free(&q->subpacket[i].channel_coupling);
|
||||
|
||||
av_log(avctx, AV_LOG_DEBUG, "Memory deallocated.\n");
|
||||
|
||||
|
@ -796,9 +796,9 @@ av_cold void ff_dca_init_vlcs(void)
|
||||
do { \
|
||||
vlc.table = &dca_table[offset]; \
|
||||
vlc.table_allocated = FF_ARRAY_ELEMS(dca_table) - offset; \
|
||||
ff_init_vlc_from_lengths(&vlc, nb_bits, nb_codes, &src_table[0][1], 2, \
|
||||
ff_vlc_init_from_lengths(&vlc, nb_bits, nb_codes, &src_table[0][1], 2, \
|
||||
&src_table[0][0], 2, 1, entry_offset, \
|
||||
INIT_VLC_STATIC_OVERLONG, NULL); \
|
||||
VLC_INIT_STATIC_OVERLONG, NULL); \
|
||||
offset += vlc.table_size; \
|
||||
src_table += nb_codes; \
|
||||
} while (0)
|
||||
@ -822,9 +822,9 @@ av_cold void ff_dca_init_vlcs(void)
|
||||
do { \
|
||||
vlc.table = &dca_table[offset]; \
|
||||
vlc.table_allocated = FF_ARRAY_ELEMS(dca_table) - offset; \
|
||||
ff_init_vlc_from_lengths(&vlc, nb_bits, nb_codes, &src_table[0][1], 2, \
|
||||
ff_vlc_init_from_lengths(&vlc, nb_bits, nb_codes, &src_table[0][1], 2, \
|
||||
&src_table[0][0], 2, 1, entry_offset, \
|
||||
INIT_VLC_STATIC_OVERLONG | INIT_VLC_LE,\
|
||||
VLC_INIT_STATIC_OVERLONG | VLC_INIT_LE,\
|
||||
NULL); \
|
||||
offset += vlc.table_size; \
|
||||
src_table += nb_codes; \
|
||||
|
@ -130,19 +130,19 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth)
|
||||
ctx->cid_table = cid_table;
|
||||
av_log(ctx->avctx, AV_LOG_VERBOSE, "Profile cid %"PRIu32".\n", cid);
|
||||
|
||||
ff_free_vlc(&ctx->ac_vlc);
|
||||
ff_free_vlc(&ctx->dc_vlc);
|
||||
ff_free_vlc(&ctx->run_vlc);
|
||||
ff_vlc_free(&ctx->ac_vlc);
|
||||
ff_vlc_free(&ctx->dc_vlc);
|
||||
ff_vlc_free(&ctx->run_vlc);
|
||||
|
||||
if ((ret = init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257,
|
||||
if ((ret = vlc_init(&ctx->ac_vlc, DNXHD_VLC_BITS, 257,
|
||||
ctx->cid_table->ac_bits, 1, 1,
|
||||
ctx->cid_table->ac_codes, 2, 2, 0)) < 0)
|
||||
goto out;
|
||||
if ((ret = init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, bitdepth > 8 ? 14 : 12,
|
||||
if ((ret = vlc_init(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, bitdepth > 8 ? 14 : 12,
|
||||
ctx->cid_table->dc_bits, 1, 1,
|
||||
ctx->cid_table->dc_codes, 1, 1, 0)) < 0)
|
||||
goto out;
|
||||
if ((ret = init_vlc(&ctx->run_vlc, DNXHD_VLC_BITS, 62,
|
||||
if ((ret = vlc_init(&ctx->run_vlc, DNXHD_VLC_BITS, 62,
|
||||
ctx->cid_table->run_bits, 1, 1,
|
||||
ctx->cid_table->run_codes, 2, 2, 0)) < 0)
|
||||
goto out;
|
||||
@ -152,7 +152,7 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth)
|
||||
ret = 0;
|
||||
out:
|
||||
if (ret < 0)
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "init_vlc failed\n");
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "vlc_init failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -716,9 +716,9 @@ static av_cold int dnxhd_decode_close(AVCodecContext *avctx)
|
||||
{
|
||||
DNXHDContext *ctx = avctx->priv_data;
|
||||
|
||||
ff_free_vlc(&ctx->ac_vlc);
|
||||
ff_free_vlc(&ctx->dc_vlc);
|
||||
ff_free_vlc(&ctx->run_vlc);
|
||||
ff_vlc_free(&ctx->ac_vlc);
|
||||
ff_vlc_free(&ctx->dc_vlc);
|
||||
ff_vlc_free(&ctx->run_vlc);
|
||||
|
||||
av_freep(&ctx->rows);
|
||||
|
||||
|
@ -175,9 +175,9 @@ static av_cold void dv_init_static(void)
|
||||
|
||||
/* NOTE: as a trick, we use the fact the no codes are unused
|
||||
* to accelerate the parsing of partial codes */
|
||||
ff_init_vlc_from_lengths(&dv_vlc, TEX_VLC_BITS, j,
|
||||
ff_vlc_init_from_lengths(&dv_vlc, TEX_VLC_BITS, j,
|
||||
&tmp[0].len, sizeof(tmp[0]),
|
||||
NULL, 0, 0, 0, INIT_VLC_USE_NEW_STATIC, NULL);
|
||||
NULL, 0, 0, 0, VLC_INIT_USE_STATIC, NULL);
|
||||
av_assert1(dv_vlc.table_size == 1664);
|
||||
|
||||
for (int i = 0; i < dv_vlc.table_size; i++) {
|
||||
|
@ -404,8 +404,8 @@ static int huf_build_dec_table(const EXRContext *s,
|
||||
td->he[j].code = td->freq[iM] >> 6;
|
||||
j++;
|
||||
|
||||
ff_free_vlc(&td->vlc);
|
||||
return ff_init_vlc_sparse(&td->vlc, 12, j,
|
||||
ff_vlc_free(&td->vlc);
|
||||
return ff_vlc_init_sparse(&td->vlc, 12, j,
|
||||
&td->he[0].len, sizeof(td->he[0]), sizeof(td->he[0].len),
|
||||
&td->he[0].code, sizeof(td->he[0]), sizeof(td->he[0].code),
|
||||
&td->he[0].sym, sizeof(td->he[0]), sizeof(td->he[0].sym), 0);
|
||||
@ -2284,7 +2284,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
|
||||
av_freep(&td->dc_data);
|
||||
av_freep(&td->rle_data);
|
||||
av_freep(&td->rle_raw_data);
|
||||
ff_free_vlc(&td->vlc);
|
||||
ff_vlc_free(&td->vlc);
|
||||
}
|
||||
|
||||
av_freep(&s->thread_data);
|
||||
|
@ -108,13 +108,13 @@ static av_cold void ccitt_unpack_init(void)
|
||||
ccitt_vlc[1].table = code_table2;
|
||||
ccitt_vlc[1].table_allocated = 648;
|
||||
for (i = 0; i < 2; i++) {
|
||||
ff_init_vlc_sparse(&ccitt_vlc[i], 9, CCITT_SYMS,
|
||||
ff_vlc_init_sparse(&ccitt_vlc[i], 9, CCITT_SYMS,
|
||||
ccitt_codes_lens[i], 1, 1,
|
||||
ccitt_codes_bits[i], 1, 1,
|
||||
ccitt_syms, 2, 2,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
VLC_INIT_USE_STATIC);
|
||||
}
|
||||
INIT_VLC_STATIC(&ccitt_group3_2d_vlc, 9, 11,
|
||||
VLC_INIT_STATIC(&ccitt_group3_2d_vlc, 9, 11,
|
||||
ccitt_group3_2d_lens, 1, 1,
|
||||
ccitt_group3_2d_bits, 1, 1, 512);
|
||||
}
|
||||
|
@ -123,13 +123,13 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w,
|
||||
else if (Uoff)
|
||||
dst[i] += 0x80;
|
||||
if (get_bits_left(&gb) < 0) {
|
||||
ff_free_vlc(&vlc);
|
||||
ff_vlc_free(&vlc);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
dst += stride;
|
||||
}
|
||||
ff_free_vlc(&vlc);
|
||||
ff_vlc_free(&vlc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -195,8 +195,8 @@ static av_cold void jpg_free_context(JPGContext *ctx)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
ff_free_vlc(&ctx->dc_vlc[i]);
|
||||
ff_free_vlc(&ctx->ac_vlc[i]);
|
||||
ff_vlc_free(&ctx->dc_vlc[i]);
|
||||
ff_vlc_free(&ctx->ac_vlc[i]);
|
||||
}
|
||||
|
||||
av_freep(&ctx->buf);
|
||||
|
@ -643,7 +643,7 @@ static inline const uint8_t *align_get_bits(GetBitContext *s)
|
||||
/**
|
||||
* Parse a vlc code.
|
||||
* @param bits is the number of bits which will be read at once, must be
|
||||
* identical to nb_bits in init_vlc()
|
||||
* identical to nb_bits in vlc_init()
|
||||
* @param max_depth is the number of times bits bits must be read to completely
|
||||
* read the longest vlc code
|
||||
* = (max_vlc_length + bits - 1) / bits
|
||||
|
@ -64,16 +64,16 @@ typedef struct H261DecContext {
|
||||
|
||||
static av_cold void h261_decode_init_static(void)
|
||||
{
|
||||
INIT_VLC_STATIC(&h261_mba_vlc, H261_MBA_VLC_BITS, 35,
|
||||
VLC_INIT_STATIC(&h261_mba_vlc, H261_MBA_VLC_BITS, 35,
|
||||
ff_h261_mba_bits, 1, 1,
|
||||
ff_h261_mba_code, 1, 1, 540);
|
||||
INIT_VLC_STATIC(&h261_mtype_vlc, H261_MTYPE_VLC_BITS, 10,
|
||||
VLC_INIT_STATIC(&h261_mtype_vlc, H261_MTYPE_VLC_BITS, 10,
|
||||
ff_h261_mtype_bits, 1, 1,
|
||||
ff_h261_mtype_code, 1, 1, 80);
|
||||
INIT_VLC_STATIC(&h261_mv_vlc, H261_MV_VLC_BITS, 17,
|
||||
VLC_INIT_STATIC(&h261_mv_vlc, H261_MV_VLC_BITS, 17,
|
||||
&ff_h261_mv_tab[0][1], 2, 1,
|
||||
&ff_h261_mv_tab[0][0], 2, 1, 144);
|
||||
INIT_VLC_STATIC(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63,
|
||||
VLC_INIT_STATIC(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63,
|
||||
&ff_h261_cbp_tab[0][1], 2, 1,
|
||||
&ff_h261_cbp_tab[0][0], 2, 1, 512);
|
||||
INIT_FIRST_VLC_RL(ff_h261_rl_tcoeff, 552);
|
||||
|
@ -328,26 +328,26 @@ av_cold void ff_h264_decode_init_vlc(void)
|
||||
|
||||
chroma_dc_coeff_token_vlc.table = chroma_dc_coeff_token_vlc_table;
|
||||
chroma_dc_coeff_token_vlc.table_allocated = chroma_dc_coeff_token_vlc_table_size;
|
||||
init_vlc(&chroma_dc_coeff_token_vlc, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 4*5,
|
||||
vlc_init(&chroma_dc_coeff_token_vlc, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 4*5,
|
||||
&chroma_dc_coeff_token_len [0], 1, 1,
|
||||
&chroma_dc_coeff_token_bits[0], 1, 1,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
VLC_INIT_USE_STATIC);
|
||||
|
||||
chroma422_dc_coeff_token_vlc.table = chroma422_dc_coeff_token_vlc_table;
|
||||
chroma422_dc_coeff_token_vlc.table_allocated = chroma422_dc_coeff_token_vlc_table_size;
|
||||
init_vlc(&chroma422_dc_coeff_token_vlc, CHROMA422_DC_COEFF_TOKEN_VLC_BITS, 4*9,
|
||||
vlc_init(&chroma422_dc_coeff_token_vlc, CHROMA422_DC_COEFF_TOKEN_VLC_BITS, 4*9,
|
||||
&chroma422_dc_coeff_token_len [0], 1, 1,
|
||||
&chroma422_dc_coeff_token_bits[0], 1, 1,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
VLC_INIT_USE_STATIC);
|
||||
|
||||
offset = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
coeff_token_vlc[i].table = coeff_token_vlc_tables + offset;
|
||||
coeff_token_vlc[i].table_allocated = coeff_token_vlc_tables_size[i];
|
||||
init_vlc(&coeff_token_vlc[i], COEFF_TOKEN_VLC_BITS, 4*17,
|
||||
vlc_init(&coeff_token_vlc[i], COEFF_TOKEN_VLC_BITS, 4*17,
|
||||
&coeff_token_len [i][0], 1, 1,
|
||||
&coeff_token_bits[i][0], 1, 1,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
VLC_INIT_USE_STATIC);
|
||||
offset += coeff_token_vlc_tables_size[i];
|
||||
}
|
||||
/*
|
||||
@ -360,48 +360,48 @@ av_cold void ff_h264_decode_init_vlc(void)
|
||||
for (int i = 0; i < 3; i++) {
|
||||
chroma_dc_total_zeros_vlc[i + 1].table = chroma_dc_total_zeros_vlc_tables[i];
|
||||
chroma_dc_total_zeros_vlc[i + 1].table_allocated = chroma_dc_total_zeros_vlc_tables_size;
|
||||
init_vlc(&chroma_dc_total_zeros_vlc[i + 1],
|
||||
vlc_init(&chroma_dc_total_zeros_vlc[i + 1],
|
||||
CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 4,
|
||||
&chroma_dc_total_zeros_len [i][0], 1, 1,
|
||||
&chroma_dc_total_zeros_bits[i][0], 1, 1,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
VLC_INIT_USE_STATIC);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
chroma422_dc_total_zeros_vlc[i + 1].table = chroma422_dc_total_zeros_vlc_tables[i];
|
||||
chroma422_dc_total_zeros_vlc[i + 1].table_allocated = chroma422_dc_total_zeros_vlc_tables_size;
|
||||
init_vlc(&chroma422_dc_total_zeros_vlc[i + 1],
|
||||
vlc_init(&chroma422_dc_total_zeros_vlc[i + 1],
|
||||
CHROMA422_DC_TOTAL_ZEROS_VLC_BITS, 8,
|
||||
&chroma422_dc_total_zeros_len [i][0], 1, 1,
|
||||
&chroma422_dc_total_zeros_bits[i][0], 1, 1,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
VLC_INIT_USE_STATIC);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 15; i++) {
|
||||
total_zeros_vlc[i + 1].table = total_zeros_vlc_tables[i];
|
||||
total_zeros_vlc[i + 1].table_allocated = total_zeros_vlc_tables_size;
|
||||
init_vlc(&total_zeros_vlc[i + 1],
|
||||
vlc_init(&total_zeros_vlc[i + 1],
|
||||
TOTAL_ZEROS_VLC_BITS, 16,
|
||||
&total_zeros_len [i][0], 1, 1,
|
||||
&total_zeros_bits[i][0], 1, 1,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
VLC_INIT_USE_STATIC);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
run_vlc[i + 1].table = run_vlc_tables[i];
|
||||
run_vlc[i + 1].table_allocated = run_vlc_tables_size;
|
||||
init_vlc(&run_vlc[i + 1],
|
||||
vlc_init(&run_vlc[i + 1],
|
||||
RUN_VLC_BITS, 7,
|
||||
&run_len [i][0], 1, 1,
|
||||
&run_bits[i][0], 1, 1,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
VLC_INIT_USE_STATIC);
|
||||
}
|
||||
run7_vlc.table = run7_vlc_table;
|
||||
run7_vlc.table_allocated = run7_vlc_table_size;
|
||||
init_vlc(&run7_vlc, RUN7_VLC_BITS, 16,
|
||||
vlc_init(&run7_vlc, RUN7_VLC_BITS, 16,
|
||||
&run_len [6][0], 1, 1,
|
||||
&run_bits[6][0], 1, 1,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
VLC_INIT_USE_STATIC);
|
||||
|
||||
init_cavlc_level_tab();
|
||||
}
|
||||
|
@ -376,8 +376,8 @@ static av_cold int hq_hqa_decode_close(AVCodecContext *avctx)
|
||||
{
|
||||
HQContext *ctx = avctx->priv_data;
|
||||
|
||||
ff_free_vlc(&ctx->hq_ac_vlc);
|
||||
ff_free_vlc(&ctx->hqa_cbp_vlc);
|
||||
ff_vlc_free(&ctx->hq_ac_vlc);
|
||||
ff_vlc_free(&ctx->hqa_cbp_vlc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -8367,11 +8367,11 @@ const HQProfile ff_hq_profile[NUM_HQ_PROFILES] = {
|
||||
|
||||
av_cold int ff_hq_init_vlcs(HQContext *c)
|
||||
{
|
||||
int ret = init_vlc(&c->hqa_cbp_vlc, 5, FF_ARRAY_ELEMS(cbp_vlc_lens),
|
||||
int ret = vlc_init(&c->hqa_cbp_vlc, 5, FF_ARRAY_ELEMS(cbp_vlc_lens),
|
||||
cbp_vlc_lens, 1, 1, cbp_vlc_bits, 1, 1, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return init_vlc(&c->hq_ac_vlc, 9, NUM_HQ_AC_ENTRIES,
|
||||
return vlc_init(&c->hq_ac_vlc, 9, NUM_HQ_AC_ENTRIES,
|
||||
hq_ac_bits, 1, 1, hq_ac_codes, 2, 2, 0);
|
||||
}
|
||||
|
@ -517,9 +517,9 @@ static av_cold int hqx_decode_close(AVCodecContext *avctx)
|
||||
int i;
|
||||
HQXContext *ctx = avctx->priv_data;
|
||||
|
||||
ff_free_vlc(&ctx->cbp_vlc);
|
||||
ff_vlc_free(&ctx->cbp_vlc);
|
||||
for (i = 0; i < 3; i++) {
|
||||
ff_free_vlc(&ctx->dc_vlc[i]);
|
||||
ff_vlc_free(&ctx->dc_vlc[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -2140,7 +2140,7 @@ const HQXAC ff_hqx_ac[NUM_HQX_AC] = {
|
||||
|
||||
#define INIT_DC_TABLE(idx, name) \
|
||||
do { \
|
||||
ret = init_vlc(&ctx->dc_vlc[idx], HQX_DC_VLC_BITS, \
|
||||
ret = vlc_init(&ctx->dc_vlc[idx], HQX_DC_VLC_BITS, \
|
||||
FF_ARRAY_ELEMS(name ## _vlc_lens), \
|
||||
name ## _vlc_lens, 1, 1, \
|
||||
name ## _vlc_bits, 2, 2, 0); \
|
||||
@ -2150,7 +2150,7 @@ const HQXAC ff_hqx_ac[NUM_HQX_AC] = {
|
||||
|
||||
av_cold int ff_hqx_init_vlcs(HQXContext *ctx)
|
||||
{
|
||||
int ret = init_vlc(&ctx->cbp_vlc, HQX_CBP_VLC_BITS, FF_ARRAY_ELEMS(cbp_vlc_lens),
|
||||
int ret = vlc_init(&ctx->cbp_vlc, HQX_CBP_VLC_BITS, FF_ARRAY_ELEMS(cbp_vlc_lens),
|
||||
cbp_vlc_lens, 1, 1, cbp_vlc_bits, 1, 1, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@ -148,7 +148,7 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags, int nb_bi
|
||||
|
||||
get_tree_codes(bits, lens, xlat, nodes, head, 0, 0,
|
||||
&pos, no_zero_count);
|
||||
return ff_init_vlc_sparse(vlc, nb_bits, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
|
||||
return ff_vlc_init_sparse(vlc, nb_bits, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -193,8 +193,8 @@ static int generate_joint_tables(HYuvDecContext *s)
|
||||
i++;
|
||||
}
|
||||
}
|
||||
ff_free_vlc(&s->vlc[4 + p]);
|
||||
if ((ret = ff_init_vlc_sparse(&s->vlc[4 + p], VLC_BITS, i, len, 1, 1,
|
||||
ff_vlc_free(&s->vlc[4 + p]);
|
||||
if ((ret = ff_vlc_init_sparse(&s->vlc[4 + p], VLC_BITS, i, len, 1, 1,
|
||||
bits, 2, 2, symbols, 2, 2, 0)) < 0)
|
||||
goto out;
|
||||
}
|
||||
@ -237,8 +237,8 @@ static int generate_joint_tables(HYuvDecContext *s)
|
||||
}
|
||||
}
|
||||
}
|
||||
ff_free_vlc(&s->vlc[4]);
|
||||
if ((ret = init_vlc(&s->vlc[4], VLC_BITS, i, len, 1, 1,
|
||||
ff_vlc_free(&s->vlc[4]);
|
||||
if ((ret = vlc_init(&s->vlc[4], VLC_BITS, i, len, 1, 1,
|
||||
bits, 2, 2, 0)) < 0)
|
||||
goto out;
|
||||
}
|
||||
@ -265,8 +265,8 @@ static int read_huffman_tables(HYuvDecContext *s, const uint8_t *src, int length
|
||||
return ret;
|
||||
if ((ret = ff_huffyuv_generate_bits_table(s->bits[i], s->len[i], s->vlc_n)) < 0)
|
||||
return ret;
|
||||
ff_free_vlc(&s->vlc[i]);
|
||||
if ((ret = init_vlc(&s->vlc[i], VLC_BITS, s->vlc_n, s->len[i], 1, 1,
|
||||
ff_vlc_free(&s->vlc[i]);
|
||||
if ((ret = vlc_init(&s->vlc[i], VLC_BITS, s->vlc_n, s->len[i], 1, 1,
|
||||
s->bits[i], 4, 4, 0)) < 0)
|
||||
return ret;
|
||||
}
|
||||
@ -305,8 +305,8 @@ static int read_old_huffman_tables(HYuvDecContext *s)
|
||||
memcpy(s->len[2], s->len[1], 256 * sizeof(uint8_t));
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
ff_free_vlc(&s->vlc[i]);
|
||||
if ((ret = init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1,
|
||||
ff_vlc_free(&s->vlc[i]);
|
||||
if ((ret = vlc_init(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1,
|
||||
s->bits[i], 4, 4, 0)) < 0)
|
||||
return ret;
|
||||
}
|
||||
@ -326,7 +326,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
|
||||
av_freep(&s->bitstream_buffer);
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
ff_free_vlc(&s->vlc[i]);
|
||||
ff_vlc_free(&s->vlc[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -176,10 +176,10 @@ static av_cold void imc_init_static(void)
|
||||
for (int j = 0; j < 4; j++) {
|
||||
huffman_vlc[i][j].table = &vlc_tables[offset];
|
||||
huffman_vlc[i][j].table_allocated = VLC_TABLES_SIZE - offset;
|
||||
ff_init_vlc_from_lengths(&huffman_vlc[i][j], IMC_VLC_BITS, imc_huffman_sizes[i],
|
||||
ff_vlc_init_from_lengths(&huffman_vlc[i][j], IMC_VLC_BITS, imc_huffman_sizes[i],
|
||||
imc_huffman_lens[i][j], 1,
|
||||
imc_huffman_syms[i][j], 1, 1,
|
||||
0, INIT_VLC_STATIC_OVERLONG, NULL);
|
||||
0, VLC_INIT_STATIC_OVERLONG, NULL);
|
||||
offset += huffman_vlc[i][j].table_size;
|
||||
}
|
||||
}
|
||||
|
@ -473,18 +473,18 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
|
||||
static av_cold void imm4_init_static_data(void)
|
||||
{
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&cbplo_tab, CBPLO_VLC_BITS, FF_ARRAY_ELEMS(cbplo),
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&cbplo_tab, CBPLO_VLC_BITS, FF_ARRAY_ELEMS(cbplo),
|
||||
&cbplo[0][1], 2, &cbplo[0][0], 2, 1,
|
||||
0, 0, 1 << CBPLO_VLC_BITS);
|
||||
|
||||
INIT_VLC_SPARSE_STATIC(&cbphi_tab, CBPHI_VLC_BITS, FF_ARRAY_ELEMS(cbphi_bits),
|
||||
VLC_INIT_SPARSE_STATIC(&cbphi_tab, CBPHI_VLC_BITS, FF_ARRAY_ELEMS(cbphi_bits),
|
||||
cbphi_bits, 1, 1, cbphi_codes, 1, 1, NULL, 0, 0, 64);
|
||||
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&blktype_tab, BLKTYPE_VLC_BITS, FF_ARRAY_ELEMS(blktype),
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&blktype_tab, BLKTYPE_VLC_BITS, FF_ARRAY_ELEMS(blktype),
|
||||
&blktype[0][1], 2, &blktype[0][0], 2, 1,
|
||||
0, 0, 1 << BLKTYPE_VLC_BITS);
|
||||
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&block_tab, BLOCK_VLC_BITS, FF_ARRAY_ELEMS(block_bits),
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&block_tab, BLOCK_VLC_BITS, FF_ARRAY_ELEMS(block_bits),
|
||||
block_bits, 1, block_symbols, 2, 2,
|
||||
0, 0, 1 << BLOCK_VLC_BITS);
|
||||
}
|
||||
|
@ -226,9 +226,9 @@ static int ir2_decode_frame(AVCodecContext *avctx, AVFrame *picture,
|
||||
|
||||
static av_cold void ir2_init_static(void)
|
||||
{
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&ir2_vlc, CODE_VLC_BITS, IR2_CODES,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&ir2_vlc, CODE_VLC_BITS, IR2_CODES,
|
||||
&ir2_tab[0][1], 2, &ir2_tab[0][0], 2, 1,
|
||||
0, INIT_VLC_OUTPUT_LE, 1 << CODE_VLC_BITS);
|
||||
0, VLC_INIT_OUTPUT_LE, 1 << CODE_VLC_BITS);
|
||||
}
|
||||
|
||||
static av_cold int ir2_decode_init(AVCodecContext *avctx)
|
||||
|
@ -56,8 +56,8 @@ static av_cold void x8_init_vlc(VLC *vlc, int nb_bits, int nb_codes,
|
||||
|
||||
vlc->table = &vlc_buf[*offset];
|
||||
vlc->table_allocated = VLC_BUFFER_SIZE - *offset;
|
||||
ff_init_vlc_from_lengths(vlc, nb_bits, nb_codes, &table[0][1], 2,
|
||||
&table[0][0], 2, 1, 0, INIT_VLC_STATIC_OVERLONG, NULL);
|
||||
ff_vlc_init_from_lengths(vlc, nb_bits, nb_codes, &table[0][1], 2,
|
||||
&table[0][0], 2, 1, 0, VLC_INIT_STATIC_OVERLONG, NULL);
|
||||
*offset += vlc->table_size;
|
||||
}
|
||||
|
||||
|
@ -110,25 +110,25 @@ static VLC cbpc_b_vlc;
|
||||
|
||||
static av_cold void h263_decode_init_vlc(void)
|
||||
{
|
||||
INIT_VLC_STATIC(&ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 9,
|
||||
VLC_INIT_STATIC(&ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 9,
|
||||
ff_h263_intra_MCBPC_bits, 1, 1,
|
||||
ff_h263_intra_MCBPC_code, 1, 1, 72);
|
||||
INIT_VLC_STATIC(&ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 28,
|
||||
VLC_INIT_STATIC(&ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 28,
|
||||
ff_h263_inter_MCBPC_bits, 1, 1,
|
||||
ff_h263_inter_MCBPC_code, 1, 1, 198);
|
||||
INIT_VLC_STATIC(&ff_h263_cbpy_vlc, CBPY_VLC_BITS, 16,
|
||||
VLC_INIT_STATIC(&ff_h263_cbpy_vlc, CBPY_VLC_BITS, 16,
|
||||
&ff_h263_cbpy_tab[0][1], 2, 1,
|
||||
&ff_h263_cbpy_tab[0][0], 2, 1, 64);
|
||||
INIT_VLC_STATIC(&ff_h263_mv_vlc, H263_MV_VLC_BITS, 33,
|
||||
VLC_INIT_STATIC(&ff_h263_mv_vlc, H263_MV_VLC_BITS, 33,
|
||||
&ff_mvtab[0][1], 2, 1,
|
||||
&ff_mvtab[0][0], 2, 1, 538);
|
||||
ff_h263_init_rl_inter();
|
||||
INIT_VLC_RL(ff_h263_rl_inter, 554);
|
||||
VLC_INIT_RL(ff_h263_rl_inter, 554);
|
||||
INIT_FIRST_VLC_RL(ff_rl_intra_aic, 554);
|
||||
INIT_VLC_STATIC(&h263_mbtype_b_vlc, H263_MBTYPE_B_VLC_BITS, 15,
|
||||
VLC_INIT_STATIC(&h263_mbtype_b_vlc, H263_MBTYPE_B_VLC_BITS, 15,
|
||||
&ff_h263_mbtype_b_tab[0][1], 2, 1,
|
||||
&ff_h263_mbtype_b_tab[0][0], 2, 1, 80);
|
||||
INIT_VLC_STATIC(&cbpc_b_vlc, CBPC_B_VLC_BITS, 4,
|
||||
VLC_INIT_STATIC(&cbpc_b_vlc, CBPC_B_VLC_BITS, 4,
|
||||
&ff_cbpc_b_tab[0][1], 2, 1,
|
||||
&ff_cbpc_b_tab[0][0], 2, 1, 8);
|
||||
}
|
||||
|
@ -154,8 +154,8 @@ static int ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag)
|
||||
}//for i
|
||||
|
||||
/* number of codewords = pos */
|
||||
return init_vlc(vlc, IVI_VLC_BITS, pos, bits, 1, 1, codewords, 2, 2,
|
||||
(flag ? INIT_VLC_USE_NEW_STATIC : 0) | INIT_VLC_OUTPUT_LE);
|
||||
return vlc_init(vlc, IVI_VLC_BITS, pos, bits, 1, 1, codewords, 2, 2,
|
||||
(flag ? VLC_INIT_USE_STATIC : 0) | VLC_INIT_OUTPUT_LE);
|
||||
}
|
||||
|
||||
static av_cold void ivi_init_static_vlc(void)
|
||||
@ -237,7 +237,7 @@ int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab,
|
||||
ivi_huff_desc_copy(&huff_tab->cust_desc, &new_huff);
|
||||
|
||||
if (huff_tab->cust_tab.table)
|
||||
ff_free_vlc(&huff_tab->cust_tab);
|
||||
ff_vlc_free(&huff_tab->cust_tab);
|
||||
result = ivi_create_huff_from_desc(&huff_tab->cust_desc,
|
||||
&huff_tab->cust_tab, 0);
|
||||
if (result) {
|
||||
@ -277,7 +277,7 @@ static av_cold void ivi_free_buffers(IVIPlaneDesc *planes)
|
||||
av_freep(&band->bufs[3]);
|
||||
|
||||
if (band->blk_vlc.cust_tab.table)
|
||||
ff_free_vlc(&band->blk_vlc.cust_tab);
|
||||
ff_vlc_free(&band->blk_vlc.cust_tab);
|
||||
for (t = 0; t < band->num_tiles; t++)
|
||||
av_freep(&band->tiles[t].mbs);
|
||||
av_freep(&band->tiles);
|
||||
@ -1215,10 +1215,10 @@ av_cold int ff_ivi_decode_close(AVCodecContext *avctx)
|
||||
ivi_free_buffers(&ctx->planes[0]);
|
||||
|
||||
if (ctx->mb_vlc.cust_tab.table)
|
||||
ff_free_vlc(&ctx->mb_vlc.cust_tab);
|
||||
ff_vlc_free(&ctx->mb_vlc.cust_tab);
|
||||
|
||||
if (ctx->blk_vlc.cust_tab.table)
|
||||
ff_free_vlc(&ctx->blk_vlc.cust_tab);
|
||||
ff_vlc_free(&ctx->blk_vlc.cust_tab);
|
||||
|
||||
av_frame_free(&ctx->p_frame);
|
||||
|
||||
|
@ -474,7 +474,7 @@ static void dist_bundle_close(JXLDistributionBundle *bundle)
|
||||
{
|
||||
if (bundle->use_prefix_code && bundle->dists)
|
||||
for (int i = 0; i < bundle->num_clusters; i++)
|
||||
ff_free_vlc(&bundle->dists[i].vlc);
|
||||
ff_vlc_free(&bundle->dists[i].vlc);
|
||||
av_freep(&bundle->dists);
|
||||
av_freep(&bundle->cluster_map);
|
||||
}
|
||||
@ -668,8 +668,8 @@ static int read_simple_vlc_prefix(GetBitContext *gb, JXLEntropyDecoder *dec, JXL
|
||||
return AVERROR_BUG;
|
||||
}
|
||||
|
||||
return ff_init_vlc_from_lengths(&dist->vlc, bits, nsym, lens, 1, symbols,
|
||||
2, 2, 0, INIT_VLC_LE, dec->logctx);
|
||||
return ff_vlc_init_from_lengths(&dist->vlc, bits, nsym, lens, 1, symbols,
|
||||
2, 2, 0, VLC_INIT_LE, dec->logctx);
|
||||
}
|
||||
|
||||
static int read_vlc_prefix(GetBitContext *gb, JXLEntropyDecoder *dec, JXLSymbolDistribution *dist)
|
||||
@ -724,8 +724,8 @@ static int read_vlc_prefix(GetBitContext *gb, JXLEntropyDecoder *dec, JXLSymbolD
|
||||
level1_syms[idx] = i;
|
||||
}
|
||||
|
||||
ret = ff_init_vlc_from_lengths(&level1_vlc, 5, 18, level1_lens_s, 1, level1_syms, 2, 2,
|
||||
0, INIT_VLC_LE, dec->logctx);
|
||||
ret = ff_vlc_init_from_lengths(&level1_vlc, 5, 18, level1_lens_s, 1, level1_syms, 2, 2,
|
||||
0, VLC_INIT_LE, dec->logctx);
|
||||
if (ret < 0)
|
||||
goto end;
|
||||
|
||||
@ -789,12 +789,12 @@ static int read_vlc_prefix(GetBitContext *gb, JXLEntropyDecoder *dec, JXLSymbolD
|
||||
level2_syms[idx] = i;
|
||||
}
|
||||
|
||||
ret = ff_init_vlc_from_lengths(&dist->vlc, 15, dist->alphabet_size, level2_lens_s,
|
||||
1, level2_syms, 2, 2, 0, INIT_VLC_LE, dec->logctx);
|
||||
ret = ff_vlc_init_from_lengths(&dist->vlc, 15, dist->alphabet_size, level2_lens_s,
|
||||
1, level2_syms, 2, 2, 0, VLC_INIT_LE, dec->logctx);
|
||||
|
||||
end:
|
||||
av_freep(&buf);
|
||||
ff_free_vlc(&level1_vlc);
|
||||
ff_vlc_free(&level1_vlc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -86,9 +86,9 @@ static int huff_build(const uint8_t len[], uint16_t codes_pos[33],
|
||||
for (unsigned i = nb_elems; i-- > 0;)
|
||||
he[--codes_pos[len[i]]] = (HuffEntry){ len[i], i };
|
||||
|
||||
ff_free_vlc(vlc);
|
||||
ff_free_vlc_multi(multi);
|
||||
return ff_init_vlc_multi_from_lengths(vlc, multi, FFMIN(he[0].len, VLC_BITS), nb_elems, nb_elems,
|
||||
ff_vlc_free(vlc);
|
||||
ff_vlc_free_multi(multi);
|
||||
return ff_vlc_init_multi_from_lengths(vlc, multi, FFMIN(he[0].len, VLC_BITS), nb_elems, nb_elems,
|
||||
&he[0].len, sizeof(he[0]),
|
||||
&he[0].sym, sizeof(he[0]), sizeof(he[0].sym),
|
||||
0, 0, logctx);
|
||||
@ -688,8 +688,8 @@ static av_cold int magy_decode_end(AVCodecContext *avctx)
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(s->slices); i++) {
|
||||
av_freep(&s->slices[i]);
|
||||
s->slices_size[i] = 0;
|
||||
ff_free_vlc(&s->vlc[i]);
|
||||
ff_free_vlc_multi(&s->multi[i]);
|
||||
ff_vlc_free(&s->vlc[i]);
|
||||
ff_vlc_free_multi(&s->multi[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -120,7 +120,7 @@ static av_cold int mimic_decode_end(AVCodecContext *avctx)
|
||||
|
||||
static av_cold void mimic_init_static(void)
|
||||
{
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&block_vlc, MIMIC_VLC_BITS, FF_ARRAY_ELEMS(huffbits),
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&block_vlc, MIMIC_VLC_BITS, FF_ARRAY_ELEMS(huffbits),
|
||||
huffbits, 1, huffsyms, 1, 1, 0, 0, 4368);
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ static int init_default_huffman_tables(MJpegDecodeContext *s)
|
||||
int i, ret;
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(ht); i++) {
|
||||
ff_free_vlc(&s->vlcs[ht[i].class][ht[i].index]);
|
||||
ff_vlc_free(&s->vlcs[ht[i].class][ht[i].index]);
|
||||
ret = ff_mjpeg_build_vlc(&s->vlcs[ht[i].class][ht[i].index],
|
||||
ht[i].bits, ht[i].values,
|
||||
ht[i].class == 1, s->avctx);
|
||||
@ -277,7 +277,7 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
|
||||
len -= n;
|
||||
|
||||
/* build VLC and flush previous vlc if present */
|
||||
ff_free_vlc(&s->vlcs[class][index]);
|
||||
ff_vlc_free(&s->vlcs[class][index]);
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "class=%d index=%d nb_codes=%d\n",
|
||||
class, index, n);
|
||||
if ((ret = ff_mjpeg_build_vlc(&s->vlcs[class][index], bits_table,
|
||||
@ -285,7 +285,7 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
|
||||
return ret;
|
||||
|
||||
if (class > 0) {
|
||||
ff_free_vlc(&s->vlcs[2][index]);
|
||||
ff_vlc_free(&s->vlcs[2][index]);
|
||||
if ((ret = ff_mjpeg_build_vlc(&s->vlcs[2][index], bits_table,
|
||||
val_table, 0, s->avctx)) < 0)
|
||||
return ret;
|
||||
@ -2955,7 +2955,7 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 4; j++)
|
||||
ff_free_vlc(&s->vlcs[i][j]);
|
||||
ff_vlc_free(&s->vlcs[i][j]);
|
||||
}
|
||||
for (i = 0; i < MAX_COMPONENTS; i++) {
|
||||
av_freep(&s->blocks[i]);
|
||||
|
@ -52,6 +52,6 @@ int ff_mjpeg_build_vlc(VLC *vlc, const uint8_t *bits_table,
|
||||
huff_sym[i] = 16 * 256;
|
||||
}
|
||||
|
||||
return ff_init_vlc_from_lengths(vlc, 9, nb_codes, huff_size, 1,
|
||||
return ff_vlc_init_from_lengths(vlc, 9, nb_codes, huff_size, 1,
|
||||
huff_sym, 2, 2, 0, 0, logctx);
|
||||
}
|
||||
|
@ -230,9 +230,9 @@ static av_cold void init_static(void)
|
||||
static VLCElem vlc_buf[3 * VLC_STATIC_SIZE];
|
||||
huff_vlc[i].table = &vlc_buf[i * VLC_STATIC_SIZE];
|
||||
huff_vlc[i].table_allocated = VLC_STATIC_SIZE;
|
||||
init_vlc(&huff_vlc[i], VLC_BITS, 18,
|
||||
vlc_init(&huff_vlc[i], VLC_BITS, 18,
|
||||
&ff_mlp_huffman_tables[i][0][1], 2, 1,
|
||||
&ff_mlp_huffman_tables[i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC);
|
||||
&ff_mlp_huffman_tables[i][0][0], 2, 1, VLC_INIT_USE_STATIC);
|
||||
}
|
||||
|
||||
ff_mlp_init_crc();
|
||||
|
@ -279,11 +279,11 @@ static VLC mv_vlc[2][16];
|
||||
|
||||
static av_cold void mobiclip_init_static(void)
|
||||
{
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&rl_vlc[0], MOBI_RL_VLC_BITS, 104,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&rl_vlc[0], MOBI_RL_VLC_BITS, 104,
|
||||
bits0, sizeof(*bits0),
|
||||
syms0, sizeof(*syms0), sizeof(*syms0),
|
||||
0, 0, 1 << MOBI_RL_VLC_BITS);
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&rl_vlc[1], MOBI_RL_VLC_BITS, 104,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&rl_vlc[1], MOBI_RL_VLC_BITS, 104,
|
||||
bits0, sizeof(*bits0),
|
||||
syms1, sizeof(*syms1), sizeof(*syms1),
|
||||
0, 0, 1 << MOBI_RL_VLC_BITS);
|
||||
@ -292,10 +292,10 @@ static av_cold void mobiclip_init_static(void)
|
||||
for (int j = 0; j < 16; j++) {
|
||||
mv_vlc[i][j].table = &vlc_buf[(16 * i + j) << MOBI_MV_VLC_BITS];
|
||||
mv_vlc[i][j].table_allocated = 1 << MOBI_MV_VLC_BITS;
|
||||
ff_init_vlc_from_lengths(&mv_vlc[i][j], MOBI_MV_VLC_BITS, mv_len[j],
|
||||
ff_vlc_init_from_lengths(&mv_vlc[i][j], MOBI_MV_VLC_BITS, mv_len[j],
|
||||
mv_bits[i][j], sizeof(*mv_bits[i][j]),
|
||||
mv_syms[i][j], sizeof(*mv_syms[i][j]), sizeof(*mv_syms[i][j]),
|
||||
0, INIT_VLC_USE_NEW_STATIC, NULL);
|
||||
0, VLC_INIT_USE_STATIC, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ static int mp_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
if (mp->codes_count > 1) {
|
||||
/* The entries of the mp->codes array are sorted from right to left
|
||||
* in the Huffman tree, hence -(int)sizeof(HuffCode). */
|
||||
ret = ff_init_vlc_from_lengths(&mp->vlc, mp->max_codes_bits, mp->codes_count,
|
||||
ret = ff_vlc_init_from_lengths(&mp->vlc, mp->max_codes_bits, mp->codes_count,
|
||||
&mp->codes[mp->codes_count - 1].size, -(int)sizeof(HuffCode),
|
||||
&mp->codes[mp->codes_count - 1].delta, -(int)sizeof(HuffCode), 1,
|
||||
0, 0, avctx);
|
||||
@ -336,7 +336,7 @@ static int mp_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
|
||||
goto end;
|
||||
}
|
||||
mp_decode_frame_helper(mp, &gb);
|
||||
ff_free_vlc(&mp->vlc);
|
||||
ff_vlc_free(&mp->vlc);
|
||||
|
||||
end:
|
||||
if ((ret = av_frame_ref(rframe, mp->frame)) < 0)
|
||||
|
@ -47,24 +47,24 @@ static av_cold void mpc7_init_static(void)
|
||||
static VLCElem quant_tables[7224];
|
||||
const uint8_t *raw_quant_table = mpc7_quant_vlcs;
|
||||
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE,
|
||||
&mpc7_scfi[1], 2,
|
||||
&mpc7_scfi[0], 2, 1, 0, 0, 1 << MPC7_SCFI_BITS);
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE,
|
||||
&mpc7_dscf[1], 2,
|
||||
&mpc7_dscf[0], 2, 1, -7, 0, 1 << MPC7_DSCF_BITS);
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE,
|
||||
&mpc7_hdr[1], 2,
|
||||
&mpc7_hdr[0], 2, 1, -5, 0, 1 << MPC7_HDR_BITS);
|
||||
for (unsigned i = 0, offset = 0; i < MPC7_QUANT_VLC_TABLES; i++){
|
||||
for (int j = 0; j < 2; j++) {
|
||||
quant_vlc[i][j].table = &quant_tables[offset];
|
||||
quant_vlc[i][j].table_allocated = FF_ARRAY_ELEMS(quant_tables) - offset;
|
||||
ff_init_vlc_from_lengths(&quant_vlc[i][j], 9, mpc7_quant_vlc_sizes[i],
|
||||
ff_vlc_init_from_lengths(&quant_vlc[i][j], 9, mpc7_quant_vlc_sizes[i],
|
||||
&raw_quant_table[1], 2,
|
||||
&raw_quant_table[0], 2, 1,
|
||||
mpc7_quant_vlc_off[i],
|
||||
INIT_VLC_STATIC_OVERLONG, NULL);
|
||||
VLC_INIT_STATIC_OVERLONG, NULL);
|
||||
raw_quant_table += 2 * mpc7_quant_vlc_sizes[i];
|
||||
offset += quant_vlc[i][j].table_size;
|
||||
}
|
||||
|
@ -103,8 +103,8 @@ static av_cold void build_vlc(VLC *vlc, unsigned *buf_offset,
|
||||
for (unsigned tmp = num + codes_counts[i - 1]; num < tmp; num++)
|
||||
len[num] = i;
|
||||
|
||||
ff_init_vlc_from_lengths(vlc, FFMIN(len[0], 9), num, len, 1,
|
||||
*syms, 1, 1, offset, INIT_VLC_STATIC_OVERLONG, NULL);
|
||||
ff_vlc_init_from_lengths(vlc, FFMIN(len[0], 9), num, len, 1,
|
||||
*syms, 1, 1, offset, VLC_INIT_STATIC_OVERLONG, NULL);
|
||||
*buf_offset += vlc->table_size;
|
||||
*syms += num;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ av_cold void ff_init_2d_vlc_rl(const uint16_t table_vlc[][2], RL_VLC_ELEM rl_vlc
|
||||
VLCElem table[680] = { 0 };
|
||||
VLC vlc = { .table = table, .table_allocated = static_size };
|
||||
av_assert0(static_size <= FF_ARRAY_ELEMS(table));
|
||||
init_vlc(&vlc, TEX_VLC_BITS, n + 2, &table_vlc[0][1], 4, 2, &table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC | flags);
|
||||
vlc_init(&vlc, TEX_VLC_BITS, n + 2, &table_vlc[0][1], 4, 2, &table_vlc[0][0], 4, 2, VLC_INIT_USE_STATIC | flags);
|
||||
|
||||
for (i = 0; i < vlc.table_size; i++) {
|
||||
int code = vlc.table[i].sym;
|
||||
@ -130,26 +130,26 @@ RL_VLC_ELEM ff_mpeg2_rl_vlc[674];
|
||||
|
||||
static av_cold void mpeg12_init_vlcs(void)
|
||||
{
|
||||
INIT_VLC_STATIC(&ff_dc_lum_vlc, DC_VLC_BITS, 12,
|
||||
VLC_INIT_STATIC(&ff_dc_lum_vlc, DC_VLC_BITS, 12,
|
||||
ff_mpeg12_vlc_dc_lum_bits, 1, 1,
|
||||
ff_mpeg12_vlc_dc_lum_code, 2, 2, 512);
|
||||
INIT_VLC_STATIC(&ff_dc_chroma_vlc, DC_VLC_BITS, 12,
|
||||
VLC_INIT_STATIC(&ff_dc_chroma_vlc, DC_VLC_BITS, 12,
|
||||
ff_mpeg12_vlc_dc_chroma_bits, 1, 1,
|
||||
ff_mpeg12_vlc_dc_chroma_code, 2, 2, 514);
|
||||
INIT_VLC_STATIC(&ff_mv_vlc, MV_VLC_BITS, 17,
|
||||
VLC_INIT_STATIC(&ff_mv_vlc, MV_VLC_BITS, 17,
|
||||
&ff_mpeg12_mbMotionVectorTable[0][1], 2, 1,
|
||||
&ff_mpeg12_mbMotionVectorTable[0][0], 2, 1, 266);
|
||||
INIT_VLC_STATIC(&ff_mbincr_vlc, MBINCR_VLC_BITS, 36,
|
||||
VLC_INIT_STATIC(&ff_mbincr_vlc, MBINCR_VLC_BITS, 36,
|
||||
&ff_mpeg12_mbAddrIncrTable[0][1], 2, 1,
|
||||
&ff_mpeg12_mbAddrIncrTable[0][0], 2, 1, 538);
|
||||
INIT_VLC_STATIC(&ff_mb_pat_vlc, MB_PAT_VLC_BITS, 64,
|
||||
VLC_INIT_STATIC(&ff_mb_pat_vlc, MB_PAT_VLC_BITS, 64,
|
||||
&ff_mpeg12_mbPatTable[0][1], 2, 1,
|
||||
&ff_mpeg12_mbPatTable[0][0], 2, 1, 512);
|
||||
|
||||
INIT_VLC_STATIC(&ff_mb_ptype_vlc, MB_PTYPE_VLC_BITS, 7,
|
||||
VLC_INIT_STATIC(&ff_mb_ptype_vlc, MB_PTYPE_VLC_BITS, 7,
|
||||
&table_mb_ptype[0][1], 2, 1,
|
||||
&table_mb_ptype[0][0], 2, 1, 64);
|
||||
INIT_VLC_STATIC(&ff_mb_btype_vlc, MB_BTYPE_VLC_BITS, 11,
|
||||
VLC_INIT_STATIC(&ff_mb_btype_vlc, MB_BTYPE_VLC_BITS, 11,
|
||||
&table_mb_btype[0][1], 2, 1,
|
||||
&table_mb_btype[0][0], 2, 1, 64);
|
||||
|
||||
|
@ -3761,12 +3761,12 @@ static av_cold void mpeg4_init_static(void)
|
||||
{
|
||||
static uint8_t mpeg4_rvlc_rl_tables[2][2][2 * MAX_RUN + MAX_LEVEL + 3];
|
||||
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&studio_luma_dc, STUDIO_INTRA_BITS, 19,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&studio_luma_dc, STUDIO_INTRA_BITS, 19,
|
||||
&ff_mpeg4_studio_dc_luma[0][1], 2,
|
||||
&ff_mpeg4_studio_dc_luma[0][0], 2, 1,
|
||||
0, 0, 528);
|
||||
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&studio_chroma_dc, STUDIO_INTRA_BITS, 19,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&studio_chroma_dc, STUDIO_INTRA_BITS, 19,
|
||||
&ff_mpeg4_studio_dc_chroma[0][1], 2,
|
||||
&ff_mpeg4_studio_dc_chroma[0][0], 2, 1,
|
||||
0, 0, 528);
|
||||
@ -3776,11 +3776,11 @@ static av_cold void mpeg4_init_static(void)
|
||||
|
||||
studio_intra_tab[i].table = &vlc_buf[offset];
|
||||
studio_intra_tab[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset;
|
||||
ff_init_vlc_from_lengths(&studio_intra_tab[i],
|
||||
ff_vlc_init_from_lengths(&studio_intra_tab[i],
|
||||
STUDIO_INTRA_BITS, 24,
|
||||
&ff_mpeg4_studio_intra[i][0][1], 2,
|
||||
&ff_mpeg4_studio_intra[i][0][0], 2, 1,
|
||||
0, INIT_VLC_STATIC_OVERLONG, NULL);
|
||||
0, VLC_INIT_STATIC_OVERLONG, NULL);
|
||||
offset += studio_intra_tab[i].table_size;
|
||||
}
|
||||
|
||||
@ -3788,18 +3788,18 @@ static av_cold void mpeg4_init_static(void)
|
||||
ff_rl_init(&ff_rvlc_rl_inter, mpeg4_rvlc_rl_tables[0]);
|
||||
ff_rl_init(&ff_rvlc_rl_intra, mpeg4_rvlc_rl_tables[1]);
|
||||
INIT_FIRST_VLC_RL(ff_mpeg4_rl_intra, 554);
|
||||
INIT_VLC_RL(ff_rvlc_rl_inter, 1072);
|
||||
VLC_INIT_RL(ff_rvlc_rl_inter, 1072);
|
||||
INIT_FIRST_VLC_RL(ff_rvlc_rl_intra, 1072);
|
||||
INIT_VLC_STATIC(&dc_lum, DC_VLC_BITS, 10 /* 13 */,
|
||||
VLC_INIT_STATIC(&dc_lum, DC_VLC_BITS, 10 /* 13 */,
|
||||
&ff_mpeg4_DCtab_lum[0][1], 2, 1,
|
||||
&ff_mpeg4_DCtab_lum[0][0], 2, 1, 512);
|
||||
INIT_VLC_STATIC(&dc_chrom, DC_VLC_BITS, 10 /* 13 */,
|
||||
VLC_INIT_STATIC(&dc_chrom, DC_VLC_BITS, 10 /* 13 */,
|
||||
&ff_mpeg4_DCtab_chrom[0][1], 2, 1,
|
||||
&ff_mpeg4_DCtab_chrom[0][0], 2, 1, 512);
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&sprite_trajectory, SPRITE_TRAJ_VLC_BITS, 15,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&sprite_trajectory, SPRITE_TRAJ_VLC_BITS, 15,
|
||||
ff_sprite_trajectory_lens, 1,
|
||||
NULL, 0, 0, 0, 0, 128);
|
||||
INIT_VLC_STATIC(&mb_type_b_vlc, MB_TYPE_B_VLC_BITS, 4,
|
||||
VLC_INIT_STATIC(&mb_type_b_vlc, MB_TYPE_B_VLC_BITS, 4,
|
||||
&ff_mb_type_b_tab[0][1], 2, 1,
|
||||
&ff_mb_type_b_tab[0][0], 2, 1, 16);
|
||||
}
|
||||
|
@ -428,9 +428,9 @@ static av_cold void mpegaudiodec_common_init_static(void)
|
||||
|
||||
ff_huff_vlc[++i].table = huff_vlc_tables + offset;
|
||||
ff_huff_vlc[i].table_allocated = FF_ARRAY_ELEMS(huff_vlc_tables) - offset;
|
||||
ff_init_vlc_from_lengths(&ff_huff_vlc[i], 7, j,
|
||||
ff_vlc_init_from_lengths(&ff_huff_vlc[i], 7, j,
|
||||
huff_lens, 1, tmp_symbols, 2, 2,
|
||||
0, INIT_VLC_STATIC_OVERLONG, NULL);
|
||||
0, VLC_INIT_STATIC_OVERLONG, NULL);
|
||||
offset += ff_huff_vlc[i].table_size;
|
||||
huff_lens += j;
|
||||
huff_sym += j;
|
||||
@ -443,9 +443,9 @@ static av_cold void mpegaudiodec_common_init_static(void)
|
||||
ff_huff_quad_vlc[i].table = huff_quad_vlc_tables + offset;
|
||||
ff_huff_quad_vlc[i].table_allocated = 1 << bits;
|
||||
offset += 1 << bits;
|
||||
init_vlc(&ff_huff_quad_vlc[i], bits, 16,
|
||||
vlc_init(&ff_huff_quad_vlc[i], bits, 16,
|
||||
mpa_quad_bits[i], 1, 1, mpa_quad_codes[i], 1, 1,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
VLC_INIT_USE_STATIC);
|
||||
}
|
||||
av_assert0(offset == FF_ARRAY_ELEMS(huff_quad_vlc_tables));
|
||||
|
||||
|
@ -38,20 +38,20 @@ VLC ff_msmp4_dc_chroma_vlc[2];
|
||||
|
||||
static av_cold void msmp4_vc1_vlcs_init(void)
|
||||
{
|
||||
INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[0], MSMP4_DC_VLC_BITS, 120,
|
||||
VLC_INIT_STATIC(&ff_msmp4_dc_luma_vlc[0], MSMP4_DC_VLC_BITS, 120,
|
||||
&ff_table0_dc_lum[0][1], 8, 4,
|
||||
&ff_table0_dc_lum[0][0], 8, 4, 1158);
|
||||
INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[0], MSMP4_DC_VLC_BITS, 120,
|
||||
VLC_INIT_STATIC(&ff_msmp4_dc_chroma_vlc[0], MSMP4_DC_VLC_BITS, 120,
|
||||
&ff_table0_dc_chroma[0][1], 8, 4,
|
||||
&ff_table0_dc_chroma[0][0], 8, 4, 1118);
|
||||
INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[1], MSMP4_DC_VLC_BITS, 120,
|
||||
VLC_INIT_STATIC(&ff_msmp4_dc_luma_vlc[1], MSMP4_DC_VLC_BITS, 120,
|
||||
&ff_table1_dc_lum[0][1], 8, 4,
|
||||
&ff_table1_dc_lum[0][0], 8, 4, 1476);
|
||||
INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[1], MSMP4_DC_VLC_BITS, 120,
|
||||
VLC_INIT_STATIC(&ff_msmp4_dc_chroma_vlc[1], MSMP4_DC_VLC_BITS, 120,
|
||||
&ff_table1_dc_chroma[0][1], 8, 4,
|
||||
&ff_table1_dc_chroma[0][0], 8, 4, 1216);
|
||||
|
||||
INIT_VLC_STATIC(&ff_msmp4_mb_i_vlc, MSMP4_MB_INTRA_VLC_BITS, 64,
|
||||
VLC_INIT_STATIC(&ff_msmp4_mb_i_vlc, MSMP4_MB_INTRA_VLC_BITS, 64,
|
||||
&ff_msmp4_mb_i_table[0][1], 4, 2,
|
||||
&ff_msmp4_mb_i_table[0][0], 4, 2, 536);
|
||||
}
|
||||
|
@ -301,33 +301,33 @@ static av_cold void msmpeg4_decode_init_static(void)
|
||||
INIT_FIRST_VLC_RL(ff_rl_table[0], 642);
|
||||
INIT_FIRST_VLC_RL(ff_rl_table[1], 1104);
|
||||
INIT_FIRST_VLC_RL(ff_rl_table[2], 554);
|
||||
INIT_VLC_RL(ff_rl_table[3], 940);
|
||||
INIT_VLC_RL(ff_rl_table[4], 962);
|
||||
VLC_INIT_RL(ff_rl_table[3], 940);
|
||||
VLC_INIT_RL(ff_rl_table[4], 962);
|
||||
/* ff_rl_table[5] coincides with ff_h263_rl_inter which has just been
|
||||
* initialized in ff_h263_decode_init() earlier. So just copy the VLCs. */
|
||||
av_assert1(ff_h263_rl_inter.rl_vlc[0]);
|
||||
memcpy(ff_rl_table[5].rl_vlc, ff_h263_rl_inter.rl_vlc, sizeof(ff_rl_table[5].rl_vlc));
|
||||
|
||||
mv = &ff_mv_tables[0];
|
||||
INIT_VLC_STATIC(&mv->vlc, MV_VLC_BITS, MSMPEG4_MV_TABLES_NB_ELEMS + 1,
|
||||
VLC_INIT_STATIC(&mv->vlc, MV_VLC_BITS, MSMPEG4_MV_TABLES_NB_ELEMS + 1,
|
||||
mv->table_mv_bits, 1, 1,
|
||||
mv->table_mv_code, 2, 2, 3714);
|
||||
mv = &ff_mv_tables[1];
|
||||
INIT_VLC_STATIC(&mv->vlc, MV_VLC_BITS, MSMPEG4_MV_TABLES_NB_ELEMS + 1,
|
||||
VLC_INIT_STATIC(&mv->vlc, MV_VLC_BITS, MSMPEG4_MV_TABLES_NB_ELEMS + 1,
|
||||
mv->table_mv_bits, 1, 1,
|
||||
mv->table_mv_code, 2, 2, 2694);
|
||||
|
||||
INIT_VLC_STATIC(&v2_dc_lum_vlc, MSMP4_DC_VLC_BITS, 512,
|
||||
VLC_INIT_STATIC(&v2_dc_lum_vlc, MSMP4_DC_VLC_BITS, 512,
|
||||
&ff_v2_dc_lum_table[0][1], 8, 4,
|
||||
&ff_v2_dc_lum_table[0][0], 8, 4, 1472);
|
||||
INIT_VLC_STATIC(&v2_dc_chroma_vlc, MSMP4_DC_VLC_BITS, 512,
|
||||
VLC_INIT_STATIC(&v2_dc_chroma_vlc, MSMP4_DC_VLC_BITS, 512,
|
||||
&ff_v2_dc_chroma_table[0][1], 8, 4,
|
||||
&ff_v2_dc_chroma_table[0][0], 8, 4, 1506);
|
||||
|
||||
INIT_VLC_STATIC(&v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 4,
|
||||
VLC_INIT_STATIC(&v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 4,
|
||||
&ff_v2_intra_cbpc[0][1], 2, 1,
|
||||
&ff_v2_intra_cbpc[0][0], 2, 1, 8);
|
||||
INIT_VLC_STATIC(&v2_mb_type_vlc, V2_MB_TYPE_VLC_BITS, 8,
|
||||
VLC_INIT_STATIC(&v2_mb_type_vlc, V2_MB_TYPE_VLC_BITS, 8,
|
||||
&ff_v2_mb_type[0][1], 2, 1,
|
||||
&ff_v2_mb_type[0][0], 2, 1, 128);
|
||||
|
||||
@ -335,14 +335,14 @@ static av_cold void msmpeg4_decode_init_static(void)
|
||||
static VLCElem vlc_buf[1636 + 2648 + 1532 + 2488];
|
||||
ff_mb_non_intra_vlc[i].table = &vlc_buf[offset];
|
||||
ff_mb_non_intra_vlc[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset;
|
||||
init_vlc(&ff_mb_non_intra_vlc[i], MB_NON_INTRA_VLC_BITS, 128,
|
||||
vlc_init(&ff_mb_non_intra_vlc[i], MB_NON_INTRA_VLC_BITS, 128,
|
||||
&ff_wmv2_inter_table[i][0][1], 8, 4,
|
||||
&ff_wmv2_inter_table[i][0][0], 8, 4,
|
||||
INIT_VLC_STATIC_OVERLONG);
|
||||
VLC_INIT_STATIC_OVERLONG);
|
||||
offset += ff_mb_non_intra_vlc[i].table_size;
|
||||
}
|
||||
|
||||
INIT_VLC_STATIC(&ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 4,
|
||||
VLC_INIT_STATIC(&ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 4,
|
||||
&ff_table_inter_intra[0][1], 2, 1,
|
||||
&ff_table_inter_intra[0][0], 2, 1, 8);
|
||||
ff_msmp4_vc1_vlcs_init_once();
|
||||
|
@ -324,7 +324,7 @@ static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, ptrdiff_t pal_stride,
|
||||
if (next_code != 1 << current_length)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((i = init_vlc(&vlc, 9, alphabet_size, bits, 1, 1, codes, 4, 4, 0)) < 0)
|
||||
if ((i = vlc_init(&vlc, 9, alphabet_size, bits, 1, 1, codes, 4, 4, 0)) < 0)
|
||||
return i;
|
||||
|
||||
/* frame decode */
|
||||
@ -371,7 +371,7 @@ static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, ptrdiff_t pal_stride,
|
||||
prev_avail = 1;
|
||||
} while (--h);
|
||||
|
||||
ff_free_vlc(&vlc);
|
||||
ff_vlc_free(&vlc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -115,9 +115,9 @@ static av_cold void mss4_init_vlc(VLC *vlc, unsigned *offset,
|
||||
|
||||
vlc->table = &vlc_buf[*offset];
|
||||
vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *offset;
|
||||
ff_init_vlc_from_lengths(vlc, FFMIN(bits[idx - 1], 9), idx,
|
||||
ff_vlc_init_from_lengths(vlc, FFMIN(bits[idx - 1], 9), idx,
|
||||
bits, 1, syms, 1, 1,
|
||||
0, INIT_VLC_STATIC_OVERLONG, NULL);
|
||||
0, VLC_INIT_STATIC_OVERLONG, NULL);
|
||||
*offset += vlc->table_size;
|
||||
}
|
||||
|
||||
|
@ -657,7 +657,7 @@ static const uint8_t cbp_bits[] = {
|
||||
|
||||
static av_cold void init_static_data(void)
|
||||
{
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&cbp_tab, CBP_VLC_BITS, FF_ARRAY_ELEMS(cbp_bits),
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&cbp_tab, CBP_VLC_BITS, FF_ARRAY_ELEMS(cbp_bits),
|
||||
cbp_bits, 1, NULL, 0, 0, 0, 0, 1 << CBP_VLC_BITS);
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ static int build_vlc(AVCodecContext *avctx, VLC *vlc)
|
||||
uint8_t xlat[256];
|
||||
int cur_node, i, j, pos = 0;
|
||||
|
||||
ff_free_vlc(vlc);
|
||||
ff_vlc_free(vlc);
|
||||
|
||||
for (i = 0; i < s->nb_symbols; i++) {
|
||||
nodes[i].count = s->prob[i];
|
||||
@ -140,7 +140,7 @@ static int build_vlc(AVCodecContext *avctx, VLC *vlc)
|
||||
|
||||
get_tree_codes(bits, lens, xlat, nodes, cur_node - 1, 0, 0, &pos);
|
||||
|
||||
return ff_init_vlc_sparse(vlc, 12, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
|
||||
return ff_vlc_init_sparse(vlc, 12, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
|
||||
}
|
||||
|
||||
static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
@ -294,7 +294,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
|
||||
MVHAContext *s = avctx->priv_data;
|
||||
|
||||
ff_inflate_end(&s->zstream);
|
||||
ff_free_vlc(&s->vlc);
|
||||
ff_vlc_free(&s->vlc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -892,9 +892,9 @@ static av_cold void on2avc_free_vlcs(On2AVCContext *c)
|
||||
{
|
||||
int i;
|
||||
|
||||
ff_free_vlc(&c->scale_diff);
|
||||
ff_vlc_free(&c->scale_diff);
|
||||
for (i = 1; i < 16; i++)
|
||||
ff_free_vlc(&c->cb_vlc[i]);
|
||||
ff_vlc_free(&c->cb_vlc[i]);
|
||||
}
|
||||
|
||||
static av_cold int on2avc_decode_init(AVCodecContext *avctx)
|
||||
@ -969,14 +969,14 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx)
|
||||
if (!c->fdsp)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ret = ff_init_vlc_from_lengths(&c->scale_diff, 9, ON2AVC_SCALE_DIFFS,
|
||||
ret = ff_vlc_init_from_lengths(&c->scale_diff, 9, ON2AVC_SCALE_DIFFS,
|
||||
ff_on2avc_scale_diff_bits, 1,
|
||||
ff_on2avc_scale_diff_syms, 1, 1, -60, 0, avctx);
|
||||
if (ret < 0)
|
||||
goto vlc_fail;
|
||||
for (i = 1; i < 16; i++) {
|
||||
int idx = i - 1;
|
||||
ret = ff_init_vlc_from_lengths(&c->cb_vlc[i], 9, ff_on2avc_cb_elems[idx],
|
||||
ret = ff_vlc_init_from_lengths(&c->cb_vlc[i], 9, ff_on2avc_cb_elems[idx],
|
||||
lens, 1,
|
||||
syms, 2, 2, 0, 0, avctx);
|
||||
if (ret < 0)
|
||||
|
@ -210,8 +210,8 @@ static av_noinline int read_hufftable(AVCodecContext *avctx, VLC *vlc)
|
||||
s->syms[j] = sym;
|
||||
}
|
||||
|
||||
ff_free_vlc(vlc);
|
||||
ret = ff_init_vlc_sparse(vlc, 12, count,
|
||||
ff_vlc_free(vlc);
|
||||
ret = ff_vlc_init_sparse(vlc, 12, count,
|
||||
s->bits, sizeof(*s->bits), sizeof(*s->bits),
|
||||
s->codes, sizeof(*s->codes), sizeof(*s->codes),
|
||||
s->syms, sizeof(*s->syms), sizeof(*s->syms), 0);
|
||||
@ -438,7 +438,7 @@ static av_cold int photocd_decode_close(AVCodecContext *avctx)
|
||||
PhotoCDContext *s = avctx->priv_data;
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
ff_free_vlc(&s->vlc[i]);
|
||||
ff_vlc_free(&s->vlc[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -116,9 +116,9 @@ static av_cold void build_vlc(VLC *vlc, int nb_bits, int nb_codes,
|
||||
{
|
||||
vlc->table = &qdm2_table[*offset];
|
||||
vlc->table_allocated = FF_ARRAY_ELEMS(qdm2_table) - *offset;
|
||||
ff_init_vlc_from_lengths(vlc, nb_bits, nb_codes,
|
||||
ff_vlc_init_from_lengths(vlc, nb_bits, nb_codes,
|
||||
&tab[0][1], 2, &tab[0][0], 2, 1,
|
||||
-1, INIT_VLC_STATIC_OVERLONG | INIT_VLC_LE, NULL);
|
||||
-1, VLC_INIT_STATIC_OVERLONG | VLC_INIT_LE, NULL);
|
||||
*offset += vlc->table_size;
|
||||
}
|
||||
|
||||
|
@ -172,9 +172,9 @@ static av_cold void qdmc_init_static_data(void)
|
||||
static VLCElem vlc_buffer[13698];
|
||||
vtable[i].table = &vlc_buffer[offset];
|
||||
vtable[i].table_allocated = FF_ARRAY_ELEMS(vlc_buffer) - offset;
|
||||
ff_init_vlc_from_lengths(&vtable[i], huff_bits[i], huff_sizes[i],
|
||||
ff_vlc_init_from_lengths(&vtable[i], huff_bits[i], huff_sizes[i],
|
||||
&hufftab[0][1], 2, &hufftab[0][0], 2, 1, -1,
|
||||
INIT_VLC_LE | INIT_VLC_STATIC_OVERLONG, NULL);
|
||||
VLC_INIT_LE | VLC_INIT_STATIC_OVERLONG, NULL);
|
||||
hufftab += huff_sizes[i];
|
||||
offset += vtable[i].table_size;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ static av_cold int init_ralf_vlc(VLC *vlc, const uint8_t *data, int elems)
|
||||
for (i = 0; i < elems; i++)
|
||||
codes[i] = prefixes[lens[i]]++;
|
||||
|
||||
return ff_init_vlc_sparse(vlc, FFMIN(max_bits, 9), elems,
|
||||
return ff_vlc_init_sparse(vlc, FFMIN(max_bits, 9), elems,
|
||||
lens, 1, 1, codes, 2, 2, NULL, 0, 0, 0);
|
||||
}
|
||||
|
||||
@ -109,16 +109,16 @@ static av_cold int decode_close(AVCodecContext *avctx)
|
||||
int i, j, k;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
ff_free_vlc(&ctx->sets[i].filter_params);
|
||||
ff_free_vlc(&ctx->sets[i].bias);
|
||||
ff_free_vlc(&ctx->sets[i].coding_mode);
|
||||
ff_vlc_free(&ctx->sets[i].filter_params);
|
||||
ff_vlc_free(&ctx->sets[i].bias);
|
||||
ff_vlc_free(&ctx->sets[i].coding_mode);
|
||||
for (j = 0; j < 10; j++)
|
||||
for (k = 0; k < 11; k++)
|
||||
ff_free_vlc(&ctx->sets[i].filter_coeffs[j][k]);
|
||||
ff_vlc_free(&ctx->sets[i].filter_coeffs[j][k]);
|
||||
for (j = 0; j < 15; j++)
|
||||
ff_free_vlc(&ctx->sets[i].short_codes[j]);
|
||||
ff_vlc_free(&ctx->sets[i].short_codes[j]);
|
||||
for (j = 0; j < 125; j++)
|
||||
ff_free_vlc(&ctx->sets[i].long_codes[j]);
|
||||
ff_vlc_free(&ctx->sets[i].long_codes[j]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -82,7 +82,9 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
|
||||
VLCElem table[1500] = { 0 };
|
||||
VLC vlc = { .table = table, .table_allocated = static_size };
|
||||
av_assert0(static_size <= FF_ARRAY_ELEMS(table));
|
||||
init_vlc(&vlc, 9, rl->n + 1, &rl->table_vlc[0][1], 4, 2, &rl->table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC);
|
||||
vlc_init(&vlc, 9, rl->n + 1,
|
||||
&rl->table_vlc[0][1], 4, 2,
|
||||
&rl->table_vlc[0][0], 4, 2, VLC_INIT_USE_STATIC);
|
||||
|
||||
for (q = 0; q < 32; q++) {
|
||||
int qmul = q * 2;
|
||||
|
@ -80,7 +80,7 @@ void ff_rl_init(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3])
|
||||
*/
|
||||
void ff_rl_init_vlc(RLTable *rl, unsigned static_size);
|
||||
|
||||
#define INIT_VLC_RL(rl, static_size)\
|
||||
#define VLC_INIT_RL(rl, static_size)\
|
||||
{\
|
||||
static RL_VLC_ELEM rl_vlc_table[32][static_size];\
|
||||
\
|
||||
|
@ -334,8 +334,8 @@ static av_cold void rv10_build_vlc(VLC *vlc, const uint16_t len_count[15],
|
||||
for (unsigned tmp = nb_lens + len_count[i]; nb_lens < tmp; nb_lens++)
|
||||
lens[nb_lens] = i + 2;
|
||||
av_assert1(nb_lens == nb_syms);
|
||||
ff_init_vlc_from_lengths(vlc, DC_VLC_BITS, nb_lens, lens, 1,
|
||||
syms, 2, 2, 0, INIT_VLC_STATIC_OVERLONG, NULL);
|
||||
ff_vlc_init_from_lengths(vlc, DC_VLC_BITS, nb_lens, lens, 1,
|
||||
syms, 2, 2, 0, VLC_INIT_STATIC_OVERLONG, NULL);
|
||||
}
|
||||
|
||||
static av_cold void rv10_init_static(void)
|
||||
|
@ -113,10 +113,10 @@ static void rv34_gen_vlc(const uint8_t *bits, int size, VLC *vlc, const uint8_t
|
||||
|
||||
vlc->table = &table_data[*offset];
|
||||
vlc->table_allocated = FF_ARRAY_ELEMS(table_data) - *offset;
|
||||
ff_init_vlc_sparse(vlc, FFMIN(maxbits, 9), size,
|
||||
ff_vlc_init_sparse(vlc, FFMIN(maxbits, 9), size,
|
||||
bits, 1, 1,
|
||||
cw, 2, 2,
|
||||
syms, !!syms, !!syms, INIT_VLC_STATIC_OVERLONG);
|
||||
syms, !!syms, !!syms, VLC_INIT_STATIC_OVERLONG);
|
||||
*offset += vlc->table_size;
|
||||
}
|
||||
|
||||
|
@ -53,9 +53,9 @@ static av_cold void rv40_init_table(VLC *vlc, unsigned *offset, int nb_bits,
|
||||
vlc->table_allocated = 1 << nb_bits;
|
||||
*offset += 1 << nb_bits;
|
||||
|
||||
ff_init_vlc_from_lengths(vlc, nb_bits, nb_codes,
|
||||
ff_vlc_init_from_lengths(vlc, nb_bits, nb_codes,
|
||||
&tab[0][1], 2, &tab[0][0], 2, 1,
|
||||
0, INIT_VLC_USE_NEW_STATIC, NULL);
|
||||
0, VLC_INIT_USE_STATIC, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,9 +87,9 @@ static av_cold void rv40_init_tables(void)
|
||||
}
|
||||
aic_mode2_vlc[i].table = &aic_mode2_table[offset];
|
||||
aic_mode2_vlc[i].table_allocated = FF_ARRAY_ELEMS(aic_mode2_table) - offset;
|
||||
ff_init_vlc_from_lengths(&aic_mode2_vlc[i], AIC_MODE2_BITS, AIC_MODE2_SIZE,
|
||||
ff_vlc_init_from_lengths(&aic_mode2_vlc[i], AIC_MODE2_BITS, AIC_MODE2_SIZE,
|
||||
aic_mode2_vlc_bits[i], 1,
|
||||
syms, 2, 2, 0, INIT_VLC_STATIC_OVERLONG, NULL);
|
||||
syms, 2, 2, 0, VLC_INIT_STATIC_OVERLONG, NULL);
|
||||
offset += aic_mode2_vlc[i].table_size;
|
||||
}
|
||||
for(i = 0; i < NUM_PTYPE_VLCS; i++){
|
||||
|
@ -1796,8 +1796,8 @@ static av_cold int build_vlc(VLC *vlc, const SheerTable *table)
|
||||
lens[count] = len;
|
||||
}
|
||||
|
||||
ff_free_vlc(vlc);
|
||||
return ff_init_vlc_from_lengths(vlc, SHEER_VLC_BITS, count,
|
||||
ff_vlc_free(vlc);
|
||||
return ff_vlc_init_from_lengths(vlc, SHEER_VLC_BITS, count,
|
||||
lens, sizeof(*lens), NULL, 0, 0, 0, 0, NULL);
|
||||
}
|
||||
|
||||
@ -1992,8 +1992,8 @@ static av_cold int decode_end(AVCodecContext *avctx)
|
||||
{
|
||||
SheerVideoContext *s = avctx->priv_data;
|
||||
|
||||
ff_free_vlc(&s->vlc[0]);
|
||||
ff_free_vlc(&s->vlc[1]);
|
||||
ff_vlc_free(&s->vlc[0]);
|
||||
ff_vlc_free(&s->vlc[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -220,10 +220,10 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
|
||||
goto error;
|
||||
skip_bits1(gb);
|
||||
if (h.current > 1) {
|
||||
err = ff_init_vlc_from_lengths(&vlc[i], SMKTREE_BITS, h.current,
|
||||
err = ff_vlc_init_from_lengths(&vlc[i], SMKTREE_BITS, h.current,
|
||||
&h.entries[0].length, sizeof(*h.entries),
|
||||
&h.entries[0].value, sizeof(*h.entries), 1,
|
||||
0, INIT_VLC_OUTPUT_LE, smk->avctx);
|
||||
0, VLC_INIT_OUTPUT_LE, smk->avctx);
|
||||
if (err < 0) {
|
||||
av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
|
||||
goto error;
|
||||
@ -264,7 +264,7 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int
|
||||
err = 0;
|
||||
error:
|
||||
for (int i = 0; i < 2; i++) {
|
||||
ff_free_vlc(&vlc[i]);
|
||||
ff_vlc_free(&vlc[i]);
|
||||
}
|
||||
|
||||
return err;
|
||||
@ -659,10 +659,10 @@ static int smka_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
goto error;
|
||||
skip_bits1(&gb);
|
||||
if (h.current > 1) {
|
||||
ret = ff_init_vlc_from_lengths(&vlc[i], SMKTREE_BITS, h.current,
|
||||
ret = ff_vlc_init_from_lengths(&vlc[i], SMKTREE_BITS, h.current,
|
||||
&h.entries[0].length, sizeof(*h.entries),
|
||||
&h.entries[0].value, sizeof(*h.entries), 1,
|
||||
0, INIT_VLC_OUTPUT_LE, avctx);
|
||||
0, VLC_INIT_OUTPUT_LE, avctx);
|
||||
if (ret < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
|
||||
goto error;
|
||||
@ -740,7 +740,7 @@ static int smka_decode_frame(AVCodecContext *avctx, AVFrame *frame,
|
||||
|
||||
error:
|
||||
for(i = 0; i < 4; i++) {
|
||||
ff_free_vlc(&vlc[i]);
|
||||
ff_vlc_free(&vlc[i]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -506,7 +506,7 @@ static av_cold void compute_alpha_vlcs(void)
|
||||
|
||||
av_assert0(entry == FF_ARRAY_ELEMS(run_code));
|
||||
|
||||
INIT_LE_VLC_SPARSE_STATIC(&dc_alpha_run_vlc_le, ALPHA_VLC_BITS,
|
||||
VLC_INIT_LE_SPARSE_STATIC(&dc_alpha_run_vlc_le, ALPHA_VLC_BITS,
|
||||
FF_ARRAY_ELEMS(run_code),
|
||||
run_bits, 1, 1,
|
||||
run_code, 2, 2,
|
||||
@ -546,7 +546,7 @@ static av_cold void compute_alpha_vlcs(void)
|
||||
|
||||
av_assert0(entry == FF_ARRAY_ELEMS(level_code));
|
||||
|
||||
INIT_LE_VLC_SPARSE_STATIC(&dc_alpha_level_vlc_le, ALPHA_VLC_BITS,
|
||||
VLC_INIT_LE_SPARSE_STATIC(&dc_alpha_level_vlc_le, ALPHA_VLC_BITS,
|
||||
FF_ARRAY_ELEMS(level_code),
|
||||
level_bits, 1, 1,
|
||||
level_code, 2, 2,
|
||||
@ -556,18 +556,18 @@ static av_cold void compute_alpha_vlcs(void)
|
||||
static av_cold void speedhq_static_init(void)
|
||||
{
|
||||
/* Exactly the same as MPEG-2, except for a little-endian reader. */
|
||||
INIT_CUSTOM_VLC_STATIC(&dc_lum_vlc_le, DC_VLC_BITS, 12,
|
||||
VLC_INIT_CUSTOM_STATIC(&dc_lum_vlc_le, DC_VLC_BITS, 12,
|
||||
ff_mpeg12_vlc_dc_lum_bits, 1, 1,
|
||||
ff_mpeg12_vlc_dc_lum_code, 2, 2,
|
||||
INIT_VLC_OUTPUT_LE, 512);
|
||||
INIT_CUSTOM_VLC_STATIC(&dc_chroma_vlc_le, DC_VLC_BITS, 12,
|
||||
VLC_INIT_OUTPUT_LE, 512);
|
||||
VLC_INIT_CUSTOM_STATIC(&dc_chroma_vlc_le, DC_VLC_BITS, 12,
|
||||
ff_mpeg12_vlc_dc_chroma_bits, 1, 1,
|
||||
ff_mpeg12_vlc_dc_chroma_code, 2, 2,
|
||||
INIT_VLC_OUTPUT_LE, 514);
|
||||
VLC_INIT_OUTPUT_LE, 514);
|
||||
|
||||
ff_init_2d_vlc_rl(ff_speedhq_vlc_table, speedhq_rl_vlc, ff_speedhq_run,
|
||||
ff_speedhq_level, SPEEDHQ_RL_NB_ELEMS,
|
||||
FF_ARRAY_ELEMS(speedhq_rl_vlc), INIT_VLC_LE);
|
||||
FF_ARRAY_ELEMS(speedhq_rl_vlc), VLC_INIT_LE);
|
||||
|
||||
compute_alpha_vlcs();
|
||||
}
|
||||
|
@ -777,11 +777,11 @@ static int svq1_decode_frame(AVCodecContext *avctx, AVFrame *cur,
|
||||
|
||||
static av_cold void svq1_static_init(void)
|
||||
{
|
||||
INIT_VLC_STATIC(&svq1_block_type, SVQ1_BLOCK_TYPE_VLC_BITS, 4,
|
||||
VLC_INIT_STATIC(&svq1_block_type, SVQ1_BLOCK_TYPE_VLC_BITS, 4,
|
||||
&ff_svq1_block_type_vlc[0][1], 2, 1,
|
||||
&ff_svq1_block_type_vlc[0][0], 2, 1, 8);
|
||||
|
||||
INIT_VLC_STATIC(&svq1_motion_component, 7, 33,
|
||||
VLC_INIT_STATIC(&svq1_motion_component, 7, 33,
|
||||
&ff_mvtab[0][1], 2, 1,
|
||||
&ff_mvtab[0][0], 2, 1, 176);
|
||||
|
||||
@ -792,24 +792,24 @@ static av_cold void svq1_static_init(void)
|
||||
svq1_intra_multistage[i].table = &table[offset];
|
||||
svq1_intra_multistage[i].table_allocated = sizes[0][i];
|
||||
offset += sizes[0][i];
|
||||
init_vlc(&svq1_intra_multistage[i], 3, 8,
|
||||
vlc_init(&svq1_intra_multistage[i], 3, 8,
|
||||
&ff_svq1_intra_multistage_vlc[i][0][1], 2, 1,
|
||||
&ff_svq1_intra_multistage_vlc[i][0][0], 2, 1,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
VLC_INIT_USE_STATIC);
|
||||
svq1_inter_multistage[i].table = &table[offset];
|
||||
svq1_inter_multistage[i].table_allocated = sizes[1][i];
|
||||
offset += sizes[1][i];
|
||||
init_vlc(&svq1_inter_multistage[i], 3, 8,
|
||||
vlc_init(&svq1_inter_multistage[i], 3, 8,
|
||||
&ff_svq1_inter_multistage_vlc[i][0][1], 2, 1,
|
||||
&ff_svq1_inter_multistage_vlc[i][0][0], 2, 1,
|
||||
INIT_VLC_USE_NEW_STATIC);
|
||||
VLC_INIT_USE_STATIC);
|
||||
}
|
||||
|
||||
INIT_VLC_STATIC(&svq1_intra_mean, 8, 256,
|
||||
VLC_INIT_STATIC(&svq1_intra_mean, 8, 256,
|
||||
&ff_svq1_intra_mean_vlc[0][1], 4, 2,
|
||||
&ff_svq1_intra_mean_vlc[0][0], 4, 2, 632);
|
||||
|
||||
INIT_VLC_STATIC(&svq1_inter_mean, 9, 512,
|
||||
VLC_INIT_STATIC(&svq1_inter_mean, 9, 512,
|
||||
&ff_svq1_inter_mean_vlc[0][1], 4, 2,
|
||||
&ff_svq1_inter_mean_vlc[0][0], 4, 2, 1434);
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)
|
||||
|
||||
/* convert codes to vlc_table */
|
||||
if (res >= 0) {
|
||||
res = ff_init_vlc_from_lengths(&code->vlc, huff.max_bits, huff.max_num,
|
||||
res = ff_vlc_init_from_lengths(&code->vlc, huff.max_bits, huff.max_num,
|
||||
huff.lens, sizeof(huff.lens[0]),
|
||||
NULL, 0, 0, 0, 0, ctx->avctx);
|
||||
if (res < 0)
|
||||
@ -223,7 +223,7 @@ static void tm2_free_codes(TM2Codes *code)
|
||||
{
|
||||
av_free(code->recode);
|
||||
if (code->vlc.table)
|
||||
ff_free_vlc(&code->vlc);
|
||||
ff_vlc_free(&code->vlc);
|
||||
}
|
||||
|
||||
static inline int tm2_get_token(GetBitContext *gb, TM2Codes *code)
|
||||
|
@ -61,9 +61,9 @@ static av_cold void tscc2_init_vlc(VLC *vlc, int *offset, int nb_codes,
|
||||
|
||||
vlc->table = &vlc_buf[*offset];
|
||||
vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *offset;
|
||||
ff_init_vlc_from_lengths(vlc, TSCC2_VLC_BITS, nb_codes,
|
||||
ff_vlc_init_from_lengths(vlc, TSCC2_VLC_BITS, nb_codes,
|
||||
lens, 1, syms, sym_length, sym_length, 0,
|
||||
INIT_VLC_STATIC_OVERLONG | INIT_VLC_OUTPUT_LE, NULL);
|
||||
VLC_INIT_STATIC_OVERLONG | VLC_INIT_OUTPUT_LE, NULL);
|
||||
*offset += vlc->table_size;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ static int build_huff(UtvideoContext *c, const uint8_t *src, VLC *vlc,
|
||||
he[--codes_count[bits[i]]] = (HuffEntry) { bits[i], i };
|
||||
|
||||
#define VLC_BITS 11
|
||||
return ff_init_vlc_multi_from_lengths(vlc, multi, VLC_BITS, nb_elems, codes_count[0],
|
||||
return ff_vlc_init_multi_from_lengths(vlc, multi, VLC_BITS, nb_elems, codes_count[0],
|
||||
&he[0].len, sizeof(*he),
|
||||
&he[0].sym, sizeof(*he), 2, 0, 0, c->avctx);
|
||||
}
|
||||
@ -188,13 +188,13 @@ static int decode_plane10(UtvideoContext *c, int plane_no,
|
||||
"%d bits left after decoding slice\n", get_bits_left(&gb));
|
||||
}
|
||||
|
||||
ff_free_vlc(&vlc);
|
||||
ff_free_vlc_multi(&multi);
|
||||
ff_vlc_free(&vlc);
|
||||
ff_vlc_free_multi(&multi);
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
ff_free_vlc(&vlc);
|
||||
ff_free_vlc_multi(&multi);
|
||||
ff_vlc_free(&vlc);
|
||||
ff_vlc_free_multi(&multi);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@ -333,13 +333,13 @@ static int decode_plane(UtvideoContext *c, int plane_no,
|
||||
"%d bits left after decoding slice\n", get_bits_left(&gb));
|
||||
}
|
||||
|
||||
ff_free_vlc(&vlc);
|
||||
ff_free_vlc_multi(&multi);
|
||||
ff_vlc_free(&vlc);
|
||||
ff_vlc_free_multi(&multi);
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
ff_free_vlc(&vlc);
|
||||
ff_free_vlc_multi(&multi);
|
||||
ff_vlc_free(&vlc);
|
||||
ff_vlc_free_multi(&multi);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
|
@ -484,108 +484,108 @@ static av_cold void vc1_init_static(void)
|
||||
{
|
||||
static VLCElem vlc_table[32372];
|
||||
|
||||
INIT_VLC_STATIC(&ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4,
|
||||
VLC_INIT_STATIC(&ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4,
|
||||
vc1_norm2_bits, 1, 1,
|
||||
vc1_norm2_codes, 1, 1, 1 << VC1_NORM2_VLC_BITS);
|
||||
INIT_VLC_STATIC(&ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64,
|
||||
VLC_INIT_STATIC(&ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64,
|
||||
vc1_norm6_bits, 1, 1,
|
||||
vc1_norm6_codes, 2, 2, 556);
|
||||
INIT_VLC_STATIC(&ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7,
|
||||
VLC_INIT_STATIC(&ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7,
|
||||
vc1_imode_bits, 1, 1,
|
||||
vc1_imode_codes, 1, 1, 1 << VC1_IMODE_VLC_BITS);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
ff_vc1_ttmb_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 0]];
|
||||
ff_vc1_ttmb_vlc[i].table_allocated = vlc_offs[i * 3 + 1] - vlc_offs[i * 3 + 0];
|
||||
init_vlc(&ff_vc1_ttmb_vlc[i], VC1_TTMB_VLC_BITS, 16,
|
||||
vlc_init(&ff_vc1_ttmb_vlc[i], VC1_TTMB_VLC_BITS, 16,
|
||||
vc1_ttmb_bits[i], 1, 1,
|
||||
vc1_ttmb_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_ttmb_codes[i], 2, 2, VLC_INIT_USE_STATIC);
|
||||
ff_vc1_ttblk_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 1]];
|
||||
ff_vc1_ttblk_vlc[i].table_allocated = vlc_offs[i * 3 + 2] - vlc_offs[i * 3 + 1];
|
||||
init_vlc(&ff_vc1_ttblk_vlc[i], VC1_TTBLK_VLC_BITS, 8,
|
||||
vlc_init(&ff_vc1_ttblk_vlc[i], VC1_TTBLK_VLC_BITS, 8,
|
||||
vc1_ttblk_bits[i], 1, 1,
|
||||
vc1_ttblk_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_ttblk_codes[i], 1, 1, VLC_INIT_USE_STATIC);
|
||||
ff_vc1_subblkpat_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 2]];
|
||||
ff_vc1_subblkpat_vlc[i].table_allocated = vlc_offs[i * 3 + 3] - vlc_offs[i * 3 + 2];
|
||||
init_vlc(&ff_vc1_subblkpat_vlc[i], VC1_SUBBLKPAT_VLC_BITS, 15,
|
||||
vlc_init(&ff_vc1_subblkpat_vlc[i], VC1_SUBBLKPAT_VLC_BITS, 15,
|
||||
vc1_subblkpat_bits[i], 1, 1,
|
||||
vc1_subblkpat_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_subblkpat_codes[i], 1, 1, VLC_INIT_USE_STATIC);
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
ff_vc1_4mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 9]];
|
||||
ff_vc1_4mv_block_pattern_vlc[i].table_allocated = vlc_offs[i * 3 + 10] - vlc_offs[i * 3 + 9];
|
||||
init_vlc(&ff_vc1_4mv_block_pattern_vlc[i], VC1_4MV_BLOCK_PATTERN_VLC_BITS, 16,
|
||||
vlc_init(&ff_vc1_4mv_block_pattern_vlc[i], VC1_4MV_BLOCK_PATTERN_VLC_BITS, 16,
|
||||
vc1_4mv_block_pattern_bits[i], 1, 1,
|
||||
vc1_4mv_block_pattern_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_4mv_block_pattern_codes[i], 1, 1, VLC_INIT_USE_STATIC);
|
||||
ff_vc1_cbpcy_p_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 10]];
|
||||
ff_vc1_cbpcy_p_vlc[i].table_allocated = vlc_offs[i * 3 + 11] - vlc_offs[i * 3 + 10];
|
||||
init_vlc(&ff_vc1_cbpcy_p_vlc[i], VC1_CBPCY_P_VLC_BITS, 64,
|
||||
vlc_init(&ff_vc1_cbpcy_p_vlc[i], VC1_CBPCY_P_VLC_BITS, 64,
|
||||
vc1_cbpcy_p_bits[i], 1, 1,
|
||||
vc1_cbpcy_p_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_cbpcy_p_codes[i], 2, 2, VLC_INIT_USE_STATIC);
|
||||
ff_vc1_mv_diff_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 11]];
|
||||
ff_vc1_mv_diff_vlc[i].table_allocated = vlc_offs[i * 3 + 12] - vlc_offs[i * 3 + 11];
|
||||
init_vlc(&ff_vc1_mv_diff_vlc[i], VC1_MV_DIFF_VLC_BITS, 73,
|
||||
vlc_init(&ff_vc1_mv_diff_vlc[i], VC1_MV_DIFF_VLC_BITS, 73,
|
||||
vc1_mv_diff_bits[i], 1, 1,
|
||||
vc1_mv_diff_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_mv_diff_codes[i], 2, 2, VLC_INIT_USE_STATIC);
|
||||
}
|
||||
for (int i = 0; i < 8; i++) {
|
||||
ff_vc1_ac_coeff_table[i].table = &vlc_table[vlc_offs[i * 2 + 21]];
|
||||
ff_vc1_ac_coeff_table[i].table_allocated = vlc_offs[i * 2 + 22] - vlc_offs[i * 2 + 21];
|
||||
init_vlc(&ff_vc1_ac_coeff_table[i], AC_VLC_BITS, ff_vc1_ac_sizes[i],
|
||||
vlc_init(&ff_vc1_ac_coeff_table[i], AC_VLC_BITS, ff_vc1_ac_sizes[i],
|
||||
&vc1_ac_tables[i][0][1], 8, 4,
|
||||
&vc1_ac_tables[i][0][0], 8, 4, INIT_VLC_USE_NEW_STATIC);
|
||||
&vc1_ac_tables[i][0][0], 8, 4, VLC_INIT_USE_STATIC);
|
||||
/* initialize interlaced MVDATA tables (2-Ref) */
|
||||
ff_vc1_2ref_mvdata_vlc[i].table = &vlc_table[vlc_offs[i * 2 + 22]];
|
||||
ff_vc1_2ref_mvdata_vlc[i].table_allocated = vlc_offs[i * 2 + 23] - vlc_offs[i * 2 + 22];
|
||||
init_vlc(&ff_vc1_2ref_mvdata_vlc[i], VC1_2REF_MVDATA_VLC_BITS, 126,
|
||||
vlc_init(&ff_vc1_2ref_mvdata_vlc[i], VC1_2REF_MVDATA_VLC_BITS, 126,
|
||||
vc1_2ref_mvdata_bits[i], 1, 1,
|
||||
vc1_2ref_mvdata_codes[i], 4, 4, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_2ref_mvdata_codes[i], 4, 4, VLC_INIT_USE_STATIC);
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
/* initialize 4MV MBMODE VLC tables for interlaced frame P picture */
|
||||
ff_vc1_intfr_4mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 37]];
|
||||
ff_vc1_intfr_4mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 38] - vlc_offs[i * 3 + 37];
|
||||
init_vlc(&ff_vc1_intfr_4mv_mbmode_vlc[i], VC1_INTFR_4MV_MBMODE_VLC_BITS, 15,
|
||||
vlc_init(&ff_vc1_intfr_4mv_mbmode_vlc[i], VC1_INTFR_4MV_MBMODE_VLC_BITS, 15,
|
||||
vc1_intfr_4mv_mbmode_bits[i], 1, 1,
|
||||
vc1_intfr_4mv_mbmode_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_intfr_4mv_mbmode_codes[i], 2, 2, VLC_INIT_USE_STATIC);
|
||||
/* initialize NON-4MV MBMODE VLC tables for the same */
|
||||
ff_vc1_intfr_non4mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 38]];
|
||||
ff_vc1_intfr_non4mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 39] - vlc_offs[i * 3 + 38];
|
||||
init_vlc(&ff_vc1_intfr_non4mv_mbmode_vlc[i], VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 9,
|
||||
vlc_init(&ff_vc1_intfr_non4mv_mbmode_vlc[i], VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 9,
|
||||
vc1_intfr_non4mv_mbmode_bits[i], 1, 1,
|
||||
vc1_intfr_non4mv_mbmode_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_intfr_non4mv_mbmode_codes[i], 1, 1, VLC_INIT_USE_STATIC);
|
||||
/* initialize interlaced MVDATA tables (1-Ref) */
|
||||
ff_vc1_1ref_mvdata_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 39]];
|
||||
ff_vc1_1ref_mvdata_vlc[i].table_allocated = vlc_offs[i * 3 + 40] - vlc_offs[i * 3 + 39];
|
||||
init_vlc(&ff_vc1_1ref_mvdata_vlc[i], VC1_1REF_MVDATA_VLC_BITS, 72,
|
||||
vlc_init(&ff_vc1_1ref_mvdata_vlc[i], VC1_1REF_MVDATA_VLC_BITS, 72,
|
||||
vc1_1ref_mvdata_bits[i], 1, 1,
|
||||
vc1_1ref_mvdata_codes[i], 4, 4, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_1ref_mvdata_codes[i], 4, 4, VLC_INIT_USE_STATIC);
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
/* Initialize 2MV Block pattern VLC tables */
|
||||
ff_vc1_2mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i + 49]];
|
||||
ff_vc1_2mv_block_pattern_vlc[i].table_allocated = vlc_offs[i + 50] - vlc_offs[i + 49];
|
||||
init_vlc(&ff_vc1_2mv_block_pattern_vlc[i], VC1_2MV_BLOCK_PATTERN_VLC_BITS, 4,
|
||||
vlc_init(&ff_vc1_2mv_block_pattern_vlc[i], VC1_2MV_BLOCK_PATTERN_VLC_BITS, 4,
|
||||
vc1_2mv_block_pattern_bits[i], 1, 1,
|
||||
vc1_2mv_block_pattern_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_2mv_block_pattern_codes[i], 1, 1, VLC_INIT_USE_STATIC);
|
||||
}
|
||||
for (int i = 0; i < 8; i++) {
|
||||
/* Initialize interlaced CBPCY VLC tables (Table 124 - Table 131) */
|
||||
ff_vc1_icbpcy_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 53]];
|
||||
ff_vc1_icbpcy_vlc[i].table_allocated = vlc_offs[i * 3 + 54] - vlc_offs[i * 3 + 53];
|
||||
init_vlc(&ff_vc1_icbpcy_vlc[i], VC1_ICBPCY_VLC_BITS, 63,
|
||||
vlc_init(&ff_vc1_icbpcy_vlc[i], VC1_ICBPCY_VLC_BITS, 63,
|
||||
vc1_icbpcy_p_bits[i], 1, 1,
|
||||
vc1_icbpcy_p_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_icbpcy_p_codes[i], 2, 2, VLC_INIT_USE_STATIC);
|
||||
/* Initialize interlaced field picture MBMODE VLC tables */
|
||||
ff_vc1_if_mmv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 54]];
|
||||
ff_vc1_if_mmv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 55] - vlc_offs[i * 3 + 54];
|
||||
init_vlc(&ff_vc1_if_mmv_mbmode_vlc[i], VC1_IF_MMV_MBMODE_VLC_BITS, 8,
|
||||
vlc_init(&ff_vc1_if_mmv_mbmode_vlc[i], VC1_IF_MMV_MBMODE_VLC_BITS, 8,
|
||||
vc1_if_mmv_mbmode_bits[i], 1, 1,
|
||||
vc1_if_mmv_mbmode_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_if_mmv_mbmode_codes[i], 1, 1, VLC_INIT_USE_STATIC);
|
||||
ff_vc1_if_1mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 55]];
|
||||
ff_vc1_if_1mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 56] - vlc_offs[i * 3 + 55];
|
||||
init_vlc(&ff_vc1_if_1mv_mbmode_vlc[i], VC1_IF_1MV_MBMODE_VLC_BITS, 6,
|
||||
vlc_init(&ff_vc1_if_1mv_mbmode_vlc[i], VC1_IF_1MV_MBMODE_VLC_BITS, 6,
|
||||
vc1_if_1mv_mbmode_bits[i], 1, 1,
|
||||
vc1_if_1mv_mbmode_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
|
||||
vc1_if_1mv_mbmode_codes[i], 1, 1, VLC_INIT_USE_STATIC);
|
||||
}
|
||||
ff_msmp4_vc1_vlcs_init_once();
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ static int alloc_table(VLC *vlc, int size, int use_static)
|
||||
vlc->table_size += size;
|
||||
if (vlc->table_size > vlc->table_allocated) {
|
||||
if (use_static)
|
||||
abort(); // cannot do anything, init_vlc() is used with too little memory
|
||||
abort(); // cannot do anything, vlc_init() is used with too little memory
|
||||
vlc->table_allocated += (1 << vlc->bits);
|
||||
vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(*vlc->table));
|
||||
if (!vlc->table) {
|
||||
@ -100,7 +100,7 @@ static int vlc_common_init(VLC *vlc, int nb_bits, int nb_codes,
|
||||
{
|
||||
vlc->bits = nb_bits;
|
||||
vlc->table_size = 0;
|
||||
if (flags & INIT_VLC_USE_NEW_STATIC) {
|
||||
if (flags & VLC_INIT_USE_STATIC) {
|
||||
av_assert0(nb_codes <= LOCALBUF_ELEMS);
|
||||
} else {
|
||||
vlc->table = NULL;
|
||||
@ -144,7 +144,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
||||
if (table_nb_bits > 30)
|
||||
return AVERROR(EINVAL);
|
||||
table_size = 1 << table_nb_bits;
|
||||
table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
|
||||
table_index = alloc_table(vlc, table_size, flags & VLC_INIT_USE_STATIC);
|
||||
ff_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
|
||||
if (table_index < 0)
|
||||
return table_index;
|
||||
@ -162,7 +162,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
||||
int nb = 1 << (table_nb_bits - n);
|
||||
int inc = 1;
|
||||
|
||||
if (flags & INIT_VLC_OUTPUT_LE) {
|
||||
if (flags & VLC_INIT_OUTPUT_LE) {
|
||||
j = bitswap_32(code);
|
||||
inc = 1 << n;
|
||||
}
|
||||
@ -200,7 +200,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
||||
subtable_bits = FFMAX(subtable_bits, n);
|
||||
}
|
||||
subtable_bits = FFMIN(subtable_bits, table_nb_bits);
|
||||
j = (flags & INIT_VLC_OUTPUT_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix;
|
||||
j = (flags & VLC_INIT_OUTPUT_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix;
|
||||
table[j].len = -subtable_bits;
|
||||
ff_dlog(NULL, "%4x: n=%d (subtable)\n",
|
||||
j, codes[i].bits + table_nb_bits);
|
||||
@ -231,9 +231,9 @@ static int vlc_common_end(VLC *vlc, int nb_bits, int nb_codes, VLCcode *codes,
|
||||
{
|
||||
int ret = build_table(vlc, nb_bits, nb_codes, codes, flags);
|
||||
|
||||
if (flags & INIT_VLC_USE_NEW_STATIC) {
|
||||
if (flags & VLC_INIT_USE_STATIC) {
|
||||
if (vlc->table_size != vlc->table_allocated &&
|
||||
!(flags & (INIT_VLC_STATIC_OVERLONG & ~INIT_VLC_USE_NEW_STATIC)))
|
||||
!(flags & (VLC_INIT_STATIC_OVERLONG & ~VLC_INIT_USE_STATIC)))
|
||||
av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated);
|
||||
av_assert0(ret >= 0);
|
||||
} else {
|
||||
@ -247,7 +247,7 @@ static int vlc_common_end(VLC *vlc, int nb_bits, int nb_codes, VLCcode *codes,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
|
||||
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,
|
||||
@ -269,7 +269,7 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
|
||||
if (!(condition)) \
|
||||
continue; \
|
||||
if (len > 3*nb_bits || len > 32) { \
|
||||
av_log(NULL, AV_LOG_ERROR, "Too long VLC (%u) in init_vlc\n", len);\
|
||||
av_log(NULL, AV_LOG_ERROR, "Too long VLC (%u) in vlc_init\n", len);\
|
||||
if (buf != localbuf) \
|
||||
av_free(buf); \
|
||||
return AVERROR(EINVAL); \
|
||||
@ -278,12 +278,12 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
|
||||
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 %"PRIx32" for %d in " \
|
||||
"init_vlc\n", buf[j].code, i); \
|
||||
"vlc_init\n", buf[j].code, i); \
|
||||
if (buf != localbuf) \
|
||||
av_free(buf); \
|
||||
return AVERROR(EINVAL); \
|
||||
} \
|
||||
if (flags & INIT_VLC_INPUT_LE) \
|
||||
if (flags & VLC_INIT_INPUT_LE) \
|
||||
buf[j].code = bitswap_32(buf[j].code); \
|
||||
else \
|
||||
buf[j].code <<= 32 - buf[j].bits; \
|
||||
@ -294,7 +294,7 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
|
||||
j++; \
|
||||
}
|
||||
COPY(len > nb_bits);
|
||||
// qsort is the slowest part of init_vlc, and could probably be improved or avoided
|
||||
// qsort is the slowest part of vlc_init, and could probably be improved or avoided
|
||||
AV_QSORT(buf, j, struct VLCcode, compare_vlcspec);
|
||||
COPY(len && len <= nb_bits);
|
||||
nb_codes = j;
|
||||
@ -303,7 +303,7 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
|
||||
flags, localbuf);
|
||||
}
|
||||
|
||||
int ff_init_vlc_from_lengths(VLC *vlc, int nb_bits, int nb_codes,
|
||||
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)
|
||||
@ -427,7 +427,7 @@ static int vlc_multi_gen(VLC_MULTI_ELEM *table, const VLC *single,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_init_vlc_multi_from_lengths(VLC *vlc, VLC_MULTI *multi, int nb_bits, int nb_elems,
|
||||
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)
|
||||
@ -481,12 +481,12 @@ fail:
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
void ff_free_vlc_multi(VLC_MULTI *vlc)
|
||||
void ff_vlc_free_multi(VLC_MULTI *vlc)
|
||||
{
|
||||
av_freep(&vlc->table);
|
||||
}
|
||||
|
||||
void ff_free_vlc(VLC *vlc)
|
||||
void ff_vlc_free(VLC *vlc)
|
||||
{
|
||||
av_freep(&vlc->table);
|
||||
}
|
||||
|
@ -53,11 +53,11 @@ typedef struct RL_VLC_ELEM {
|
||||
uint8_t run;
|
||||
} RL_VLC_ELEM;
|
||||
|
||||
#define init_vlc(vlc, nb_bits, nb_codes, \
|
||||
#define vlc_init(vlc, nb_bits, nb_codes, \
|
||||
bits, bits_wrap, bits_size, \
|
||||
codes, codes_wrap, codes_size, \
|
||||
flags) \
|
||||
ff_init_vlc_sparse(vlc, nb_bits, nb_codes, \
|
||||
ff_vlc_init_sparse(vlc, nb_bits, nb_codes, \
|
||||
bits, bits_wrap, bits_size, \
|
||||
codes, codes_wrap, codes_size, \
|
||||
NULL, 0, 0, flags)
|
||||
@ -86,12 +86,12 @@ typedef struct RL_VLC_ELEM {
|
||||
* May be NULL, then 0, 1, 2, 3, 4,... will be used.
|
||||
* @param[in] symbols_wrap Stride (in bytes) of the symbols table.
|
||||
* @param[in] symbols_size Size of the symbols. 1 and 2 are supported.
|
||||
* @param[in] flags A combination of the INIT_VLC_* flags.
|
||||
* @param[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.
|
||||
*/
|
||||
int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
|
||||
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,
|
||||
@ -123,10 +123,10 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
|
||||
* @param[in] symbols_wrap Stride (in bytes) of the symbols.
|
||||
* @param[in] symbols_size Size of the symbols. 1 and 2 are supported.
|
||||
* @param[in] offset An offset to apply to all the valid symbols.
|
||||
* @param[in] flags A combination of the INIT_VLC_* flags; notice that
|
||||
* INIT_VLC_INPUT_LE is pointless and ignored.
|
||||
* @param[in] flags A combination of the VLC_INIT_* flags; notice that
|
||||
* VLC_INIT_INPUT_LE is pointless and ignored.
|
||||
*/
|
||||
int ff_init_vlc_from_lengths(VLC *vlc, int nb_bits, int nb_codes,
|
||||
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);
|
||||
@ -161,65 +161,65 @@ int ff_init_vlc_from_lengths(VLC *vlc, int nb_bits, int nb_codes,
|
||||
* @param[in] symbols_wrap Stride (in bytes) of the symbols.
|
||||
* @param[in] symbols_size Size of the symbols. 1 and 2 are supported.
|
||||
* @param[in] offset An offset to apply to all the valid symbols.
|
||||
* @param[in] flags A combination of the INIT_VLC_* flags; notice that
|
||||
* INIT_VLC_INPUT_LE is pointless and ignored.
|
||||
* @param[in] flags A combination of the VLC_INIT_* flags; notice that
|
||||
* VLC_INIT_INPUT_LE is pointless and ignored.
|
||||
*/
|
||||
int ff_init_vlc_multi_from_lengths(VLC *vlc, VLC_MULTI *multi, int nb_bits, int nb_elems,
|
||||
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);
|
||||
|
||||
|
||||
void ff_free_vlc_multi(VLC_MULTI *vlc);
|
||||
void ff_free_vlc(VLC *vlc);
|
||||
void ff_vlc_free_multi(VLC_MULTI *vlc);
|
||||
void ff_vlc_free(VLC *vlc);
|
||||
|
||||
/* If INIT_VLC_INPUT_LE is set, the LSB bit of the codes used to
|
||||
#define VLC_INIT_USE_STATIC 1
|
||||
#define VLC_INIT_STATIC_OVERLONG (2 | VLC_INIT_USE_STATIC)
|
||||
/* If VLC_INIT_INPUT_LE is set, the LSB bit of the codes used to
|
||||
* initialize the VLC table is the first bit to be read. */
|
||||
#define INIT_VLC_INPUT_LE 2
|
||||
#define VLC_INIT_INPUT_LE 4
|
||||
/* If set the VLC is intended for a little endian bitstream reader. */
|
||||
#define INIT_VLC_OUTPUT_LE 8
|
||||
#define INIT_VLC_LE (INIT_VLC_INPUT_LE | INIT_VLC_OUTPUT_LE)
|
||||
#define INIT_VLC_USE_NEW_STATIC 4
|
||||
#define INIT_VLC_STATIC_OVERLONG (1 | INIT_VLC_USE_NEW_STATIC)
|
||||
#define VLC_INIT_OUTPUT_LE 8
|
||||
#define VLC_INIT_LE (VLC_INIT_INPUT_LE | VLC_INIT_OUTPUT_LE)
|
||||
|
||||
#define INIT_CUSTOM_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \
|
||||
#define VLC_INIT_CUSTOM_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \
|
||||
h, i, j, flags, static_size) \
|
||||
do { \
|
||||
static VLCElem table[static_size]; \
|
||||
(vlc)->table = table; \
|
||||
(vlc)->table_allocated = static_size; \
|
||||
ff_init_vlc_sparse(vlc, bits, a, b, c, d, e, f, g, h, i, j, \
|
||||
flags | INIT_VLC_USE_NEW_STATIC); \
|
||||
ff_vlc_init_sparse(vlc, bits, a, b, c, d, e, f, g, h, i, j, \
|
||||
flags | VLC_INIT_USE_STATIC); \
|
||||
} while (0)
|
||||
|
||||
#define INIT_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, h, i, j, static_size) \
|
||||
INIT_CUSTOM_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \
|
||||
#define VLC_INIT_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, h, i, j, static_size) \
|
||||
VLC_INIT_CUSTOM_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \
|
||||
h, i, j, 0, static_size)
|
||||
|
||||
#define INIT_LE_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, h, i, j, static_size) \
|
||||
INIT_CUSTOM_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \
|
||||
h, i, j, INIT_VLC_LE, static_size)
|
||||
#define VLC_INIT_LE_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, h, i, j, static_size) \
|
||||
VLC_INIT_CUSTOM_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \
|
||||
h, i, j, VLC_INIT_LE, static_size)
|
||||
|
||||
#define INIT_CUSTOM_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, flags, static_size) \
|
||||
INIT_CUSTOM_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \
|
||||
#define VLC_INIT_CUSTOM_STATIC(vlc, bits, a, b, c, d, e, f, g, flags, static_size) \
|
||||
VLC_INIT_CUSTOM_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \
|
||||
NULL, 0, 0, flags, static_size)
|
||||
|
||||
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \
|
||||
INIT_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, NULL, 0, 0, static_size)
|
||||
#define VLC_INIT_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \
|
||||
VLC_INIT_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, NULL, 0, 0, static_size)
|
||||
|
||||
#define INIT_LE_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \
|
||||
INIT_LE_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, NULL, 0, 0, static_size)
|
||||
#define VLC_INIT_LE_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \
|
||||
VLC_INIT_LE_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, NULL, 0, 0, static_size)
|
||||
|
||||
#define INIT_VLC_STATIC_FROM_LENGTHS(vlc, bits, nb_codes, lens, len_wrap, \
|
||||
#define VLC_INIT_STATIC_FROM_LENGTHS(vlc, bits, nb_codes, lens, len_wrap, \
|
||||
symbols, symbols_wrap, symbols_size, \
|
||||
offset, flags, static_size) \
|
||||
do { \
|
||||
static VLCElem table[static_size]; \
|
||||
(vlc)->table = table; \
|
||||
(vlc)->table_allocated = static_size; \
|
||||
ff_init_vlc_from_lengths(vlc, bits, nb_codes, lens, len_wrap, \
|
||||
ff_vlc_init_from_lengths(vlc, bits, nb_codes, lens, len_wrap, \
|
||||
symbols, symbols_wrap, symbols_size, \
|
||||
offset, flags | INIT_VLC_USE_NEW_STATIC, \
|
||||
offset, flags | VLC_INIT_USE_STATIC, \
|
||||
NULL); \
|
||||
} while (0)
|
||||
|
||||
|
@ -210,7 +210,7 @@ static void vorbis_free(vorbis_context *vc)
|
||||
if (vc->codebooks)
|
||||
for (i = 0; i < vc->codebook_count; ++i) {
|
||||
av_freep(&vc->codebooks[i].codevectors);
|
||||
ff_free_vlc(&vc->codebooks[i].vlc);
|
||||
ff_vlc_free(&vc->codebooks[i].vlc);
|
||||
}
|
||||
av_freep(&vc->codebooks);
|
||||
|
||||
@ -454,11 +454,11 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
|
||||
|
||||
codebook_setup->maxdepth = (codebook_setup->maxdepth+codebook_setup->nb_bits - 1) / codebook_setup->nb_bits;
|
||||
|
||||
if ((ret = init_vlc(&codebook_setup->vlc, codebook_setup->nb_bits,
|
||||
if ((ret = vlc_init(&codebook_setup->vlc, codebook_setup->nb_bits,
|
||||
entries, tmp_vlc_bits, sizeof(*tmp_vlc_bits),
|
||||
sizeof(*tmp_vlc_bits), tmp_vlc_codes,
|
||||
sizeof(*tmp_vlc_codes), sizeof(*tmp_vlc_codes),
|
||||
INIT_VLC_LE))) {
|
||||
VLC_INIT_LE))) {
|
||||
av_log(vc->avctx, AV_LOG_ERROR, " Error generating vlc tables. \n");
|
||||
goto error;
|
||||
}
|
||||
|
@ -361,19 +361,19 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx)
|
||||
av_frame_free(&s->golden_frame.f);
|
||||
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(s->coeff_vlc); i++)
|
||||
ff_free_vlc(&s->coeff_vlc[i]);
|
||||
ff_vlc_free(&s->coeff_vlc[i]);
|
||||
|
||||
ff_free_vlc(&s->superblock_run_length_vlc);
|
||||
ff_free_vlc(&s->fragment_run_length_vlc);
|
||||
ff_free_vlc(&s->mode_code_vlc);
|
||||
ff_free_vlc(&s->motion_vector_vlc);
|
||||
ff_vlc_free(&s->superblock_run_length_vlc);
|
||||
ff_vlc_free(&s->fragment_run_length_vlc);
|
||||
ff_vlc_free(&s->mode_code_vlc);
|
||||
ff_vlc_free(&s->motion_vector_vlc);
|
||||
|
||||
for (j = 0; j < 2; j++)
|
||||
for (i = 0; i < 7; i++)
|
||||
ff_free_vlc(&s->vp4_mv_vlc[j][i]);
|
||||
ff_vlc_free(&s->vp4_mv_vlc[j][i]);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
ff_free_vlc(&s->block_pattern_vlc[i]);
|
||||
ff_vlc_free(&s->block_pattern_vlc[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2439,7 +2439,7 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
|
||||
/* init VLC tables */
|
||||
bias_tabs = CONFIG_VP4_DECODER && s->version >= 2 ? vp4_bias : vp3_bias;
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(s->coeff_vlc); i++) {
|
||||
ret = ff_init_vlc_from_lengths(&s->coeff_vlc[i], 11, 32,
|
||||
ret = ff_vlc_init_from_lengths(&s->coeff_vlc[i], 11, 32,
|
||||
&bias_tabs[i][0][1], 2,
|
||||
&bias_tabs[i][0][0], 2, 1,
|
||||
0, 0, avctx);
|
||||
@ -2450,7 +2450,7 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
|
||||
for (i = 0; i < FF_ARRAY_ELEMS(s->coeff_vlc); i++) {
|
||||
const HuffTable *tab = &s->huffman_table[i];
|
||||
|
||||
ret = ff_init_vlc_from_lengths(&s->coeff_vlc[i], 11, tab->nb_entries,
|
||||
ret = ff_vlc_init_from_lengths(&s->coeff_vlc[i], 11, tab->nb_entries,
|
||||
&tab->entries[0].len, sizeof(*tab->entries),
|
||||
&tab->entries[0].sym, sizeof(*tab->entries), 1,
|
||||
0, 0, avctx);
|
||||
@ -2459,25 +2459,25 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
|
||||
}
|
||||
}
|
||||
|
||||
ret = ff_init_vlc_from_lengths(&s->superblock_run_length_vlc, SUPERBLOCK_VLC_BITS, 34,
|
||||
ret = ff_vlc_init_from_lengths(&s->superblock_run_length_vlc, SUPERBLOCK_VLC_BITS, 34,
|
||||
superblock_run_length_vlc_lens, 1,
|
||||
NULL, 0, 0, 1, 0, avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = ff_init_vlc_from_lengths(&s->fragment_run_length_vlc, 5, 30,
|
||||
ret = ff_vlc_init_from_lengths(&s->fragment_run_length_vlc, 5, 30,
|
||||
fragment_run_length_vlc_len, 1,
|
||||
NULL, 0, 0, 0, 0, avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = ff_init_vlc_from_lengths(&s->mode_code_vlc, 3, 8,
|
||||
ret = ff_vlc_init_from_lengths(&s->mode_code_vlc, 3, 8,
|
||||
mode_code_vlc_len, 1,
|
||||
NULL, 0, 0, 0, 0, avctx);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = ff_init_vlc_from_lengths(&s->motion_vector_vlc, VP3_MV_VLC_BITS, 63,
|
||||
ret = ff_vlc_init_from_lengths(&s->motion_vector_vlc, VP3_MV_VLC_BITS, 63,
|
||||
&motion_vector_vlc_table[0][1], 2,
|
||||
&motion_vector_vlc_table[0][0], 2, 1,
|
||||
-31, 0, avctx);
|
||||
@ -2487,7 +2487,7 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
|
||||
#if CONFIG_VP4_DECODER
|
||||
for (j = 0; j < 2; j++)
|
||||
for (i = 0; i < 7; i++) {
|
||||
ret = ff_init_vlc_from_lengths(&s->vp4_mv_vlc[j][i], VP4_MV_VLC_BITS, 63,
|
||||
ret = ff_vlc_init_from_lengths(&s->vp4_mv_vlc[j][i], VP4_MV_VLC_BITS, 63,
|
||||
&vp4_mv_vlc[j][i][0][1], 2,
|
||||
&vp4_mv_vlc[j][i][0][0], 2, 1, -31,
|
||||
0, avctx);
|
||||
@ -2497,7 +2497,7 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
|
||||
|
||||
/* version >= 2 */
|
||||
for (i = 0; i < 2; i++)
|
||||
if ((ret = init_vlc(&s->block_pattern_vlc[i], 3, 14,
|
||||
if ((ret = vlc_init(&s->block_pattern_vlc[i], 3, 14,
|
||||
&vp4_block_pattern_vlc[i][0][1], 2, 1,
|
||||
&vp4_block_pattern_vlc[i][0][0], 2, 1, 0)) < 0)
|
||||
return ret;
|
||||
|
@ -279,7 +279,7 @@ static int vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[],
|
||||
nodes[map[2*i+1]].count = b + !b;
|
||||
}
|
||||
|
||||
ff_free_vlc(vlc);
|
||||
ff_vlc_free(vlc);
|
||||
/* then build the huffman tree according to probabilities */
|
||||
return ff_huff_build_tree(s->avctx, vlc, size, FF_HUFFMAN_BITS,
|
||||
nodes, vp6_huff_cmp,
|
||||
@ -708,11 +708,11 @@ static av_cold void vp6_decode_free_context(VP56Context *s)
|
||||
ff_vp56_free_context(s);
|
||||
|
||||
for (pt=0; pt<2; pt++) {
|
||||
ff_free_vlc(&s->dccv_vlc[pt]);
|
||||
ff_free_vlc(&s->runv_vlc[pt]);
|
||||
ff_vlc_free(&s->dccv_vlc[pt]);
|
||||
ff_vlc_free(&s->runv_vlc[pt]);
|
||||
for (ct=0; ct<3; ct++)
|
||||
for (cg=0; cg<6; cg++)
|
||||
ff_free_vlc(&s->ract_vlc[pt][ct][cg]);
|
||||
ff_vlc_free(&s->ract_vlc[pt][ct][cg]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ static VLC vector_vlc;
|
||||
|
||||
static av_cold void vqc_init_static_data(void)
|
||||
{
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&vector_vlc, VECTOR_VLC_BITS, FF_ARRAY_ELEMS(vector_nbits),
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&vector_vlc, VECTOR_VLC_BITS, FF_ARRAY_ELEMS(vector_nbits),
|
||||
vector_nbits, 1,
|
||||
vector_symbols, 1, 1,
|
||||
0, 0, 1 << VECTOR_VLC_BITS);
|
||||
|
@ -233,7 +233,7 @@ static void image_ctx_free(ImageContext *img)
|
||||
if (img->huffman_groups) {
|
||||
for (i = 0; i < img->nb_huffman_groups; i++) {
|
||||
for (j = 0; j < HUFFMAN_CODES_PER_META_CODE; j++)
|
||||
ff_free_vlc(&img->huffman_groups[i * HUFFMAN_CODES_PER_META_CODE + j].vlc);
|
||||
ff_vlc_free(&img->huffman_groups[i * HUFFMAN_CODES_PER_META_CODE + j].vlc);
|
||||
}
|
||||
av_free(img->huffman_groups);
|
||||
}
|
||||
@ -300,9 +300,9 @@ static int huff_reader_build_canonical(HuffReader *r, const uint8_t *code_length
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
ret = init_vlc(&r->vlc, 8, alphabet_size,
|
||||
ret = vlc_init(&r->vlc, 8, alphabet_size,
|
||||
code_lengths, sizeof(*code_lengths), sizeof(*code_lengths),
|
||||
codes, sizeof(*codes), sizeof(*codes), INIT_VLC_OUTPUT_LE);
|
||||
codes, sizeof(*codes), sizeof(*codes), VLC_INIT_OUTPUT_LE);
|
||||
if (ret < 0) {
|
||||
av_free(codes);
|
||||
return ret;
|
||||
@ -415,7 +415,7 @@ static int read_huffman_code_normal(WebPContext *s, HuffReader *hc,
|
||||
ret = huff_reader_build_canonical(hc, code_lengths, alphabet_size);
|
||||
|
||||
finish:
|
||||
ff_free_vlc(&code_len_hc.vlc);
|
||||
ff_vlc_free(&code_len_hc.vlc);
|
||||
av_free(code_lengths);
|
||||
return ret;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ static av_cold int init_coef_vlc(VLC *vlc, uint16_t **prun_table,
|
||||
float *flevel_table;
|
||||
int i, l, j, k, level, ret;
|
||||
|
||||
ret = init_vlc(vlc, VLCBITS, n, table_bits, 1, 1, table_codes, 4, 4, 0);
|
||||
ret = vlc_init(vlc, VLCBITS, n, table_bits, 1, 1, table_codes, 4, 4, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@ -372,11 +372,11 @@ int ff_wma_end(AVCodecContext *avctx)
|
||||
av_tx_uninit(&s->mdct_ctx[i]);
|
||||
|
||||
if (s->use_exp_vlc)
|
||||
ff_free_vlc(&s->exp_vlc);
|
||||
ff_vlc_free(&s->exp_vlc);
|
||||
if (s->use_noise_coding)
|
||||
ff_free_vlc(&s->hgain_vlc);
|
||||
ff_vlc_free(&s->hgain_vlc);
|
||||
for (i = 0; i < 2; i++) {
|
||||
ff_free_vlc(&s->coef_vlc[i]);
|
||||
ff_vlc_free(&s->coef_vlc[i]);
|
||||
av_freep(&s->run_table[i]);
|
||||
av_freep(&s->level_table[i]);
|
||||
av_freep(&s->int_table[i]);
|
||||
|
@ -119,7 +119,7 @@ static av_cold int wma_decode_init(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
if (s->use_noise_coding) {
|
||||
ret = ff_init_vlc_from_lengths(&s->hgain_vlc, HGAINVLCBITS,
|
||||
ret = ff_vlc_init_from_lengths(&s->hgain_vlc, HGAINVLCBITS,
|
||||
FF_ARRAY_ELEMS(ff_wma_hgain_hufftab),
|
||||
&ff_wma_hgain_hufftab[0][1], 2,
|
||||
&ff_wma_hgain_hufftab[0][0], 2, 1,
|
||||
@ -130,7 +130,7 @@ static av_cold int wma_decode_init(AVCodecContext *avctx)
|
||||
|
||||
if (s->use_exp_vlc) {
|
||||
// FIXME move out of context
|
||||
ret = init_vlc(&s->exp_vlc, EXPVLCBITS, sizeof(ff_aac_scalefactor_bits),
|
||||
ret = vlc_init(&s->exp_vlc, EXPVLCBITS, sizeof(ff_aac_scalefactor_bits),
|
||||
ff_aac_scalefactor_bits, 1, 1,
|
||||
ff_aac_scalefactor_code, 4, 4, 0);
|
||||
if (ret < 0)
|
||||
|
@ -320,25 +320,25 @@ static av_cold int get_rate(AVCodecContext *avctx)
|
||||
|
||||
static av_cold void decode_init_static(void)
|
||||
{
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&sf_vlc, SCALEVLCBITS, HUFF_SCALE_SIZE,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&sf_vlc, SCALEVLCBITS, HUFF_SCALE_SIZE,
|
||||
&scale_table[0][1], 2,
|
||||
&scale_table[0][0], 2, 1, -60, 0, 616);
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&sf_rl_vlc, VLCBITS, HUFF_SCALE_RL_SIZE,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&sf_rl_vlc, VLCBITS, HUFF_SCALE_RL_SIZE,
|
||||
&scale_rl_table[0][1], 2,
|
||||
&scale_rl_table[0][0], 2, 1, 0, 0, 1406);
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&coef_vlc[0], VLCBITS, HUFF_COEF0_SIZE,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&coef_vlc[0], VLCBITS, HUFF_COEF0_SIZE,
|
||||
coef0_lens, 1,
|
||||
coef0_syms, 2, 2, 0, 0, 2108);
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&coef_vlc[1], VLCBITS, HUFF_COEF1_SIZE,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&coef_vlc[1], VLCBITS, HUFF_COEF1_SIZE,
|
||||
&coef1_table[0][1], 2,
|
||||
&coef1_table[0][0], 2, 1, 0, 0, 3912);
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&vec4_vlc, VLCBITS, HUFF_VEC4_SIZE,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&vec4_vlc, VLCBITS, HUFF_VEC4_SIZE,
|
||||
vec4_lens, 1,
|
||||
vec4_syms, 2, 2, -1, 0, 604);
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&vec2_vlc, VLCBITS, HUFF_VEC2_SIZE,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&vec2_vlc, VLCBITS, HUFF_VEC2_SIZE,
|
||||
&vec2_table[0][1], 2,
|
||||
&vec2_table[0][0], 2, 1, -1, 0, 562);
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&vec1_vlc, VLCBITS, HUFF_VEC1_SIZE,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&vec1_vlc, VLCBITS, HUFF_VEC1_SIZE,
|
||||
&vec1_table[0][1], 2,
|
||||
&vec1_table[0][0], 2, 1, 0, 0, 562);
|
||||
|
||||
|
@ -320,7 +320,7 @@ static av_cold void wmavoice_init_static_data(void)
|
||||
14, 14, 14, 14
|
||||
};
|
||||
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&frame_type_vlc, VLC_NBITS,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&frame_type_vlc, VLC_NBITS,
|
||||
FF_ARRAY_ELEMS(bits), bits,
|
||||
1, NULL, 0, 0, 0, 0, 132);
|
||||
}
|
||||
|
@ -115,10 +115,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||
|
||||
static av_cold void wnv1_init_static(void)
|
||||
{
|
||||
INIT_VLC_STATIC_FROM_LENGTHS(&code_vlc, CODE_VLC_BITS, 16,
|
||||
VLC_INIT_STATIC_FROM_LENGTHS(&code_vlc, CODE_VLC_BITS, 16,
|
||||
&code_tab[0][1], 2,
|
||||
&code_tab[0][0], 2, 1,
|
||||
-7, INIT_VLC_OUTPUT_LE, 1 << CODE_VLC_BITS);
|
||||
-7, VLC_INIT_OUTPUT_LE, 1 << CODE_VLC_BITS);
|
||||
}
|
||||
|
||||
static av_cold int decode_init(AVCodecContext *avctx)
|
||||
|
@ -87,7 +87,7 @@ static int build_vlc(AVCodecContext *avctx, VLC *vlc, const uint32_t *table)
|
||||
uint8_t xlat[256];
|
||||
int cur_node, i, j, pos = 0;
|
||||
|
||||
ff_free_vlc(vlc);
|
||||
ff_vlc_free(vlc);
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
nodes[i].count = table[i];
|
||||
@ -142,7 +142,7 @@ static int build_vlc(AVCodecContext *avctx, VLC *vlc, const uint32_t *table)
|
||||
|
||||
get_tree_codes(bits, lens, xlat, nodes, cur_node - 1, 0, 0, &pos);
|
||||
|
||||
return ff_init_vlc_sparse(vlc, YLC_VLC_BITS, pos, lens, 2, 2,
|
||||
return ff_vlc_init_sparse(vlc, YLC_VLC_BITS, pos, lens, 2, 2,
|
||||
bits, 4, 4, xlat, 1, 1, 0);
|
||||
}
|
||||
|
||||
@ -438,7 +438,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
|
||||
YLCContext *s = avctx->priv_data;
|
||||
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(s->vlc); i++)
|
||||
ff_free_vlc(&s->vlc[i]);
|
||||
ff_vlc_free(&s->vlc[i]);
|
||||
av_freep(&s->buffer);
|
||||
s->buffer_size = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user