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 595324e143b57a52e2329eb47b84395c70f93087, so that the NEW has been dropped.) Finally, reorder the flags and change their values accordingly.
Unified · Split
| @@ -257,10 +257,10 @@ static av_cold void init_vlcs(void) · 256 unmodified lines | |||
| 257 | for (j = 0; j < 4; j++) { | 257 | for (j = 0; j < 4; j++) { |
| 258 | block_type_vlc[i][j].table = table[i][j]; | 258 | block_type_vlc[i][j].table = table[i][j]; |
| 259 | block_type_vlc[i][j].table_allocated = 32; | 259 | block_type_vlc[i][j].table_allocated = 32; |
| 260 | init_vlc(&block_type_vlc[i][j], BLOCK_TYPE_VLC_BITS, 7, | 260 | vlc_init(&block_type_vlc[i][j], BLOCK_TYPE_VLC_BITS, 7, |
| 261 | &block_type_tab[i][j][0][1], 2, 1, | 261 | &block_type_tab[i][j][0][1], 2, 1, |
| 262 | &block_type_tab[i][j][0][0], 2, 1, | 262 | &block_type_tab[i][j][0][0], 2, 1, |
| 263 | INIT_VLC_USE_NEW_STATIC); | 263 | VLC_INIT_USE_STATIC); |
| 264 | } | 264 | } |
| 265 | } | 265 | } |
| 266 | } | 266 | } |
| @@ -706,8 +706,8 @@ static const uint8_t *read_huffman_tables(FourXContext *f, · 439 unmodified lines | |||
| 706 | len_tab[j] = len; | 706 | len_tab[j] = len; |
| 707 | } | 707 | } |
| 708 | 708 | ||
| 709 | ff_free_vlc(&f->pre_vlc); | 709 | ff_vlc_free(&f->pre_vlc); |
| 710 | if (init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257, len_tab, 1, 1, | 710 | if (vlc_init(&f->pre_vlc, ACDC_VLC_BITS, 257, len_tab, 1, 1, |
| 711 | bits_tab, 4, 4, 0)) | 711 | bits_tab, 4, 4, 0)) |
| 712 | return NULL; | 712 | return NULL; |
| 713 | 713 | ||
| @@ -985,7 +985,7 @@ static av_cold int decode_end(AVCodecContext *avctx) · 271 unmodified lines | |||
| 985 | av_freep(&f->cfrm[i].data); | 985 | av_freep(&f->cfrm[i].data); |
| 986 | f->cfrm[i].allocated_size = 0; | 986 | f->cfrm[i].allocated_size = 0; |
| 987 | } | 987 | } |
| 988 | ff_free_vlc(&f->pre_vlc); | 988 | ff_vlc_free(&f->pre_vlc); |
| 989 | 989 | ||
| 990 | return 0; | 990 | return 0; |
| 991 | } | 991 | } |
| @@ -1133,14 +1133,14 @@ static av_cold void aac_static_table_init(void) · 1132 unmodified lines | |||
| 1133 | for (unsigned i = 0, offset = 0; i < 11; i++) { | 1133 | for (unsigned i = 0, offset = 0; i < 11; i++) { |
| 1134 | vlc_spectral[i].table = &vlc_buf[offset]; | 1134 | vlc_spectral[i].table = &vlc_buf[offset]; |
| 1135 | vlc_spectral[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset; | 1135 | vlc_spectral[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset; |
| 1136 | ff_init_vlc_sparse(&vlc_spectral[i], 8, ff_aac_spectral_sizes[i], | 1136 | ff_vlc_init_sparse(&vlc_spectral[i], 8, ff_aac_spectral_sizes[i], |
| 1137 | ff_aac_spectral_bits[i], sizeof(ff_aac_spectral_bits[i][0]), | 1137 | ff_aac_spectral_bits[i], sizeof(ff_aac_spectral_bits[i][0]), |
| 1138 | sizeof(ff_aac_spectral_bits[i][0]), | 1138 | sizeof(ff_aac_spectral_bits[i][0]), |
| 1139 | ff_aac_spectral_codes[i], sizeof(ff_aac_spectral_codes[i][0]), | 1139 | ff_aac_spectral_codes[i], sizeof(ff_aac_spectral_codes[i][0]), |
| 1140 | sizeof(ff_aac_spectral_codes[i][0]), | 1140 | sizeof(ff_aac_spectral_codes[i][0]), |
| 1141 | ff_aac_codebook_vector_idx[i], sizeof(ff_aac_codebook_vector_idx[i][0]), | 1141 | ff_aac_codebook_vector_idx[i], sizeof(ff_aac_codebook_vector_idx[i][0]), |
| 1142 | sizeof(ff_aac_codebook_vector_idx[i][0]), | 1142 | sizeof(ff_aac_codebook_vector_idx[i][0]), |
| 1143 | INIT_VLC_STATIC_OVERLONG); | 1143 | VLC_INIT_STATIC_OVERLONG); |
| 1144 | offset += vlc_spectral[i].table_size; | 1144 | offset += vlc_spectral[i].table_size; |
| 1145 | } | 1145 | } |
| 1146 | 1146 | ||
| @@ -1148,7 +1148,7 @@ static av_cold void aac_static_table_init(void) · 1 unmodified line | |||
| 1148 | 1148 | ||
| 1149 | ff_aac_tableinit(); | 1149 | ff_aac_tableinit(); |
| 1150 | 1150 | ||
| 1151 | INIT_VLC_STATIC(&vlc_scalefactors, 7, | 1151 | VLC_INIT_STATIC(&vlc_scalefactors, 7, |
| 1152 | FF_ARRAY_ELEMS(ff_aac_scalefactor_code), | 1152 | FF_ARRAY_ELEMS(ff_aac_scalefactor_code), |
| 1153 | ff_aac_scalefactor_bits, | 1153 | ff_aac_scalefactor_bits, |
| 1154 | sizeof(ff_aac_scalefactor_bits[0]), | 1154 | sizeof(ff_aac_scalefactor_bits[0]), |
| @@ -290,7 +290,7 @@ err: · 289 unmodified lines | |||
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | #define PS_INIT_VLC_STATIC(num, nb_bits, size) \ | 292 | #define PS_INIT_VLC_STATIC(num, nb_bits, size) \ |
| 293 | INIT_VLC_STATIC(&vlc_ps[num], nb_bits, ps_tmp[num].table_size / ps_tmp[num].elem_size, \ | 293 | VLC_INIT_STATIC(&vlc_ps[num], nb_bits, ps_tmp[num].table_size / ps_tmp[num].elem_size, \ |
| 294 | ps_tmp[num].ps_bits, 1, 1, \ | 294 | ps_tmp[num].ps_bits, 1, 1, \ |
| 295 | ps_tmp[num].ps_codes, ps_tmp[num].elem_size, ps_tmp[num].elem_size, \ | 295 | ps_tmp[num].ps_codes, ps_tmp[num].elem_size, ps_tmp[num].elem_size, \ |
| 296 | size); | 296 | size); |
| @@ -70,7 +70,7 @@ static const int8_t vlc_sbr_lav[10] = · 69 unmodified lines | |||
| 70 | { 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 }; | 70 | { 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 }; |
| 71 | 71 | ||
| 72 | #define SBR_INIT_VLC_STATIC(num, size) \ | 72 | #define SBR_INIT_VLC_STATIC(num, size) \ |
| 73 | INIT_VLC_STATIC(&vlc_sbr[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \ | 73 | VLC_INIT_STATIC(&vlc_sbr[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \ |
| 74 | sbr_tmp[num].sbr_bits , 1, 1, \ | 74 | sbr_tmp[num].sbr_bits , 1, 1, \ |
| 75 | sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, sbr_tmp[num].elem_size, \ | 75 | sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, sbr_tmp[num].elem_size, \ |
| 76 | size) | 76 | size) |
| @@ -1015,12 +1015,12 @@ static int build_huff(const uint8_t *bitlen, VLC *vlc) · 1014 unmodified lines | |||
| 1015 | } | 1015 | } |
| 1016 | } | 1016 | } |
| 1017 | 1017 | ||
| 1018 | ff_free_vlc(vlc); | 1018 | ff_vlc_free(vlc); |
| 1019 | return ff_init_vlc_sparse(vlc, 13, nb_codes, | 1019 | return ff_vlc_init_sparse(vlc, 13, nb_codes, |
| 1020 | bits, 1, 1, | 1020 | bits, 1, 1, |
| 1021 | codes, 4, 4, | 1021 | codes, 4, 4, |
| 1022 | symbols, 1, 1, | 1022 | symbols, 1, 1, |
| 1023 | INIT_VLC_LE); | 1023 | VLC_INIT_LE); |
| 1024 | } | 1024 | } |
| 1025 | 1025 | ||
| 1026 | static int decode_huffman2(AVCodecContext *avctx, int header, int size) | 1026 | static int decode_huffman2(AVCodecContext *avctx, int header, int size) |
| @@ -1255,7 +1255,7 @@ static av_cold int decode_close(AVCodecContext *avctx) · 228 unmodified lines | |||
| 1255 | { | 1255 | { |
| 1256 | AGMContext *s = avctx->priv_data; | 1256 | AGMContext *s = avctx->priv_data; |
| 1257 | 1257 | ||
| 1258 | ff_free_vlc(&s->vlc); | 1258 | ff_vlc_free(&s->vlc); |
| 1259 | av_frame_free(&s->prev_frame); | 1259 | av_frame_free(&s->prev_frame); |
| 1260 | av_freep(&s->mvectors); | 1260 | av_freep(&s->mvectors); |
| 1261 | s->mvectors_size = 0; | 1261 | s->mvectors_size = 0; |
| @@ -67,19 +67,19 @@ typedef struct ASVDecContext { · 66 unmodified lines | |||
| 67 | 67 | ||
| 68 | static av_cold void init_vlcs(void) | 68 | static av_cold void init_vlcs(void) |
| 69 | { | 69 | { |
| 70 | INIT_VLC_STATIC(&ccp_vlc, CCP_VLC_BITS, 17, | 70 | VLC_INIT_STATIC(&ccp_vlc, CCP_VLC_BITS, 17, |
| 71 | &ff_asv_ccp_tab[0][1], 2, 1, | 71 | &ff_asv_ccp_tab[0][1], 2, 1, |
| 72 | &ff_asv_ccp_tab[0][0], 2, 1, 32); | 72 | &ff_asv_ccp_tab[0][0], 2, 1, 32); |
| 73 | INIT_LE_VLC_STATIC(&dc_ccp_vlc, DC_CCP_VLC_BITS, 8, | 73 | VLC_INIT_LE_STATIC(&dc_ccp_vlc, DC_CCP_VLC_BITS, 8, |
| 74 | &ff_asv_dc_ccp_tab[0][1], 2, 1, | 74 | &ff_asv_dc_ccp_tab[0][1], 2, 1, |
| 75 | &ff_asv_dc_ccp_tab[0][0], 2, 1, 16); | 75 | &ff_asv_dc_ccp_tab[0][0], 2, 1, 16); |
| 76 | INIT_LE_VLC_STATIC(&ac_ccp_vlc, AC_CCP_VLC_BITS, 16, | 76 | VLC_INIT_LE_STATIC(&ac_ccp_vlc, AC_CCP_VLC_BITS, 16, |
| 77 | &ff_asv_ac_ccp_tab[0][1], 2, 1, | 77 | &ff_asv_ac_ccp_tab[0][1], 2, 1, |
| 78 | &ff_asv_ac_ccp_tab[0][0], 2, 1, 64); | 78 | &ff_asv_ac_ccp_tab[0][0], 2, 1, 64); |
| 79 | INIT_VLC_STATIC(&level_vlc, ASV1_LEVEL_VLC_BITS, 7, | 79 | VLC_INIT_STATIC(&level_vlc, ASV1_LEVEL_VLC_BITS, 7, |
| 80 | &ff_asv_level_tab[0][1], 2, 1, | 80 | &ff_asv_level_tab[0][1], 2, 1, |
| 81 | &ff_asv_level_tab[0][0], 2, 1, 16); | 81 | &ff_asv_level_tab[0][0], 2, 1, 16); |
| 82 | INIT_LE_VLC_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, | 82 | VLC_INIT_LE_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, |
| 83 | &ff_asv2_level_tab[0][1], 4, 2, | 83 | &ff_asv2_level_tab[0][1], 4, 2, |
| 84 | &ff_asv2_level_tab[0][0], 4, 2, 1024); | 84 | &ff_asv2_level_tab[0][0], 4, 2, 1024); |
| 85 | } | 85 | } |
| @@ -863,10 +863,10 @@ static av_cold void atrac3_init_static_data(void) · 862 unmodified lines | |||
| 863 | for (i = 0; i < 7; i++) { | 863 | for (i = 0; i < 7; i++) { |
| 864 | spectral_coeff_tab[i].table = table; | 864 | spectral_coeff_tab[i].table = table; |
| 865 | spectral_coeff_tab[i].table_allocated = 256; | 865 | spectral_coeff_tab[i].table_allocated = 256; |
| 866 | ff_init_vlc_from_lengths(&spectral_coeff_tab[i], ATRAC3_VLC_BITS, huff_tab_sizes[i], | 866 | ff_vlc_init_from_lengths(&spectral_coeff_tab[i], ATRAC3_VLC_BITS, huff_tab_sizes[i], |
| 867 | &hufftabs[0][1], 2, | 867 | &hufftabs[0][1], 2, |
| 868 | &hufftabs[0][0], 2, 1, | 868 | &hufftabs[0][0], 2, 1, |
| 869 | -31, INIT_VLC_USE_NEW_STATIC, NULL); | 869 | -31, VLC_INIT_USE_STATIC, NULL); |
| 870 | hufftabs += huff_tab_sizes[i]; | 870 | hufftabs += huff_tab_sizes[i]; |
| 871 | table += 256; | 871 | table += 256; |
| 872 | } | 872 | } |
| @@ -66,8 +66,8 @@ static av_cold void build_canonical_huff(const uint8_t *cb, const uint8_t **xlat · 65 unmodified lines | |||
| 66 | out_vlc->table = &tables_data[*tab_offset]; | 66 | out_vlc->table = &tables_data[*tab_offset]; |
| 67 | out_vlc->table_allocated = 1 << max_len; | 67 | out_vlc->table_allocated = 1 << max_len; |
| 68 | 68 | ||
| 69 | ff_init_vlc_from_lengths(out_vlc, max_len, index, bits, 1, | 69 | ff_vlc_init_from_lengths(out_vlc, max_len, index, bits, 1, |
| 70 | *xlat, 1, 1, 0, INIT_VLC_USE_NEW_STATIC, NULL); | 70 | *xlat, 1, 1, 0, VLC_INIT_USE_STATIC, NULL); |
| 71 | 71 | ||
| 72 | *tab_offset += 1 << max_len; | 72 | *tab_offset += 1 << max_len; |
| 73 | *xlat += index; | 73 | *xlat += index; |
| @@ -849,9 +849,9 @@ static av_cold void atrac9_init_vlc(VLC *vlc, int nb_bits, int nb_codes, · 848 unmodified lines | |||
| 849 | 849 | ||
| 850 | vlc->table = &vlc_buf[*buf_offset]; | 850 | vlc->table = &vlc_buf[*buf_offset]; |
| 851 | vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *buf_offset; | 851 | vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *buf_offset; |
| 852 | ff_init_vlc_from_lengths(vlc, nb_bits, nb_codes, | 852 | ff_vlc_init_from_lengths(vlc, nb_bits, nb_codes, |
| 853 | &(*tab)[0][1], 2, &(*tab)[0][0], 2, 1, | 853 | &(*tab)[0][1], 2, &(*tab)[0][0], 2, 1, |
| 854 | offset, INIT_VLC_STATIC_OVERLONG, NULL); | 854 | offset, VLC_INIT_STATIC_OVERLONG, NULL); |
| 855 | *buf_offset += vlc->table_size; | 855 | *buf_offset += vlc->table_size; |
| 856 | *tab += nb_codes; | 856 | *tab += nb_codes; |
| 857 | } | 857 | } |
| @@ -1318,9 +1318,9 @@ static av_cold void bink_init_vlcs(void) · 1317 unmodified lines | |||
| 1318 | bink_trees[i].table = table + offset; | 1318 | bink_trees[i].table = table + offset; |
| 1319 | bink_trees[i].table_allocated = 1 << maxbits; | 1319 | bink_trees[i].table_allocated = 1 << maxbits; |
| 1320 | offset += bink_trees[i].table_allocated; | 1320 | offset += bink_trees[i].table_allocated; |
| 1321 | init_vlc(&bink_trees[i], maxbits, 16, | 1321 | vlc_init(&bink_trees[i], maxbits, 16, |
| 1322 | bink_tree_lens[i], 1, 1, | 1322 | bink_tree_lens[i], 1, 1, |
| 1323 | bink_tree_bits[i], 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); | 1323 | bink_tree_bits[i], 1, 1, VLC_INIT_USE_STATIC | VLC_INIT_LE); |
| 1324 | } | 1324 | } |
| 1325 | } | 1325 | } |
| 1326 | 1326 | ||
| @@ -491,7 +491,7 @@ static inline int BS_FUNC(priv_set_idx)(BSCTX *bc, int code, int *n, · 490 unmodified lines | |||
| 491 | /** | 491 | /** |
| 492 | * Parse a vlc code. | 492 | * Parse a vlc code. |
| 493 | * @param bits is the number of bits which will be read at once, must be | 493 | * @param bits is the number of bits which will be read at once, must be |
| 494 | * identical to nb_bits in init_vlc() | 494 | * identical to nb_bits in vlc_init() |
| 495 | * @param max_depth is the number of times bits bits must be read to completely | 495 | * @param max_depth is the number of times bits bits must be read to completely |
| 496 | * read the longest vlc code | 496 | * read the longest vlc code |
| 497 | * = (max_vlc_length + bits - 1) / bits | 497 | * = (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, · 149 unmodified lines | |||
| 150 | } | 150 | } |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | ret = ff_init_vlc_from_lengths(&vlc, VLC_BITS, j, | 153 | ret = ff_vlc_init_from_lengths(&vlc, VLC_BITS, j, |
| 154 | &tmp[0].len, sizeof(tmp[0]), | 154 | &tmp[0].len, sizeof(tmp[0]), |
| 155 | NULL, 0, 0, 0, 0, logctx); | 155 | NULL, 0, 0, 0, 0, logctx); |
| 156 | if (ret < 0) | 156 | if (ret < 0) |
| @@ -173,7 +173,7 @@ static av_cold int cfhd_init_vlc(CFHD_RL_VLC_ELEM out[], unsigned out_size, · 16 unmodified lines | |||
| 173 | out[i].level = level; | 173 | out[i].level = level; |
| 174 | out[i].run = run; | 174 | out[i].run = run; |
| 175 | } | 175 | } |
| 176 | ff_free_vlc(&vlc); | 176 | ff_vlc_free(&vlc); |
| 177 | 177 | ||
| 178 | return 0; | 178 | return 0; |
| 179 | } | 179 | } |
| @@ -637,8 +637,8 @@ static av_cold void build_vlc(VLC *vlc, const uint8_t counts[16], · 636 unmodified lines | |||
| 637 | } | 637 | } |
| 638 | vlc->table = &vlc_buf[*offset]; | 638 | vlc->table = &vlc_buf[*offset]; |
| 639 | vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *offset; | 639 | vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *offset; |
| 640 | ff_init_vlc_from_lengths(vlc, CLV_VLC_BITS, num, lens, 1, | 640 | ff_vlc_init_from_lengths(vlc, CLV_VLC_BITS, num, lens, 1, |
| 641 | *syms, 2, 2, 0, INIT_VLC_STATIC_OVERLONG, NULL); | 641 | *syms, 2, 2, 0, VLC_INIT_STATIC_OVERLONG, NULL); |
| 642 | *syms += num; | 642 | *syms += num; |
| 643 | *offset += vlc->table_size; | 643 | *offset += vlc->table_size; |
| 644 | } | 644 | } |
| @@ -647,10 +647,10 @@ static av_cold void clv_init_static(void) · 2 unmodified lines | |||
| 647 | { | 647 | { |
| 648 | const uint16_t *mv_syms = clv_mv_syms, *bias_syms = clv_bias_syms; | 648 | const uint16_t *mv_syms = clv_mv_syms, *bias_syms = clv_bias_syms; |
| 649 | 649 | ||
| 650 | INIT_VLC_STATIC_FROM_LENGTHS(&dc_vlc, CLV_VLC_BITS, NUM_DC_CODES, | 650 | VLC_INIT_STATIC_FROM_LENGTHS(&dc_vlc, CLV_VLC_BITS, NUM_DC_CODES, |
| 651 | clv_dc_lens, 1, | 651 | clv_dc_lens, 1, |
| 652 | clv_dc_syms, 1, 1, -63, 0, 1104); | 652 | clv_dc_syms, 1, 1, -63, 0, 1104); |
| 653 | INIT_VLC_STATIC_FROM_LENGTHS(&ac_vlc, CLV_VLC_BITS, NUM_AC_CODES, | 653 | VLC_INIT_STATIC_FROM_LENGTHS(&ac_vlc, CLV_VLC_BITS, NUM_AC_CODES, |
| 654 | clv_ac_bits, 1, | 654 | clv_ac_bits, 1, |
| 655 | clv_ac_syms, 2, 2, 0, 0, 554); | 655 | clv_ac_syms, 2, 2, 0, 0, 554); |
| 656 | for (unsigned i = 0, j = 0, k = 0, offset = 0;; i++) { | 656 | for (unsigned i = 0, j = 0, k = 0, offset = 0;; i++) { |
| @@ -663,10 +663,10 @@ static av_cold void clv_init_static(void) · 6 unmodified lines | |||
| 663 | if (0x1B7 & (1 << i)) { | 663 | if (0x1B7 & (1 << i)) { |
| 664 | lev[i].flags_cb.table = &vlc_buf[offset]; | 664 | lev[i].flags_cb.table = &vlc_buf[offset]; |
| 665 | lev[i].flags_cb.table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset; | 665 | lev[i].flags_cb.table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset; |
| 666 | ff_init_vlc_from_lengths(&lev[i].flags_cb, CLV_VLC_BITS, 16, | 666 | ff_vlc_init_from_lengths(&lev[i].flags_cb, CLV_VLC_BITS, 16, |
| 667 | clv_flags_bits[j], 1, | 667 | clv_flags_bits[j], 1, |
| 668 | clv_flags_syms[j], 1, 1, | 668 | clv_flags_syms[j], 1, 1, |
| 669 | 0, INIT_VLC_STATIC_OVERLONG, NULL); | 669 | 0, VLC_INIT_STATIC_OVERLONG, NULL); |
| 670 | offset += lev[i].flags_cb.table_size; | 670 | offset += lev[i].flags_cb.table_size; |
| 671 | 671 | ||
| 672 | build_vlc(&lev[i + 1].bias_cb, clv_bias_len_counts[j], | 672 | 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) · 76 unmodified lines | |||
| 77 | } | 77 | } |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | return ff_init_vlc_from_lengths(vlc, VLC_BITS, count, bits, 1, | 80 | return ff_vlc_init_from_lengths(vlc, VLC_BITS, count, bits, 1, |
| 81 | symbols, 1, 1, 0, 0, ctx->avctx); | 81 | symbols, 1, 1, 0, 0, ctx->avctx); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| @@ -235,7 +235,7 @@ static int decode_argb_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic) · 151 unmodified lines | |||
| 235 | ret = read_code_table(ctx, gb, &vlc[i]); | 235 | ret = read_code_table(ctx, gb, &vlc[i]); |
| 236 | if (ret < 0) { | 236 | if (ret < 0) { |
| 237 | for (j = 0; j < i; j++) | 237 | for (j = 0; j < i; j++) |
| 238 | ff_free_vlc(&vlc[j]); | 238 | ff_vlc_free(&vlc[j]); |
| 239 | 239 | ||
| 240 | av_log(ctx->avctx, AV_LOG_ERROR, | 240 | av_log(ctx->avctx, AV_LOG_ERROR, |
| 241 | "Could not read code table %d.\n", i); | 241 | "Could not read code table %d.\n", i); |
| @@ -251,7 +251,7 @@ static int decode_argb_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic) · 9 unmodified lines | |||
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | for (i = 0; i < 4; i++) | 253 | for (i = 0; i < 4; i++) |
| 254 | ff_free_vlc(&vlc[i]); | 254 | ff_vlc_free(&vlc[i]); |
| 255 | 255 | ||
| 256 | return 0; | 256 | return 0; |
| 257 | } | 257 | } |
| @@ -278,7 +278,7 @@ static int decode_rgb24_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic) · 20 unmodified lines | |||
| 278 | ret = read_code_table(ctx, gb, &vlc[i]); | 278 | ret = read_code_table(ctx, gb, &vlc[i]); |
| 279 | if (ret < 0) { | 279 | if (ret < 0) { |
| 280 | for (j = 0; j < i; j++) | 280 | for (j = 0; j < i; j++) |
| 281 | ff_free_vlc(&vlc[j]); | 281 | ff_vlc_free(&vlc[j]); |
| 282 | 282 | ||
| 283 | av_log(ctx->avctx, AV_LOG_ERROR, | 283 | av_log(ctx->avctx, AV_LOG_ERROR, |
| 284 | "Could not read code table %d.\n", i); | 284 | "Could not read code table %d.\n", i); |
| @@ -295,7 +295,7 @@ static int decode_rgb24_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic) · 10 unmodified lines | |||
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | for (i = 0; i < 3; i++) | 297 | for (i = 0; i < 3; i++) |
| 298 | ff_free_vlc(&vlc[i]); | 298 | ff_vlc_free(&vlc[i]); |
| 299 | 299 | ||
| 300 | return 0; | 300 | return 0; |
| 301 | } | 301 | } |
| @@ -331,7 +331,7 @@ static int decode_yuv_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic) · 29 unmodified lines | |||
| 331 | ret = read_code_table(ctx, gb, &vlc[i]); | 331 | ret = read_code_table(ctx, gb, &vlc[i]); |
| 332 | if (ret < 0) { | 332 | if (ret < 0) { |
| 333 | for (j = 0; j < i; j++) | 333 | for (j = 0; j < i; j++) |
| 334 | ff_free_vlc(&vlc[j]); | 334 | ff_vlc_free(&vlc[j]); |
| 335 | 335 | ||
| 336 | av_log(ctx->avctx, AV_LOG_ERROR, | 336 | av_log(ctx->avctx, AV_LOG_ERROR, |
| 337 | "Could not read code table %d.\n", i); | 337 | "Could not read code table %d.\n", i); |
| @@ -350,7 +350,7 @@ static int decode_yuv_frame(CLLCContext *ctx, GetBitContext *gb, AVFrame *pic) · 12 unmodified lines | |||
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | for (i = 0; i < 2; i++) | 352 | for (i = 0; i < 2; i++) |
| 353 | ff_free_vlc(&vlc[i]); | 353 | ff_vlc_free(&vlc[i]); |
| 354 | 354 | ||
| 355 | return 0; | 355 | return 0; |
| 356 | } | 356 | } |
| @@ -208,7 +208,7 @@ static av_cold int build_vlc(VLC *vlc, int nb_bits, const uint8_t counts[16], · 207 unmodified lines | |||
| 208 | for (unsigned count = num + counts[i]; num < count; num++) | 208 | for (unsigned count = num + counts[i]; num < count; num++) |
| 209 | lens[num] = i + 1; | 209 | lens[num] = i + 1; |
| 210 | 210 | ||
| 211 | return ff_init_vlc_from_lengths(vlc, nb_bits, num, lens, 1, | 211 | return ff_vlc_init_from_lengths(vlc, nb_bits, num, lens, 1, |
| 212 | syms, symbol_size, symbol_size, | 212 | syms, symbol_size, symbol_size, |
| 213 | offset, 0, logctx); | 213 | offset, 0, logctx); |
| 214 | } | 214 | } |
| @@ -341,11 +341,11 @@ static av_cold int cook_decode_close(AVCodecContext *avctx) · 126 unmodified lines | |||
| 341 | 341 | ||
| 342 | /* Free the VLC tables. */ | 342 | /* Free the VLC tables. */ |
| 343 | for (i = 0; i < 13; i++) | 343 | for (i = 0; i < 13; i++) |
| 344 | ff_free_vlc(&q->envelope_quant_index[i]); | 344 | ff_vlc_free(&q->envelope_quant_index[i]); |
| 345 | for (i = 0; i < 7; i++) | 345 | for (i = 0; i < 7; i++) |
| 346 | ff_free_vlc(&q->sqvh[i]); | 346 | ff_vlc_free(&q->sqvh[i]); |
| 347 | for (i = 0; i < q->num_subpackets; i++) | 347 | for (i = 0; i < q->num_subpackets; i++) |
| 348 | ff_free_vlc(&q->subpacket[i].channel_coupling); | 348 | ff_vlc_free(&q->subpacket[i].channel_coupling); |
| 349 | 349 | ||
| 350 | av_log(avctx, AV_LOG_DEBUG, "Memory deallocated.\n"); | 350 | av_log(avctx, AV_LOG_DEBUG, "Memory deallocated.\n"); |
| 351 | 351 | ||
| @@ -796,9 +796,9 @@ av_cold void ff_dca_init_vlcs(void) · 795 unmodified lines | |||
| 796 | do { \ | 796 | do { \ |
| 797 | vlc.table = &dca_table[offset]; \ | 797 | vlc.table = &dca_table[offset]; \ |
| 798 | vlc.table_allocated = FF_ARRAY_ELEMS(dca_table) - offset; \ | 798 | vlc.table_allocated = FF_ARRAY_ELEMS(dca_table) - offset; \ |
| 799 | ff_init_vlc_from_lengths(&vlc, nb_bits, nb_codes, &src_table[0][1], 2, \ | 799 | ff_vlc_init_from_lengths(&vlc, nb_bits, nb_codes, &src_table[0][1], 2, \ |
| 800 | &src_table[0][0], 2, 1, entry_offset, \ | 800 | &src_table[0][0], 2, 1, entry_offset, \ |
| 801 | INIT_VLC_STATIC_OVERLONG, NULL); \ | 801 | VLC_INIT_STATIC_OVERLONG, NULL); \ |
| 802 | offset += vlc.table_size; \ | 802 | offset += vlc.table_size; \ |
| 803 | src_table += nb_codes; \ | 803 | src_table += nb_codes; \ |
| 804 | } while (0) | 804 | } while (0) |
| @@ -822,9 +822,9 @@ av_cold void ff_dca_init_vlcs(void) · 17 unmodified lines | |||
| 822 | do { \ | 822 | do { \ |
| 823 | vlc.table = &dca_table[offset]; \ | 823 | vlc.table = &dca_table[offset]; \ |
| 824 | vlc.table_allocated = FF_ARRAY_ELEMS(dca_table) - offset; \ | 824 | vlc.table_allocated = FF_ARRAY_ELEMS(dca_table) - offset; \ |
| 825 | ff_init_vlc_from_lengths(&vlc, nb_bits, nb_codes, &src_table[0][1], 2, \ | 825 | ff_vlc_init_from_lengths(&vlc, nb_bits, nb_codes, &src_table[0][1], 2, \ |
| 826 | &src_table[0][0], 2, 1, entry_offset, \ | 826 | &src_table[0][0], 2, 1, entry_offset, \ |
| 827 | INIT_VLC_STATIC_OVERLONG | INIT_VLC_LE,\ | 827 | VLC_INIT_STATIC_OVERLONG | VLC_INIT_LE,\ |
| 828 | NULL); \ | 828 | NULL); \ |
| 829 | offset += vlc.table_size; \ | 829 | offset += vlc.table_size; \ |
| 830 | src_table += nb_codes; \ | 830 | src_table += nb_codes; \ |
| @@ -130,19 +130,19 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth) · 129 unmodified lines | |||
| 130 | ctx->cid_table = cid_table; | 130 | ctx->cid_table = cid_table; |
| 131 | av_log(ctx->avctx, AV_LOG_VERBOSE, "Profile cid %"PRIu32".\n", cid); | 131 | av_log(ctx->avctx, AV_LOG_VERBOSE, "Profile cid %"PRIu32".\n", cid); |
| 132 | 132 | ||
| 133 | ff_free_vlc(&ctx->ac_vlc); | 133 | ff_vlc_free(&ctx->ac_vlc); |
| 134 | ff_free_vlc(&ctx->dc_vlc); | 134 | ff_vlc_free(&ctx->dc_vlc); |
| 135 | ff_free_vlc(&ctx->run_vlc); | 135 | ff_vlc_free(&ctx->run_vlc); |
| 136 | 136 | ||
| 137 | if ((ret = init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257, | 137 | if ((ret = vlc_init(&ctx->ac_vlc, DNXHD_VLC_BITS, 257, |
| 138 | ctx->cid_table->ac_bits, 1, 1, | 138 | ctx->cid_table->ac_bits, 1, 1, |
| 139 | ctx->cid_table->ac_codes, 2, 2, 0)) < 0) | 139 | ctx->cid_table->ac_codes, 2, 2, 0)) < 0) |
| 140 | goto out; | 140 | goto out; |
| 141 | if ((ret = init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, bitdepth > 8 ? 14 : 12, | 141 | if ((ret = vlc_init(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, bitdepth > 8 ? 14 : 12, |
| 142 | ctx->cid_table->dc_bits, 1, 1, | 142 | ctx->cid_table->dc_bits, 1, 1, |
| 143 | ctx->cid_table->dc_codes, 1, 1, 0)) < 0) | 143 | ctx->cid_table->dc_codes, 1, 1, 0)) < 0) |
| 144 | goto out; | 144 | goto out; |
| 145 | if ((ret = init_vlc(&ctx->run_vlc, DNXHD_VLC_BITS, 62, | 145 | if ((ret = vlc_init(&ctx->run_vlc, DNXHD_VLC_BITS, 62, |
| 146 | ctx->cid_table->run_bits, 1, 1, | 146 | ctx->cid_table->run_bits, 1, 1, |
| 147 | ctx->cid_table->run_codes, 2, 2, 0)) < 0) | 147 | ctx->cid_table->run_codes, 2, 2, 0)) < 0) |
| 148 | goto out; | 148 | goto out; |
| @@ -152,7 +152,7 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth) · 3 unmodified lines | |||
| 152 | ret = 0; | 152 | ret = 0; |
| 153 | out: | 153 | out: |
| 154 | if (ret < 0) | 154 | if (ret < 0) |
| 155 | av_log(ctx->avctx, AV_LOG_ERROR, "init_vlc failed\n"); | 155 | av_log(ctx->avctx, AV_LOG_ERROR, "vlc_init failed\n"); |
| 156 | return ret; | 156 | return ret; |
| 157 | } | 157 | } |
| 158 | 158 | ||
| @@ -716,9 +716,9 @@ static av_cold int dnxhd_decode_close(AVCodecContext *avctx) · 557 unmodified lines | |||
| 716 | { | 716 | { |
| 717 | DNXHDContext *ctx = avctx->priv_data; | 717 | DNXHDContext *ctx = avctx->priv_data; |
| 718 | 718 | ||
| 719 | ff_free_vlc(&ctx->ac_vlc); | 719 | ff_vlc_free(&ctx->ac_vlc); |
| 720 | ff_free_vlc(&ctx->dc_vlc); | 720 | ff_vlc_free(&ctx->dc_vlc); |
| 721 | ff_free_vlc(&ctx->run_vlc); | 721 | ff_vlc_free(&ctx->run_vlc); |
| 722 | 722 | ||
| 723 | av_freep(&ctx->rows); | 723 | av_freep(&ctx->rows); |
| 724 | 724 | ||
| @@ -175,9 +175,9 @@ static av_cold void dv_init_static(void) · 174 unmodified lines | |||
| 175 | 175 | ||
| 176 | /* NOTE: as a trick, we use the fact the no codes are unused | 176 | /* NOTE: as a trick, we use the fact the no codes are unused |
| 177 | * to accelerate the parsing of partial codes */ | 177 | * to accelerate the parsing of partial codes */ |
| 178 | ff_init_vlc_from_lengths(&dv_vlc, TEX_VLC_BITS, j, | 178 | ff_vlc_init_from_lengths(&dv_vlc, TEX_VLC_BITS, j, |
| 179 | &tmp[0].len, sizeof(tmp[0]), | 179 | &tmp[0].len, sizeof(tmp[0]), |
| 180 | NULL, 0, 0, 0, INIT_VLC_USE_NEW_STATIC, NULL); | 180 | NULL, 0, 0, 0, VLC_INIT_USE_STATIC, NULL); |
| 181 | av_assert1(dv_vlc.table_size == 1664); | 181 | av_assert1(dv_vlc.table_size == 1664); |
| 182 | 182 | ||
| 183 | for (int i = 0; i < dv_vlc.table_size; i++) { | 183 | for (int i = 0; i < dv_vlc.table_size; i++) { |
| @@ -404,8 +404,8 @@ static int huf_build_dec_table(const EXRContext *s, · 403 unmodified lines | |||
| 404 | td->he[j].code = td->freq[iM] >> 6; | 404 | td->he[j].code = td->freq[iM] >> 6; |
| 405 | j++; | 405 | j++; |
| 406 | 406 | ||
| 407 | ff_free_vlc(&td->vlc); | 407 | ff_vlc_free(&td->vlc); |
| 408 | return ff_init_vlc_sparse(&td->vlc, 12, j, | 408 | return ff_vlc_init_sparse(&td->vlc, 12, j, |
| 409 | &td->he[0].len, sizeof(td->he[0]), sizeof(td->he[0].len), | 409 | &td->he[0].len, sizeof(td->he[0]), sizeof(td->he[0].len), |
| 410 | &td->he[0].code, sizeof(td->he[0]), sizeof(td->he[0].code), | 410 | &td->he[0].code, sizeof(td->he[0]), sizeof(td->he[0].code), |
| 411 | &td->he[0].sym, sizeof(td->he[0]), sizeof(td->he[0].sym), 0); | 411 | &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) · 1872 unmodified lines | |||
| 2284 | av_freep(&td->dc_data); | 2284 | av_freep(&td->dc_data); |
| 2285 | av_freep(&td->rle_data); | 2285 | av_freep(&td->rle_data); |
| 2286 | av_freep(&td->rle_raw_data); | 2286 | av_freep(&td->rle_raw_data); |
| 2287 | ff_free_vlc(&td->vlc); | 2287 | ff_vlc_free(&td->vlc); |
| 2288 | } | 2288 | } |
| 2289 | 2289 | ||
| 2290 | av_freep(&s->thread_data); | 2290 | av_freep(&s->thread_data); |
| @@ -108,13 +108,13 @@ static av_cold void ccitt_unpack_init(void) · 107 unmodified lines | |||
| 108 | ccitt_vlc[1].table = code_table2; | 108 | ccitt_vlc[1].table = code_table2; |
| 109 | ccitt_vlc[1].table_allocated = 648; | 109 | ccitt_vlc[1].table_allocated = 648; |
| 110 | for (i = 0; i < 2; i++) { | 110 | for (i = 0; i < 2; i++) { |
| 111 | ff_init_vlc_sparse(&ccitt_vlc[i], 9, CCITT_SYMS, | 111 | ff_vlc_init_sparse(&ccitt_vlc[i], 9, CCITT_SYMS, |
| 112 | ccitt_codes_lens[i], 1, 1, | 112 | ccitt_codes_lens[i], 1, 1, |
| 113 | ccitt_codes_bits[i], 1, 1, | 113 | ccitt_codes_bits[i], 1, 1, |
| 114 | ccitt_syms, 2, 2, | 114 | ccitt_syms, 2, 2, |
| 115 | INIT_VLC_USE_NEW_STATIC); | 115 | VLC_INIT_USE_STATIC); |
| 116 | } | 116 | } |
| 117 | INIT_VLC_STATIC(&ccitt_group3_2d_vlc, 9, 11, | 117 | VLC_INIT_STATIC(&ccitt_group3_2d_vlc, 9, 11, |
| 118 | ccitt_group3_2d_lens, 1, 1, | 118 | ccitt_group3_2d_lens, 1, 1, |
| 119 | ccitt_group3_2d_bits, 1, 1, 512); | 119 | ccitt_group3_2d_bits, 1, 1, 512); |
| 120 | } | 120 | } |
| @@ -123,13 +123,13 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w, · 122 unmodified lines | |||
| 123 | else if (Uoff) | 123 | else if (Uoff) |
| 124 | dst[i] += 0x80; | 124 | dst[i] += 0x80; |
| 125 | if (get_bits_left(&gb) < 0) { | 125 | if (get_bits_left(&gb) < 0) { |
| 126 | ff_free_vlc(&vlc); | 126 | ff_vlc_free(&vlc); |
| 127 | return AVERROR_INVALIDDATA; | 127 | return AVERROR_INVALIDDATA; |
| 128 | } | 128 | } |
| 129 | } | 129 | } |
| 130 | dst += stride; | 130 | dst += stride; |
| 131 | } | 131 | } |
| 132 | ff_free_vlc(&vlc); | 132 | ff_vlc_free(&vlc); |
| 133 | return 0; | 133 | return 0; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| @@ -195,8 +195,8 @@ static av_cold void jpg_free_context(JPGContext *ctx) · 194 unmodified lines | |||
| 195 | int i; | 195 | int i; |
| 196 | 196 | ||
| 197 | for (i = 0; i < 2; i++) { | 197 | for (i = 0; i < 2; i++) { |
| 198 | ff_free_vlc(&ctx->dc_vlc[i]); | 198 | ff_vlc_free(&ctx->dc_vlc[i]); |
| 199 | ff_free_vlc(&ctx->ac_vlc[i]); | 199 | ff_vlc_free(&ctx->ac_vlc[i]); |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | av_freep(&ctx->buf); | 202 | av_freep(&ctx->buf); |
| @@ -643,7 +643,7 @@ static inline const uint8_t *align_get_bits(GetBitContext *s) · 642 unmodified lines | |||
| 643 | /** | 643 | /** |
| 644 | * Parse a vlc code. | 644 | * Parse a vlc code. |
| 645 | * @param bits is the number of bits which will be read at once, must be | 645 | * @param bits is the number of bits which will be read at once, must be |
| 646 | * identical to nb_bits in init_vlc() | 646 | * identical to nb_bits in vlc_init() |
| 647 | * @param max_depth is the number of times bits bits must be read to completely | 647 | * @param max_depth is the number of times bits bits must be read to completely |
| 648 | * read the longest vlc code | 648 | * read the longest vlc code |
| 649 | * = (max_vlc_length + bits - 1) / bits | 649 | * = (max_vlc_length + bits - 1) / bits |
| @@ -64,16 +64,16 @@ typedef struct H261DecContext { · 63 unmodified lines | |||
| 64 | 64 | ||
| 65 | static av_cold void h261_decode_init_static(void) | 65 | static av_cold void h261_decode_init_static(void) |
| 66 | { | 66 | { |
| 67 | INIT_VLC_STATIC(&h261_mba_vlc, H261_MBA_VLC_BITS, 35, | 67 | VLC_INIT_STATIC(&h261_mba_vlc, H261_MBA_VLC_BITS, 35, |
| 68 | ff_h261_mba_bits, 1, 1, | 68 | ff_h261_mba_bits, 1, 1, |
| 69 | ff_h261_mba_code, 1, 1, 540); | 69 | ff_h261_mba_code, 1, 1, 540); |
| 70 | INIT_VLC_STATIC(&h261_mtype_vlc, H261_MTYPE_VLC_BITS, 10, | 70 | VLC_INIT_STATIC(&h261_mtype_vlc, H261_MTYPE_VLC_BITS, 10, |
| 71 | ff_h261_mtype_bits, 1, 1, | 71 | ff_h261_mtype_bits, 1, 1, |
| 72 | ff_h261_mtype_code, 1, 1, 80); | 72 | ff_h261_mtype_code, 1, 1, 80); |
| 73 | INIT_VLC_STATIC(&h261_mv_vlc, H261_MV_VLC_BITS, 17, | 73 | VLC_INIT_STATIC(&h261_mv_vlc, H261_MV_VLC_BITS, 17, |
| 74 | &ff_h261_mv_tab[0][1], 2, 1, | 74 | &ff_h261_mv_tab[0][1], 2, 1, |
| 75 | &ff_h261_mv_tab[0][0], 2, 1, 144); | 75 | &ff_h261_mv_tab[0][0], 2, 1, 144); |
| 76 | INIT_VLC_STATIC(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63, | 76 | VLC_INIT_STATIC(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63, |
| 77 | &ff_h261_cbp_tab[0][1], 2, 1, | 77 | &ff_h261_cbp_tab[0][1], 2, 1, |
| 78 | &ff_h261_cbp_tab[0][0], 2, 1, 512); | 78 | &ff_h261_cbp_tab[0][0], 2, 1, 512); |
| 79 | INIT_FIRST_VLC_RL(ff_h261_rl_tcoeff, 552); | 79 | INIT_FIRST_VLC_RL(ff_h261_rl_tcoeff, 552); |
| @@ -328,26 +328,26 @@ av_cold void ff_h264_decode_init_vlc(void) · 327 unmodified lines | |||
| 328 | 328 | ||
| 329 | chroma_dc_coeff_token_vlc.table = chroma_dc_coeff_token_vlc_table; | 329 | chroma_dc_coeff_token_vlc.table = chroma_dc_coeff_token_vlc_table; |
| 330 | chroma_dc_coeff_token_vlc.table_allocated = chroma_dc_coeff_token_vlc_table_size; | 330 | chroma_dc_coeff_token_vlc.table_allocated = chroma_dc_coeff_token_vlc_table_size; |
| 331 | init_vlc(&chroma_dc_coeff_token_vlc, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 4*5, | 331 | vlc_init(&chroma_dc_coeff_token_vlc, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 4*5, |
| 332 | &chroma_dc_coeff_token_len [0], 1, 1, | 332 | &chroma_dc_coeff_token_len [0], 1, 1, |
| 333 | &chroma_dc_coeff_token_bits[0], 1, 1, | 333 | &chroma_dc_coeff_token_bits[0], 1, 1, |
| 334 | INIT_VLC_USE_NEW_STATIC); | 334 | VLC_INIT_USE_STATIC); |
| 335 | 335 | ||
| 336 | chroma422_dc_coeff_token_vlc.table = chroma422_dc_coeff_token_vlc_table; | 336 | chroma422_dc_coeff_token_vlc.table = chroma422_dc_coeff_token_vlc_table; |
| 337 | chroma422_dc_coeff_token_vlc.table_allocated = chroma422_dc_coeff_token_vlc_table_size; | 337 | chroma422_dc_coeff_token_vlc.table_allocated = chroma422_dc_coeff_token_vlc_table_size; |
| 338 | init_vlc(&chroma422_dc_coeff_token_vlc, CHROMA422_DC_COEFF_TOKEN_VLC_BITS, 4*9, | 338 | vlc_init(&chroma422_dc_coeff_token_vlc, CHROMA422_DC_COEFF_TOKEN_VLC_BITS, 4*9, |
| 339 | &chroma422_dc_coeff_token_len [0], 1, 1, | 339 | &chroma422_dc_coeff_token_len [0], 1, 1, |
| 340 | &chroma422_dc_coeff_token_bits[0], 1, 1, | 340 | &chroma422_dc_coeff_token_bits[0], 1, 1, |
| 341 | INIT_VLC_USE_NEW_STATIC); | 341 | VLC_INIT_USE_STATIC); |
| 342 | 342 | ||
| 343 | offset = 0; | 343 | offset = 0; |
| 344 | for (int i = 0; i < 4; i++) { | 344 | for (int i = 0; i < 4; i++) { |
| 345 | coeff_token_vlc[i].table = coeff_token_vlc_tables + offset; | 345 | coeff_token_vlc[i].table = coeff_token_vlc_tables + offset; |
| 346 | coeff_token_vlc[i].table_allocated = coeff_token_vlc_tables_size[i]; | 346 | coeff_token_vlc[i].table_allocated = coeff_token_vlc_tables_size[i]; |
| 347 | init_vlc(&coeff_token_vlc[i], COEFF_TOKEN_VLC_BITS, 4*17, | 347 | vlc_init(&coeff_token_vlc[i], COEFF_TOKEN_VLC_BITS, 4*17, |
| 348 | &coeff_token_len [i][0], 1, 1, | 348 | &coeff_token_len [i][0], 1, 1, |
| 349 | &coeff_token_bits[i][0], 1, 1, | 349 | &coeff_token_bits[i][0], 1, 1, |
| 350 | INIT_VLC_USE_NEW_STATIC); | 350 | VLC_INIT_USE_STATIC); |
| 351 | offset += coeff_token_vlc_tables_size[i]; | 351 | offset += coeff_token_vlc_tables_size[i]; |
| 352 | } | 352 | } |
| 353 | /* | 353 | /* |
| @@ -360,48 +360,48 @@ av_cold void ff_h264_decode_init_vlc(void) · 6 unmodified lines | |||
| 360 | for (int i = 0; i < 3; i++) { | 360 | for (int i = 0; i < 3; i++) { |
| 361 | chroma_dc_total_zeros_vlc[i + 1].table = chroma_dc_total_zeros_vlc_tables[i]; | 361 | chroma_dc_total_zeros_vlc[i + 1].table = chroma_dc_total_zeros_vlc_tables[i]; |
| 362 | chroma_dc_total_zeros_vlc[i + 1].table_allocated = chroma_dc_total_zeros_vlc_tables_size; | 362 | chroma_dc_total_zeros_vlc[i + 1].table_allocated = chroma_dc_total_zeros_vlc_tables_size; |
| 363 | init_vlc(&chroma_dc_total_zeros_vlc[i + 1], | 363 | vlc_init(&chroma_dc_total_zeros_vlc[i + 1], |
| 364 | CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 4, | 364 | CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 4, |
| 365 | &chroma_dc_total_zeros_len [i][0], 1, 1, | 365 | &chroma_dc_total_zeros_len [i][0], 1, 1, |
| 366 | &chroma_dc_total_zeros_bits[i][0], 1, 1, | 366 | &chroma_dc_total_zeros_bits[i][0], 1, 1, |
| 367 | INIT_VLC_USE_NEW_STATIC); | 367 | VLC_INIT_USE_STATIC); |
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | for (int i = 0; i < 7; i++) { | 370 | for (int i = 0; i < 7; i++) { |
| 371 | chroma422_dc_total_zeros_vlc[i + 1].table = chroma422_dc_total_zeros_vlc_tables[i]; | 371 | chroma422_dc_total_zeros_vlc[i + 1].table = chroma422_dc_total_zeros_vlc_tables[i]; |
| 372 | chroma422_dc_total_zeros_vlc[i + 1].table_allocated = chroma422_dc_total_zeros_vlc_tables_size; | 372 | chroma422_dc_total_zeros_vlc[i + 1].table_allocated = chroma422_dc_total_zeros_vlc_tables_size; |
| 373 | init_vlc(&chroma422_dc_total_zeros_vlc[i + 1], | 373 | vlc_init(&chroma422_dc_total_zeros_vlc[i + 1], |
| 374 | CHROMA422_DC_TOTAL_ZEROS_VLC_BITS, 8, | 374 | CHROMA422_DC_TOTAL_ZEROS_VLC_BITS, 8, |
| 375 | &chroma422_dc_total_zeros_len [i][0], 1, 1, | 375 | &chroma422_dc_total_zeros_len [i][0], 1, 1, |
| 376 | &chroma422_dc_total_zeros_bits[i][0], 1, 1, | 376 | &chroma422_dc_total_zeros_bits[i][0], 1, 1, |
| 377 | INIT_VLC_USE_NEW_STATIC); | 377 | VLC_INIT_USE_STATIC); |
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | for (int i = 0; i < 15; i++) { | 380 | for (int i = 0; i < 15; i++) { |
| 381 | total_zeros_vlc[i + 1].table = total_zeros_vlc_tables[i]; | 381 | total_zeros_vlc[i + 1].table = total_zeros_vlc_tables[i]; |
| 382 | total_zeros_vlc[i + 1].table_allocated = total_zeros_vlc_tables_size; | 382 | total_zeros_vlc[i + 1].table_allocated = total_zeros_vlc_tables_size; |
| 383 | init_vlc(&total_zeros_vlc[i + 1], | 383 | vlc_init(&total_zeros_vlc[i + 1], |
| 384 | TOTAL_ZEROS_VLC_BITS, 16, | 384 | TOTAL_ZEROS_VLC_BITS, 16, |
| 385 | &total_zeros_len [i][0], 1, 1, | 385 | &total_zeros_len [i][0], 1, 1, |
| 386 | &total_zeros_bits[i][0], 1, 1, | 386 | &total_zeros_bits[i][0], 1, 1, |
| 387 | INIT_VLC_USE_NEW_STATIC); | 387 | VLC_INIT_USE_STATIC); |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | for (int i = 0; i < 6; i++) { | 390 | for (int i = 0; i < 6; i++) { |
| 391 | run_vlc[i + 1].table = run_vlc_tables[i]; | 391 | run_vlc[i + 1].table = run_vlc_tables[i]; |
| 392 | run_vlc[i + 1].table_allocated = run_vlc_tables_size; | 392 | run_vlc[i + 1].table_allocated = run_vlc_tables_size; |
| 393 | init_vlc(&run_vlc[i + 1], | 393 | vlc_init(&run_vlc[i + 1], |
| 394 | RUN_VLC_BITS, 7, | 394 | RUN_VLC_BITS, 7, |
| 395 | &run_len [i][0], 1, 1, | 395 | &run_len [i][0], 1, 1, |
| 396 | &run_bits[i][0], 1, 1, | 396 | &run_bits[i][0], 1, 1, |
| 397 | INIT_VLC_USE_NEW_STATIC); | 397 | VLC_INIT_USE_STATIC); |
| 398 | } | 398 | } |
| 399 | run7_vlc.table = run7_vlc_table; | 399 | run7_vlc.table = run7_vlc_table; |
| 400 | run7_vlc.table_allocated = run7_vlc_table_size; | 400 | run7_vlc.table_allocated = run7_vlc_table_size; |
| 401 | init_vlc(&run7_vlc, RUN7_VLC_BITS, 16, | 401 | vlc_init(&run7_vlc, RUN7_VLC_BITS, 16, |
| 402 | &run_len [6][0], 1, 1, | 402 | &run_len [6][0], 1, 1, |
| 403 | &run_bits[6][0], 1, 1, | 403 | &run_bits[6][0], 1, 1, |
| 404 | INIT_VLC_USE_NEW_STATIC); | 404 | VLC_INIT_USE_STATIC); |
| 405 | 405 | ||
| 406 | init_cavlc_level_tab(); | 406 | init_cavlc_level_tab(); |
| 407 | } | 407 | } |
| @@ -376,8 +376,8 @@ static av_cold int hq_hqa_decode_close(AVCodecContext *avctx) · 375 unmodified lines | |||
| 376 | { | 376 | { |
| 377 | HQContext *ctx = avctx->priv_data; | 377 | HQContext *ctx = avctx->priv_data; |
| 378 | 378 | ||
| 379 | ff_free_vlc(&ctx->hq_ac_vlc); | 379 | ff_vlc_free(&ctx->hq_ac_vlc); |
| 380 | ff_free_vlc(&ctx->hqa_cbp_vlc); | 380 | ff_vlc_free(&ctx->hqa_cbp_vlc); |
| 381 | 381 | ||
| 382 | return 0; | 382 | return 0; |
| 383 | } | 383 | } |
| @@ -8367,11 +8367,11 @@ const HQProfile ff_hq_profile[NUM_HQ_PROFILES] = { · 8366 unmodified lines | |||
| 8367 | 8367 | ||
| 8368 | av_cold int ff_hq_init_vlcs(HQContext *c) | 8368 | av_cold int ff_hq_init_vlcs(HQContext *c) |
| 8369 | { | 8369 | { |
| 8370 | int ret = init_vlc(&c->hqa_cbp_vlc, 5, FF_ARRAY_ELEMS(cbp_vlc_lens), | 8370 | int ret = vlc_init(&c->hqa_cbp_vlc, 5, FF_ARRAY_ELEMS(cbp_vlc_lens), |
| 8371 | cbp_vlc_lens, 1, 1, cbp_vlc_bits, 1, 1, 0); | 8371 | cbp_vlc_lens, 1, 1, cbp_vlc_bits, 1, 1, 0); |
| 8372 | if (ret < 0) | 8372 | if (ret < 0) |
| 8373 | return ret; | 8373 | return ret; |
| 8374 | 8374 | ||
| 8375 | return init_vlc(&c->hq_ac_vlc, 9, NUM_HQ_AC_ENTRIES, | 8375 | return vlc_init(&c->hq_ac_vlc, 9, NUM_HQ_AC_ENTRIES, |
| 8376 | hq_ac_bits, 1, 1, hq_ac_codes, 2, 2, 0); | 8376 | hq_ac_bits, 1, 1, hq_ac_codes, 2, 2, 0); |
| 8377 | } | 8377 | } |
| @@ -517,9 +517,9 @@ static av_cold int hqx_decode_close(AVCodecContext *avctx) · 516 unmodified lines | |||
| 517 | int i; | 517 | int i; |
| 518 | HQXContext *ctx = avctx->priv_data; | 518 | HQXContext *ctx = avctx->priv_data; |
| 519 | 519 | ||
| 520 | ff_free_vlc(&ctx->cbp_vlc); | 520 | ff_vlc_free(&ctx->cbp_vlc); |
| 521 | for (i = 0; i < 3; i++) { | 521 | for (i = 0; i < 3; i++) { |
| 522 | ff_free_vlc(&ctx->dc_vlc[i]); | 522 | ff_vlc_free(&ctx->dc_vlc[i]); |
| 523 | } | 523 | } |
| 524 | 524 | ||
| 525 | return 0; | 525 | return 0; |
| @@ -2140,7 +2140,7 @@ const HQXAC ff_hqx_ac[NUM_HQX_AC] = { · 2139 unmodified lines | |||
| 2140 | 2140 | ||
| 2141 | #define INIT_DC_TABLE(idx, name) \ | 2141 | #define INIT_DC_TABLE(idx, name) \ |
| 2142 | do { \ | 2142 | do { \ |
| 2143 | ret = init_vlc(&ctx->dc_vlc[idx], HQX_DC_VLC_BITS, \ | 2143 | ret = vlc_init(&ctx->dc_vlc[idx], HQX_DC_VLC_BITS, \ |
| 2144 | FF_ARRAY_ELEMS(name ## _vlc_lens), \ | 2144 | FF_ARRAY_ELEMS(name ## _vlc_lens), \ |
| 2145 | name ## _vlc_lens, 1, 1, \ | 2145 | name ## _vlc_lens, 1, 1, \ |
| 2146 | name ## _vlc_bits, 2, 2, 0); \ | 2146 | name ## _vlc_bits, 2, 2, 0); \ |
| @@ -2150,7 +2150,7 @@ const HQXAC ff_hqx_ac[NUM_HQX_AC] = { · 3 unmodified lines | |||
| 2150 | 2150 | ||
| 2151 | av_cold int ff_hqx_init_vlcs(HQXContext *ctx) | 2151 | av_cold int ff_hqx_init_vlcs(HQXContext *ctx) |
| 2152 | { | 2152 | { |
| 2153 | int ret = init_vlc(&ctx->cbp_vlc, HQX_CBP_VLC_BITS, FF_ARRAY_ELEMS(cbp_vlc_lens), | 2153 | int ret = vlc_init(&ctx->cbp_vlc, HQX_CBP_VLC_BITS, FF_ARRAY_ELEMS(cbp_vlc_lens), |
| 2154 | cbp_vlc_lens, 1, 1, cbp_vlc_bits, 1, 1, 0); | 2154 | cbp_vlc_lens, 1, 1, cbp_vlc_bits, 1, 1, 0); |
| 2155 | if (ret < 0) | 2155 | if (ret < 0) |
| 2156 | return ret; | 2156 | return ret; |
| @@ -148,7 +148,7 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags, int nb_bi · 147 unmodified lines | |||
| 148 | 148 | ||
| 149 | get_tree_codes(bits, lens, xlat, nodes, head, 0, 0, | 149 | get_tree_codes(bits, lens, xlat, nodes, head, 0, 0, |
| 150 | &pos, no_zero_count); | 150 | &pos, no_zero_count); |
| 151 | return ff_init_vlc_sparse(vlc, nb_bits, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0); | 151 | return ff_vlc_init_sparse(vlc, nb_bits, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | 154 | ||
| @@ -193,8 +193,8 @@ static int generate_joint_tables(HYuvDecContext *s) · 192 unmodified lines | |||
| 193 | i++; | 193 | i++; |
| 194 | } | 194 | } |
| 195 | } | 195 | } |
| 196 | ff_free_vlc(&s->vlc[4 + p]); | 196 | ff_vlc_free(&s->vlc[4 + p]); |
| 197 | if ((ret = ff_init_vlc_sparse(&s->vlc[4 + p], VLC_BITS, i, len, 1, 1, | 197 | if ((ret = ff_vlc_init_sparse(&s->vlc[4 + p], VLC_BITS, i, len, 1, 1, |
| 198 | bits, 2, 2, symbols, 2, 2, 0)) < 0) | 198 | bits, 2, 2, symbols, 2, 2, 0)) < 0) |
| 199 | goto out; | 199 | goto out; |
| 200 | } | 200 | } |
| @@ -237,8 +237,8 @@ static int generate_joint_tables(HYuvDecContext *s) · 36 unmodified lines | |||
| 237 | } | 237 | } |
| 238 | } | 238 | } |
| 239 | } | 239 | } |
| 240 | ff_free_vlc(&s->vlc[4]); | 240 | ff_vlc_free(&s->vlc[4]); |
| 241 | if ((ret = init_vlc(&s->vlc[4], VLC_BITS, i, len, 1, 1, | 241 | if ((ret = vlc_init(&s->vlc[4], VLC_BITS, i, len, 1, 1, |
| 242 | bits, 2, 2, 0)) < 0) | 242 | bits, 2, 2, 0)) < 0) |
| 243 | goto out; | 243 | goto out; |
| 244 | } | 244 | } |
| @@ -265,8 +265,8 @@ static int read_huffman_tables(HYuvDecContext *s, const uint8_t *src, int length · 20 unmodified lines | |||
| 265 | return ret; | 265 | return ret; |
| 266 | if ((ret = ff_huffyuv_generate_bits_table(s->bits[i], s->len[i], s->vlc_n)) < 0) | 266 | if ((ret = ff_huffyuv_generate_bits_table(s->bits[i], s->len[i], s->vlc_n)) < 0) |
| 267 | return ret; | 267 | return ret; |
| 268 | ff_free_vlc(&s->vlc[i]); | 268 | ff_vlc_free(&s->vlc[i]); |
| 269 | if ((ret = init_vlc(&s->vlc[i], VLC_BITS, s->vlc_n, s->len[i], 1, 1, | 269 | if ((ret = vlc_init(&s->vlc[i], VLC_BITS, s->vlc_n, s->len[i], 1, 1, |
| 270 | s->bits[i], 4, 4, 0)) < 0) | 270 | s->bits[i], 4, 4, 0)) < 0) |
| 271 | return ret; | 271 | return ret; |
| 272 | } | 272 | } |
| @@ -305,8 +305,8 @@ static int read_old_huffman_tables(HYuvDecContext *s) · 32 unmodified lines | |||
| 305 | memcpy(s->len[2], s->len[1], 256 * sizeof(uint8_t)); | 305 | memcpy(s->len[2], s->len[1], 256 * sizeof(uint8_t)); |
| 306 | 306 | ||
| 307 | for (i = 0; i < 4; i++) { | 307 | for (i = 0; i < 4; i++) { |
| 308 | ff_free_vlc(&s->vlc[i]); | 308 | ff_vlc_free(&s->vlc[i]); |
| 309 | if ((ret = init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, | 309 | if ((ret = vlc_init(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, |
| 310 | s->bits[i], 4, 4, 0)) < 0) | 310 | s->bits[i], 4, 4, 0)) < 0) |
| 311 | return ret; | 311 | return ret; |
| 312 | } | 312 | } |
| @@ -326,7 +326,7 @@ static av_cold int decode_end(AVCodecContext *avctx) · 13 unmodified lines | |||
| 326 | av_freep(&s->bitstream_buffer); | 326 | av_freep(&s->bitstream_buffer); |
| 327 | 327 | ||
| 328 | for (i = 0; i < 8; i++) | 328 | for (i = 0; i < 8; i++) |
| 329 | ff_free_vlc(&s->vlc[i]); | 329 | ff_vlc_free(&s->vlc[i]); |
| 330 | 330 | ||
| 331 | return 0; | 331 | return 0; |
| 332 | } | 332 | } |
| @@ -176,10 +176,10 @@ static av_cold void imc_init_static(void) · 175 unmodified lines | |||
| 176 | for (int j = 0; j < 4; j++) { | 176 | for (int j = 0; j < 4; j++) { |
| 177 | huffman_vlc[i][j].table = &vlc_tables[offset]; | 177 | huffman_vlc[i][j].table = &vlc_tables[offset]; |
| 178 | huffman_vlc[i][j].table_allocated = VLC_TABLES_SIZE - offset; | 178 | huffman_vlc[i][j].table_allocated = VLC_TABLES_SIZE - offset; |
| 179 | ff_init_vlc_from_lengths(&huffman_vlc[i][j], IMC_VLC_BITS, imc_huffman_sizes[i], | 179 | ff_vlc_init_from_lengths(&huffman_vlc[i][j], IMC_VLC_BITS, imc_huffman_sizes[i], |
| 180 | imc_huffman_lens[i][j], 1, | 180 | imc_huffman_lens[i][j], 1, |
| 181 | imc_huffman_syms[i][j], 1, 1, | 181 | imc_huffman_syms[i][j], 1, 1, |
| 182 | 0, INIT_VLC_STATIC_OVERLONG, NULL); | 182 | 0, VLC_INIT_STATIC_OVERLONG, NULL); |
| 183 | offset += huffman_vlc[i][j].table_size; | 183 | offset += huffman_vlc[i][j].table_size; |
| 184 | } | 184 | } |
| 185 | } | 185 | } |
| @@ -473,18 +473,18 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, · 472 unmodified lines | |||
| 473 | 473 | ||
| 474 | static av_cold void imm4_init_static_data(void) | 474 | static av_cold void imm4_init_static_data(void) |
| 475 | { | 475 | { |
| 476 | INIT_VLC_STATIC_FROM_LENGTHS(&cbplo_tab, CBPLO_VLC_BITS, FF_ARRAY_ELEMS(cbplo), | 476 | VLC_INIT_STATIC_FROM_LENGTHS(&cbplo_tab, CBPLO_VLC_BITS, FF_ARRAY_ELEMS(cbplo), |
| 477 | &cbplo[0][1], 2, &cbplo[0][0], 2, 1, | 477 | &cbplo[0][1], 2, &cbplo[0][0], 2, 1, |
| 478 | 0, 0, 1 << CBPLO_VLC_BITS); | 478 | 0, 0, 1 << CBPLO_VLC_BITS); |
| 479 | 479 | ||
| 480 | INIT_VLC_SPARSE_STATIC(&cbphi_tab, CBPHI_VLC_BITS, FF_ARRAY_ELEMS(cbphi_bits), | 480 | VLC_INIT_SPARSE_STATIC(&cbphi_tab, CBPHI_VLC_BITS, FF_ARRAY_ELEMS(cbphi_bits), |
| 481 | cbphi_bits, 1, 1, cbphi_codes, 1, 1, NULL, 0, 0, 64); | 481 | cbphi_bits, 1, 1, cbphi_codes, 1, 1, NULL, 0, 0, 64); |
| 482 | 482 | ||
| 483 | INIT_VLC_STATIC_FROM_LENGTHS(&blktype_tab, BLKTYPE_VLC_BITS, FF_ARRAY_ELEMS(blktype), | 483 | VLC_INIT_STATIC_FROM_LENGTHS(&blktype_tab, BLKTYPE_VLC_BITS, FF_ARRAY_ELEMS(blktype), |
| 484 | &blktype[0][1], 2, &blktype[0][0], 2, 1, | 484 | &blktype[0][1], 2, &blktype[0][0], 2, 1, |
| 485 | 0, 0, 1 << BLKTYPE_VLC_BITS); | 485 | 0, 0, 1 << BLKTYPE_VLC_BITS); |
| 486 | 486 | ||
| 487 | INIT_VLC_STATIC_FROM_LENGTHS(&block_tab, BLOCK_VLC_BITS, FF_ARRAY_ELEMS(block_bits), | 487 | VLC_INIT_STATIC_FROM_LENGTHS(&block_tab, BLOCK_VLC_BITS, FF_ARRAY_ELEMS(block_bits), |
| 488 | block_bits, 1, block_symbols, 2, 2, | 488 | block_bits, 1, block_symbols, 2, 2, |
| 489 | 0, 0, 1 << BLOCK_VLC_BITS); | 489 | 0, 0, 1 << BLOCK_VLC_BITS); |
| 490 | } | 490 | } |
| @@ -226,9 +226,9 @@ static int ir2_decode_frame(AVCodecContext *avctx, AVFrame *picture, · 225 unmodified lines | |||
| 226 | 226 | ||
| 227 | static av_cold void ir2_init_static(void) | 227 | static av_cold void ir2_init_static(void) |
| 228 | { | 228 | { |
| 229 | INIT_VLC_STATIC_FROM_LENGTHS(&ir2_vlc, CODE_VLC_BITS, IR2_CODES, | 229 | VLC_INIT_STATIC_FROM_LENGTHS(&ir2_vlc, CODE_VLC_BITS, IR2_CODES, |
| 230 | &ir2_tab[0][1], 2, &ir2_tab[0][0], 2, 1, | 230 | &ir2_tab[0][1], 2, &ir2_tab[0][0], 2, 1, |
| 231 | 0, INIT_VLC_OUTPUT_LE, 1 << CODE_VLC_BITS); | 231 | 0, VLC_INIT_OUTPUT_LE, 1 << CODE_VLC_BITS); |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | static av_cold int ir2_decode_init(AVCodecContext *avctx) | 234 | 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, · 55 unmodified lines | |||
| 56 | 56 | ||
| 57 | vlc->table = &vlc_buf[*offset]; | 57 | vlc->table = &vlc_buf[*offset]; |
| 58 | vlc->table_allocated = VLC_BUFFER_SIZE - *offset; | 58 | vlc->table_allocated = VLC_BUFFER_SIZE - *offset; |
| 59 | ff_init_vlc_from_lengths(vlc, nb_bits, nb_codes, &table[0][1], 2, | 59 | ff_vlc_init_from_lengths(vlc, nb_bits, nb_codes, &table[0][1], 2, |
| 60 | &table[0][0], 2, 1, 0, INIT_VLC_STATIC_OVERLONG, NULL); | 60 | &table[0][0], 2, 1, 0, VLC_INIT_STATIC_OVERLONG, NULL); |
| 61 | *offset += vlc->table_size; | 61 | *offset += vlc->table_size; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| @@ -110,25 +110,25 @@ static VLC cbpc_b_vlc; · 109 unmodified lines | |||
| 110 | 110 | ||
| 111 | static av_cold void h263_decode_init_vlc(void) | 111 | static av_cold void h263_decode_init_vlc(void) |
| 112 | { | 112 | { |
| 113 | INIT_VLC_STATIC(&ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 9, | 113 | VLC_INIT_STATIC(&ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 9, |
| 114 | ff_h263_intra_MCBPC_bits, 1, 1, | 114 | ff_h263_intra_MCBPC_bits, 1, 1, |
| 115 | ff_h263_intra_MCBPC_code, 1, 1, 72); | 115 | ff_h263_intra_MCBPC_code, 1, 1, 72); |
| 116 | INIT_VLC_STATIC(&ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 28, | 116 | VLC_INIT_STATIC(&ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 28, |
| 117 | ff_h263_inter_MCBPC_bits, 1, 1, | 117 | ff_h263_inter_MCBPC_bits, 1, 1, |
| 118 | ff_h263_inter_MCBPC_code, 1, 1, 198); | 118 | ff_h263_inter_MCBPC_code, 1, 1, 198); |
| 119 | INIT_VLC_STATIC(&ff_h263_cbpy_vlc, CBPY_VLC_BITS, 16, | 119 | VLC_INIT_STATIC(&ff_h263_cbpy_vlc, CBPY_VLC_BITS, 16, |
| 120 | &ff_h263_cbpy_tab[0][1], 2, 1, | 120 | &ff_h263_cbpy_tab[0][1], 2, 1, |
| 121 | &ff_h263_cbpy_tab[0][0], 2, 1, 64); | 121 | &ff_h263_cbpy_tab[0][0], 2, 1, 64); |
| 122 | INIT_VLC_STATIC(&ff_h263_mv_vlc, H263_MV_VLC_BITS, 33, | 122 | VLC_INIT_STATIC(&ff_h263_mv_vlc, H263_MV_VLC_BITS, 33, |
| 123 | &ff_mvtab[0][1], 2, 1, | 123 | &ff_mvtab[0][1], 2, 1, |
| 124 | &ff_mvtab[0][0], 2, 1, 538); | 124 | &ff_mvtab[0][0], 2, 1, 538); |
| 125 | ff_h263_init_rl_inter(); | 125 | ff_h263_init_rl_inter(); |
| 126 | INIT_VLC_RL(ff_h263_rl_inter, 554); | 126 | VLC_INIT_RL(ff_h263_rl_inter, 554); |
| 127 | INIT_FIRST_VLC_RL(ff_rl_intra_aic, 554); | 127 | INIT_FIRST_VLC_RL(ff_rl_intra_aic, 554); |
| 128 | INIT_VLC_STATIC(&h263_mbtype_b_vlc, H263_MBTYPE_B_VLC_BITS, 15, | 128 | VLC_INIT_STATIC(&h263_mbtype_b_vlc, H263_MBTYPE_B_VLC_BITS, 15, |
| 129 | &ff_h263_mbtype_b_tab[0][1], 2, 1, | 129 | &ff_h263_mbtype_b_tab[0][1], 2, 1, |
| 130 | &ff_h263_mbtype_b_tab[0][0], 2, 1, 80); | 130 | &ff_h263_mbtype_b_tab[0][0], 2, 1, 80); |
| 131 | INIT_VLC_STATIC(&cbpc_b_vlc, CBPC_B_VLC_BITS, 4, | 131 | VLC_INIT_STATIC(&cbpc_b_vlc, CBPC_B_VLC_BITS, 4, |
| 132 | &ff_cbpc_b_tab[0][1], 2, 1, | 132 | &ff_cbpc_b_tab[0][1], 2, 1, |
| 133 | &ff_cbpc_b_tab[0][0], 2, 1, 8); | 133 | &ff_cbpc_b_tab[0][0], 2, 1, 8); |
| 134 | } | 134 | } |
| @@ -154,8 +154,8 @@ static int ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag) · 153 unmodified lines | |||
| 154 | }//for i | 154 | }//for i |
| 155 | 155 | ||
| 156 | /* number of codewords = pos */ | 156 | /* number of codewords = pos */ |
| 157 | return init_vlc(vlc, IVI_VLC_BITS, pos, bits, 1, 1, codewords, 2, 2, | 157 | return vlc_init(vlc, IVI_VLC_BITS, pos, bits, 1, 1, codewords, 2, 2, |
| 158 | (flag ? INIT_VLC_USE_NEW_STATIC : 0) | INIT_VLC_OUTPUT_LE); | 158 | (flag ? VLC_INIT_USE_STATIC : 0) | VLC_INIT_OUTPUT_LE); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | static av_cold void ivi_init_static_vlc(void) | 161 | 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, · 75 unmodified lines | |||
| 237 | ivi_huff_desc_copy(&huff_tab->cust_desc, &new_huff); | 237 | ivi_huff_desc_copy(&huff_tab->cust_desc, &new_huff); |
| 238 | 238 | ||
| 239 | if (huff_tab->cust_tab.table) | 239 | if (huff_tab->cust_tab.table) |
| 240 | ff_free_vlc(&huff_tab->cust_tab); | 240 | ff_vlc_free(&huff_tab->cust_tab); |
| 241 | result = ivi_create_huff_from_desc(&huff_tab->cust_desc, | 241 | result = ivi_create_huff_from_desc(&huff_tab->cust_desc, |
| 242 | &huff_tab->cust_tab, 0); | 242 | &huff_tab->cust_tab, 0); |
| 243 | if (result) { | 243 | if (result) { |
| @@ -277,7 +277,7 @@ static av_cold void ivi_free_buffers(IVIPlaneDesc *planes) · 33 unmodified lines | |||
| 277 | av_freep(&band->bufs[3]); | 277 | av_freep(&band->bufs[3]); |
| 278 | 278 | ||
| 279 | if (band->blk_vlc.cust_tab.table) | 279 | if (band->blk_vlc.cust_tab.table) |
| 280 | ff_free_vlc(&band->blk_vlc.cust_tab); | 280 | ff_vlc_free(&band->blk_vlc.cust_tab); |
| 281 | for (t = 0; t < band->num_tiles; t++) | 281 | for (t = 0; t < band->num_tiles; t++) |
| 282 | av_freep(&band->tiles[t].mbs); | 282 | av_freep(&band->tiles[t].mbs); |
| 283 | av_freep(&band->tiles); | 283 | av_freep(&band->tiles); |
| @@ -1215,10 +1215,10 @@ av_cold int ff_ivi_decode_close(AVCodecContext *avctx) · 931 unmodified lines | |||
| 1215 | ivi_free_buffers(&ctx->planes[0]); | 1215 | ivi_free_buffers(&ctx->planes[0]); |
| 1216 | 1216 | ||
| 1217 | if (ctx->mb_vlc.cust_tab.table) | 1217 | if (ctx->mb_vlc.cust_tab.table) |
| 1218 | ff_free_vlc(&ctx->mb_vlc.cust_tab); | 1218 | ff_vlc_free(&ctx->mb_vlc.cust_tab); |
| 1219 | 1219 | ||
| 1220 | if (ctx->blk_vlc.cust_tab.table) | 1220 | if (ctx->blk_vlc.cust_tab.table) |
| 1221 | ff_free_vlc(&ctx->blk_vlc.cust_tab); | 1221 | ff_vlc_free(&ctx->blk_vlc.cust_tab); |
| 1222 | 1222 | ||
| 1223 | av_frame_free(&ctx->p_frame); | 1223 | av_frame_free(&ctx->p_frame); |
| 1224 | 1224 | ||
| @@ -474,7 +474,7 @@ static void dist_bundle_close(JXLDistributionBundle *bundle) · 473 unmodified lines | |||
| 474 | { | 474 | { |
| 475 | if (bundle->use_prefix_code && bundle->dists) | 475 | if (bundle->use_prefix_code && bundle->dists) |
| 476 | for (int i = 0; i < bundle->num_clusters; i++) | 476 | for (int i = 0; i < bundle->num_clusters; i++) |
| 477 | ff_free_vlc(&bundle->dists[i].vlc); | 477 | ff_vlc_free(&bundle->dists[i].vlc); |
| 478 | av_freep(&bundle->dists); | 478 | av_freep(&bundle->dists); |
| 479 | av_freep(&bundle->cluster_map); | 479 | av_freep(&bundle->cluster_map); |
| 480 | } | 480 | } |
| @@ -668,8 +668,8 @@ static int read_simple_vlc_prefix(GetBitContext *gb, JXLEntropyDecoder *dec, JXL · 187 unmodified lines | |||
| 668 | return AVERROR_BUG; | 668 | return AVERROR_BUG; |
| 669 | } | 669 | } |
| 670 | 670 | ||
| 671 | return ff_init_vlc_from_lengths(&dist->vlc, bits, nsym, lens, 1, symbols, | 671 | return ff_vlc_init_from_lengths(&dist->vlc, bits, nsym, lens, 1, symbols, |
| 672 | 2, 2, 0, INIT_VLC_LE, dec->logctx); | 672 | 2, 2, 0, VLC_INIT_LE, dec->logctx); |
| 673 | } | 673 | } |
| 674 | 674 | ||
| 675 | static int read_vlc_prefix(GetBitContext *gb, JXLEntropyDecoder *dec, JXLSymbolDistribution *dist) | 675 | 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 · 48 unmodified lines | |||
| 724 | level1_syms[idx] = i; | 724 | level1_syms[idx] = i; |
| 725 | } | 725 | } |
| 726 | 726 | ||
| 727 | ret = ff_init_vlc_from_lengths(&level1_vlc, 5, 18, level1_lens_s, 1, level1_syms, 2, 2, | 727 | ret = ff_vlc_init_from_lengths(&level1_vlc, 5, 18, level1_lens_s, 1, level1_syms, 2, 2, |
| 728 | 0, INIT_VLC_LE, dec->logctx); | 728 | 0, VLC_INIT_LE, dec->logctx); |
| 729 | if (ret < 0) | 729 | if (ret < 0) |
| 730 | goto end; | 730 | goto end; |
| 731 | 731 | ||
| @@ -789,12 +789,12 @@ static int read_vlc_prefix(GetBitContext *gb, JXLEntropyDecoder *dec, JXLSymbolD · 57 unmodified lines | |||
| 789 | level2_syms[idx] = i; | 789 | level2_syms[idx] = i; |
| 790 | } | 790 | } |
| 791 | 791 | ||
| 792 | ret = ff_init_vlc_from_lengths(&dist->vlc, 15, dist->alphabet_size, level2_lens_s, | 792 | ret = ff_vlc_init_from_lengths(&dist->vlc, 15, dist->alphabet_size, level2_lens_s, |
| 793 | 1, level2_syms, 2, 2, 0, INIT_VLC_LE, dec->logctx); | 793 | 1, level2_syms, 2, 2, 0, VLC_INIT_LE, dec->logctx); |
| 794 | 794 | ||
| 795 | end: | 795 | end: |
| 796 | av_freep(&buf); | 796 | av_freep(&buf); |
| 797 | ff_free_vlc(&level1_vlc); | 797 | ff_vlc_free(&level1_vlc); |
| 798 | 798 | ||
| 799 | return ret; | 799 | return ret; |
| 800 | } | 800 | } |
| @@ -86,9 +86,9 @@ static int huff_build(const uint8_t len[], uint16_t codes_pos[33], · 85 unmodified lines | |||
| 86 | for (unsigned i = nb_elems; i-- > 0;) | 86 | for (unsigned i = nb_elems; i-- > 0;) |
| 87 | he[--codes_pos[len[i]]] = (HuffEntry){ len[i], i }; | 87 | he[--codes_pos[len[i]]] = (HuffEntry){ len[i], i }; |
| 88 | 88 | ||
| 89 | ff_free_vlc(vlc); | 89 | ff_vlc_free(vlc); |
| 90 | ff_free_vlc_multi(multi); | 90 | ff_vlc_free_multi(multi); |
| 91 | return ff_init_vlc_multi_from_lengths(vlc, multi, FFMIN(he[0].len, VLC_BITS), nb_elems, nb_elems, | 91 | return ff_vlc_init_multi_from_lengths(vlc, multi, FFMIN(he[0].len, VLC_BITS), nb_elems, nb_elems, |
| 92 | &he[0].len, sizeof(he[0]), | 92 | &he[0].len, sizeof(he[0]), |
| 93 | &he[0].sym, sizeof(he[0]), sizeof(he[0].sym), | 93 | &he[0].sym, sizeof(he[0]), sizeof(he[0].sym), |
| 94 | 0, 0, logctx); | 94 | 0, 0, logctx); |
| @@ -688,8 +688,8 @@ static av_cold int magy_decode_end(AVCodecContext *avctx) · 593 unmodified lines | |||
| 688 | for (i = 0; i < FF_ARRAY_ELEMS(s->slices); i++) { | 688 | for (i = 0; i < FF_ARRAY_ELEMS(s->slices); i++) { |
| 689 | av_freep(&s->slices[i]); | 689 | av_freep(&s->slices[i]); |
| 690 | s->slices_size[i] = 0; | 690 | s->slices_size[i] = 0; |
| 691 | ff_free_vlc(&s->vlc[i]); | 691 | ff_vlc_free(&s->vlc[i]); |
| 692 | ff_free_vlc_multi(&s->multi[i]); | 692 | ff_vlc_free_multi(&s->multi[i]); |
| 693 | } | 693 | } |
| 694 | 694 | ||
| 695 | return 0; | 695 | return 0; |
| @@ -120,7 +120,7 @@ static av_cold int mimic_decode_end(AVCodecContext *avctx) · 119 unmodified lines | |||
| 120 | 120 | ||
| 121 | static av_cold void mimic_init_static(void) | 121 | static av_cold void mimic_init_static(void) |
| 122 | { | 122 | { |
| 123 | INIT_VLC_STATIC_FROM_LENGTHS(&block_vlc, MIMIC_VLC_BITS, FF_ARRAY_ELEMS(huffbits), | 123 | VLC_INIT_STATIC_FROM_LENGTHS(&block_vlc, MIMIC_VLC_BITS, FF_ARRAY_ELEMS(huffbits), |
| 124 | huffbits, 1, huffsyms, 1, 1, 0, 0, 4368); | 124 | huffbits, 1, huffsyms, 1, 1, 0, 0, 4368); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| @@ -83,7 +83,7 @@ static int init_default_huffman_tables(MJpegDecodeContext *s) · 82 unmodified lines | |||
| 83 | int i, ret; | 83 | int i, ret; |
| 84 | 84 | ||
| 85 | for (i = 0; i < FF_ARRAY_ELEMS(ht); i++) { | 85 | for (i = 0; i < FF_ARRAY_ELEMS(ht); i++) { |
| 86 | ff_free_vlc(&s->vlcs[ht[i].class][ht[i].index]); | 86 | ff_vlc_free(&s->vlcs[ht[i].class][ht[i].index]); |
| 87 | ret = ff_mjpeg_build_vlc(&s->vlcs[ht[i].class][ht[i].index], | 87 | ret = ff_mjpeg_build_vlc(&s->vlcs[ht[i].class][ht[i].index], |
| 88 | ht[i].bits, ht[i].values, | 88 | ht[i].bits, ht[i].values, |
| 89 | ht[i].class == 1, s->avctx); | 89 | ht[i].class == 1, s->avctx); |
| @@ -277,7 +277,7 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s) · 187 unmodified lines | |||
| 277 | len -= n; | 277 | len -= n; |
| 278 | 278 | ||
| 279 | /* build VLC and flush previous vlc if present */ | 279 | /* build VLC and flush previous vlc if present */ |
| 280 | ff_free_vlc(&s->vlcs[class][index]); | 280 | ff_vlc_free(&s->vlcs[class][index]); |
| 281 | av_log(s->avctx, AV_LOG_DEBUG, "class=%d index=%d nb_codes=%d\n", | 281 | av_log(s->avctx, AV_LOG_DEBUG, "class=%d index=%d nb_codes=%d\n", |
| 282 | class, index, n); | 282 | class, index, n); |
| 283 | if ((ret = ff_mjpeg_build_vlc(&s->vlcs[class][index], bits_table, | 283 | if ((ret = ff_mjpeg_build_vlc(&s->vlcs[class][index], bits_table, |
| @@ -285,7 +285,7 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s) · 1 unmodified line | |||
| 285 | return ret; | 285 | return ret; |
| 286 | 286 | ||
| 287 | if (class > 0) { | 287 | if (class > 0) { |
| 288 | ff_free_vlc(&s->vlcs[2][index]); | 288 | ff_vlc_free(&s->vlcs[2][index]); |
| 289 | if ((ret = ff_mjpeg_build_vlc(&s->vlcs[2][index], bits_table, | 289 | if ((ret = ff_mjpeg_build_vlc(&s->vlcs[2][index], bits_table, |
| 290 | val_table, 0, s->avctx)) < 0) | 290 | val_table, 0, s->avctx)) < 0) |
| 291 | return ret; | 291 | return ret; |
| @@ -2955,7 +2955,7 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx) · 2663 unmodified lines | |||
| 2955 | 2955 | ||
| 2956 | for (i = 0; i < 3; i++) { | 2956 | for (i = 0; i < 3; i++) { |
| 2957 | for (j = 0; j < 4; j++) | 2957 | for (j = 0; j < 4; j++) |
| 2958 | ff_free_vlc(&s->vlcs[i][j]); | 2958 | ff_vlc_free(&s->vlcs[i][j]); |
| 2959 | } | 2959 | } |
| 2960 | for (i = 0; i < MAX_COMPONENTS; i++) { | 2960 | for (i = 0; i < MAX_COMPONENTS; i++) { |
| 2961 | av_freep(&s->blocks[i]); | 2961 | av_freep(&s->blocks[i]); |
| @@ -52,6 +52,6 @@ int ff_mjpeg_build_vlc(VLC *vlc, const uint8_t *bits_table, · 51 unmodified lines | |||
| 52 | huff_sym[i] = 16 * 256; | 52 | huff_sym[i] = 16 * 256; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | return ff_init_vlc_from_lengths(vlc, 9, nb_codes, huff_size, 1, | 55 | return ff_vlc_init_from_lengths(vlc, 9, nb_codes, huff_size, 1, |
| 56 | huff_sym, 2, 2, 0, 0, logctx); | 56 | huff_sym, 2, 2, 0, 0, logctx); |
| 57 | } | 57 | } |
| @@ -230,9 +230,9 @@ static av_cold void init_static(void) · 229 unmodified lines | |||
| 230 | static VLCElem vlc_buf[3 * VLC_STATIC_SIZE]; | 230 | static VLCElem vlc_buf[3 * VLC_STATIC_SIZE]; |
| 231 | huff_vlc[i].table = &vlc_buf[i * VLC_STATIC_SIZE]; | 231 | huff_vlc[i].table = &vlc_buf[i * VLC_STATIC_SIZE]; |
| 232 | huff_vlc[i].table_allocated = VLC_STATIC_SIZE; | 232 | huff_vlc[i].table_allocated = VLC_STATIC_SIZE; |
| 233 | init_vlc(&huff_vlc[i], VLC_BITS, 18, | 233 | vlc_init(&huff_vlc[i], VLC_BITS, 18, |
| 234 | &ff_mlp_huffman_tables[i][0][1], 2, 1, | 234 | &ff_mlp_huffman_tables[i][0][1], 2, 1, |
| 235 | &ff_mlp_huffman_tables[i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC); | 235 | &ff_mlp_huffman_tables[i][0][0], 2, 1, VLC_INIT_USE_STATIC); |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | ff_mlp_init_crc(); | 238 | ff_mlp_init_crc(); |
| @@ -279,11 +279,11 @@ static VLC mv_vlc[2][16]; · 278 unmodified lines | |||
| 279 | 279 | ||
| 280 | static av_cold void mobiclip_init_static(void) | 280 | static av_cold void mobiclip_init_static(void) |
| 281 | { | 281 | { |
| 282 | INIT_VLC_STATIC_FROM_LENGTHS(&rl_vlc[0], MOBI_RL_VLC_BITS, 104, | 282 | VLC_INIT_STATIC_FROM_LENGTHS(&rl_vlc[0], MOBI_RL_VLC_BITS, 104, |
| 283 | bits0, sizeof(*bits0), | 283 | bits0, sizeof(*bits0), |
| 284 | syms0, sizeof(*syms0), sizeof(*syms0), | 284 | syms0, sizeof(*syms0), sizeof(*syms0), |
| 285 | 0, 0, 1 << MOBI_RL_VLC_BITS); | 285 | 0, 0, 1 << MOBI_RL_VLC_BITS); |
| 286 | INIT_VLC_STATIC_FROM_LENGTHS(&rl_vlc[1], MOBI_RL_VLC_BITS, 104, | 286 | VLC_INIT_STATIC_FROM_LENGTHS(&rl_vlc[1], MOBI_RL_VLC_BITS, 104, |
| 287 | bits0, sizeof(*bits0), | 287 | bits0, sizeof(*bits0), |
| 288 | syms1, sizeof(*syms1), sizeof(*syms1), | 288 | syms1, sizeof(*syms1), sizeof(*syms1), |
| 289 | 0, 0, 1 << MOBI_RL_VLC_BITS); | 289 | 0, 0, 1 << MOBI_RL_VLC_BITS); |
| @@ -292,10 +292,10 @@ static av_cold void mobiclip_init_static(void) · 2 unmodified lines | |||
| 292 | for (int j = 0; j < 16; j++) { | 292 | for (int j = 0; j < 16; j++) { |
| 293 | mv_vlc[i][j].table = &vlc_buf[(16 * i + j) << MOBI_MV_VLC_BITS]; | 293 | mv_vlc[i][j].table = &vlc_buf[(16 * i + j) << MOBI_MV_VLC_BITS]; |
| 294 | mv_vlc[i][j].table_allocated = 1 << MOBI_MV_VLC_BITS; | 294 | mv_vlc[i][j].table_allocated = 1 << MOBI_MV_VLC_BITS; |
| 295 | ff_init_vlc_from_lengths(&mv_vlc[i][j], MOBI_MV_VLC_BITS, mv_len[j], | 295 | ff_vlc_init_from_lengths(&mv_vlc[i][j], MOBI_MV_VLC_BITS, mv_len[j], |
| 296 | mv_bits[i][j], sizeof(*mv_bits[i][j]), | 296 | mv_bits[i][j], sizeof(*mv_bits[i][j]), |
| 297 | mv_syms[i][j], sizeof(*mv_syms[i][j]), sizeof(*mv_syms[i][j]), | 297 | mv_syms[i][j], sizeof(*mv_syms[i][j]), sizeof(*mv_syms[i][j]), |
| 298 | 0, INIT_VLC_USE_NEW_STATIC, NULL); | 298 | 0, VLC_INIT_USE_STATIC, NULL); |
| 299 | } | 299 | } |
| 300 | } | 300 | } |
| 301 | } | 301 | } |
| @@ -328,7 +328,7 @@ static int mp_decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 327 unmodified lines | |||
| 328 | if (mp->codes_count > 1) { | 328 | if (mp->codes_count > 1) { |
| 329 | /* The entries of the mp->codes array are sorted from right to left | 329 | /* The entries of the mp->codes array are sorted from right to left |
| 330 | * in the Huffman tree, hence -(int)sizeof(HuffCode). */ | 330 | * in the Huffman tree, hence -(int)sizeof(HuffCode). */ |
| 331 | ret = ff_init_vlc_from_lengths(&mp->vlc, mp->max_codes_bits, mp->codes_count, | 331 | ret = ff_vlc_init_from_lengths(&mp->vlc, mp->max_codes_bits, mp->codes_count, |
| 332 | &mp->codes[mp->codes_count - 1].size, -(int)sizeof(HuffCode), | 332 | &mp->codes[mp->codes_count - 1].size, -(int)sizeof(HuffCode), |
| 333 | &mp->codes[mp->codes_count - 1].delta, -(int)sizeof(HuffCode), 1, | 333 | &mp->codes[mp->codes_count - 1].delta, -(int)sizeof(HuffCode), 1, |
| 334 | 0, 0, avctx); | 334 | 0, 0, avctx); |
| @@ -336,7 +336,7 @@ static int mp_decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 1 unmodified line | |||
| 336 | goto end; | 336 | goto end; |
| 337 | } | 337 | } |
| 338 | mp_decode_frame_helper(mp, &gb); | 338 | mp_decode_frame_helper(mp, &gb); |
| 339 | ff_free_vlc(&mp->vlc); | 339 | ff_vlc_free(&mp->vlc); |
| 340 | 340 | ||
| 341 | end: | 341 | end: |
| 342 | if ((ret = av_frame_ref(rframe, mp->frame)) < 0) | 342 | if ((ret = av_frame_ref(rframe, mp->frame)) < 0) |
| @@ -47,24 +47,24 @@ static av_cold void mpc7_init_static(void) · 46 unmodified lines | |||
| 47 | static VLCElem quant_tables[7224]; | 47 | static VLCElem quant_tables[7224]; |
| 48 | const uint8_t *raw_quant_table = mpc7_quant_vlcs; | 48 | const uint8_t *raw_quant_table = mpc7_quant_vlcs; |
| 49 | 49 | ||
| 50 | INIT_VLC_STATIC_FROM_LENGTHS(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE, | 50 | VLC_INIT_STATIC_FROM_LENGTHS(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE, |
| 51 | &mpc7_scfi[1], 2, | 51 | &mpc7_scfi[1], 2, |
| 52 | &mpc7_scfi[0], 2, 1, 0, 0, 1 << MPC7_SCFI_BITS); | 52 | &mpc7_scfi[0], 2, 1, 0, 0, 1 << MPC7_SCFI_BITS); |
| 53 | INIT_VLC_STATIC_FROM_LENGTHS(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE, | 53 | VLC_INIT_STATIC_FROM_LENGTHS(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE, |
| 54 | &mpc7_dscf[1], 2, | 54 | &mpc7_dscf[1], 2, |
| 55 | &mpc7_dscf[0], 2, 1, -7, 0, 1 << MPC7_DSCF_BITS); | 55 | &mpc7_dscf[0], 2, 1, -7, 0, 1 << MPC7_DSCF_BITS); |
| 56 | INIT_VLC_STATIC_FROM_LENGTHS(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE, | 56 | VLC_INIT_STATIC_FROM_LENGTHS(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE, |
| 57 | &mpc7_hdr[1], 2, | 57 | &mpc7_hdr[1], 2, |
| 58 | &mpc7_hdr[0], 2, 1, -5, 0, 1 << MPC7_HDR_BITS); | 58 | &mpc7_hdr[0], 2, 1, -5, 0, 1 << MPC7_HDR_BITS); |
| 59 | for (unsigned i = 0, offset = 0; i < MPC7_QUANT_VLC_TABLES; i++){ | 59 | for (unsigned i = 0, offset = 0; i < MPC7_QUANT_VLC_TABLES; i++){ |
| 60 | for (int j = 0; j < 2; j++) { | 60 | for (int j = 0; j < 2; j++) { |
| 61 | quant_vlc[i][j].table = &quant_tables[offset]; | 61 | quant_vlc[i][j].table = &quant_tables[offset]; |
| 62 | quant_vlc[i][j].table_allocated = FF_ARRAY_ELEMS(quant_tables) - offset; | 62 | quant_vlc[i][j].table_allocated = FF_ARRAY_ELEMS(quant_tables) - offset; |
| 63 | ff_init_vlc_from_lengths(&quant_vlc[i][j], 9, mpc7_quant_vlc_sizes[i], | 63 | ff_vlc_init_from_lengths(&quant_vlc[i][j], 9, mpc7_quant_vlc_sizes[i], |
| 64 | &raw_quant_table[1], 2, | 64 | &raw_quant_table[1], 2, |
| 65 | &raw_quant_table[0], 2, 1, | 65 | &raw_quant_table[0], 2, 1, |
| 66 | mpc7_quant_vlc_off[i], | 66 | mpc7_quant_vlc_off[i], |
| 67 | INIT_VLC_STATIC_OVERLONG, NULL); | 67 | VLC_INIT_STATIC_OVERLONG, NULL); |
| 68 | raw_quant_table += 2 * mpc7_quant_vlc_sizes[i]; | 68 | raw_quant_table += 2 * mpc7_quant_vlc_sizes[i]; |
| 69 | offset += quant_vlc[i][j].table_size; | 69 | offset += quant_vlc[i][j].table_size; |
| 70 | } | 70 | } |
| @@ -103,8 +103,8 @@ static av_cold void build_vlc(VLC *vlc, unsigned *buf_offset, · 102 unmodified lines | |||
| 103 | for (unsigned tmp = num + codes_counts[i - 1]; num < tmp; num++) | 103 | for (unsigned tmp = num + codes_counts[i - 1]; num < tmp; num++) |
| 104 | len[num] = i; | 104 | len[num] = i; |
| 105 | 105 | ||
| 106 | ff_init_vlc_from_lengths(vlc, FFMIN(len[0], 9), num, len, 1, | 106 | ff_vlc_init_from_lengths(vlc, FFMIN(len[0], 9), num, len, 1, |
| 107 | *syms, 1, 1, offset, INIT_VLC_STATIC_OVERLONG, NULL); | 107 | *syms, 1, 1, offset, VLC_INIT_STATIC_OVERLONG, NULL); |
| 108 | *buf_offset += vlc->table_size; | 108 | *buf_offset += vlc->table_size; |
| 109 | *syms += num; | 109 | *syms += num; |
| 110 | } | 110 | } |
| @@ -72,7 +72,7 @@ av_cold void ff_init_2d_vlc_rl(const uint16_t table_vlc[][2], RL_VLC_ELEM rl_vlc · 71 unmodified lines | |||
| 72 | VLCElem table[680] = { 0 }; | 72 | VLCElem table[680] = { 0 }; |
| 73 | VLC vlc = { .table = table, .table_allocated = static_size }; | 73 | VLC vlc = { .table = table, .table_allocated = static_size }; |
| 74 | av_assert0(static_size <= FF_ARRAY_ELEMS(table)); | 74 | av_assert0(static_size <= FF_ARRAY_ELEMS(table)); |
| 75 | 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); | 75 | 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); |
| 76 | 76 | ||
| 77 | for (i = 0; i < vlc.table_size; i++) { | 77 | for (i = 0; i < vlc.table_size; i++) { |
| 78 | int code = vlc.table[i].sym; | 78 | int code = vlc.table[i].sym; |
| @@ -130,26 +130,26 @@ RL_VLC_ELEM ff_mpeg2_rl_vlc[674]; · 51 unmodified lines | |||
| 130 | 130 | ||
| 131 | static av_cold void mpeg12_init_vlcs(void) | 131 | static av_cold void mpeg12_init_vlcs(void) |
| 132 | { | 132 | { |
| 133 | INIT_VLC_STATIC(&ff_dc_lum_vlc, DC_VLC_BITS, 12, | 133 | VLC_INIT_STATIC(&ff_dc_lum_vlc, DC_VLC_BITS, 12, |
| 134 | ff_mpeg12_vlc_dc_lum_bits, 1, 1, | 134 | ff_mpeg12_vlc_dc_lum_bits, 1, 1, |
| 135 | ff_mpeg12_vlc_dc_lum_code, 2, 2, 512); | 135 | ff_mpeg12_vlc_dc_lum_code, 2, 2, 512); |
| 136 | INIT_VLC_STATIC(&ff_dc_chroma_vlc, DC_VLC_BITS, 12, | 136 | VLC_INIT_STATIC(&ff_dc_chroma_vlc, DC_VLC_BITS, 12, |
| 137 | ff_mpeg12_vlc_dc_chroma_bits, 1, 1, | 137 | ff_mpeg12_vlc_dc_chroma_bits, 1, 1, |
| 138 | ff_mpeg12_vlc_dc_chroma_code, 2, 2, 514); | 138 | ff_mpeg12_vlc_dc_chroma_code, 2, 2, 514); |
| 139 | INIT_VLC_STATIC(&ff_mv_vlc, MV_VLC_BITS, 17, | 139 | VLC_INIT_STATIC(&ff_mv_vlc, MV_VLC_BITS, 17, |
| 140 | &ff_mpeg12_mbMotionVectorTable[0][1], 2, 1, | 140 | &ff_mpeg12_mbMotionVectorTable[0][1], 2, 1, |
| 141 | &ff_mpeg12_mbMotionVectorTable[0][0], 2, 1, 266); | 141 | &ff_mpeg12_mbMotionVectorTable[0][0], 2, 1, 266); |
| 142 | INIT_VLC_STATIC(&ff_mbincr_vlc, MBINCR_VLC_BITS, 36, | 142 | VLC_INIT_STATIC(&ff_mbincr_vlc, MBINCR_VLC_BITS, 36, |
| 143 | &ff_mpeg12_mbAddrIncrTable[0][1], 2, 1, | 143 | &ff_mpeg12_mbAddrIncrTable[0][1], 2, 1, |
| 144 | &ff_mpeg12_mbAddrIncrTable[0][0], 2, 1, 538); | 144 | &ff_mpeg12_mbAddrIncrTable[0][0], 2, 1, 538); |
| 145 | INIT_VLC_STATIC(&ff_mb_pat_vlc, MB_PAT_VLC_BITS, 64, | 145 | VLC_INIT_STATIC(&ff_mb_pat_vlc, MB_PAT_VLC_BITS, 64, |
| 146 | &ff_mpeg12_mbPatTable[0][1], 2, 1, | 146 | &ff_mpeg12_mbPatTable[0][1], 2, 1, |
| 147 | &ff_mpeg12_mbPatTable[0][0], 2, 1, 512); | 147 | &ff_mpeg12_mbPatTable[0][0], 2, 1, 512); |
| 148 | 148 | ||
| 149 | INIT_VLC_STATIC(&ff_mb_ptype_vlc, MB_PTYPE_VLC_BITS, 7, | 149 | VLC_INIT_STATIC(&ff_mb_ptype_vlc, MB_PTYPE_VLC_BITS, 7, |
| 150 | &table_mb_ptype[0][1], 2, 1, | 150 | &table_mb_ptype[0][1], 2, 1, |
| 151 | &table_mb_ptype[0][0], 2, 1, 64); | 151 | &table_mb_ptype[0][0], 2, 1, 64); |
| 152 | INIT_VLC_STATIC(&ff_mb_btype_vlc, MB_BTYPE_VLC_BITS, 11, | 152 | VLC_INIT_STATIC(&ff_mb_btype_vlc, MB_BTYPE_VLC_BITS, 11, |
| 153 | &table_mb_btype[0][1], 2, 1, | 153 | &table_mb_btype[0][1], 2, 1, |
| 154 | &table_mb_btype[0][0], 2, 1, 64); | 154 | &table_mb_btype[0][0], 2, 1, 64); |
| 155 | 155 | ||
| @@ -3761,12 +3761,12 @@ static av_cold void mpeg4_init_static(void) · 3760 unmodified lines | |||
| 3761 | { | 3761 | { |
| 3762 | static uint8_t mpeg4_rvlc_rl_tables[2][2][2 * MAX_RUN + MAX_LEVEL + 3]; | 3762 | static uint8_t mpeg4_rvlc_rl_tables[2][2][2 * MAX_RUN + MAX_LEVEL + 3]; |
| 3763 | 3763 | ||
| 3764 | INIT_VLC_STATIC_FROM_LENGTHS(&studio_luma_dc, STUDIO_INTRA_BITS, 19, | 3764 | VLC_INIT_STATIC_FROM_LENGTHS(&studio_luma_dc, STUDIO_INTRA_BITS, 19, |
| 3765 | &ff_mpeg4_studio_dc_luma[0][1], 2, | 3765 | &ff_mpeg4_studio_dc_luma[0][1], 2, |
| 3766 | &ff_mpeg4_studio_dc_luma[0][0], 2, 1, | 3766 | &ff_mpeg4_studio_dc_luma[0][0], 2, 1, |
| 3767 | 0, 0, 528); | 3767 | 0, 0, 528); |
| 3768 | 3768 | ||
| 3769 | INIT_VLC_STATIC_FROM_LENGTHS(&studio_chroma_dc, STUDIO_INTRA_BITS, 19, | 3769 | VLC_INIT_STATIC_FROM_LENGTHS(&studio_chroma_dc, STUDIO_INTRA_BITS, 19, |
| 3770 | &ff_mpeg4_studio_dc_chroma[0][1], 2, | 3770 | &ff_mpeg4_studio_dc_chroma[0][1], 2, |
| 3771 | &ff_mpeg4_studio_dc_chroma[0][0], 2, 1, | 3771 | &ff_mpeg4_studio_dc_chroma[0][0], 2, 1, |
| 3772 | 0, 0, 528); | 3772 | 0, 0, 528); |
| @@ -3776,11 +3776,11 @@ static av_cold void mpeg4_init_static(void) · 3 unmodified lines | |||
| 3776 | 3776 | ||
| 3777 | studio_intra_tab[i].table = &vlc_buf[offset]; | 3777 | studio_intra_tab[i].table = &vlc_buf[offset]; |
| 3778 | studio_intra_tab[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset; | 3778 | studio_intra_tab[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset; |
| 3779 | ff_init_vlc_from_lengths(&studio_intra_tab[i], | 3779 | ff_vlc_init_from_lengths(&studio_intra_tab[i], |
| 3780 | STUDIO_INTRA_BITS, 24, | 3780 | STUDIO_INTRA_BITS, 24, |
| 3781 | &ff_mpeg4_studio_intra[i][0][1], 2, | 3781 | &ff_mpeg4_studio_intra[i][0][1], 2, |
| 3782 | &ff_mpeg4_studio_intra[i][0][0], 2, 1, | 3782 | &ff_mpeg4_studio_intra[i][0][0], 2, 1, |
| 3783 | 0, INIT_VLC_STATIC_OVERLONG, NULL); | 3783 | 0, VLC_INIT_STATIC_OVERLONG, NULL); |
| 3784 | offset += studio_intra_tab[i].table_size; | 3784 | offset += studio_intra_tab[i].table_size; |
| 3785 | } | 3785 | } |
| 3786 | 3786 | ||
| @@ -3788,18 +3788,18 @@ static av_cold void mpeg4_init_static(void) · 1 unmodified line | |||
| 3788 | ff_rl_init(&ff_rvlc_rl_inter, mpeg4_rvlc_rl_tables[0]); | 3788 | ff_rl_init(&ff_rvlc_rl_inter, mpeg4_rvlc_rl_tables[0]); |
| 3789 | ff_rl_init(&ff_rvlc_rl_intra, mpeg4_rvlc_rl_tables[1]); | 3789 | ff_rl_init(&ff_rvlc_rl_intra, mpeg4_rvlc_rl_tables[1]); |
| 3790 | INIT_FIRST_VLC_RL(ff_mpeg4_rl_intra, 554); | 3790 | INIT_FIRST_VLC_RL(ff_mpeg4_rl_intra, 554); |
| 3791 | INIT_VLC_RL(ff_rvlc_rl_inter, 1072); | 3791 | VLC_INIT_RL(ff_rvlc_rl_inter, 1072); |
| 3792 | INIT_FIRST_VLC_RL(ff_rvlc_rl_intra, 1072); | 3792 | INIT_FIRST_VLC_RL(ff_rvlc_rl_intra, 1072); |
| 3793 | INIT_VLC_STATIC(&dc_lum, DC_VLC_BITS, 10 /* 13 */, | 3793 | VLC_INIT_STATIC(&dc_lum, DC_VLC_BITS, 10 /* 13 */, |
| 3794 | &ff_mpeg4_DCtab_lum[0][1], 2, 1, | 3794 | &ff_mpeg4_DCtab_lum[0][1], 2, 1, |
| 3795 | &ff_mpeg4_DCtab_lum[0][0], 2, 1, 512); | 3795 | &ff_mpeg4_DCtab_lum[0][0], 2, 1, 512); |
| 3796 | INIT_VLC_STATIC(&dc_chrom, DC_VLC_BITS, 10 /* 13 */, | 3796 | VLC_INIT_STATIC(&dc_chrom, DC_VLC_BITS, 10 /* 13 */, |
| 3797 | &ff_mpeg4_DCtab_chrom[0][1], 2, 1, | 3797 | &ff_mpeg4_DCtab_chrom[0][1], 2, 1, |
| 3798 | &ff_mpeg4_DCtab_chrom[0][0], 2, 1, 512); | 3798 | &ff_mpeg4_DCtab_chrom[0][0], 2, 1, 512); |
| 3799 | INIT_VLC_STATIC_FROM_LENGTHS(&sprite_trajectory, SPRITE_TRAJ_VLC_BITS, 15, | 3799 | VLC_INIT_STATIC_FROM_LENGTHS(&sprite_trajectory, SPRITE_TRAJ_VLC_BITS, 15, |
| 3800 | ff_sprite_trajectory_lens, 1, | 3800 | ff_sprite_trajectory_lens, 1, |
| 3801 | NULL, 0, 0, 0, 0, 128); | 3801 | NULL, 0, 0, 0, 0, 128); |
| 3802 | INIT_VLC_STATIC(&mb_type_b_vlc, MB_TYPE_B_VLC_BITS, 4, | 3802 | VLC_INIT_STATIC(&mb_type_b_vlc, MB_TYPE_B_VLC_BITS, 4, |
| 3803 | &ff_mb_type_b_tab[0][1], 2, 1, | 3803 | &ff_mb_type_b_tab[0][1], 2, 1, |
| 3804 | &ff_mb_type_b_tab[0][0], 2, 1, 16); | 3804 | &ff_mb_type_b_tab[0][0], 2, 1, 16); |
| 3805 | } | 3805 | } |
| @@ -428,9 +428,9 @@ static av_cold void mpegaudiodec_common_init_static(void) · 427 unmodified lines | |||
| 428 | 428 | ||
| 429 | ff_huff_vlc[++i].table = huff_vlc_tables + offset; | 429 | ff_huff_vlc[++i].table = huff_vlc_tables + offset; |
| 430 | ff_huff_vlc[i].table_allocated = FF_ARRAY_ELEMS(huff_vlc_tables) - offset; | 430 | ff_huff_vlc[i].table_allocated = FF_ARRAY_ELEMS(huff_vlc_tables) - offset; |
| 431 | ff_init_vlc_from_lengths(&ff_huff_vlc[i], 7, j, | 431 | ff_vlc_init_from_lengths(&ff_huff_vlc[i], 7, j, |
| 432 | huff_lens, 1, tmp_symbols, 2, 2, | 432 | huff_lens, 1, tmp_symbols, 2, 2, |
| 433 | 0, INIT_VLC_STATIC_OVERLONG, NULL); | 433 | 0, VLC_INIT_STATIC_OVERLONG, NULL); |
| 434 | offset += ff_huff_vlc[i].table_size; | 434 | offset += ff_huff_vlc[i].table_size; |
| 435 | huff_lens += j; | 435 | huff_lens += j; |
| 436 | huff_sym += j; | 436 | huff_sym += j; |
| @@ -443,9 +443,9 @@ static av_cold void mpegaudiodec_common_init_static(void) · 6 unmodified lines | |||
| 443 | ff_huff_quad_vlc[i].table = huff_quad_vlc_tables + offset; | 443 | ff_huff_quad_vlc[i].table = huff_quad_vlc_tables + offset; |
| 444 | ff_huff_quad_vlc[i].table_allocated = 1 << bits; | 444 | ff_huff_quad_vlc[i].table_allocated = 1 << bits; |
| 445 | offset += 1 << bits; | 445 | offset += 1 << bits; |
| 446 | init_vlc(&ff_huff_quad_vlc[i], bits, 16, | 446 | vlc_init(&ff_huff_quad_vlc[i], bits, 16, |
| 447 | mpa_quad_bits[i], 1, 1, mpa_quad_codes[i], 1, 1, | 447 | mpa_quad_bits[i], 1, 1, mpa_quad_codes[i], 1, 1, |
| 448 | INIT_VLC_USE_NEW_STATIC); | 448 | VLC_INIT_USE_STATIC); |
| 449 | } | 449 | } |
| 450 | av_assert0(offset == FF_ARRAY_ELEMS(huff_quad_vlc_tables)); | 450 | av_assert0(offset == FF_ARRAY_ELEMS(huff_quad_vlc_tables)); |
| 451 | 451 | ||
| @@ -38,20 +38,20 @@ VLC ff_msmp4_dc_chroma_vlc[2]; · 37 unmodified lines | |||
| 38 | 38 | ||
| 39 | static av_cold void msmp4_vc1_vlcs_init(void) | 39 | static av_cold void msmp4_vc1_vlcs_init(void) |
| 40 | { | 40 | { |
| 41 | INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[0], MSMP4_DC_VLC_BITS, 120, | 41 | VLC_INIT_STATIC(&ff_msmp4_dc_luma_vlc[0], MSMP4_DC_VLC_BITS, 120, |
| 42 | &ff_table0_dc_lum[0][1], 8, 4, | 42 | &ff_table0_dc_lum[0][1], 8, 4, |
| 43 | &ff_table0_dc_lum[0][0], 8, 4, 1158); | 43 | &ff_table0_dc_lum[0][0], 8, 4, 1158); |
| 44 | INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[0], MSMP4_DC_VLC_BITS, 120, | 44 | VLC_INIT_STATIC(&ff_msmp4_dc_chroma_vlc[0], MSMP4_DC_VLC_BITS, 120, |
| 45 | &ff_table0_dc_chroma[0][1], 8, 4, | 45 | &ff_table0_dc_chroma[0][1], 8, 4, |
| 46 | &ff_table0_dc_chroma[0][0], 8, 4, 1118); | 46 | &ff_table0_dc_chroma[0][0], 8, 4, 1118); |
| 47 | INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[1], MSMP4_DC_VLC_BITS, 120, | 47 | VLC_INIT_STATIC(&ff_msmp4_dc_luma_vlc[1], MSMP4_DC_VLC_BITS, 120, |
| 48 | &ff_table1_dc_lum[0][1], 8, 4, | 48 | &ff_table1_dc_lum[0][1], 8, 4, |
| 49 | &ff_table1_dc_lum[0][0], 8, 4, 1476); | 49 | &ff_table1_dc_lum[0][0], 8, 4, 1476); |
| 50 | INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[1], MSMP4_DC_VLC_BITS, 120, | 50 | VLC_INIT_STATIC(&ff_msmp4_dc_chroma_vlc[1], MSMP4_DC_VLC_BITS, 120, |
| 51 | &ff_table1_dc_chroma[0][1], 8, 4, | 51 | &ff_table1_dc_chroma[0][1], 8, 4, |
| 52 | &ff_table1_dc_chroma[0][0], 8, 4, 1216); | 52 | &ff_table1_dc_chroma[0][0], 8, 4, 1216); |
| 53 | 53 | ||
| 54 | INIT_VLC_STATIC(&ff_msmp4_mb_i_vlc, MSMP4_MB_INTRA_VLC_BITS, 64, | 54 | VLC_INIT_STATIC(&ff_msmp4_mb_i_vlc, MSMP4_MB_INTRA_VLC_BITS, 64, |
| 55 | &ff_msmp4_mb_i_table[0][1], 4, 2, | 55 | &ff_msmp4_mb_i_table[0][1], 4, 2, |
| 56 | &ff_msmp4_mb_i_table[0][0], 4, 2, 536); | 56 | &ff_msmp4_mb_i_table[0][0], 4, 2, 536); |
| 57 | } | 57 | } |
| @@ -301,33 +301,33 @@ static av_cold void msmpeg4_decode_init_static(void) · 300 unmodified lines | |||
| 301 | INIT_FIRST_VLC_RL(ff_rl_table[0], 642); | 301 | INIT_FIRST_VLC_RL(ff_rl_table[0], 642); |
| 302 | INIT_FIRST_VLC_RL(ff_rl_table[1], 1104); | 302 | INIT_FIRST_VLC_RL(ff_rl_table[1], 1104); |
| 303 | INIT_FIRST_VLC_RL(ff_rl_table[2], 554); | 303 | INIT_FIRST_VLC_RL(ff_rl_table[2], 554); |
| 304 | INIT_VLC_RL(ff_rl_table[3], 940); | 304 | VLC_INIT_RL(ff_rl_table[3], 940); |
| 305 | INIT_VLC_RL(ff_rl_table[4], 962); | 305 | VLC_INIT_RL(ff_rl_table[4], 962); |
| 306 | /* ff_rl_table[5] coincides with ff_h263_rl_inter which has just been | 306 | /* ff_rl_table[5] coincides with ff_h263_rl_inter which has just been |
| 307 | * initialized in ff_h263_decode_init() earlier. So just copy the VLCs. */ | 307 | * initialized in ff_h263_decode_init() earlier. So just copy the VLCs. */ |
| 308 | av_assert1(ff_h263_rl_inter.rl_vlc[0]); | 308 | av_assert1(ff_h263_rl_inter.rl_vlc[0]); |
| 309 | memcpy(ff_rl_table[5].rl_vlc, ff_h263_rl_inter.rl_vlc, sizeof(ff_rl_table[5].rl_vlc)); | 309 | memcpy(ff_rl_table[5].rl_vlc, ff_h263_rl_inter.rl_vlc, sizeof(ff_rl_table[5].rl_vlc)); |
| 310 | 310 | ||
| 311 | mv = &ff_mv_tables[0]; | 311 | mv = &ff_mv_tables[0]; |
| 312 | INIT_VLC_STATIC(&mv->vlc, MV_VLC_BITS, MSMPEG4_MV_TABLES_NB_ELEMS + 1, | 312 | VLC_INIT_STATIC(&mv->vlc, MV_VLC_BITS, MSMPEG4_MV_TABLES_NB_ELEMS + 1, |
| 313 | mv->table_mv_bits, 1, 1, | 313 | mv->table_mv_bits, 1, 1, |
| 314 | mv->table_mv_code, 2, 2, 3714); | 314 | mv->table_mv_code, 2, 2, 3714); |
| 315 | mv = &ff_mv_tables[1]; | 315 | mv = &ff_mv_tables[1]; |
| 316 | INIT_VLC_STATIC(&mv->vlc, MV_VLC_BITS, MSMPEG4_MV_TABLES_NB_ELEMS + 1, | 316 | VLC_INIT_STATIC(&mv->vlc, MV_VLC_BITS, MSMPEG4_MV_TABLES_NB_ELEMS + 1, |
| 317 | mv->table_mv_bits, 1, 1, | 317 | mv->table_mv_bits, 1, 1, |
| 318 | mv->table_mv_code, 2, 2, 2694); | 318 | mv->table_mv_code, 2, 2, 2694); |
| 319 | 319 | ||
| 320 | INIT_VLC_STATIC(&v2_dc_lum_vlc, MSMP4_DC_VLC_BITS, 512, | 320 | VLC_INIT_STATIC(&v2_dc_lum_vlc, MSMP4_DC_VLC_BITS, 512, |
| 321 | &ff_v2_dc_lum_table[0][1], 8, 4, | 321 | &ff_v2_dc_lum_table[0][1], 8, 4, |
| 322 | &ff_v2_dc_lum_table[0][0], 8, 4, 1472); | 322 | &ff_v2_dc_lum_table[0][0], 8, 4, 1472); |
| 323 | INIT_VLC_STATIC(&v2_dc_chroma_vlc, MSMP4_DC_VLC_BITS, 512, | 323 | VLC_INIT_STATIC(&v2_dc_chroma_vlc, MSMP4_DC_VLC_BITS, 512, |
| 324 | &ff_v2_dc_chroma_table[0][1], 8, 4, | 324 | &ff_v2_dc_chroma_table[0][1], 8, 4, |
| 325 | &ff_v2_dc_chroma_table[0][0], 8, 4, 1506); | 325 | &ff_v2_dc_chroma_table[0][0], 8, 4, 1506); |
| 326 | 326 | ||
| 327 | INIT_VLC_STATIC(&v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 4, | 327 | VLC_INIT_STATIC(&v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 4, |
| 328 | &ff_v2_intra_cbpc[0][1], 2, 1, | 328 | &ff_v2_intra_cbpc[0][1], 2, 1, |
| 329 | &ff_v2_intra_cbpc[0][0], 2, 1, 8); | 329 | &ff_v2_intra_cbpc[0][0], 2, 1, 8); |
| 330 | INIT_VLC_STATIC(&v2_mb_type_vlc, V2_MB_TYPE_VLC_BITS, 8, | 330 | VLC_INIT_STATIC(&v2_mb_type_vlc, V2_MB_TYPE_VLC_BITS, 8, |
| 331 | &ff_v2_mb_type[0][1], 2, 1, | 331 | &ff_v2_mb_type[0][1], 2, 1, |
| 332 | &ff_v2_mb_type[0][0], 2, 1, 128); | 332 | &ff_v2_mb_type[0][0], 2, 1, 128); |
| 333 | 333 | ||
| @@ -335,14 +335,14 @@ static av_cold void msmpeg4_decode_init_static(void) · 1 unmodified line | |||
| 335 | static VLCElem vlc_buf[1636 + 2648 + 1532 + 2488]; | 335 | static VLCElem vlc_buf[1636 + 2648 + 1532 + 2488]; |
| 336 | ff_mb_non_intra_vlc[i].table = &vlc_buf[offset]; | 336 | ff_mb_non_intra_vlc[i].table = &vlc_buf[offset]; |
| 337 | ff_mb_non_intra_vlc[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset; | 337 | ff_mb_non_intra_vlc[i].table_allocated = FF_ARRAY_ELEMS(vlc_buf) - offset; |
| 338 | init_vlc(&ff_mb_non_intra_vlc[i], MB_NON_INTRA_VLC_BITS, 128, | 338 | vlc_init(&ff_mb_non_intra_vlc[i], MB_NON_INTRA_VLC_BITS, 128, |
| 339 | &ff_wmv2_inter_table[i][0][1], 8, 4, | 339 | &ff_wmv2_inter_table[i][0][1], 8, 4, |
| 340 | &ff_wmv2_inter_table[i][0][0], 8, 4, | 340 | &ff_wmv2_inter_table[i][0][0], 8, 4, |
| 341 | INIT_VLC_STATIC_OVERLONG); | 341 | VLC_INIT_STATIC_OVERLONG); |
| 342 | offset += ff_mb_non_intra_vlc[i].table_size; | 342 | offset += ff_mb_non_intra_vlc[i].table_size; |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | INIT_VLC_STATIC(&ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 4, | 345 | VLC_INIT_STATIC(&ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 4, |
| 346 | &ff_table_inter_intra[0][1], 2, 1, | 346 | &ff_table_inter_intra[0][1], 2, 1, |
| 347 | &ff_table_inter_intra[0][0], 2, 1, 8); | 347 | &ff_table_inter_intra[0][0], 2, 1, 8); |
| 348 | ff_msmp4_vc1_vlcs_init_once(); | 348 | ff_msmp4_vc1_vlcs_init_once(); |
| @@ -324,7 +324,7 @@ static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, ptrdiff_t pal_stride, · 323 unmodified lines | |||
| 324 | if (next_code != 1 << current_length) | 324 | if (next_code != 1 << current_length) |
| 325 | return AVERROR_INVALIDDATA; | 325 | return AVERROR_INVALIDDATA; |
| 326 | 326 | ||
| 327 | if ((i = init_vlc(&vlc, 9, alphabet_size, bits, 1, 1, codes, 4, 4, 0)) < 0) | 327 | if ((i = vlc_init(&vlc, 9, alphabet_size, bits, 1, 1, codes, 4, 4, 0)) < 0) |
| 328 | return i; | 328 | return i; |
| 329 | 329 | ||
| 330 | /* frame decode */ | 330 | /* frame decode */ |
| @@ -371,7 +371,7 @@ static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, ptrdiff_t pal_stride, · 40 unmodified lines | |||
| 371 | prev_avail = 1; | 371 | prev_avail = 1; |
| 372 | } while (--h); | 372 | } while (--h); |
| 373 | 373 | ||
| 374 | ff_free_vlc(&vlc); | 374 | ff_vlc_free(&vlc); |
| 375 | return 0; | 375 | return 0; |
| 376 | } | 376 | } |
| 377 | 377 | ||
| @@ -115,9 +115,9 @@ static av_cold void mss4_init_vlc(VLC *vlc, unsigned *offset, · 114 unmodified lines | |||
| 115 | 115 | ||
| 116 | vlc->table = &vlc_buf[*offset]; | 116 | vlc->table = &vlc_buf[*offset]; |
| 117 | vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *offset; | 117 | vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *offset; |
| 118 | ff_init_vlc_from_lengths(vlc, FFMIN(bits[idx - 1], 9), idx, | 118 | ff_vlc_init_from_lengths(vlc, FFMIN(bits[idx - 1], 9), idx, |
| 119 | bits, 1, syms, 1, 1, | 119 | bits, 1, syms, 1, 1, |
| 120 | 0, INIT_VLC_STATIC_OVERLONG, NULL); | 120 | 0, VLC_INIT_STATIC_OVERLONG, NULL); |
| 121 | *offset += vlc->table_size; | 121 | *offset += vlc->table_size; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| @@ -657,7 +657,7 @@ static const uint8_t cbp_bits[] = { · 656 unmodified lines | |||
| 657 | 657 | ||
| 658 | static av_cold void init_static_data(void) | 658 | static av_cold void init_static_data(void) |
| 659 | { | 659 | { |
| 660 | INIT_VLC_STATIC_FROM_LENGTHS(&cbp_tab, CBP_VLC_BITS, FF_ARRAY_ELEMS(cbp_bits), | 660 | VLC_INIT_STATIC_FROM_LENGTHS(&cbp_tab, CBP_VLC_BITS, FF_ARRAY_ELEMS(cbp_bits), |
| 661 | cbp_bits, 1, NULL, 0, 0, 0, 0, 1 << CBP_VLC_BITS); | 661 | cbp_bits, 1, NULL, 0, 0, 0, 0, 1 << CBP_VLC_BITS); |
| 662 | } | 662 | } |
| 663 | 663 | ||
| @@ -83,7 +83,7 @@ static int build_vlc(AVCodecContext *avctx, VLC *vlc) · 82 unmodified lines | |||
| 83 | uint8_t xlat[256]; | 83 | uint8_t xlat[256]; |
| 84 | int cur_node, i, j, pos = 0; | 84 | int cur_node, i, j, pos = 0; |
| 85 | 85 | ||
| 86 | ff_free_vlc(vlc); | 86 | ff_vlc_free(vlc); |
| 87 | 87 | ||
| 88 | for (i = 0; i < s->nb_symbols; i++) { | 88 | for (i = 0; i < s->nb_symbols; i++) { |
| 89 | nodes[i].count = s->prob[i]; | 89 | nodes[i].count = s->prob[i]; |
| @@ -140,7 +140,7 @@ static int build_vlc(AVCodecContext *avctx, VLC *vlc) · 50 unmodified lines | |||
| 140 | 140 | ||
| 141 | get_tree_codes(bits, lens, xlat, nodes, cur_node - 1, 0, 0, &pos); | 141 | get_tree_codes(bits, lens, xlat, nodes, cur_node - 1, 0, 0, &pos); |
| 142 | 142 | ||
| 143 | return ff_init_vlc_sparse(vlc, 12, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0); | 143 | return ff_vlc_init_sparse(vlc, 12, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0); |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | static int decode_frame(AVCodecContext *avctx, AVFrame *frame, | 146 | static int decode_frame(AVCodecContext *avctx, AVFrame *frame, |
| @@ -294,7 +294,7 @@ static av_cold int decode_close(AVCodecContext *avctx) · 147 unmodified lines | |||
| 294 | MVHAContext *s = avctx->priv_data; | 294 | MVHAContext *s = avctx->priv_data; |
| 295 | 295 | ||
| 296 | ff_inflate_end(&s->zstream); | 296 | ff_inflate_end(&s->zstream); |
| 297 | ff_free_vlc(&s->vlc); | 297 | ff_vlc_free(&s->vlc); |
| 298 | 298 | ||
| 299 | return 0; | 299 | return 0; |
| 300 | } | 300 | } |
| @@ -892,9 +892,9 @@ static av_cold void on2avc_free_vlcs(On2AVCContext *c) · 891 unmodified lines | |||
| 892 | { | 892 | { |
| 893 | int i; | 893 | int i; |
| 894 | 894 | ||
| 895 | ff_free_vlc(&c->scale_diff); | 895 | ff_vlc_free(&c->scale_diff); |
| 896 | for (i = 1; i < 16; i++) | 896 | for (i = 1; i < 16; i++) |
| 897 | ff_free_vlc(&c->cb_vlc[i]); | 897 | ff_vlc_free(&c->cb_vlc[i]); |
| 898 | } | 898 | } |
| 899 | 899 | ||
| 900 | static av_cold int on2avc_decode_init(AVCodecContext *avctx) | 900 | static av_cold int on2avc_decode_init(AVCodecContext *avctx) |
| @@ -969,14 +969,14 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx) · 68 unmodified lines | |||
| 969 | if (!c->fdsp) | 969 | if (!c->fdsp) |
| 970 | return AVERROR(ENOMEM); | 970 | return AVERROR(ENOMEM); |
| 971 | 971 | ||
| 972 | ret = ff_init_vlc_from_lengths(&c->scale_diff, 9, ON2AVC_SCALE_DIFFS, | 972 | ret = ff_vlc_init_from_lengths(&c->scale_diff, 9, ON2AVC_SCALE_DIFFS, |
| 973 | ff_on2avc_scale_diff_bits, 1, | 973 | ff_on2avc_scale_diff_bits, 1, |
| 974 | ff_on2avc_scale_diff_syms, 1, 1, -60, 0, avctx); | 974 | ff_on2avc_scale_diff_syms, 1, 1, -60, 0, avctx); |
| 975 | if (ret < 0) | 975 | if (ret < 0) |
| 976 | goto vlc_fail; | 976 | goto vlc_fail; |
| 977 | for (i = 1; i < 16; i++) { | 977 | for (i = 1; i < 16; i++) { |
| 978 | int idx = i - 1; | 978 | int idx = i - 1; |
| 979 | ret = ff_init_vlc_from_lengths(&c->cb_vlc[i], 9, ff_on2avc_cb_elems[idx], | 979 | ret = ff_vlc_init_from_lengths(&c->cb_vlc[i], 9, ff_on2avc_cb_elems[idx], |
| 980 | lens, 1, | 980 | lens, 1, |
| 981 | syms, 2, 2, 0, 0, avctx); | 981 | syms, 2, 2, 0, 0, avctx); |
| 982 | if (ret < 0) | 982 | if (ret < 0) |
| @@ -210,8 +210,8 @@ static av_noinline int read_hufftable(AVCodecContext *avctx, VLC *vlc) · 209 unmodified lines | |||
| 210 | s->syms[j] = sym; | 210 | s->syms[j] = sym; |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | ff_free_vlc(vlc); | 213 | ff_vlc_free(vlc); |
| 214 | ret = ff_init_vlc_sparse(vlc, 12, count, | 214 | ret = ff_vlc_init_sparse(vlc, 12, count, |
| 215 | s->bits, sizeof(*s->bits), sizeof(*s->bits), | 215 | s->bits, sizeof(*s->bits), sizeof(*s->bits), |
| 216 | s->codes, sizeof(*s->codes), sizeof(*s->codes), | 216 | s->codes, sizeof(*s->codes), sizeof(*s->codes), |
| 217 | s->syms, sizeof(*s->syms), sizeof(*s->syms), 0); | 217 | s->syms, sizeof(*s->syms), sizeof(*s->syms), 0); |
| @@ -438,7 +438,7 @@ static av_cold int photocd_decode_close(AVCodecContext *avctx) · 220 unmodified lines | |||
| 438 | PhotoCDContext *s = avctx->priv_data; | 438 | PhotoCDContext *s = avctx->priv_data; |
| 439 | 439 | ||
| 440 | for (int i = 0; i < 3; i++) | 440 | for (int i = 0; i < 3; i++) |
| 441 | ff_free_vlc(&s->vlc[i]); | 441 | ff_vlc_free(&s->vlc[i]); |
| 442 | 442 | ||
| 443 | return 0; | 443 | return 0; |
| 444 | } | 444 | } |
| @@ -116,9 +116,9 @@ static av_cold void build_vlc(VLC *vlc, int nb_bits, int nb_codes, · 115 unmodified lines | |||
| 116 | { | 116 | { |
| 117 | vlc->table = &qdm2_table[*offset]; | 117 | vlc->table = &qdm2_table[*offset]; |
| 118 | vlc->table_allocated = FF_ARRAY_ELEMS(qdm2_table) - *offset; | 118 | vlc->table_allocated = FF_ARRAY_ELEMS(qdm2_table) - *offset; |
| 119 | ff_init_vlc_from_lengths(vlc, nb_bits, nb_codes, | 119 | ff_vlc_init_from_lengths(vlc, nb_bits, nb_codes, |
| 120 | &tab[0][1], 2, &tab[0][0], 2, 1, | 120 | &tab[0][1], 2, &tab[0][0], 2, 1, |
| 121 | -1, INIT_VLC_STATIC_OVERLONG | INIT_VLC_LE, NULL); | 121 | -1, VLC_INIT_STATIC_OVERLONG | VLC_INIT_LE, NULL); |
| 122 | *offset += vlc->table_size; | 122 | *offset += vlc->table_size; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| @@ -172,9 +172,9 @@ static av_cold void qdmc_init_static_data(void) · 171 unmodified lines | |||
| 172 | static VLCElem vlc_buffer[13698]; | 172 | static VLCElem vlc_buffer[13698]; |
| 173 | vtable[i].table = &vlc_buffer[offset]; | 173 | vtable[i].table = &vlc_buffer[offset]; |
| 174 | vtable[i].table_allocated = FF_ARRAY_ELEMS(vlc_buffer) - offset; | 174 | vtable[i].table_allocated = FF_ARRAY_ELEMS(vlc_buffer) - offset; |
| 175 | ff_init_vlc_from_lengths(&vtable[i], huff_bits[i], huff_sizes[i], | 175 | ff_vlc_init_from_lengths(&vtable[i], huff_bits[i], huff_sizes[i], |
| 176 | &hufftab[0][1], 2, &hufftab[0][0], 2, 1, -1, | 176 | &hufftab[0][1], 2, &hufftab[0][0], 2, 1, -1, |
| 177 | INIT_VLC_LE | INIT_VLC_STATIC_OVERLONG, NULL); | 177 | VLC_INIT_LE | VLC_INIT_STATIC_OVERLONG, NULL); |
| 178 | hufftab += huff_sizes[i]; | 178 | hufftab += huff_sizes[i]; |
| 179 | offset += vtable[i].table_size; | 179 | offset += vtable[i].table_size; |
| 180 | } | 180 | } |
| @@ -99,7 +99,7 @@ static av_cold int init_ralf_vlc(VLC *vlc, const uint8_t *data, int elems) · 98 unmodified lines | |||
| 99 | for (i = 0; i < elems; i++) | 99 | for (i = 0; i < elems; i++) |
| 100 | codes[i] = prefixes[lens[i]]++; | 100 | codes[i] = prefixes[lens[i]]++; |
| 101 | 101 | ||
| 102 | return ff_init_vlc_sparse(vlc, FFMIN(max_bits, 9), elems, | 102 | return ff_vlc_init_sparse(vlc, FFMIN(max_bits, 9), elems, |
| 103 | lens, 1, 1, codes, 2, 2, NULL, 0, 0, 0); | 103 | lens, 1, 1, codes, 2, 2, NULL, 0, 0, 0); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| @@ -109,16 +109,16 @@ static av_cold int decode_close(AVCodecContext *avctx) · 3 unmodified lines | |||
| 109 | int i, j, k; | 109 | int i, j, k; |
| 110 | 110 | ||
| 111 | for (i = 0; i < 3; i++) { | 111 | for (i = 0; i < 3; i++) { |
| 112 | ff_free_vlc(&ctx->sets[i].filter_params); | 112 | ff_vlc_free(&ctx->sets[i].filter_params); |
| 113 | ff_free_vlc(&ctx->sets[i].bias); | 113 | ff_vlc_free(&ctx->sets[i].bias); |
| 114 | ff_free_vlc(&ctx->sets[i].coding_mode); | 114 | ff_vlc_free(&ctx->sets[i].coding_mode); |
| 115 | for (j = 0; j < 10; j++) | 115 | for (j = 0; j < 10; j++) |
| 116 | for (k = 0; k < 11; k++) | 116 | for (k = 0; k < 11; k++) |
| 117 | ff_free_vlc(&ctx->sets[i].filter_coeffs[j][k]); | 117 | ff_vlc_free(&ctx->sets[i].filter_coeffs[j][k]); |
| 118 | for (j = 0; j < 15; j++) | 118 | for (j = 0; j < 15; j++) |
| 119 | ff_free_vlc(&ctx->sets[i].short_codes[j]); | 119 | ff_vlc_free(&ctx->sets[i].short_codes[j]); |
| 120 | for (j = 0; j < 125; j++) | 120 | for (j = 0; j < 125; j++) |
| 121 | ff_free_vlc(&ctx->sets[i].long_codes[j]); | 121 | ff_vlc_free(&ctx->sets[i].long_codes[j]); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | return 0; | 124 | return 0; |
| @@ -82,7 +82,9 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size) · 81 unmodified lines | |||
| 82 | VLCElem table[1500] = { 0 }; | 82 | VLCElem table[1500] = { 0 }; |
| 83 | VLC vlc = { .table = table, .table_allocated = static_size }; | 83 | VLC vlc = { .table = table, .table_allocated = static_size }; |
| 84 | av_assert0(static_size <= FF_ARRAY_ELEMS(table)); | 84 | av_assert0(static_size <= FF_ARRAY_ELEMS(table)); |
| 85 | 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); | 85 | vlc_init(&vlc, 9, rl->n + 1, |
| 86 | &rl->table_vlc[0][1], 4, 2, | ||
| 87 | &rl->table_vlc[0][0], 4, 2, VLC_INIT_USE_STATIC); | ||
| 86 | 88 | ||
| 87 | for (q = 0; q < 32; q++) { | 89 | for (q = 0; q < 32; q++) { |
| 88 | int qmul = q * 2; | 90 | 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]) · 79 unmodified lines | |||
| 80 | */ | 80 | */ |
| 81 | void ff_rl_init_vlc(RLTable *rl, unsigned static_size); | 81 | void ff_rl_init_vlc(RLTable *rl, unsigned static_size); |
| 82 | 82 | ||
| 83 | #define INIT_VLC_RL(rl, static_size)\ | 83 | #define VLC_INIT_RL(rl, static_size)\ |
| 84 | {\ | 84 | {\ |
| 85 | static RL_VLC_ELEM rl_vlc_table[32][static_size];\ | 85 | static RL_VLC_ELEM rl_vlc_table[32][static_size];\ |
| 86 | \ | 86 | \ |
| @@ -334,8 +334,8 @@ static av_cold void rv10_build_vlc(VLC *vlc, const uint16_t len_count[15], · 333 unmodified lines | |||
| 334 | for (unsigned tmp = nb_lens + len_count[i]; nb_lens < tmp; nb_lens++) | 334 | for (unsigned tmp = nb_lens + len_count[i]; nb_lens < tmp; nb_lens++) |
| 335 | lens[nb_lens] = i + 2; | 335 | lens[nb_lens] = i + 2; |
| 336 | av_assert1(nb_lens == nb_syms); | 336 | av_assert1(nb_lens == nb_syms); |
| 337 | ff_init_vlc_from_lengths(vlc, DC_VLC_BITS, nb_lens, lens, 1, | 337 | ff_vlc_init_from_lengths(vlc, DC_VLC_BITS, nb_lens, lens, 1, |
| 338 | syms, 2, 2, 0, INIT_VLC_STATIC_OVERLONG, NULL); | 338 | syms, 2, 2, 0, VLC_INIT_STATIC_OVERLONG, NULL); |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | static av_cold void rv10_init_static(void) | 341 | 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 · 112 unmodified lines | |||
| 113 | 113 | ||
| 114 | vlc->table = &table_data[*offset]; | 114 | vlc->table = &table_data[*offset]; |
| 115 | vlc->table_allocated = FF_ARRAY_ELEMS(table_data) - *offset; | 115 | vlc->table_allocated = FF_ARRAY_ELEMS(table_data) - *offset; |
| 116 | ff_init_vlc_sparse(vlc, FFMIN(maxbits, 9), size, | 116 | ff_vlc_init_sparse(vlc, FFMIN(maxbits, 9), size, |
| 117 | bits, 1, 1, | 117 | bits, 1, 1, |
| 118 | cw, 2, 2, | 118 | cw, 2, 2, |
| 119 | syms, !!syms, !!syms, INIT_VLC_STATIC_OVERLONG); | 119 | syms, !!syms, !!syms, VLC_INIT_STATIC_OVERLONG); |
| 120 | *offset += vlc->table_size; | 120 | *offset += vlc->table_size; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| @@ -53,9 +53,9 @@ static av_cold void rv40_init_table(VLC *vlc, unsigned *offset, int nb_bits, · 52 unmodified lines | |||
| 53 | vlc->table_allocated = 1 << nb_bits; | 53 | vlc->table_allocated = 1 << nb_bits; |
| 54 | *offset += 1 << nb_bits; | 54 | *offset += 1 << nb_bits; |
| 55 | 55 | ||
| 56 | ff_init_vlc_from_lengths(vlc, nb_bits, nb_codes, | 56 | ff_vlc_init_from_lengths(vlc, nb_bits, nb_codes, |
| 57 | &tab[0][1], 2, &tab[0][0], 2, 1, | 57 | &tab[0][1], 2, &tab[0][0], 2, 1, |
| 58 | 0, INIT_VLC_USE_NEW_STATIC, NULL); | 58 | 0, VLC_INIT_USE_STATIC, NULL); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | /** | 61 | /** |
| @@ -87,9 +87,9 @@ static av_cold void rv40_init_tables(void) · 25 unmodified lines | |||
| 87 | } | 87 | } |
| 88 | aic_mode2_vlc[i].table = &aic_mode2_table[offset]; | 88 | aic_mode2_vlc[i].table = &aic_mode2_table[offset]; |
| 89 | aic_mode2_vlc[i].table_allocated = FF_ARRAY_ELEMS(aic_mode2_table) - offset; | 89 | aic_mode2_vlc[i].table_allocated = FF_ARRAY_ELEMS(aic_mode2_table) - offset; |
| 90 | ff_init_vlc_from_lengths(&aic_mode2_vlc[i], AIC_MODE2_BITS, AIC_MODE2_SIZE, | 90 | ff_vlc_init_from_lengths(&aic_mode2_vlc[i], AIC_MODE2_BITS, AIC_MODE2_SIZE, |
| 91 | aic_mode2_vlc_bits[i], 1, | 91 | aic_mode2_vlc_bits[i], 1, |
| 92 | syms, 2, 2, 0, INIT_VLC_STATIC_OVERLONG, NULL); | 92 | syms, 2, 2, 0, VLC_INIT_STATIC_OVERLONG, NULL); |
| 93 | offset += aic_mode2_vlc[i].table_size; | 93 | offset += aic_mode2_vlc[i].table_size; |
| 94 | } | 94 | } |
| 95 | for(i = 0; i < NUM_PTYPE_VLCS; i++){ | 95 | for(i = 0; i < NUM_PTYPE_VLCS; i++){ |
| @@ -1796,8 +1796,8 @@ static av_cold int build_vlc(VLC *vlc, const SheerTable *table) · 1795 unmodified lines | |||
| 1796 | lens[count] = len; | 1796 | lens[count] = len; |
| 1797 | } | 1797 | } |
| 1798 | 1798 | ||
| 1799 | ff_free_vlc(vlc); | 1799 | ff_vlc_free(vlc); |
| 1800 | return ff_init_vlc_from_lengths(vlc, SHEER_VLC_BITS, count, | 1800 | return ff_vlc_init_from_lengths(vlc, SHEER_VLC_BITS, count, |
| 1801 | lens, sizeof(*lens), NULL, 0, 0, 0, 0, NULL); | 1801 | lens, sizeof(*lens), NULL, 0, 0, 0, 0, NULL); |
| 1802 | } | 1802 | } |
| 1803 | 1803 | ||
| @@ -1992,8 +1992,8 @@ static av_cold int decode_end(AVCodecContext *avctx) · 188 unmodified lines | |||
| 1992 | { | 1992 | { |
| 1993 | SheerVideoContext *s = avctx->priv_data; | 1993 | SheerVideoContext *s = avctx->priv_data; |
| 1994 | 1994 | ||
| 1995 | ff_free_vlc(&s->vlc[0]); | 1995 | ff_vlc_free(&s->vlc[0]); |
| 1996 | ff_free_vlc(&s->vlc[1]); | 1996 | ff_vlc_free(&s->vlc[1]); |
| 1997 | 1997 | ||
| 1998 | return 0; | 1998 | return 0; |
| 1999 | } | 1999 | } |
| @@ -220,10 +220,10 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int · 219 unmodified lines | |||
| 220 | goto error; | 220 | goto error; |
| 221 | skip_bits1(gb); | 221 | skip_bits1(gb); |
| 222 | if (h.current > 1) { | 222 | if (h.current > 1) { |
| 223 | err = ff_init_vlc_from_lengths(&vlc[i], SMKTREE_BITS, h.current, | 223 | err = ff_vlc_init_from_lengths(&vlc[i], SMKTREE_BITS, h.current, |
| 224 | &h.entries[0].length, sizeof(*h.entries), | 224 | &h.entries[0].length, sizeof(*h.entries), |
| 225 | &h.entries[0].value, sizeof(*h.entries), 1, | 225 | &h.entries[0].value, sizeof(*h.entries), 1, |
| 226 | 0, INIT_VLC_OUTPUT_LE, smk->avctx); | 226 | 0, VLC_INIT_OUTPUT_LE, smk->avctx); |
| 227 | if (err < 0) { | 227 | if (err < 0) { |
| 228 | av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); | 228 | av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); |
| 229 | goto error; | 229 | goto error; |
| @@ -264,7 +264,7 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int · 34 unmodified lines | |||
| 264 | err = 0; | 264 | err = 0; |
| 265 | error: | 265 | error: |
| 266 | for (int i = 0; i < 2; i++) { | 266 | for (int i = 0; i < 2; i++) { |
| 267 | ff_free_vlc(&vlc[i]); | 267 | ff_vlc_free(&vlc[i]); |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | return err; | 270 | return err; |
| @@ -659,10 +659,10 @@ static int smka_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 388 unmodified lines | |||
| 659 | goto error; | 659 | goto error; |
| 660 | skip_bits1(&gb); | 660 | skip_bits1(&gb); |
| 661 | if (h.current > 1) { | 661 | if (h.current > 1) { |
| 662 | ret = ff_init_vlc_from_lengths(&vlc[i], SMKTREE_BITS, h.current, | 662 | ret = ff_vlc_init_from_lengths(&vlc[i], SMKTREE_BITS, h.current, |
| 663 | &h.entries[0].length, sizeof(*h.entries), | 663 | &h.entries[0].length, sizeof(*h.entries), |
| 664 | &h.entries[0].value, sizeof(*h.entries), 1, | 664 | &h.entries[0].value, sizeof(*h.entries), 1, |
| 665 | 0, INIT_VLC_OUTPUT_LE, avctx); | 665 | 0, VLC_INIT_OUTPUT_LE, avctx); |
| 666 | if (ret < 0) { | 666 | if (ret < 0) { |
| 667 | av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); | 667 | av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); |
| 668 | goto error; | 668 | goto error; |
| @@ -740,7 +740,7 @@ static int smka_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 71 unmodified lines | |||
| 740 | 740 | ||
| 741 | error: | 741 | error: |
| 742 | for(i = 0; i < 4; i++) { | 742 | for(i = 0; i < 4; i++) { |
| 743 | ff_free_vlc(&vlc[i]); | 743 | ff_vlc_free(&vlc[i]); |
| 744 | } | 744 | } |
| 745 | 745 | ||
| 746 | return ret; | 746 | return ret; |
| @@ -506,7 +506,7 @@ static av_cold void compute_alpha_vlcs(void) · 505 unmodified lines | |||
| 506 | 506 | ||
| 507 | av_assert0(entry == FF_ARRAY_ELEMS(run_code)); | 507 | av_assert0(entry == FF_ARRAY_ELEMS(run_code)); |
| 508 | 508 | ||
| 509 | INIT_LE_VLC_SPARSE_STATIC(&dc_alpha_run_vlc_le, ALPHA_VLC_BITS, | 509 | VLC_INIT_LE_SPARSE_STATIC(&dc_alpha_run_vlc_le, ALPHA_VLC_BITS, |
| 510 | FF_ARRAY_ELEMS(run_code), | 510 | FF_ARRAY_ELEMS(run_code), |
| 511 | run_bits, 1, 1, | 511 | run_bits, 1, 1, |
| 512 | run_code, 2, 2, | 512 | run_code, 2, 2, |
| @@ -546,7 +546,7 @@ static av_cold void compute_alpha_vlcs(void) · 33 unmodified lines | |||
| 546 | 546 | ||
| 547 | av_assert0(entry == FF_ARRAY_ELEMS(level_code)); | 547 | av_assert0(entry == FF_ARRAY_ELEMS(level_code)); |
| 548 | 548 | ||
| 549 | INIT_LE_VLC_SPARSE_STATIC(&dc_alpha_level_vlc_le, ALPHA_VLC_BITS, | 549 | VLC_INIT_LE_SPARSE_STATIC(&dc_alpha_level_vlc_le, ALPHA_VLC_BITS, |
| 550 | FF_ARRAY_ELEMS(level_code), | 550 | FF_ARRAY_ELEMS(level_code), |
| 551 | level_bits, 1, 1, | 551 | level_bits, 1, 1, |
| 552 | level_code, 2, 2, | 552 | level_code, 2, 2, |
| @@ -556,18 +556,18 @@ static av_cold void compute_alpha_vlcs(void) · 3 unmodified lines | |||
| 556 | static av_cold void speedhq_static_init(void) | 556 | static av_cold void speedhq_static_init(void) |
| 557 | { | 557 | { |
| 558 | /* Exactly the same as MPEG-2, except for a little-endian reader. */ | 558 | /* Exactly the same as MPEG-2, except for a little-endian reader. */ |
| 559 | INIT_CUSTOM_VLC_STATIC(&dc_lum_vlc_le, DC_VLC_BITS, 12, | 559 | VLC_INIT_CUSTOM_STATIC(&dc_lum_vlc_le, DC_VLC_BITS, 12, |
| 560 | ff_mpeg12_vlc_dc_lum_bits, 1, 1, | 560 | ff_mpeg12_vlc_dc_lum_bits, 1, 1, |
| 561 | ff_mpeg12_vlc_dc_lum_code, 2, 2, | 561 | ff_mpeg12_vlc_dc_lum_code, 2, 2, |
| 562 | INIT_VLC_OUTPUT_LE, 512); | 562 | VLC_INIT_OUTPUT_LE, 512); |
| 563 | INIT_CUSTOM_VLC_STATIC(&dc_chroma_vlc_le, DC_VLC_BITS, 12, | 563 | VLC_INIT_CUSTOM_STATIC(&dc_chroma_vlc_le, DC_VLC_BITS, 12, |
| 564 | ff_mpeg12_vlc_dc_chroma_bits, 1, 1, | 564 | ff_mpeg12_vlc_dc_chroma_bits, 1, 1, |
| 565 | ff_mpeg12_vlc_dc_chroma_code, 2, 2, | 565 | ff_mpeg12_vlc_dc_chroma_code, 2, 2, |
| 566 | INIT_VLC_OUTPUT_LE, 514); | 566 | VLC_INIT_OUTPUT_LE, 514); |
| 567 | 567 | ||
| 568 | ff_init_2d_vlc_rl(ff_speedhq_vlc_table, speedhq_rl_vlc, ff_speedhq_run, | 568 | ff_init_2d_vlc_rl(ff_speedhq_vlc_table, speedhq_rl_vlc, ff_speedhq_run, |
| 569 | ff_speedhq_level, SPEEDHQ_RL_NB_ELEMS, | 569 | ff_speedhq_level, SPEEDHQ_RL_NB_ELEMS, |
| 570 | FF_ARRAY_ELEMS(speedhq_rl_vlc), INIT_VLC_LE); | 570 | FF_ARRAY_ELEMS(speedhq_rl_vlc), VLC_INIT_LE); |
| 571 | 571 | ||
| 572 | compute_alpha_vlcs(); | 572 | compute_alpha_vlcs(); |
| 573 | } | 573 | } |
| @@ -777,11 +777,11 @@ static int svq1_decode_frame(AVCodecContext *avctx, AVFrame *cur, · 776 unmodified lines | |||
| 777 | 777 | ||
| 778 | static av_cold void svq1_static_init(void) | 778 | static av_cold void svq1_static_init(void) |
| 779 | { | 779 | { |
| 780 | INIT_VLC_STATIC(&svq1_block_type, SVQ1_BLOCK_TYPE_VLC_BITS, 4, | 780 | VLC_INIT_STATIC(&svq1_block_type, SVQ1_BLOCK_TYPE_VLC_BITS, 4, |
| 781 | &ff_svq1_block_type_vlc[0][1], 2, 1, | 781 | &ff_svq1_block_type_vlc[0][1], 2, 1, |
| 782 | &ff_svq1_block_type_vlc[0][0], 2, 1, 8); | 782 | &ff_svq1_block_type_vlc[0][0], 2, 1, 8); |
| 783 | 783 | ||
| 784 | INIT_VLC_STATIC(&svq1_motion_component, 7, 33, | 784 | VLC_INIT_STATIC(&svq1_motion_component, 7, 33, |
| 785 | &ff_mvtab[0][1], 2, 1, | 785 | &ff_mvtab[0][1], 2, 1, |
| 786 | &ff_mvtab[0][0], 2, 1, 176); | 786 | &ff_mvtab[0][0], 2, 1, 176); |
| 787 | 787 | ||
| @@ -792,24 +792,24 @@ static av_cold void svq1_static_init(void) · 4 unmodified lines | |||
| 792 | svq1_intra_multistage[i].table = &table[offset]; | 792 | svq1_intra_multistage[i].table = &table[offset]; |
| 793 | svq1_intra_multistage[i].table_allocated = sizes[0][i]; | 793 | svq1_intra_multistage[i].table_allocated = sizes[0][i]; |
| 794 | offset += sizes[0][i]; | 794 | offset += sizes[0][i]; |
| 795 | init_vlc(&svq1_intra_multistage[i], 3, 8, | 795 | vlc_init(&svq1_intra_multistage[i], 3, 8, |
| 796 | &ff_svq1_intra_multistage_vlc[i][0][1], 2, 1, | 796 | &ff_svq1_intra_multistage_vlc[i][0][1], 2, 1, |
| 797 | &ff_svq1_intra_multistage_vlc[i][0][0], 2, 1, | 797 | &ff_svq1_intra_multistage_vlc[i][0][0], 2, 1, |
| 798 | INIT_VLC_USE_NEW_STATIC); | 798 | VLC_INIT_USE_STATIC); |
| 799 | svq1_inter_multistage[i].table = &table[offset]; | 799 | svq1_inter_multistage[i].table = &table[offset]; |
| 800 | svq1_inter_multistage[i].table_allocated = sizes[1][i]; | 800 | svq1_inter_multistage[i].table_allocated = sizes[1][i]; |
| 801 | offset += sizes[1][i]; | 801 | offset += sizes[1][i]; |
| 802 | init_vlc(&svq1_inter_multistage[i], 3, 8, | 802 | vlc_init(&svq1_inter_multistage[i], 3, 8, |
| 803 | &ff_svq1_inter_multistage_vlc[i][0][1], 2, 1, | 803 | &ff_svq1_inter_multistage_vlc[i][0][1], 2, 1, |
| 804 | &ff_svq1_inter_multistage_vlc[i][0][0], 2, 1, | 804 | &ff_svq1_inter_multistage_vlc[i][0][0], 2, 1, |
| 805 | INIT_VLC_USE_NEW_STATIC); | 805 | VLC_INIT_USE_STATIC); |
| 806 | } | 806 | } |
| 807 | 807 | ||
| 808 | INIT_VLC_STATIC(&svq1_intra_mean, 8, 256, | 808 | VLC_INIT_STATIC(&svq1_intra_mean, 8, 256, |
| 809 | &ff_svq1_intra_mean_vlc[0][1], 4, 2, | 809 | &ff_svq1_intra_mean_vlc[0][1], 4, 2, |
| 810 | &ff_svq1_intra_mean_vlc[0][0], 4, 2, 632); | 810 | &ff_svq1_intra_mean_vlc[0][0], 4, 2, 632); |
| 811 | 811 | ||
| 812 | INIT_VLC_STATIC(&svq1_inter_mean, 9, 512, | 812 | VLC_INIT_STATIC(&svq1_inter_mean, 9, 512, |
| 813 | &ff_svq1_inter_mean_vlc[0][1], 4, 2, | 813 | &ff_svq1_inter_mean_vlc[0][1], 4, 2, |
| 814 | &ff_svq1_inter_mean_vlc[0][0], 4, 2, 1434); | 814 | &ff_svq1_inter_mean_vlc[0][0], 4, 2, 1434); |
| 815 | } | 815 | } |
| @@ -198,7 +198,7 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code) · 197 unmodified lines | |||
| 198 | 198 | ||
| 199 | /* convert codes to vlc_table */ | 199 | /* convert codes to vlc_table */ |
| 200 | if (res >= 0) { | 200 | if (res >= 0) { |
| 201 | res = ff_init_vlc_from_lengths(&code->vlc, huff.max_bits, huff.max_num, | 201 | res = ff_vlc_init_from_lengths(&code->vlc, huff.max_bits, huff.max_num, |
| 202 | huff.lens, sizeof(huff.lens[0]), | 202 | huff.lens, sizeof(huff.lens[0]), |
| 203 | NULL, 0, 0, 0, 0, ctx->avctx); | 203 | NULL, 0, 0, 0, 0, ctx->avctx); |
| 204 | if (res < 0) | 204 | if (res < 0) |
| @@ -223,7 +223,7 @@ static void tm2_free_codes(TM2Codes *code) · 18 unmodified lines | |||
| 223 | { | 223 | { |
| 224 | av_free(code->recode); | 224 | av_free(code->recode); |
| 225 | if (code->vlc.table) | 225 | if (code->vlc.table) |
| 226 | ff_free_vlc(&code->vlc); | 226 | ff_vlc_free(&code->vlc); |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | static inline int tm2_get_token(GetBitContext *gb, TM2Codes *code) | 229 | 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, · 60 unmodified lines | |||
| 61 | 61 | ||
| 62 | vlc->table = &vlc_buf[*offset]; | 62 | vlc->table = &vlc_buf[*offset]; |
| 63 | vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *offset; | 63 | vlc->table_allocated = FF_ARRAY_ELEMS(vlc_buf) - *offset; |
| 64 | ff_init_vlc_from_lengths(vlc, TSCC2_VLC_BITS, nb_codes, | 64 | ff_vlc_init_from_lengths(vlc, TSCC2_VLC_BITS, nb_codes, |
| 65 | lens, 1, syms, sym_length, sym_length, 0, | 65 | lens, 1, syms, sym_length, sym_length, 0, |
| 66 | INIT_VLC_STATIC_OVERLONG | INIT_VLC_OUTPUT_LE, NULL); | 66 | VLC_INIT_STATIC_OVERLONG | VLC_INIT_OUTPUT_LE, NULL); |
| 67 | *offset += vlc->table_size; | 67 | *offset += vlc->table_size; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| @@ -82,7 +82,7 @@ static int build_huff(UtvideoContext *c, const uint8_t *src, VLC *vlc, · 81 unmodified lines | |||
| 82 | he[--codes_count[bits[i]]] = (HuffEntry) { bits[i], i }; | 82 | he[--codes_count[bits[i]]] = (HuffEntry) { bits[i], i }; |
| 83 | 83 | ||
| 84 | #define VLC_BITS 11 | 84 | #define VLC_BITS 11 |
| 85 | return ff_init_vlc_multi_from_lengths(vlc, multi, VLC_BITS, nb_elems, codes_count[0], | 85 | return ff_vlc_init_multi_from_lengths(vlc, multi, VLC_BITS, nb_elems, codes_count[0], |
| 86 | &he[0].len, sizeof(*he), | 86 | &he[0].len, sizeof(*he), |
| 87 | &he[0].sym, sizeof(*he), 2, 0, 0, c->avctx); | 87 | &he[0].sym, sizeof(*he), 2, 0, 0, c->avctx); |
| 88 | } | 88 | } |
| @@ -188,13 +188,13 @@ static int decode_plane10(UtvideoContext *c, int plane_no, · 99 unmodified lines | |||
| 188 | "%d bits left after decoding slice\n", get_bits_left(&gb)); | 188 | "%d bits left after decoding slice\n", get_bits_left(&gb)); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | ff_free_vlc(&vlc); | 191 | ff_vlc_free(&vlc); |
| 192 | ff_free_vlc_multi(&multi); | 192 | ff_vlc_free_multi(&multi); |
| 193 | 193 | ||
| 194 | return 0; | 194 | return 0; |
| 195 | fail: | 195 | fail: |
| 196 | ff_free_vlc(&vlc); | 196 | ff_vlc_free(&vlc); |
| 197 | ff_free_vlc_multi(&multi); | 197 | ff_vlc_free_multi(&multi); |
| 198 | return AVERROR_INVALIDDATA; | 198 | return AVERROR_INVALIDDATA; |
| 199 | } | 199 | } |
| 200 | 200 | ||
| @@ -333,13 +333,13 @@ static int decode_plane(UtvideoContext *c, int plane_no, · 132 unmodified lines | |||
| 333 | "%d bits left after decoding slice\n", get_bits_left(&gb)); | 333 | "%d bits left after decoding slice\n", get_bits_left(&gb)); |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | ff_free_vlc(&vlc); | 336 | ff_vlc_free(&vlc); |
| 337 | ff_free_vlc_multi(&multi); | 337 | ff_vlc_free_multi(&multi); |
| 338 | 338 | ||
| 339 | return 0; | 339 | return 0; |
| 340 | fail: | 340 | fail: |
| 341 | ff_free_vlc(&vlc); | 341 | ff_vlc_free(&vlc); |
| 342 | ff_free_vlc_multi(&multi); | 342 | ff_vlc_free_multi(&multi); |
| 343 | return AVERROR_INVALIDDATA; | 343 | return AVERROR_INVALIDDATA; |
| 344 | } | 344 | } |
| 345 | 345 | ||
| @@ -484,108 +484,108 @@ static av_cold void vc1_init_static(void) · 483 unmodified lines | |||
| 484 | { | 484 | { |
| 485 | static VLCElem vlc_table[32372]; | 485 | static VLCElem vlc_table[32372]; |
| 486 | 486 | ||
| 487 | INIT_VLC_STATIC(&ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4, | 487 | VLC_INIT_STATIC(&ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4, |
| 488 | vc1_norm2_bits, 1, 1, | 488 | vc1_norm2_bits, 1, 1, |
| 489 | vc1_norm2_codes, 1, 1, 1 << VC1_NORM2_VLC_BITS); | 489 | vc1_norm2_codes, 1, 1, 1 << VC1_NORM2_VLC_BITS); |
| 490 | INIT_VLC_STATIC(&ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64, | 490 | VLC_INIT_STATIC(&ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64, |
| 491 | vc1_norm6_bits, 1, 1, | 491 | vc1_norm6_bits, 1, 1, |
| 492 | vc1_norm6_codes, 2, 2, 556); | 492 | vc1_norm6_codes, 2, 2, 556); |
| 493 | INIT_VLC_STATIC(&ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7, | 493 | VLC_INIT_STATIC(&ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7, |
| 494 | vc1_imode_bits, 1, 1, | 494 | vc1_imode_bits, 1, 1, |
| 495 | vc1_imode_codes, 1, 1, 1 << VC1_IMODE_VLC_BITS); | 495 | vc1_imode_codes, 1, 1, 1 << VC1_IMODE_VLC_BITS); |
| 496 | for (int i = 0; i < 3; i++) { | 496 | for (int i = 0; i < 3; i++) { |
| 497 | ff_vc1_ttmb_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 0]]; | 497 | ff_vc1_ttmb_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 0]]; |
| 498 | ff_vc1_ttmb_vlc[i].table_allocated = vlc_offs[i * 3 + 1] - vlc_offs[i * 3 + 0]; | 498 | ff_vc1_ttmb_vlc[i].table_allocated = vlc_offs[i * 3 + 1] - vlc_offs[i * 3 + 0]; |
| 499 | init_vlc(&ff_vc1_ttmb_vlc[i], VC1_TTMB_VLC_BITS, 16, | 499 | vlc_init(&ff_vc1_ttmb_vlc[i], VC1_TTMB_VLC_BITS, 16, |
| 500 | vc1_ttmb_bits[i], 1, 1, | 500 | vc1_ttmb_bits[i], 1, 1, |
| 501 | vc1_ttmb_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); | 501 | vc1_ttmb_codes[i], 2, 2, VLC_INIT_USE_STATIC); |
| 502 | ff_vc1_ttblk_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 1]]; | 502 | ff_vc1_ttblk_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 1]]; |
| 503 | ff_vc1_ttblk_vlc[i].table_allocated = vlc_offs[i * 3 + 2] - vlc_offs[i * 3 + 1]; | 503 | ff_vc1_ttblk_vlc[i].table_allocated = vlc_offs[i * 3 + 2] - vlc_offs[i * 3 + 1]; |
| 504 | init_vlc(&ff_vc1_ttblk_vlc[i], VC1_TTBLK_VLC_BITS, 8, | 504 | vlc_init(&ff_vc1_ttblk_vlc[i], VC1_TTBLK_VLC_BITS, 8, |
| 505 | vc1_ttblk_bits[i], 1, 1, | 505 | vc1_ttblk_bits[i], 1, 1, |
| 506 | vc1_ttblk_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); | 506 | vc1_ttblk_codes[i], 1, 1, VLC_INIT_USE_STATIC); |
| 507 | ff_vc1_subblkpat_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 2]]; | 507 | ff_vc1_subblkpat_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 2]]; |
| 508 | ff_vc1_subblkpat_vlc[i].table_allocated = vlc_offs[i * 3 + 3] - vlc_offs[i * 3 + 2]; | 508 | ff_vc1_subblkpat_vlc[i].table_allocated = vlc_offs[i * 3 + 3] - vlc_offs[i * 3 + 2]; |
| 509 | init_vlc(&ff_vc1_subblkpat_vlc[i], VC1_SUBBLKPAT_VLC_BITS, 15, | 509 | vlc_init(&ff_vc1_subblkpat_vlc[i], VC1_SUBBLKPAT_VLC_BITS, 15, |
| 510 | vc1_subblkpat_bits[i], 1, 1, | 510 | vc1_subblkpat_bits[i], 1, 1, |
| 511 | vc1_subblkpat_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); | 511 | vc1_subblkpat_codes[i], 1, 1, VLC_INIT_USE_STATIC); |
| 512 | } | 512 | } |
| 513 | for (int i = 0; i < 4; i++) { | 513 | for (int i = 0; i < 4; i++) { |
| 514 | ff_vc1_4mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 9]]; | 514 | ff_vc1_4mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 9]]; |
| 515 | ff_vc1_4mv_block_pattern_vlc[i].table_allocated = vlc_offs[i * 3 + 10] - vlc_offs[i * 3 + 9]; | 515 | ff_vc1_4mv_block_pattern_vlc[i].table_allocated = vlc_offs[i * 3 + 10] - vlc_offs[i * 3 + 9]; |
| 516 | init_vlc(&ff_vc1_4mv_block_pattern_vlc[i], VC1_4MV_BLOCK_PATTERN_VLC_BITS, 16, | 516 | vlc_init(&ff_vc1_4mv_block_pattern_vlc[i], VC1_4MV_BLOCK_PATTERN_VLC_BITS, 16, |
| 517 | vc1_4mv_block_pattern_bits[i], 1, 1, | 517 | vc1_4mv_block_pattern_bits[i], 1, 1, |
| 518 | vc1_4mv_block_pattern_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); | 518 | vc1_4mv_block_pattern_codes[i], 1, 1, VLC_INIT_USE_STATIC); |
| 519 | ff_vc1_cbpcy_p_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 10]]; | 519 | ff_vc1_cbpcy_p_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 10]]; |
| 520 | ff_vc1_cbpcy_p_vlc[i].table_allocated = vlc_offs[i * 3 + 11] - vlc_offs[i * 3 + 10]; | 520 | ff_vc1_cbpcy_p_vlc[i].table_allocated = vlc_offs[i * 3 + 11] - vlc_offs[i * 3 + 10]; |
| 521 | init_vlc(&ff_vc1_cbpcy_p_vlc[i], VC1_CBPCY_P_VLC_BITS, 64, | 521 | vlc_init(&ff_vc1_cbpcy_p_vlc[i], VC1_CBPCY_P_VLC_BITS, 64, |
| 522 | vc1_cbpcy_p_bits[i], 1, 1, | 522 | vc1_cbpcy_p_bits[i], 1, 1, |
| 523 | vc1_cbpcy_p_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); | 523 | vc1_cbpcy_p_codes[i], 2, 2, VLC_INIT_USE_STATIC); |
| 524 | ff_vc1_mv_diff_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 11]]; | 524 | ff_vc1_mv_diff_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 11]]; |
| 525 | ff_vc1_mv_diff_vlc[i].table_allocated = vlc_offs[i * 3 + 12] - vlc_offs[i * 3 + 11]; | 525 | ff_vc1_mv_diff_vlc[i].table_allocated = vlc_offs[i * 3 + 12] - vlc_offs[i * 3 + 11]; |
| 526 | init_vlc(&ff_vc1_mv_diff_vlc[i], VC1_MV_DIFF_VLC_BITS, 73, | 526 | vlc_init(&ff_vc1_mv_diff_vlc[i], VC1_MV_DIFF_VLC_BITS, 73, |
| 527 | vc1_mv_diff_bits[i], 1, 1, | 527 | vc1_mv_diff_bits[i], 1, 1, |
| 528 | vc1_mv_diff_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); | 528 | vc1_mv_diff_codes[i], 2, 2, VLC_INIT_USE_STATIC); |
| 529 | } | 529 | } |
| 530 | for (int i = 0; i < 8; i++) { | 530 | for (int i = 0; i < 8; i++) { |
| 531 | ff_vc1_ac_coeff_table[i].table = &vlc_table[vlc_offs[i * 2 + 21]]; | 531 | ff_vc1_ac_coeff_table[i].table = &vlc_table[vlc_offs[i * 2 + 21]]; |
| 532 | ff_vc1_ac_coeff_table[i].table_allocated = vlc_offs[i * 2 + 22] - vlc_offs[i * 2 + 21]; | 532 | ff_vc1_ac_coeff_table[i].table_allocated = vlc_offs[i * 2 + 22] - vlc_offs[i * 2 + 21]; |
| 533 | init_vlc(&ff_vc1_ac_coeff_table[i], AC_VLC_BITS, ff_vc1_ac_sizes[i], | 533 | vlc_init(&ff_vc1_ac_coeff_table[i], AC_VLC_BITS, ff_vc1_ac_sizes[i], |
| 534 | &vc1_ac_tables[i][0][1], 8, 4, | 534 | &vc1_ac_tables[i][0][1], 8, 4, |
| 535 | &vc1_ac_tables[i][0][0], 8, 4, INIT_VLC_USE_NEW_STATIC); | 535 | &vc1_ac_tables[i][0][0], 8, 4, VLC_INIT_USE_STATIC); |
| 536 | /* initialize interlaced MVDATA tables (2-Ref) */ | 536 | /* initialize interlaced MVDATA tables (2-Ref) */ |
| 537 | ff_vc1_2ref_mvdata_vlc[i].table = &vlc_table[vlc_offs[i * 2 + 22]]; | 537 | ff_vc1_2ref_mvdata_vlc[i].table = &vlc_table[vlc_offs[i * 2 + 22]]; |
| 538 | ff_vc1_2ref_mvdata_vlc[i].table_allocated = vlc_offs[i * 2 + 23] - vlc_offs[i * 2 + 22]; | 538 | ff_vc1_2ref_mvdata_vlc[i].table_allocated = vlc_offs[i * 2 + 23] - vlc_offs[i * 2 + 22]; |
| 539 | init_vlc(&ff_vc1_2ref_mvdata_vlc[i], VC1_2REF_MVDATA_VLC_BITS, 126, | 539 | vlc_init(&ff_vc1_2ref_mvdata_vlc[i], VC1_2REF_MVDATA_VLC_BITS, 126, |
| 540 | vc1_2ref_mvdata_bits[i], 1, 1, | 540 | vc1_2ref_mvdata_bits[i], 1, 1, |
| 541 | vc1_2ref_mvdata_codes[i], 4, 4, INIT_VLC_USE_NEW_STATIC); | 541 | vc1_2ref_mvdata_codes[i], 4, 4, VLC_INIT_USE_STATIC); |
| 542 | } | 542 | } |
| 543 | for (int i = 0; i < 4; i++) { | 543 | for (int i = 0; i < 4; i++) { |
| 544 | /* initialize 4MV MBMODE VLC tables for interlaced frame P picture */ | 544 | /* initialize 4MV MBMODE VLC tables for interlaced frame P picture */ |
| 545 | ff_vc1_intfr_4mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 37]]; | 545 | ff_vc1_intfr_4mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 37]]; |
| 546 | ff_vc1_intfr_4mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 38] - vlc_offs[i * 3 + 37]; | 546 | ff_vc1_intfr_4mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 38] - vlc_offs[i * 3 + 37]; |
| 547 | init_vlc(&ff_vc1_intfr_4mv_mbmode_vlc[i], VC1_INTFR_4MV_MBMODE_VLC_BITS, 15, | 547 | vlc_init(&ff_vc1_intfr_4mv_mbmode_vlc[i], VC1_INTFR_4MV_MBMODE_VLC_BITS, 15, |
| 548 | vc1_intfr_4mv_mbmode_bits[i], 1, 1, | 548 | vc1_intfr_4mv_mbmode_bits[i], 1, 1, |
| 549 | vc1_intfr_4mv_mbmode_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); | 549 | vc1_intfr_4mv_mbmode_codes[i], 2, 2, VLC_INIT_USE_STATIC); |
| 550 | /* initialize NON-4MV MBMODE VLC tables for the same */ | 550 | /* initialize NON-4MV MBMODE VLC tables for the same */ |
| 551 | ff_vc1_intfr_non4mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 38]]; | 551 | ff_vc1_intfr_non4mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 38]]; |
| 552 | ff_vc1_intfr_non4mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 39] - vlc_offs[i * 3 + 38]; | 552 | ff_vc1_intfr_non4mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 39] - vlc_offs[i * 3 + 38]; |
| 553 | init_vlc(&ff_vc1_intfr_non4mv_mbmode_vlc[i], VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 9, | 553 | vlc_init(&ff_vc1_intfr_non4mv_mbmode_vlc[i], VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 9, |
| 554 | vc1_intfr_non4mv_mbmode_bits[i], 1, 1, | 554 | vc1_intfr_non4mv_mbmode_bits[i], 1, 1, |
| 555 | vc1_intfr_non4mv_mbmode_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); | 555 | vc1_intfr_non4mv_mbmode_codes[i], 1, 1, VLC_INIT_USE_STATIC); |
| 556 | /* initialize interlaced MVDATA tables (1-Ref) */ | 556 | /* initialize interlaced MVDATA tables (1-Ref) */ |
| 557 | ff_vc1_1ref_mvdata_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 39]]; | 557 | ff_vc1_1ref_mvdata_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 39]]; |
| 558 | ff_vc1_1ref_mvdata_vlc[i].table_allocated = vlc_offs[i * 3 + 40] - vlc_offs[i * 3 + 39]; | 558 | ff_vc1_1ref_mvdata_vlc[i].table_allocated = vlc_offs[i * 3 + 40] - vlc_offs[i * 3 + 39]; |
| 559 | init_vlc(&ff_vc1_1ref_mvdata_vlc[i], VC1_1REF_MVDATA_VLC_BITS, 72, | 559 | vlc_init(&ff_vc1_1ref_mvdata_vlc[i], VC1_1REF_MVDATA_VLC_BITS, 72, |
| 560 | vc1_1ref_mvdata_bits[i], 1, 1, | 560 | vc1_1ref_mvdata_bits[i], 1, 1, |
| 561 | vc1_1ref_mvdata_codes[i], 4, 4, INIT_VLC_USE_NEW_STATIC); | 561 | vc1_1ref_mvdata_codes[i], 4, 4, VLC_INIT_USE_STATIC); |
| 562 | } | 562 | } |
| 563 | for (int i = 0; i < 4; i++) { | 563 | for (int i = 0; i < 4; i++) { |
| 564 | /* Initialize 2MV Block pattern VLC tables */ | 564 | /* Initialize 2MV Block pattern VLC tables */ |
| 565 | ff_vc1_2mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i + 49]]; | 565 | ff_vc1_2mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i + 49]]; |
| 566 | ff_vc1_2mv_block_pattern_vlc[i].table_allocated = vlc_offs[i + 50] - vlc_offs[i + 49]; | 566 | ff_vc1_2mv_block_pattern_vlc[i].table_allocated = vlc_offs[i + 50] - vlc_offs[i + 49]; |
| 567 | init_vlc(&ff_vc1_2mv_block_pattern_vlc[i], VC1_2MV_BLOCK_PATTERN_VLC_BITS, 4, | 567 | vlc_init(&ff_vc1_2mv_block_pattern_vlc[i], VC1_2MV_BLOCK_PATTERN_VLC_BITS, 4, |
| 568 | vc1_2mv_block_pattern_bits[i], 1, 1, | 568 | vc1_2mv_block_pattern_bits[i], 1, 1, |
| 569 | vc1_2mv_block_pattern_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); | 569 | vc1_2mv_block_pattern_codes[i], 1, 1, VLC_INIT_USE_STATIC); |
| 570 | } | 570 | } |
| 571 | for (int i = 0; i < 8; i++) { | 571 | for (int i = 0; i < 8; i++) { |
| 572 | /* Initialize interlaced CBPCY VLC tables (Table 124 - Table 131) */ | 572 | /* Initialize interlaced CBPCY VLC tables (Table 124 - Table 131) */ |
| 573 | ff_vc1_icbpcy_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 53]]; | 573 | ff_vc1_icbpcy_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 53]]; |
| 574 | ff_vc1_icbpcy_vlc[i].table_allocated = vlc_offs[i * 3 + 54] - vlc_offs[i * 3 + 53]; | 574 | ff_vc1_icbpcy_vlc[i].table_allocated = vlc_offs[i * 3 + 54] - vlc_offs[i * 3 + 53]; |
| 575 | init_vlc(&ff_vc1_icbpcy_vlc[i], VC1_ICBPCY_VLC_BITS, 63, | 575 | vlc_init(&ff_vc1_icbpcy_vlc[i], VC1_ICBPCY_VLC_BITS, 63, |
| 576 | vc1_icbpcy_p_bits[i], 1, 1, | 576 | vc1_icbpcy_p_bits[i], 1, 1, |
| 577 | vc1_icbpcy_p_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); | 577 | vc1_icbpcy_p_codes[i], 2, 2, VLC_INIT_USE_STATIC); |
| 578 | /* Initialize interlaced field picture MBMODE VLC tables */ | 578 | /* Initialize interlaced field picture MBMODE VLC tables */ |
| 579 | ff_vc1_if_mmv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 54]]; | 579 | ff_vc1_if_mmv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 54]]; |
| 580 | ff_vc1_if_mmv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 55] - vlc_offs[i * 3 + 54]; | 580 | ff_vc1_if_mmv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 55] - vlc_offs[i * 3 + 54]; |
| 581 | init_vlc(&ff_vc1_if_mmv_mbmode_vlc[i], VC1_IF_MMV_MBMODE_VLC_BITS, 8, | 581 | vlc_init(&ff_vc1_if_mmv_mbmode_vlc[i], VC1_IF_MMV_MBMODE_VLC_BITS, 8, |
| 582 | vc1_if_mmv_mbmode_bits[i], 1, 1, | 582 | vc1_if_mmv_mbmode_bits[i], 1, 1, |
| 583 | vc1_if_mmv_mbmode_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); | 583 | vc1_if_mmv_mbmode_codes[i], 1, 1, VLC_INIT_USE_STATIC); |
| 584 | ff_vc1_if_1mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 55]]; | 584 | ff_vc1_if_1mv_mbmode_vlc[i].table = &vlc_table[vlc_offs[i * 3 + 55]]; |
| 585 | ff_vc1_if_1mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 56] - vlc_offs[i * 3 + 55]; | 585 | ff_vc1_if_1mv_mbmode_vlc[i].table_allocated = vlc_offs[i * 3 + 56] - vlc_offs[i * 3 + 55]; |
| 586 | init_vlc(&ff_vc1_if_1mv_mbmode_vlc[i], VC1_IF_1MV_MBMODE_VLC_BITS, 6, | 586 | vlc_init(&ff_vc1_if_1mv_mbmode_vlc[i], VC1_IF_1MV_MBMODE_VLC_BITS, 6, |
| 587 | vc1_if_1mv_mbmode_bits[i], 1, 1, | 587 | vc1_if_1mv_mbmode_bits[i], 1, 1, |
| 588 | vc1_if_1mv_mbmode_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); | 588 | vc1_if_1mv_mbmode_codes[i], 1, 1, VLC_INIT_USE_STATIC); |
| 589 | } | 589 | } |
| 590 | ff_msmp4_vc1_vlcs_init_once(); | 590 | ff_msmp4_vc1_vlcs_init_once(); |
| 591 | } | 591 | } |
| @@ -64,7 +64,7 @@ static int alloc_table(VLC *vlc, int size, int use_static) · 63 unmodified lines | |||
| 64 | vlc->table_size += size; | 64 | vlc->table_size += size; |
| 65 | if (vlc->table_size > vlc->table_allocated) { | 65 | if (vlc->table_size > vlc->table_allocated) { |
| 66 | if (use_static) | 66 | if (use_static) |
| 67 | abort(); // cannot do anything, init_vlc() is used with too little memory | 67 | abort(); // cannot do anything, vlc_init() is used with too little memory |
| 68 | vlc->table_allocated += (1 << vlc->bits); | 68 | vlc->table_allocated += (1 << vlc->bits); |
| 69 | vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(*vlc->table)); | 69 | vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(*vlc->table)); |
| 70 | if (!vlc->table) { | 70 | if (!vlc->table) { |
| @@ -100,7 +100,7 @@ static int vlc_common_init(VLC *vlc, int nb_bits, int nb_codes, · 29 unmodified lines | |||
| 100 | { | 100 | { |
| 101 | vlc->bits = nb_bits; | 101 | vlc->bits = nb_bits; |
| 102 | vlc->table_size = 0; | 102 | vlc->table_size = 0; |
| 103 | if (flags & INIT_VLC_USE_NEW_STATIC) { | 103 | if (flags & VLC_INIT_USE_STATIC) { |
| 104 | av_assert0(nb_codes <= LOCALBUF_ELEMS); | 104 | av_assert0(nb_codes <= LOCALBUF_ELEMS); |
| 105 | } else { | 105 | } else { |
| 106 | vlc->table = NULL; | 106 | vlc->table = NULL; |
| @@ -144,7 +144,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, · 37 unmodified lines | |||
| 144 | if (table_nb_bits > 30) | 144 | if (table_nb_bits > 30) |
| 145 | return AVERROR(EINVAL); | 145 | return AVERROR(EINVAL); |
| 146 | table_size = 1 << table_nb_bits; | 146 | table_size = 1 << table_nb_bits; |
| 147 | table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC); | 147 | table_index = alloc_table(vlc, table_size, flags & VLC_INIT_USE_STATIC); |
| 148 | ff_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size); | 148 | ff_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size); |
| 149 | if (table_index < 0) | 149 | if (table_index < 0) |
| 150 | return table_index; | 150 | return table_index; |
| @@ -162,7 +162,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, · 11 unmodified lines | |||
| 162 | int nb = 1 << (table_nb_bits - n); | 162 | int nb = 1 << (table_nb_bits - n); |
| 163 | int inc = 1; | 163 | int inc = 1; |
| 164 | 164 | ||
| 165 | if (flags & INIT_VLC_OUTPUT_LE) { | 165 | if (flags & VLC_INIT_OUTPUT_LE) { |
| 166 | j = bitswap_32(code); | 166 | j = bitswap_32(code); |
| 167 | inc = 1 << n; | 167 | inc = 1 << n; |
| 168 | } | 168 | } |
| @@ -200,7 +200,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, · 31 unmodified lines | |||
| 200 | subtable_bits = FFMAX(subtable_bits, n); | 200 | subtable_bits = FFMAX(subtable_bits, n); |
| 201 | } | 201 | } |
| 202 | subtable_bits = FFMIN(subtable_bits, table_nb_bits); | 202 | subtable_bits = FFMIN(subtable_bits, table_nb_bits); |
| 203 | j = (flags & INIT_VLC_OUTPUT_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix; | 203 | j = (flags & VLC_INIT_OUTPUT_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix; |
| 204 | table[j].len = -subtable_bits; | 204 | table[j].len = -subtable_bits; |
| 205 | ff_dlog(NULL, "%4x: n=%d (subtable)\n", | 205 | ff_dlog(NULL, "%4x: n=%d (subtable)\n", |
| 206 | j, codes[i].bits + table_nb_bits); | 206 | 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, · 24 unmodified lines | |||
| 231 | { | 231 | { |
| 232 | int ret = build_table(vlc, nb_bits, nb_codes, codes, flags); | 232 | int ret = build_table(vlc, nb_bits, nb_codes, codes, flags); |
| 233 | 233 | ||
| 234 | if (flags & INIT_VLC_USE_NEW_STATIC) { | 234 | if (flags & VLC_INIT_USE_STATIC) { |
| 235 | if (vlc->table_size != vlc->table_allocated && | 235 | if (vlc->table_size != vlc->table_allocated && |
| 236 | !(flags & (INIT_VLC_STATIC_OVERLONG & ~INIT_VLC_USE_NEW_STATIC))) | 236 | !(flags & (VLC_INIT_STATIC_OVERLONG & ~VLC_INIT_USE_STATIC))) |
| 237 | av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated); | 237 | av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated); |
| 238 | av_assert0(ret >= 0); | 238 | av_assert0(ret >= 0); |
| 239 | } else { | 239 | } else { |
| @@ -247,7 +247,7 @@ static int vlc_common_end(VLC *vlc, int nb_bits, int nb_codes, VLCcode *codes, · 7 unmodified lines | |||
| 247 | return 0; | 247 | return 0; |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, | 250 | int ff_vlc_init_sparse(VLC *vlc, int nb_bits, int nb_codes, |
| 251 | const void *bits, int bits_wrap, int bits_size, | 251 | const void *bits, int bits_wrap, int bits_size, |
| 252 | const void *codes, int codes_wrap, int codes_size, | 252 | const void *codes, int codes_wrap, int codes_size, |
| 253 | const void *symbols, int symbols_wrap, int symbols_size, | 253 | 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, · 15 unmodified lines | |||
| 269 | if (!(condition)) \ | 269 | if (!(condition)) \ |
| 270 | continue; \ | 270 | continue; \ |
| 271 | if (len > 3*nb_bits || len > 32) { \ | 271 | if (len > 3*nb_bits || len > 32) { \ |
| 272 | av_log(NULL, AV_LOG_ERROR, "Too long VLC (%u) in init_vlc\n", len);\ | 272 | av_log(NULL, AV_LOG_ERROR, "Too long VLC (%u) in vlc_init\n", len);\ |
| 273 | if (buf != localbuf) \ | 273 | if (buf != localbuf) \ |
| 274 | av_free(buf); \ | 274 | av_free(buf); \ |
| 275 | return AVERROR(EINVAL); \ | 275 | return AVERROR(EINVAL); \ |
| @@ -278,12 +278,12 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, · 2 unmodified lines | |||
| 278 | GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size); \ | 278 | GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size); \ |
| 279 | if (buf[j].code >= (1LL<<buf[j].bits)) { \ | 279 | if (buf[j].code >= (1LL<<buf[j].bits)) { \ |
| 280 | av_log(NULL, AV_LOG_ERROR, "Invalid code %"PRIx32" for %d in " \ | 280 | av_log(NULL, AV_LOG_ERROR, "Invalid code %"PRIx32" for %d in " \ |
| 281 | "init_vlc\n", buf[j].code, i); \ | 281 | "vlc_init\n", buf[j].code, i); \ |
| 282 | if (buf != localbuf) \ | 282 | if (buf != localbuf) \ |
| 283 | av_free(buf); \ | 283 | av_free(buf); \ |
| 284 | return AVERROR(EINVAL); \ | 284 | return AVERROR(EINVAL); \ |
| 285 | } \ | 285 | } \ |
| 286 | if (flags & INIT_VLC_INPUT_LE) \ | 286 | if (flags & VLC_INIT_INPUT_LE) \ |
| 287 | buf[j].code = bitswap_32(buf[j].code); \ | 287 | buf[j].code = bitswap_32(buf[j].code); \ |
| 288 | else \ | 288 | else \ |
| 289 | buf[j].code <<= 32 - buf[j].bits; \ | 289 | buf[j].code <<= 32 - buf[j].bits; \ |
| @@ -294,7 +294,7 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, · 4 unmodified lines | |||
| 294 | j++; \ | 294 | j++; \ |
| 295 | } | 295 | } |
| 296 | COPY(len > nb_bits); | 296 | COPY(len > nb_bits); |
| 297 | // qsort is the slowest part of init_vlc, and could probably be improved or avoided | 297 | // qsort is the slowest part of vlc_init, and could probably be improved or avoided |
| 298 | AV_QSORT(buf, j, struct VLCcode, compare_vlcspec); | 298 | AV_QSORT(buf, j, struct VLCcode, compare_vlcspec); |
| 299 | COPY(len && len <= nb_bits); | 299 | COPY(len && len <= nb_bits); |
| 300 | nb_codes = j; | 300 | nb_codes = j; |
| @@ -303,7 +303,7 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, · 2 unmodified lines | |||
| 303 | flags, localbuf); | 303 | flags, localbuf); |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | int ff_init_vlc_from_lengths(VLC *vlc, int nb_bits, int nb_codes, | 306 | int ff_vlc_init_from_lengths(VLC *vlc, int nb_bits, int nb_codes, |
| 307 | const int8_t *lens, int lens_wrap, | 307 | const int8_t *lens, int lens_wrap, |
| 308 | const void *symbols, int symbols_wrap, int symbols_size, | 308 | const void *symbols, int symbols_wrap, int symbols_size, |
| 309 | int offset, int flags, void *logctx) | 309 | int offset, int flags, void *logctx) |
| @@ -427,7 +427,7 @@ static int vlc_multi_gen(VLC_MULTI_ELEM *table, const VLC *single, · 117 unmodified lines | |||
| 427 | return 0; | 427 | return 0; |
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | int ff_init_vlc_multi_from_lengths(VLC *vlc, VLC_MULTI *multi, int nb_bits, int nb_elems, | 430 | int ff_vlc_init_multi_from_lengths(VLC *vlc, VLC_MULTI *multi, int nb_bits, int nb_elems, |
| 431 | int nb_codes, const int8_t *lens, int lens_wrap, | 431 | int nb_codes, const int8_t *lens, int lens_wrap, |
| 432 | const void *symbols, int symbols_wrap, int symbols_size, | 432 | const void *symbols, int symbols_wrap, int symbols_size, |
| 433 | int offset, int flags, void *logctx) | 433 | int offset, int flags, void *logctx) |
| @@ -481,12 +481,12 @@ fail: · 47 unmodified lines | |||
| 481 | return AVERROR_INVALIDDATA; | 481 | return AVERROR_INVALIDDATA; |
| 482 | } | 482 | } |
| 483 | 483 | ||
| 484 | void ff_free_vlc_multi(VLC_MULTI *vlc) | 484 | void ff_vlc_free_multi(VLC_MULTI *vlc) |
| 485 | { | 485 | { |
| 486 | av_freep(&vlc->table); | 486 | av_freep(&vlc->table); |
| 487 | } | 487 | } |
| 488 | 488 | ||
| 489 | void ff_free_vlc(VLC *vlc) | 489 | void ff_vlc_free(VLC *vlc) |
| 490 | { | 490 | { |
| 491 | av_freep(&vlc->table); | 491 | av_freep(&vlc->table); |
| 492 | } | 492 | } |
| @@ -53,11 +53,11 @@ typedef struct RL_VLC_ELEM { · 52 unmodified lines | |||
| 53 | uint8_t run; | 53 | uint8_t run; |
| 54 | } RL_VLC_ELEM; | 54 | } RL_VLC_ELEM; |
| 55 | 55 | ||
| 56 | #define init_vlc(vlc, nb_bits, nb_codes, \ | 56 | #define vlc_init(vlc, nb_bits, nb_codes, \ |
| 57 | bits, bits_wrap, bits_size, \ | 57 | bits, bits_wrap, bits_size, \ |
| 58 | codes, codes_wrap, codes_size, \ | 58 | codes, codes_wrap, codes_size, \ |
| 59 | flags) \ | 59 | flags) \ |
| 60 | ff_init_vlc_sparse(vlc, nb_bits, nb_codes, \ | 60 | ff_vlc_init_sparse(vlc, nb_bits, nb_codes, \ |
| 61 | bits, bits_wrap, bits_size, \ | 61 | bits, bits_wrap, bits_size, \ |
| 62 | codes, codes_wrap, codes_size, \ | 62 | codes, codes_wrap, codes_size, \ |
| 63 | NULL, 0, 0, flags) | 63 | NULL, 0, 0, flags) |
| @@ -86,12 +86,12 @@ typedef struct RL_VLC_ELEM { · 22 unmodified lines | |||
| 86 | * May be NULL, then 0, 1, 2, 3, 4,... will be used. | 86 | * May be NULL, then 0, 1, 2, 3, 4,... will be used. |
| 87 | * @param[in] symbols_wrap Stride (in bytes) of the symbols table. | 87 | * @param[in] symbols_wrap Stride (in bytes) of the symbols table. |
| 88 | * @param[in] symbols_size Size of the symbols. 1 and 2 are supported. | 88 | * @param[in] symbols_size Size of the symbols. 1 and 2 are supported. |
| 89 | * @param[in] flags A combination of the INIT_VLC_* flags. | 89 | * @param[in] flags A combination of the VLC_INIT_* flags. |
| 90 | * | 90 | * |
| 91 | * 'wrap' and 'size' make it possible to use any memory configuration and types | 91 | * 'wrap' and 'size' make it possible to use any memory configuration and types |
| 92 | * (byte/word/int) to store the 'bits', 'codes', and 'symbols' tables. | 92 | * (byte/word/int) to store the 'bits', 'codes', and 'symbols' tables. |
| 93 | */ | 93 | */ |
| 94 | int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, | 94 | int ff_vlc_init_sparse(VLC *vlc, int nb_bits, int nb_codes, |
| 95 | const void *bits, int bits_wrap, int bits_size, | 95 | const void *bits, int bits_wrap, int bits_size, |
| 96 | const void *codes, int codes_wrap, int codes_size, | 96 | const void *codes, int codes_wrap, int codes_size, |
| 97 | const void *symbols, int symbols_wrap, int symbols_size, | 97 | 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, · 25 unmodified lines | |||
| 123 | * @param[in] symbols_wrap Stride (in bytes) of the symbols. | 123 | * @param[in] symbols_wrap Stride (in bytes) of the symbols. |
| 124 | * @param[in] symbols_size Size of the symbols. 1 and 2 are supported. | 124 | * @param[in] symbols_size Size of the symbols. 1 and 2 are supported. |
| 125 | * @param[in] offset An offset to apply to all the valid symbols. | 125 | * @param[in] offset An offset to apply to all the valid symbols. |
| 126 | * @param[in] flags A combination of the INIT_VLC_* flags; notice that | 126 | * @param[in] flags A combination of the VLC_INIT_* flags; notice that |
| 127 | * INIT_VLC_INPUT_LE is pointless and ignored. | 127 | * VLC_INIT_INPUT_LE is pointless and ignored. |
| 128 | */ | 128 | */ |
| 129 | int ff_init_vlc_from_lengths(VLC *vlc, int nb_bits, int nb_codes, | 129 | int ff_vlc_init_from_lengths(VLC *vlc, int nb_bits, int nb_codes, |
| 130 | const int8_t *lens, int lens_wrap, | 130 | const int8_t *lens, int lens_wrap, |
| 131 | const void *symbols, int symbols_wrap, int symbols_size, | 131 | const void *symbols, int symbols_wrap, int symbols_size, |
| 132 | int offset, int flags, void *logctx); | 132 | int offset, int flags, void *logctx); |
| @@ -161,65 +161,65 @@ int ff_init_vlc_from_lengths(VLC *vlc, int nb_bits, int nb_codes, · 28 unmodified lines | |||
| 161 | * @param[in] symbols_wrap Stride (in bytes) of the symbols. | 161 | * @param[in] symbols_wrap Stride (in bytes) of the symbols. |
| 162 | * @param[in] symbols_size Size of the symbols. 1 and 2 are supported. | 162 | * @param[in] symbols_size Size of the symbols. 1 and 2 are supported. |
| 163 | * @param[in] offset An offset to apply to all the valid symbols. | 163 | * @param[in] offset An offset to apply to all the valid symbols. |
| 164 | * @param[in] flags A combination of the INIT_VLC_* flags; notice that | 164 | * @param[in] flags A combination of the VLC_INIT_* flags; notice that |
| 165 | * INIT_VLC_INPUT_LE is pointless and ignored. | 165 | * VLC_INIT_INPUT_LE is pointless and ignored. |
| 166 | */ | 166 | */ |
| 167 | int ff_init_vlc_multi_from_lengths(VLC *vlc, VLC_MULTI *multi, int nb_bits, int nb_elems, | 167 | int ff_vlc_init_multi_from_lengths(VLC *vlc, VLC_MULTI *multi, int nb_bits, int nb_elems, |
| 168 | int nb_codes, const int8_t *lens, int lens_wrap, | 168 | int nb_codes, const int8_t *lens, int lens_wrap, |
| 169 | const void *symbols, int symbols_wrap, int symbols_size, | 169 | const void *symbols, int symbols_wrap, int symbols_size, |
| 170 | int offset, int flags, void *logctx); | 170 | int offset, int flags, void *logctx); |
| 171 | 171 | ||
| 172 | 172 | ||
| 173 | void ff_free_vlc_multi(VLC_MULTI *vlc); | 173 | void ff_vlc_free_multi(VLC_MULTI *vlc); |
| 174 | void ff_free_vlc(VLC *vlc); | 174 | void ff_vlc_free(VLC *vlc); |
| 175 | 175 | ||
| 176 | /* If INIT_VLC_INPUT_LE is set, the LSB bit of the codes used to | 176 | #define VLC_INIT_USE_STATIC 1 |
| 177 | #define VLC_INIT_STATIC_OVERLONG (2 | VLC_INIT_USE_STATIC) | ||
| 178 | /* If VLC_INIT_INPUT_LE is set, the LSB bit of the codes used to | ||
| 177 | * initialize the VLC table is the first bit to be read. */ | 179 | * initialize the VLC table is the first bit to be read. */ |
| 178 | #define INIT_VLC_INPUT_LE 2 | 180 | #define VLC_INIT_INPUT_LE 4 |
| 179 | /* If set the VLC is intended for a little endian bitstream reader. */ | 181 | /* If set the VLC is intended for a little endian bitstream reader. */ |
| 180 | #define INIT_VLC_OUTPUT_LE 8 | 182 | #define VLC_INIT_OUTPUT_LE 8 |
| 181 | #define INIT_VLC_LE (INIT_VLC_INPUT_LE | INIT_VLC_OUTPUT_LE) | 183 | #define VLC_INIT_LE (VLC_INIT_INPUT_LE | VLC_INIT_OUTPUT_LE) |
| 182 | #define INIT_VLC_USE_NEW_STATIC 4 | ||
| 183 | #define INIT_VLC_STATIC_OVERLONG (1 | INIT_VLC_USE_NEW_STATIC) | ||
| 184 | 184 | ||
| 185 | #define INIT_CUSTOM_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \ | 185 | #define VLC_INIT_CUSTOM_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \ |
| 186 | h, i, j, flags, static_size) \ | 186 | h, i, j, flags, static_size) \ |
| 187 | do { \ | 187 | do { \ |
| 188 | static VLCElem table[static_size]; \ | 188 | static VLCElem table[static_size]; \ |
| 189 | (vlc)->table = table; \ | 189 | (vlc)->table = table; \ |
| 190 | (vlc)->table_allocated = static_size; \ | 190 | (vlc)->table_allocated = static_size; \ |
| 191 | ff_init_vlc_sparse(vlc, bits, a, b, c, d, e, f, g, h, i, j, \ | 191 | ff_vlc_init_sparse(vlc, bits, a, b, c, d, e, f, g, h, i, j, \ |
| 192 | flags | INIT_VLC_USE_NEW_STATIC); \ | 192 | flags | VLC_INIT_USE_STATIC); \ |
| 193 | } while (0) | 193 | } while (0) |
| 194 | 194 | ||
| 195 | #define INIT_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, h, i, j, static_size) \ | 195 | #define VLC_INIT_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, h, i, j, static_size) \ |
| 196 | INIT_CUSTOM_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \ | 196 | VLC_INIT_CUSTOM_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \ |
| 197 | h, i, j, 0, static_size) | 197 | h, i, j, 0, static_size) |
| 198 | 198 | ||
| 199 | #define INIT_LE_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, h, i, j, static_size) \ | 199 | #define VLC_INIT_LE_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, h, i, j, static_size) \ |
| 200 | INIT_CUSTOM_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \ | 200 | VLC_INIT_CUSTOM_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \ |
| 201 | h, i, j, INIT_VLC_LE, static_size) | 201 | h, i, j, VLC_INIT_LE, static_size) |
| 202 | 202 | ||
| 203 | #define INIT_CUSTOM_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, flags, static_size) \ | 203 | #define VLC_INIT_CUSTOM_STATIC(vlc, bits, a, b, c, d, e, f, g, flags, static_size) \ |
| 204 | INIT_CUSTOM_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \ | 204 | VLC_INIT_CUSTOM_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, \ |
| 205 | NULL, 0, 0, flags, static_size) | 205 | NULL, 0, 0, flags, static_size) |
| 206 | 206 | ||
| 207 | #define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \ | 207 | #define VLC_INIT_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \ |
| 208 | INIT_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, NULL, 0, 0, static_size) | 208 | VLC_INIT_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, NULL, 0, 0, static_size) |
| 209 | 209 | ||
| 210 | #define INIT_LE_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \ | 210 | #define VLC_INIT_LE_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \ |
| 211 | INIT_LE_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, NULL, 0, 0, static_size) | 211 | VLC_INIT_LE_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, NULL, 0, 0, static_size) |
| 212 | 212 | ||
| 213 | #define INIT_VLC_STATIC_FROM_LENGTHS(vlc, bits, nb_codes, lens, len_wrap, \ | 213 | #define VLC_INIT_STATIC_FROM_LENGTHS(vlc, bits, nb_codes, lens, len_wrap, \ |
| 214 | symbols, symbols_wrap, symbols_size, \ | 214 | symbols, symbols_wrap, symbols_size, \ |
| 215 | offset, flags, static_size) \ | 215 | offset, flags, static_size) \ |
| 216 | do { \ | 216 | do { \ |
| 217 | static VLCElem table[static_size]; \ | 217 | static VLCElem table[static_size]; \ |
| 218 | (vlc)->table = table; \ | 218 | (vlc)->table = table; \ |
| 219 | (vlc)->table_allocated = static_size; \ | 219 | (vlc)->table_allocated = static_size; \ |
| 220 | ff_init_vlc_from_lengths(vlc, bits, nb_codes, lens, len_wrap, \ | 220 | ff_vlc_init_from_lengths(vlc, bits, nb_codes, lens, len_wrap, \ |
| 221 | symbols, symbols_wrap, symbols_size, \ | 221 | symbols, symbols_wrap, symbols_size, \ |
| 222 | offset, flags | INIT_VLC_USE_NEW_STATIC, \ | 222 | offset, flags | VLC_INIT_USE_STATIC, \ |
| 223 | NULL); \ | 223 | NULL); \ |
| 224 | } while (0) | 224 | } while (0) |
| 225 | 225 | ||
| @@ -210,7 +210,7 @@ static void vorbis_free(vorbis_context *vc) · 209 unmodified lines | |||
| 210 | if (vc->codebooks) | 210 | if (vc->codebooks) |
| 211 | for (i = 0; i < vc->codebook_count; ++i) { | 211 | for (i = 0; i < vc->codebook_count; ++i) { |
| 212 | av_freep(&vc->codebooks[i].codevectors); | 212 | av_freep(&vc->codebooks[i].codevectors); |
| 213 | ff_free_vlc(&vc->codebooks[i].vlc); | 213 | ff_vlc_free(&vc->codebooks[i].vlc); |
| 214 | } | 214 | } |
| 215 | av_freep(&vc->codebooks); | 215 | av_freep(&vc->codebooks); |
| 216 | 216 | ||
| @@ -454,11 +454,11 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) · 237 unmodified lines | |||
| 454 | 454 | ||
| 455 | codebook_setup->maxdepth = (codebook_setup->maxdepth+codebook_setup->nb_bits - 1) / codebook_setup->nb_bits; | 455 | codebook_setup->maxdepth = (codebook_setup->maxdepth+codebook_setup->nb_bits - 1) / codebook_setup->nb_bits; |
| 456 | 456 | ||
| 457 | if ((ret = init_vlc(&codebook_setup->vlc, codebook_setup->nb_bits, | 457 | if ((ret = vlc_init(&codebook_setup->vlc, codebook_setup->nb_bits, |
| 458 | entries, tmp_vlc_bits, sizeof(*tmp_vlc_bits), | 458 | entries, tmp_vlc_bits, sizeof(*tmp_vlc_bits), |
| 459 | sizeof(*tmp_vlc_bits), tmp_vlc_codes, | 459 | sizeof(*tmp_vlc_bits), tmp_vlc_codes, |
| 460 | sizeof(*tmp_vlc_codes), sizeof(*tmp_vlc_codes), | 460 | sizeof(*tmp_vlc_codes), sizeof(*tmp_vlc_codes), |
| 461 | INIT_VLC_LE))) { | 461 | VLC_INIT_LE))) { |
| 462 | av_log(vc->avctx, AV_LOG_ERROR, " Error generating vlc tables. \n"); | 462 | av_log(vc->avctx, AV_LOG_ERROR, " Error generating vlc tables. \n"); |
| 463 | goto error; | 463 | goto error; |
| 464 | } | 464 | } |
| @@ -361,19 +361,19 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx) · 360 unmodified lines | |||
| 361 | av_frame_free(&s->golden_frame.f); | 361 | av_frame_free(&s->golden_frame.f); |
| 362 | 362 | ||
| 363 | for (i = 0; i < FF_ARRAY_ELEMS(s->coeff_vlc); i++) | 363 | for (i = 0; i < FF_ARRAY_ELEMS(s->coeff_vlc); i++) |
| 364 | ff_free_vlc(&s->coeff_vlc[i]); | 364 | ff_vlc_free(&s->coeff_vlc[i]); |
| 365 | 365 | ||
| 366 | ff_free_vlc(&s->superblock_run_length_vlc); | 366 | ff_vlc_free(&s->superblock_run_length_vlc); |
| 367 | ff_free_vlc(&s->fragment_run_length_vlc); | 367 | ff_vlc_free(&s->fragment_run_length_vlc); |
| 368 | ff_free_vlc(&s->mode_code_vlc); | 368 | ff_vlc_free(&s->mode_code_vlc); |
| 369 | ff_free_vlc(&s->motion_vector_vlc); | 369 | ff_vlc_free(&s->motion_vector_vlc); |
| 370 | 370 | ||
| 371 | for (j = 0; j < 2; j++) | 371 | for (j = 0; j < 2; j++) |
| 372 | for (i = 0; i < 7; i++) | 372 | for (i = 0; i < 7; i++) |
| 373 | ff_free_vlc(&s->vp4_mv_vlc[j][i]); | 373 | ff_vlc_free(&s->vp4_mv_vlc[j][i]); |
| 374 | 374 | ||
| 375 | for (i = 0; i < 2; i++) | 375 | for (i = 0; i < 2; i++) |
| 376 | ff_free_vlc(&s->block_pattern_vlc[i]); | 376 | ff_vlc_free(&s->block_pattern_vlc[i]); |
| 377 | return 0; | 377 | return 0; |
| 378 | } | 378 | } |
| 379 | 379 | ||
| @@ -2439,7 +2439,7 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) · 2059 unmodified lines | |||
| 2439 | /* init VLC tables */ | 2439 | /* init VLC tables */ |
| 2440 | bias_tabs = CONFIG_VP4_DECODER && s->version >= 2 ? vp4_bias : vp3_bias; | 2440 | bias_tabs = CONFIG_VP4_DECODER && s->version >= 2 ? vp4_bias : vp3_bias; |
| 2441 | for (int i = 0; i < FF_ARRAY_ELEMS(s->coeff_vlc); i++) { | 2441 | for (int i = 0; i < FF_ARRAY_ELEMS(s->coeff_vlc); i++) { |
| 2442 | ret = ff_init_vlc_from_lengths(&s->coeff_vlc[i], 11, 32, | 2442 | ret = ff_vlc_init_from_lengths(&s->coeff_vlc[i], 11, 32, |
| 2443 | &bias_tabs[i][0][1], 2, | 2443 | &bias_tabs[i][0][1], 2, |
| 2444 | &bias_tabs[i][0][0], 2, 1, | 2444 | &bias_tabs[i][0][0], 2, 1, |
| 2445 | 0, 0, avctx); | 2445 | 0, 0, avctx); |
| @@ -2450,7 +2450,7 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) · 4 unmodified lines | |||
| 2450 | for (i = 0; i < FF_ARRAY_ELEMS(s->coeff_vlc); i++) { | 2450 | for (i = 0; i < FF_ARRAY_ELEMS(s->coeff_vlc); i++) { |
| 2451 | const HuffTable *tab = &s->huffman_table[i]; | 2451 | const HuffTable *tab = &s->huffman_table[i]; |
| 2452 | 2452 | ||
| 2453 | ret = ff_init_vlc_from_lengths(&s->coeff_vlc[i], 11, tab->nb_entries, | 2453 | ret = ff_vlc_init_from_lengths(&s->coeff_vlc[i], 11, tab->nb_entries, |
| 2454 | &tab->entries[0].len, sizeof(*tab->entries), | 2454 | &tab->entries[0].len, sizeof(*tab->entries), |
| 2455 | &tab->entries[0].sym, sizeof(*tab->entries), 1, | 2455 | &tab->entries[0].sym, sizeof(*tab->entries), 1, |
| 2456 | 0, 0, avctx); | 2456 | 0, 0, avctx); |
| @@ -2459,25 +2459,25 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) · 2 unmodified lines | |||
| 2459 | } | 2459 | } |
| 2460 | } | 2460 | } |
| 2461 | 2461 | ||
| 2462 | ret = ff_init_vlc_from_lengths(&s->superblock_run_length_vlc, SUPERBLOCK_VLC_BITS, 34, | 2462 | ret = ff_vlc_init_from_lengths(&s->superblock_run_length_vlc, SUPERBLOCK_VLC_BITS, 34, |
| 2463 | superblock_run_length_vlc_lens, 1, | 2463 | superblock_run_length_vlc_lens, 1, |
| 2464 | NULL, 0, 0, 1, 0, avctx); | 2464 | NULL, 0, 0, 1, 0, avctx); |
| 2465 | if (ret < 0) | 2465 | if (ret < 0) |
| 2466 | return ret; | 2466 | return ret; |
| 2467 | 2467 | ||
| 2468 | ret = ff_init_vlc_from_lengths(&s->fragment_run_length_vlc, 5, 30, | 2468 | ret = ff_vlc_init_from_lengths(&s->fragment_run_length_vlc, 5, 30, |
| 2469 | fragment_run_length_vlc_len, 1, | 2469 | fragment_run_length_vlc_len, 1, |
| 2470 | NULL, 0, 0, 0, 0, avctx); | 2470 | NULL, 0, 0, 0, 0, avctx); |
| 2471 | if (ret < 0) | 2471 | if (ret < 0) |
| 2472 | return ret; | 2472 | return ret; |
| 2473 | 2473 | ||
| 2474 | ret = ff_init_vlc_from_lengths(&s->mode_code_vlc, 3, 8, | 2474 | ret = ff_vlc_init_from_lengths(&s->mode_code_vlc, 3, 8, |
| 2475 | mode_code_vlc_len, 1, | 2475 | mode_code_vlc_len, 1, |
| 2476 | NULL, 0, 0, 0, 0, avctx); | 2476 | NULL, 0, 0, 0, 0, avctx); |
| 2477 | if (ret < 0) | 2477 | if (ret < 0) |
| 2478 | return ret; | 2478 | return ret; |
| 2479 | 2479 | ||
| 2480 | ret = ff_init_vlc_from_lengths(&s->motion_vector_vlc, VP3_MV_VLC_BITS, 63, | 2480 | ret = ff_vlc_init_from_lengths(&s->motion_vector_vlc, VP3_MV_VLC_BITS, 63, |
| 2481 | &motion_vector_vlc_table[0][1], 2, | 2481 | &motion_vector_vlc_table[0][1], 2, |
| 2482 | &motion_vector_vlc_table[0][0], 2, 1, | 2482 | &motion_vector_vlc_table[0][0], 2, 1, |
| 2483 | -31, 0, avctx); | 2483 | -31, 0, avctx); |
| @@ -2487,7 +2487,7 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) · 3 unmodified lines | |||
| 2487 | #if CONFIG_VP4_DECODER | 2487 | #if CONFIG_VP4_DECODER |
| 2488 | for (j = 0; j < 2; j++) | 2488 | for (j = 0; j < 2; j++) |
| 2489 | for (i = 0; i < 7; i++) { | 2489 | for (i = 0; i < 7; i++) { |
| 2490 | ret = ff_init_vlc_from_lengths(&s->vp4_mv_vlc[j][i], VP4_MV_VLC_BITS, 63, | 2490 | ret = ff_vlc_init_from_lengths(&s->vp4_mv_vlc[j][i], VP4_MV_VLC_BITS, 63, |
| 2491 | &vp4_mv_vlc[j][i][0][1], 2, | 2491 | &vp4_mv_vlc[j][i][0][1], 2, |
| 2492 | &vp4_mv_vlc[j][i][0][0], 2, 1, -31, | 2492 | &vp4_mv_vlc[j][i][0][0], 2, 1, -31, |
| 2493 | 0, avctx); | 2493 | 0, avctx); |
| @@ -2497,7 +2497,7 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx) · 3 unmodified lines | |||
| 2497 | 2497 | ||
| 2498 | /* version >= 2 */ | 2498 | /* version >= 2 */ |
| 2499 | for (i = 0; i < 2; i++) | 2499 | for (i = 0; i < 2; i++) |
| 2500 | if ((ret = init_vlc(&s->block_pattern_vlc[i], 3, 14, | 2500 | if ((ret = vlc_init(&s->block_pattern_vlc[i], 3, 14, |
| 2501 | &vp4_block_pattern_vlc[i][0][1], 2, 1, | 2501 | &vp4_block_pattern_vlc[i][0][1], 2, 1, |
| 2502 | &vp4_block_pattern_vlc[i][0][0], 2, 1, 0)) < 0) | 2502 | &vp4_block_pattern_vlc[i][0][0], 2, 1, 0)) < 0) |
| 2503 | return ret; | 2503 | return ret; |
| @@ -279,7 +279,7 @@ static int vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[], · 278 unmodified lines | |||
| 279 | nodes[map[2*i+1]].count = b + !b; | 279 | nodes[map[2*i+1]].count = b + !b; |
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | ff_free_vlc(vlc); | 282 | ff_vlc_free(vlc); |
| 283 | /* then build the huffman tree according to probabilities */ | 283 | /* then build the huffman tree according to probabilities */ |
| 284 | return ff_huff_build_tree(s->avctx, vlc, size, FF_HUFFMAN_BITS, | 284 | return ff_huff_build_tree(s->avctx, vlc, size, FF_HUFFMAN_BITS, |
| 285 | nodes, vp6_huff_cmp, | 285 | nodes, vp6_huff_cmp, |
| @@ -708,11 +708,11 @@ static av_cold void vp6_decode_free_context(VP56Context *s) · 422 unmodified lines | |||
| 708 | ff_vp56_free_context(s); | 708 | ff_vp56_free_context(s); |
| 709 | 709 | ||
| 710 | for (pt=0; pt<2; pt++) { | 710 | for (pt=0; pt<2; pt++) { |
| 711 | ff_free_vlc(&s->dccv_vlc[pt]); | 711 | ff_vlc_free(&s->dccv_vlc[pt]); |
| 712 | ff_free_vlc(&s->runv_vlc[pt]); | 712 | ff_vlc_free(&s->runv_vlc[pt]); |
| 713 | for (ct=0; ct<3; ct++) | 713 | for (ct=0; ct<3; ct++) |
| 714 | for (cg=0; cg<6; cg++) | 714 | for (cg=0; cg<6; cg++) |
| 715 | ff_free_vlc(&s->ract_vlc[pt][ct][cg]); | 715 | ff_vlc_free(&s->ract_vlc[pt][ct][cg]); |
| 716 | } | 716 | } |
| 717 | } | 717 | } |
| 718 | 718 | ||
| @@ -53,7 +53,7 @@ static VLC vector_vlc; · 52 unmodified lines | |||
| 53 | 53 | ||
| 54 | static av_cold void vqc_init_static_data(void) | 54 | static av_cold void vqc_init_static_data(void) |
| 55 | { | 55 | { |
| 56 | INIT_VLC_STATIC_FROM_LENGTHS(&vector_vlc, VECTOR_VLC_BITS, FF_ARRAY_ELEMS(vector_nbits), | 56 | VLC_INIT_STATIC_FROM_LENGTHS(&vector_vlc, VECTOR_VLC_BITS, FF_ARRAY_ELEMS(vector_nbits), |
| 57 | vector_nbits, 1, | 57 | vector_nbits, 1, |
| 58 | vector_symbols, 1, 1, | 58 | vector_symbols, 1, 1, |
| 59 | 0, 0, 1 << VECTOR_VLC_BITS); | 59 | 0, 0, 1 << VECTOR_VLC_BITS); |
| @@ -233,7 +233,7 @@ static void image_ctx_free(ImageContext *img) · 232 unmodified lines | |||
| 233 | if (img->huffman_groups) { | 233 | if (img->huffman_groups) { |
| 234 | for (i = 0; i < img->nb_huffman_groups; i++) { | 234 | for (i = 0; i < img->nb_huffman_groups; i++) { |
| 235 | for (j = 0; j < HUFFMAN_CODES_PER_META_CODE; j++) | 235 | for (j = 0; j < HUFFMAN_CODES_PER_META_CODE; j++) |
| 236 | ff_free_vlc(&img->huffman_groups[i * HUFFMAN_CODES_PER_META_CODE + j].vlc); | 236 | ff_vlc_free(&img->huffman_groups[i * HUFFMAN_CODES_PER_META_CODE + j].vlc); |
| 237 | } | 237 | } |
| 238 | av_free(img->huffman_groups); | 238 | av_free(img->huffman_groups); |
| 239 | } | 239 | } |
| @@ -300,9 +300,9 @@ static int huff_reader_build_canonical(HuffReader *r, const uint8_t *code_length · 60 unmodified lines | |||
| 300 | return AVERROR_INVALIDDATA; | 300 | return AVERROR_INVALIDDATA; |
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | ret = init_vlc(&r->vlc, 8, alphabet_size, | 303 | ret = vlc_init(&r->vlc, 8, alphabet_size, |
| 304 | code_lengths, sizeof(*code_lengths), sizeof(*code_lengths), | 304 | code_lengths, sizeof(*code_lengths), sizeof(*code_lengths), |
| 305 | codes, sizeof(*codes), sizeof(*codes), INIT_VLC_OUTPUT_LE); | 305 | codes, sizeof(*codes), sizeof(*codes), VLC_INIT_OUTPUT_LE); |
| 306 | if (ret < 0) { | 306 | if (ret < 0) { |
| 307 | av_free(codes); | 307 | av_free(codes); |
| 308 | return ret; | 308 | return ret; |
| @@ -415,7 +415,7 @@ static int read_huffman_code_normal(WebPContext *s, HuffReader *hc, · 106 unmodified lines | |||
| 415 | ret = huff_reader_build_canonical(hc, code_lengths, alphabet_size); | 415 | ret = huff_reader_build_canonical(hc, code_lengths, alphabet_size); |
| 416 | 416 | ||
| 417 | finish: | 417 | finish: |
| 418 | ff_free_vlc(&code_len_hc.vlc); | 418 | ff_vlc_free(&code_len_hc.vlc); |
| 419 | av_free(code_lengths); | 419 | av_free(code_lengths); |
| 420 | return ret; | 420 | return ret; |
| 421 | } | 421 | } |
| @@ -42,7 +42,7 @@ static av_cold int init_coef_vlc(VLC *vlc, uint16_t **prun_table, · 41 unmodified lines | |||
| 42 | float *flevel_table; | 42 | float *flevel_table; |
| 43 | int i, l, j, k, level, ret; | 43 | int i, l, j, k, level, ret; |
| 44 | 44 | ||
| 45 | ret = init_vlc(vlc, VLCBITS, n, table_bits, 1, 1, table_codes, 4, 4, 0); | 45 | ret = vlc_init(vlc, VLCBITS, n, table_bits, 1, 1, table_codes, 4, 4, 0); |
| 46 | if (ret < 0) | 46 | if (ret < 0) |
| 47 | return ret; | 47 | return ret; |
| 48 | 48 | ||
| @@ -372,11 +372,11 @@ int ff_wma_end(AVCodecContext *avctx) · 323 unmodified lines | |||
| 372 | av_tx_uninit(&s->mdct_ctx[i]); | 372 | av_tx_uninit(&s->mdct_ctx[i]); |
| 373 | 373 | ||
| 374 | if (s->use_exp_vlc) | 374 | if (s->use_exp_vlc) |
| 375 | ff_free_vlc(&s->exp_vlc); | 375 | ff_vlc_free(&s->exp_vlc); |
| 376 | if (s->use_noise_coding) | 376 | if (s->use_noise_coding) |
| 377 | ff_free_vlc(&s->hgain_vlc); | 377 | ff_vlc_free(&s->hgain_vlc); |
| 378 | for (i = 0; i < 2; i++) { | 378 | for (i = 0; i < 2; i++) { |
| 379 | ff_free_vlc(&s->coef_vlc[i]); | 379 | ff_vlc_free(&s->coef_vlc[i]); |
| 380 | av_freep(&s->run_table[i]); | 380 | av_freep(&s->run_table[i]); |
| 381 | av_freep(&s->level_table[i]); | 381 | av_freep(&s->level_table[i]); |
| 382 | av_freep(&s->int_table[i]); | 382 | av_freep(&s->int_table[i]); |
| @@ -119,7 +119,7 @@ static av_cold int wma_decode_init(AVCodecContext *avctx) · 118 unmodified lines | |||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | if (s->use_noise_coding) { | 121 | if (s->use_noise_coding) { |
| 122 | ret = ff_init_vlc_from_lengths(&s->hgain_vlc, HGAINVLCBITS, | 122 | ret = ff_vlc_init_from_lengths(&s->hgain_vlc, HGAINVLCBITS, |
| 123 | FF_ARRAY_ELEMS(ff_wma_hgain_hufftab), | 123 | FF_ARRAY_ELEMS(ff_wma_hgain_hufftab), |
| 124 | &ff_wma_hgain_hufftab[0][1], 2, | 124 | &ff_wma_hgain_hufftab[0][1], 2, |
| 125 | &ff_wma_hgain_hufftab[0][0], 2, 1, | 125 | &ff_wma_hgain_hufftab[0][0], 2, 1, |
| @@ -130,7 +130,7 @@ static av_cold int wma_decode_init(AVCodecContext *avctx) · 4 unmodified lines | |||
| 130 | 130 | ||
| 131 | if (s->use_exp_vlc) { | 131 | if (s->use_exp_vlc) { |
| 132 | // FIXME move out of context | 132 | // FIXME move out of context |
| 133 | ret = init_vlc(&s->exp_vlc, EXPVLCBITS, sizeof(ff_aac_scalefactor_bits), | 133 | ret = vlc_init(&s->exp_vlc, EXPVLCBITS, sizeof(ff_aac_scalefactor_bits), |
| 134 | ff_aac_scalefactor_bits, 1, 1, | 134 | ff_aac_scalefactor_bits, 1, 1, |
| 135 | ff_aac_scalefactor_code, 4, 4, 0); | 135 | ff_aac_scalefactor_code, 4, 4, 0); |
| 136 | if (ret < 0) | 136 | if (ret < 0) |
| @@ -320,25 +320,25 @@ static av_cold int get_rate(AVCodecContext *avctx) · 319 unmodified lines | |||
| 320 | 320 | ||
| 321 | static av_cold void decode_init_static(void) | 321 | static av_cold void decode_init_static(void) |
| 322 | { | 322 | { |
| 323 | INIT_VLC_STATIC_FROM_LENGTHS(&sf_vlc, SCALEVLCBITS, HUFF_SCALE_SIZE, | 323 | VLC_INIT_STATIC_FROM_LENGTHS(&sf_vlc, SCALEVLCBITS, HUFF_SCALE_SIZE, |
| 324 | &scale_table[0][1], 2, | 324 | &scale_table[0][1], 2, |
| 325 | &scale_table[0][0], 2, 1, -60, 0, 616); | 325 | &scale_table[0][0], 2, 1, -60, 0, 616); |
| 326 | INIT_VLC_STATIC_FROM_LENGTHS(&sf_rl_vlc, VLCBITS, HUFF_SCALE_RL_SIZE, | 326 | VLC_INIT_STATIC_FROM_LENGTHS(&sf_rl_vlc, VLCBITS, HUFF_SCALE_RL_SIZE, |
| 327 | &scale_rl_table[0][1], 2, | 327 | &scale_rl_table[0][1], 2, |
| 328 | &scale_rl_table[0][0], 2, 1, 0, 0, 1406); | 328 | &scale_rl_table[0][0], 2, 1, 0, 0, 1406); |
| 329 | INIT_VLC_STATIC_FROM_LENGTHS(&coef_vlc[0], VLCBITS, HUFF_COEF0_SIZE, | 329 | VLC_INIT_STATIC_FROM_LENGTHS(&coef_vlc[0], VLCBITS, HUFF_COEF0_SIZE, |
| 330 | coef0_lens, 1, | 330 | coef0_lens, 1, |
| 331 | coef0_syms, 2, 2, 0, 0, 2108); | 331 | coef0_syms, 2, 2, 0, 0, 2108); |
| 332 | INIT_VLC_STATIC_FROM_LENGTHS(&coef_vlc[1], VLCBITS, HUFF_COEF1_SIZE, | 332 | VLC_INIT_STATIC_FROM_LENGTHS(&coef_vlc[1], VLCBITS, HUFF_COEF1_SIZE, |
| 333 | &coef1_table[0][1], 2, | 333 | &coef1_table[0][1], 2, |
| 334 | &coef1_table[0][0], 2, 1, 0, 0, 3912); | 334 | &coef1_table[0][0], 2, 1, 0, 0, 3912); |
| 335 | INIT_VLC_STATIC_FROM_LENGTHS(&vec4_vlc, VLCBITS, HUFF_VEC4_SIZE, | 335 | VLC_INIT_STATIC_FROM_LENGTHS(&vec4_vlc, VLCBITS, HUFF_VEC4_SIZE, |
| 336 | vec4_lens, 1, | 336 | vec4_lens, 1, |
| 337 | vec4_syms, 2, 2, -1, 0, 604); | 337 | vec4_syms, 2, 2, -1, 0, 604); |
| 338 | INIT_VLC_STATIC_FROM_LENGTHS(&vec2_vlc, VLCBITS, HUFF_VEC2_SIZE, | 338 | VLC_INIT_STATIC_FROM_LENGTHS(&vec2_vlc, VLCBITS, HUFF_VEC2_SIZE, |
| 339 | &vec2_table[0][1], 2, | 339 | &vec2_table[0][1], 2, |
| 340 | &vec2_table[0][0], 2, 1, -1, 0, 562); | 340 | &vec2_table[0][0], 2, 1, -1, 0, 562); |
| 341 | INIT_VLC_STATIC_FROM_LENGTHS(&vec1_vlc, VLCBITS, HUFF_VEC1_SIZE, | 341 | VLC_INIT_STATIC_FROM_LENGTHS(&vec1_vlc, VLCBITS, HUFF_VEC1_SIZE, |
| 342 | &vec1_table[0][1], 2, | 342 | &vec1_table[0][1], 2, |
| 343 | &vec1_table[0][0], 2, 1, 0, 0, 562); | 343 | &vec1_table[0][0], 2, 1, 0, 0, 562); |
| 344 | 344 | ||
| @@ -320,7 +320,7 @@ static av_cold void wmavoice_init_static_data(void) · 319 unmodified lines | |||
| 320 | 14, 14, 14, 14 | 320 | 14, 14, 14, 14 |
| 321 | }; | 321 | }; |
| 322 | 322 | ||
| 323 | INIT_VLC_STATIC_FROM_LENGTHS(&frame_type_vlc, VLC_NBITS, | 323 | VLC_INIT_STATIC_FROM_LENGTHS(&frame_type_vlc, VLC_NBITS, |
| 324 | FF_ARRAY_ELEMS(bits), bits, | 324 | FF_ARRAY_ELEMS(bits), bits, |
| 325 | 1, NULL, 0, 0, 0, 0, 132); | 325 | 1, NULL, 0, 0, 0, 0, 132); |
| 326 | } | 326 | } |
| @@ -115,10 +115,10 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, · 114 unmodified lines | |||
| 115 | 115 | ||
| 116 | static av_cold void wnv1_init_static(void) | 116 | static av_cold void wnv1_init_static(void) |
| 117 | { | 117 | { |
| 118 | INIT_VLC_STATIC_FROM_LENGTHS(&code_vlc, CODE_VLC_BITS, 16, | 118 | VLC_INIT_STATIC_FROM_LENGTHS(&code_vlc, CODE_VLC_BITS, 16, |
| 119 | &code_tab[0][1], 2, | 119 | &code_tab[0][1], 2, |
| 120 | &code_tab[0][0], 2, 1, | 120 | &code_tab[0][0], 2, 1, |
| 121 | -7, INIT_VLC_OUTPUT_LE, 1 << CODE_VLC_BITS); | 121 | -7, VLC_INIT_OUTPUT_LE, 1 << CODE_VLC_BITS); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | static av_cold int decode_init(AVCodecContext *avctx) | 124 | static av_cold int decode_init(AVCodecContext *avctx) |
| @@ -87,7 +87,7 @@ static int build_vlc(AVCodecContext *avctx, VLC *vlc, const uint32_t *table) · 86 unmodified lines | |||
| 87 | uint8_t xlat[256]; | 87 | uint8_t xlat[256]; |
| 88 | int cur_node, i, j, pos = 0; | 88 | int cur_node, i, j, pos = 0; |
| 89 | 89 | ||
| 90 | ff_free_vlc(vlc); | 90 | ff_vlc_free(vlc); |
| 91 | 91 | ||
| 92 | for (i = 0; i < 256; i++) { | 92 | for (i = 0; i < 256; i++) { |
| 93 | nodes[i].count = table[i]; | 93 | nodes[i].count = table[i]; |
| @@ -142,7 +142,7 @@ static int build_vlc(AVCodecContext *avctx, VLC *vlc, const uint32_t *table) · 48 unmodified lines | |||
| 142 | 142 | ||
| 143 | get_tree_codes(bits, lens, xlat, nodes, cur_node - 1, 0, 0, &pos); | 143 | get_tree_codes(bits, lens, xlat, nodes, cur_node - 1, 0, 0, &pos); |
| 144 | 144 | ||
| 145 | return ff_init_vlc_sparse(vlc, YLC_VLC_BITS, pos, lens, 2, 2, | 145 | return ff_vlc_init_sparse(vlc, YLC_VLC_BITS, pos, lens, 2, 2, |
| 146 | bits, 4, 4, xlat, 1, 1, 0); | 146 | bits, 4, 4, xlat, 1, 1, 0); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| @@ -438,7 +438,7 @@ static av_cold int decode_end(AVCodecContext *avctx) · 289 unmodified lines | |||
| 438 | YLCContext *s = avctx->priv_data; | 438 | YLCContext *s = avctx->priv_data; |
| 439 | 439 | ||
| 440 | for (int i = 0; i < FF_ARRAY_ELEMS(s->vlc); i++) | 440 | for (int i = 0; i < FF_ARRAY_ELEMS(s->vlc); i++) |
| 441 | ff_free_vlc(&s->vlc[i]); | 441 | ff_vlc_free(&s->vlc[i]); |
| 442 | av_freep(&s->buffer); | 442 | av_freep(&s->buffer); |
| 443 | s->buffer_size = 0; | 443 | s->buffer_size = 0; |
| 444 | 444 | ||