Signed-off-by: Martin Storsjö <martin@martin.st>tags/n0.11
| @@ -918,7 +918,7 @@ static av_cold int decode_end(AVCodecContext *avctx) | |||||
| av_freep(&f->cfrm[i].data); | av_freep(&f->cfrm[i].data); | ||||
| f->cfrm[i].allocated_size = 0; | f->cfrm[i].allocated_size = 0; | ||||
| } | } | ||||
| free_vlc(&f->pre_vlc); | |||||
| ff_free_vlc(&f->pre_vlc); | |||||
| if (f->current_picture.data[0]) | if (f->current_picture.data[0]) | ||||
| avctx->release_buffer(avctx, &f->current_picture); | avctx->release_buffer(avctx, &f->current_picture); | ||||
| if (f->last_picture.data[0]) | if (f->last_picture.data[0]) | ||||
| @@ -253,9 +253,9 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, | |||||
| (byte/word/long) to store the 'bits', 'codes', and 'symbols' tables. | (byte/word/long) to store the 'bits', 'codes', and 'symbols' tables. | ||||
| 'use_static' should be set to 1 for tables, which should be freed | 'use_static' should be set to 1 for tables, which should be freed | ||||
| with av_free_static(), 0 if free_vlc() will be used. | |||||
| with av_free_static(), 0 if ff_free_vlc() will be used. | |||||
| */ | */ | ||||
| int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, | |||||
| int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, | |||||
| const void *bits, int bits_wrap, int bits_size, | const void *bits, int bits_wrap, int bits_size, | ||||
| const void *codes, int codes_wrap, int codes_size, | const void *codes, int codes_wrap, int codes_size, | ||||
| const void *symbols, int symbols_wrap, int symbols_size, | const void *symbols, int symbols_wrap, int symbols_size, | ||||
| @@ -318,7 +318,7 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, | |||||
| } | } | ||||
| void free_vlc(VLC *vlc) | |||||
| void ff_free_vlc(VLC *vlc) | |||||
| { | { | ||||
| av_freep(&vlc->table); | av_freep(&vlc->table); | ||||
| } | } | ||||
| @@ -321,11 +321,11 @@ static av_cold int cook_decode_close(AVCodecContext *avctx) | |||||
| /* Free the VLC tables. */ | /* Free the VLC tables. */ | ||||
| for (i = 0; i < 13; i++) | for (i = 0; i < 13; i++) | ||||
| free_vlc(&q->envelope_quant_index[i]); | |||||
| ff_free_vlc(&q->envelope_quant_index[i]); | |||||
| for (i = 0; i < 7; i++) | for (i = 0; i < 7; i++) | ||||
| free_vlc(&q->sqvh[i]); | |||||
| ff_free_vlc(&q->sqvh[i]); | |||||
| for (i = 0; i < q->num_subpackets; i++) | for (i = 0; i < q->num_subpackets; i++) | ||||
| free_vlc(&q->subpacket[i].ccpl); | |||||
| ff_free_vlc(&q->subpacket[i].ccpl); | |||||
| av_log(avctx, AV_LOG_DEBUG, "Memory deallocated.\n"); | av_log(avctx, AV_LOG_DEBUG, "Memory deallocated.\n"); | ||||
| @@ -79,9 +79,9 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, int cid) | |||||
| } | } | ||||
| ctx->cid_table = &ff_dnxhd_cid_table[index]; | ctx->cid_table = &ff_dnxhd_cid_table[index]; | ||||
| free_vlc(&ctx->ac_vlc); | |||||
| free_vlc(&ctx->dc_vlc); | |||||
| free_vlc(&ctx->run_vlc); | |||||
| ff_free_vlc(&ctx->ac_vlc); | |||||
| ff_free_vlc(&ctx->dc_vlc); | |||||
| ff_free_vlc(&ctx->run_vlc); | |||||
| init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257, | init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257, | ||||
| ctx->cid_table->ac_bits, 1, 1, | ctx->cid_table->ac_bits, 1, 1, | ||||
| @@ -391,9 +391,9 @@ static av_cold int dnxhd_decode_close(AVCodecContext *avctx) | |||||
| if (ctx->picture.data[0]) | if (ctx->picture.data[0]) | ||||
| avctx->release_buffer(avctx, &ctx->picture); | avctx->release_buffer(avctx, &ctx->picture); | ||||
| free_vlc(&ctx->ac_vlc); | |||||
| free_vlc(&ctx->dc_vlc); | |||||
| free_vlc(&ctx->run_vlc); | |||||
| ff_free_vlc(&ctx->ac_vlc); | |||||
| ff_free_vlc(&ctx->dc_vlc); | |||||
| ff_free_vlc(&ctx->run_vlc); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -313,7 +313,7 @@ static av_cold int dvvideo_init(AVCodecContext *avctx) | |||||
| dv_rl_vlc[i].level = level; | dv_rl_vlc[i].level = level; | ||||
| dv_rl_vlc[i].run = run; | dv_rl_vlc[i].run = run; | ||||
| } | } | ||||
| free_vlc(&dv_vlc); | |||||
| ff_free_vlc(&dv_vlc); | |||||
| dv_vlc_map_tableinit(); | dv_vlc_map_tableinit(); | ||||
| } | } | ||||
| @@ -110,11 +110,11 @@ av_cold void ff_ccitt_unpack_init(void) | |||||
| ccitt_vlc[1].table = code_table2; | ccitt_vlc[1].table = code_table2; | ||||
| ccitt_vlc[1].table_allocated = 648; | ccitt_vlc[1].table_allocated = 648; | ||||
| for(i = 0; i < 2; i++){ | for(i = 0; i < 2; i++){ | ||||
| init_vlc_sparse(&ccitt_vlc[i], 9, CCITT_SYMS, | |||||
| ccitt_codes_lens[i], 1, 1, | |||||
| ccitt_codes_bits[i], 1, 1, | |||||
| ccitt_syms, 2, 2, | |||||
| INIT_VLC_USE_NEW_STATIC); | |||||
| ff_init_vlc_sparse(&ccitt_vlc[i], 9, CCITT_SYMS, | |||||
| ccitt_codes_lens[i], 1, 1, | |||||
| ccitt_codes_bits[i], 1, 1, | |||||
| ccitt_syms, 2, 2, | |||||
| INIT_VLC_USE_NEW_STATIC); | |||||
| } | } | ||||
| INIT_VLC_STATIC(&ccitt_group3_2d_vlc, 9, 11, | INIT_VLC_STATIC(&ccitt_group3_2d_vlc, 9, 11, | ||||
| ccitt_group3_2d_lens, 1, 1, | ccitt_group3_2d_lens, 1, 1, | ||||
| @@ -113,13 +113,13 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w, | |||||
| if(j) dst[i] += dst[i - stride]; | if(j) dst[i] += dst[i - stride]; | ||||
| else if(Uoff) dst[i] += 0x80; | else if(Uoff) dst[i] += 0x80; | ||||
| if (get_bits_left(&gb) < 0) { | if (get_bits_left(&gb) < 0) { | ||||
| free_vlc(&vlc); | |||||
| ff_free_vlc(&vlc); | |||||
| return AVERROR_INVALIDDATA; | return AVERROR_INVALIDDATA; | ||||
| } | } | ||||
| } | } | ||||
| dst += stride; | dst += stride; | ||||
| } | } | ||||
| free_vlc(&vlc); | |||||
| ff_free_vlc(&vlc); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -364,19 +364,19 @@ static inline void align_get_bits(GetBitContext *s) | |||||
| bits, bits_wrap, bits_size, \ | bits, bits_wrap, bits_size, \ | ||||
| codes, codes_wrap, codes_size, \ | codes, codes_wrap, codes_size, \ | ||||
| flags) \ | flags) \ | ||||
| init_vlc_sparse(vlc, nb_bits, nb_codes, \ | |||||
| bits, bits_wrap, bits_size, \ | |||||
| codes, codes_wrap, codes_size, \ | |||||
| NULL, 0, 0, flags) | |||||
| ff_init_vlc_sparse(vlc, nb_bits, nb_codes, \ | |||||
| bits, bits_wrap, bits_size, \ | |||||
| codes, codes_wrap, codes_size, \ | |||||
| NULL, 0, 0, flags) | |||||
| int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, | |||||
| int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, | |||||
| const void *bits, int bits_wrap, int bits_size, | const void *bits, int bits_wrap, int bits_size, | ||||
| const void *codes, int codes_wrap, int codes_size, | const void *codes, int codes_wrap, int codes_size, | ||||
| const void *symbols, int symbols_wrap, int symbols_size, | const void *symbols, int symbols_wrap, int symbols_size, | ||||
| int flags); | int flags); | ||||
| #define INIT_VLC_LE 2 | #define INIT_VLC_LE 2 | ||||
| #define INIT_VLC_USE_NEW_STATIC 4 | #define INIT_VLC_USE_NEW_STATIC 4 | ||||
| void free_vlc(VLC *vlc); | |||||
| void ff_free_vlc(VLC *vlc); | |||||
| #define INIT_VLC_STATIC(vlc, bits, a,b,c,d,e,f,g, static_size) do { \ | #define INIT_VLC_STATIC(vlc, bits, a,b,c,d,e,f,g, static_size) do { \ | ||||
| static VLC_TYPE table[static_size][2]; \ | static VLC_TYPE table[static_size][2]; \ | ||||
| @@ -66,7 +66,7 @@ static av_cold void h261_decode_init_vlc(H261Context *h){ | |||||
| INIT_VLC_STATIC(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63, | INIT_VLC_STATIC(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63, | ||||
| &h261_cbp_tab[0][1], 2, 1, | &h261_cbp_tab[0][1], 2, 1, | ||||
| &h261_cbp_tab[0][0], 2, 1, 512); | &h261_cbp_tab[0][0], 2, 1, 512); | ||||
| init_rl(&h261_rl_tcoeff, ff_h261_rl_table_store); | |||||
| ff_init_rl(&h261_rl_tcoeff, ff_h261_rl_table_store); | |||||
| INIT_VLC_RL(h261_rl_tcoeff, 552); | INIT_VLC_RL(h261_rl_tcoeff, 552); | ||||
| } | } | ||||
| } | } | ||||
| @@ -240,7 +240,7 @@ void ff_h261_encode_init(MpegEncContext *s){ | |||||
| if (!done) { | if (!done) { | ||||
| done = 1; | done = 1; | ||||
| init_rl(&h261_rl_tcoeff, ff_h261_rl_table_store); | |||||
| ff_init_rl(&h261_rl_tcoeff, ff_h261_rl_table_store); | |||||
| } | } | ||||
| s->min_qcoeff= -127; | s->min_qcoeff= -127; | ||||
| @@ -61,7 +61,7 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags) | |||||
| int pos = 0; | int pos = 0; | ||||
| get_tree_codes(bits, lens, xlat, nodes, head, 0, 0, &pos, no_zero_count); | get_tree_codes(bits, lens, xlat, nodes, head, 0, 0, &pos, no_zero_count); | ||||
| return init_vlc_sparse(vlc, 9, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0); | |||||
| return ff_init_vlc_sparse(vlc, 9, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0); | |||||
| } | } | ||||
| @@ -294,8 +294,8 @@ static void generate_joint_tables(HYuvContext *s){ | |||||
| i++; | i++; | ||||
| } | } | ||||
| } | } | ||||
| free_vlc(&s->vlc[3+p]); | |||||
| init_vlc_sparse(&s->vlc[3+p], VLC_BITS, i, len, 1, 1, bits, 2, 2, symbols, 2, 2, 0); | |||||
| ff_free_vlc(&s->vlc[3+p]); | |||||
| ff_init_vlc_sparse(&s->vlc[3+p], VLC_BITS, i, len, 1, 1, bits, 2, 2, symbols, 2, 2, 0); | |||||
| } | } | ||||
| }else{ | }else{ | ||||
| uint8_t (*map)[4] = (uint8_t(*)[4])s->pix_bgr_map; | uint8_t (*map)[4] = (uint8_t(*)[4])s->pix_bgr_map; | ||||
| @@ -335,7 +335,7 @@ static void generate_joint_tables(HYuvContext *s){ | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| free_vlc(&s->vlc[3]); | |||||
| ff_free_vlc(&s->vlc[3]); | |||||
| init_vlc(&s->vlc[3], VLC_BITS, i, len, 1, 1, bits, 2, 2, 0); | init_vlc(&s->vlc[3], VLC_BITS, i, len, 1, 1, bits, 2, 2, 0); | ||||
| } | } | ||||
| } | } | ||||
| @@ -352,7 +352,7 @@ static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length){ | |||||
| if(generate_bits_table(s->bits[i], s->len[i])<0){ | if(generate_bits_table(s->bits[i], s->len[i])<0){ | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| free_vlc(&s->vlc[i]); | |||||
| ff_free_vlc(&s->vlc[i]); | |||||
| init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0); | init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0); | ||||
| } | } | ||||
| @@ -384,7 +384,7 @@ static int read_old_huffman_tables(HYuvContext *s){ | |||||
| memcpy(s->len[2] , s->len [1], 256*sizeof(uint8_t)); | memcpy(s->len[2] , s->len [1], 256*sizeof(uint8_t)); | ||||
| for(i=0; i<3; i++){ | for(i=0; i<3; i++){ | ||||
| free_vlc(&s->vlc[i]); | |||||
| ff_free_vlc(&s->vlc[i]); | |||||
| init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0); | init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0); | ||||
| } | } | ||||
| @@ -1218,7 +1218,7 @@ static av_cold int decode_end(AVCodecContext *avctx) | |||||
| av_freep(&s->bitstream_buffer); | av_freep(&s->bitstream_buffer); | ||||
| for(i=0; i<6; i++){ | for(i=0; i<6; i++){ | ||||
| free_vlc(&s->vlc[i]); | |||||
| ff_free_vlc(&s->vlc[i]); | |||||
| } | } | ||||
| return 0; | return 0; | ||||
| @@ -813,7 +813,7 @@ static av_cold int decode_close(AVCodecContext *avctx) | |||||
| ff_ivi_free_buffers(&ctx->planes[0]); | ff_ivi_free_buffers(&ctx->planes[0]); | ||||
| if (ctx->mb_vlc.cust_tab.table) | if (ctx->mb_vlc.cust_tab.table) | ||||
| free_vlc(&ctx->mb_vlc.cust_tab); | |||||
| ff_free_vlc(&ctx->mb_vlc.cust_tab); | |||||
| if (ctx->frame.data[0]) | if (ctx->frame.data[0]) | ||||
| avctx->release_buffer(avctx, &ctx->frame); | avctx->release_buffer(avctx, &ctx->frame); | ||||
| @@ -120,8 +120,8 @@ void ff_h263_decode_init_vlc(MpegEncContext *s) | |||||
| INIT_VLC_STATIC(&mv_vlc, MV_VLC_BITS, 33, | INIT_VLC_STATIC(&mv_vlc, MV_VLC_BITS, 33, | ||||
| &ff_mvtab[0][1], 2, 1, | &ff_mvtab[0][1], 2, 1, | ||||
| &ff_mvtab[0][0], 2, 1, 538); | &ff_mvtab[0][0], 2, 1, 538); | ||||
| init_rl(&ff_h263_rl_inter, ff_h263_static_rl_table_store[0]); | |||||
| init_rl(&ff_rl_intra_aic, ff_h263_static_rl_table_store[1]); | |||||
| ff_init_rl(&ff_h263_rl_inter, ff_h263_static_rl_table_store[0]); | |||||
| ff_init_rl(&ff_rl_intra_aic, ff_h263_static_rl_table_store[1]); | |||||
| INIT_VLC_RL(ff_h263_rl_inter, 554); | INIT_VLC_RL(ff_h263_rl_inter, 554); | ||||
| INIT_VLC_RL(ff_rl_intra_aic, 554); | INIT_VLC_RL(ff_rl_intra_aic, 554); | ||||
| INIT_VLC_STATIC(&h263_mbtype_b_vlc, H263_MBTYPE_B_VLC_BITS, 15, | INIT_VLC_STATIC(&h263_mbtype_b_vlc, H263_MBTYPE_B_VLC_BITS, 15, | ||||
| @@ -775,8 +775,8 @@ void ff_h263_encode_init(MpegEncContext *s) | |||||
| if (!done) { | if (!done) { | ||||
| done = 1; | done = 1; | ||||
| init_rl(&ff_h263_rl_inter, ff_h263_static_rl_table_store[0]); | |||||
| init_rl(&ff_rl_intra_aic, ff_h263_static_rl_table_store[1]); | |||||
| ff_init_rl(&ff_h263_rl_inter, ff_h263_static_rl_table_store[0]); | |||||
| ff_init_rl(&ff_rl_intra_aic, ff_h263_static_rl_table_store[1]); | |||||
| init_uni_h263_rl_tab(&ff_rl_intra_aic, NULL, uni_h263_intra_aic_rl_len); | init_uni_h263_rl_tab(&ff_rl_intra_aic, NULL, uni_h263_intra_aic_rl_len); | ||||
| init_uni_h263_rl_tab(&ff_h263_rl_inter , NULL, uni_h263_inter_rl_len); | init_uni_h263_rl_tab(&ff_h263_rl_inter , NULL, uni_h263_inter_rl_len); | ||||
| @@ -132,7 +132,7 @@ int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab, | |||||
| ff_ivi_huff_desc_copy(&huff_tab->cust_desc, &new_huff); | ff_ivi_huff_desc_copy(&huff_tab->cust_desc, &new_huff); | ||||
| if (huff_tab->cust_tab.table) | if (huff_tab->cust_tab.table) | ||||
| free_vlc(&huff_tab->cust_tab); | |||||
| ff_free_vlc(&huff_tab->cust_tab); | |||||
| result = ff_ivi_create_huff_from_desc(&huff_tab->cust_desc, | result = ff_ivi_create_huff_from_desc(&huff_tab->cust_desc, | ||||
| &huff_tab->cust_tab, 0); | &huff_tab->cust_tab, 0); | ||||
| if (result) { | if (result) { | ||||
| @@ -237,7 +237,7 @@ void av_cold ff_ivi_free_buffers(IVIPlaneDesc *planes) | |||||
| av_freep(&planes[p].bands[b].bufs[2]); | av_freep(&planes[p].bands[b].bufs[2]); | ||||
| if (planes[p].bands[b].blk_vlc.cust_tab.table) | if (planes[p].bands[b].blk_vlc.cust_tab.table) | ||||
| free_vlc(&planes[p].bands[b].blk_vlc.cust_tab); | |||||
| ff_free_vlc(&planes[p].bands[b].blk_vlc.cust_tab); | |||||
| for (t = 0; t < planes[p].bands[b].num_tiles; t++) | for (t = 0; t < planes[p].bands[b].num_tiles; t++) | ||||
| av_freep(&planes[p].bands[b].tiles[t].mbs); | av_freep(&planes[p].bands[b].tiles[t].mbs); | ||||
| av_freep(&planes[p].bands[b].tiles); | av_freep(&planes[p].bands[b].tiles); | ||||
| @@ -412,7 +412,7 @@ static av_cold int mimic_decode_end(AVCodecContext *avctx) | |||||
| for(i = 0; i < 16; i++) | for(i = 0; i < 16; i++) | ||||
| if(ctx->buf_ptrs[i].data[0]) | if(ctx->buf_ptrs[i].data[0]) | ||||
| ff_thread_release_buffer(avctx, &ctx->buf_ptrs[i]); | ff_thread_release_buffer(avctx, &ctx->buf_ptrs[i]); | ||||
| free_vlc(&ctx->vlc); | |||||
| ff_free_vlc(&ctx->vlc); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -62,8 +62,8 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table, | |||||
| if (is_ac) | if (is_ac) | ||||
| huff_sym[0] = 16 * 256; | huff_sym[0] = 16 * 256; | ||||
| return init_vlc_sparse(vlc, 9, nb_codes, huff_size, 1, 1, | |||||
| huff_code, 2, 2, huff_sym, 2, 2, use_static); | |||||
| return ff_init_vlc_sparse(vlc, 9, nb_codes, huff_size, 1, 1, | |||||
| huff_code, 2, 2, huff_sym, 2, 2, use_static); | |||||
| } | } | ||||
| static void build_basic_mjpeg_vlc(MJpegDecodeContext *s) | static void build_basic_mjpeg_vlc(MJpegDecodeContext *s) | ||||
| @@ -191,7 +191,7 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s) | |||||
| len -= n; | len -= n; | ||||
| /* build VLC and flush previous vlc if present */ | /* build VLC and flush previous vlc if present */ | ||||
| free_vlc(&s->vlcs[class][index]); | |||||
| ff_free_vlc(&s->vlcs[class][index]); | |||||
| av_log(s->avctx, AV_LOG_DEBUG, "class=%d index=%d nb_codes=%d\n", | av_log(s->avctx, AV_LOG_DEBUG, "class=%d index=%d nb_codes=%d\n", | ||||
| class, index, code_max + 1); | class, index, code_max + 1); | ||||
| if (build_vlc(&s->vlcs[class][index], bits_table, val_table, | if (build_vlc(&s->vlcs[class][index], bits_table, val_table, | ||||
| @@ -199,7 +199,7 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s) | |||||
| return -1; | return -1; | ||||
| if (class > 0) { | if (class > 0) { | ||||
| free_vlc(&s->vlcs[2][index]); | |||||
| ff_free_vlc(&s->vlcs[2][index]); | |||||
| if (build_vlc(&s->vlcs[2][index], bits_table, val_table, | if (build_vlc(&s->vlcs[2][index], bits_table, val_table, | ||||
| code_max + 1, 0, 0) < 0) | code_max + 1, 0, 0) < 0) | ||||
| return -1; | return -1; | ||||
| @@ -1632,7 +1632,7 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx) | |||||
| for (i = 0; i < 3; i++) { | for (i = 0; i < 3; i++) { | ||||
| for (j = 0; j < 4; j++) | for (j = 0; j < 4; j++) | ||||
| free_vlc(&s->vlcs[i][j]); | |||||
| ff_free_vlc(&s->vlcs[i][j]); | |||||
| } | } | ||||
| for (i = 0; i < MAX_COMPONENTS; i++) { | for (i = 0; i < MAX_COMPONENTS; i++) { | ||||
| av_freep(&s->blocks[i]); | av_freep(&s->blocks[i]); | ||||
| @@ -286,7 +286,7 @@ static int mp_decode_frame(AVCodecContext *avctx, | |||||
| if (init_vlc(&mp->vlc, mp->max_codes_bits, mp->codes_count, &mp->codes[0].size, sizeof(HuffCode), 1, &mp->codes[0].code, sizeof(HuffCode), 4, 0)) | if (init_vlc(&mp->vlc, mp->max_codes_bits, mp->codes_count, &mp->codes[0].size, sizeof(HuffCode), 1, &mp->codes[0].code, sizeof(HuffCode), 4, 0)) | ||||
| goto end; | goto end; | ||||
| mp_decode_frame_helper(mp, &gb); | mp_decode_frame_helper(mp, &gb); | ||||
| free_vlc(&mp->vlc); | |||||
| ff_free_vlc(&mp->vlc); | |||||
| end: | end: | ||||
| *data_size = sizeof(AVFrame); | *data_size = sizeof(AVFrame); | ||||
| @@ -182,13 +182,13 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx) | |||||
| q3_vlc[0].table = q3_0_table; | q3_vlc[0].table = q3_0_table; | ||||
| q3_vlc[0].table_allocated = 512; | q3_vlc[0].table_allocated = 512; | ||||
| init_vlc_sparse(&q3_vlc[0], MPC8_Q3_BITS, MPC8_Q3_SIZE, | |||||
| ff_init_vlc_sparse(&q3_vlc[0], MPC8_Q3_BITS, MPC8_Q3_SIZE, | |||||
| mpc8_q3_bits, 1, 1, | mpc8_q3_bits, 1, 1, | ||||
| mpc8_q3_codes, 1, 1, | mpc8_q3_codes, 1, 1, | ||||
| mpc8_q3_syms, 1, 1, INIT_VLC_USE_NEW_STATIC); | mpc8_q3_syms, 1, 1, INIT_VLC_USE_NEW_STATIC); | ||||
| q3_vlc[1].table = q3_1_table; | q3_vlc[1].table = q3_1_table; | ||||
| q3_vlc[1].table_allocated = 516; | q3_vlc[1].table_allocated = 516; | ||||
| init_vlc_sparse(&q3_vlc[1], MPC8_Q4_BITS, MPC8_Q4_SIZE, | |||||
| ff_init_vlc_sparse(&q3_vlc[1], MPC8_Q4_BITS, MPC8_Q4_SIZE, | |||||
| mpc8_q4_bits, 1, 1, | mpc8_q4_bits, 1, 1, | ||||
| mpc8_q4_codes, 1, 1, | mpc8_q4_codes, 1, 1, | ||||
| mpc8_q4_syms, 1, 1, INIT_VLC_USE_NEW_STATIC); | mpc8_q4_syms, 1, 1, INIT_VLC_USE_NEW_STATIC); | ||||
| @@ -693,8 +693,8 @@ av_cold void ff_mpeg12_init_vlcs(void) | |||||
| INIT_VLC_STATIC(&mb_btype_vlc, MB_BTYPE_VLC_BITS, 11, | INIT_VLC_STATIC(&mb_btype_vlc, MB_BTYPE_VLC_BITS, 11, | ||||
| &table_mb_btype[0][1], 2, 1, | &table_mb_btype[0][1], 2, 1, | ||||
| &table_mb_btype[0][0], 2, 1, 64); | &table_mb_btype[0][0], 2, 1, 64); | ||||
| init_rl(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]); | |||||
| init_rl(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]); | |||||
| ff_init_rl(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]); | |||||
| ff_init_rl(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]); | |||||
| INIT_2D_VLC_RL(ff_rl_mpeg1, 680); | INIT_2D_VLC_RL(ff_rl_mpeg1, 680); | ||||
| INIT_2D_VLC_RL(ff_rl_mpeg2, 674); | INIT_2D_VLC_RL(ff_rl_mpeg2, 674); | ||||
| @@ -715,8 +715,8 @@ void ff_mpeg1_encode_init(MpegEncContext *s) | |||||
| int i; | int i; | ||||
| done=1; | done=1; | ||||
| init_rl(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]); | |||||
| init_rl(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]); | |||||
| ff_init_rl(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]); | |||||
| ff_init_rl(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]); | |||||
| for(i=0; i<64; i++) | for(i=0; i<64; i++) | ||||
| { | { | ||||
| @@ -2205,9 +2205,9 @@ static av_cold int decode_init(AVCodecContext *avctx) | |||||
| if (!done) { | if (!done) { | ||||
| done = 1; | done = 1; | ||||
| init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]); | |||||
| init_rl(&rvlc_rl_inter, ff_mpeg4_static_rl_table_store[1]); | |||||
| init_rl(&rvlc_rl_intra, ff_mpeg4_static_rl_table_store[2]); | |||||
| ff_init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]); | |||||
| ff_init_rl(&rvlc_rl_inter, ff_mpeg4_static_rl_table_store[1]); | |||||
| ff_init_rl(&rvlc_rl_intra, ff_mpeg4_static_rl_table_store[2]); | |||||
| INIT_VLC_RL(ff_mpeg4_rl_intra, 554); | INIT_VLC_RL(ff_mpeg4_rl_intra, 554); | ||||
| INIT_VLC_RL(rvlc_rl_inter, 1072); | INIT_VLC_RL(rvlc_rl_inter, 1072); | ||||
| INIT_VLC_RL(rvlc_rl_intra, 1072); | INIT_VLC_RL(rvlc_rl_intra, 1072); | ||||
| @@ -1230,7 +1230,7 @@ static av_cold int encode_init(AVCodecContext *avctx) | |||||
| init_uni_dc_tab(); | init_uni_dc_tab(); | ||||
| init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]); | |||||
| ff_init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]); | |||||
| init_uni_mpeg4_rl_tab(&ff_mpeg4_rl_intra, uni_mpeg4_intra_rl_bits, uni_mpeg4_intra_rl_len); | init_uni_mpeg4_rl_tab(&ff_mpeg4_rl_intra, uni_mpeg4_intra_rl_bits, uni_mpeg4_intra_rl_len); | ||||
| init_uni_mpeg4_rl_tab(&ff_h263_rl_inter, uni_mpeg4_inter_rl_bits, uni_mpeg4_inter_rl_len); | init_uni_mpeg4_rl_tab(&ff_h263_rl_inter, uni_mpeg4_inter_rl_bits, uni_mpeg4_inter_rl_len); | ||||
| @@ -1003,8 +1003,8 @@ void MPV_common_end(MpegEncContext *s) | |||||
| avcodec_default_free_buffers(s->avctx); | avcodec_default_free_buffers(s->avctx); | ||||
| } | } | ||||
| void init_rl(RLTable *rl, | |||||
| uint8_t static_store[2][2 * MAX_RUN + MAX_LEVEL + 3]) | |||||
| void ff_init_rl(RLTable *rl, | |||||
| uint8_t static_store[2][2 * MAX_RUN + MAX_LEVEL + 3]) | |||||
| { | { | ||||
| int8_t max_level[MAX_RUN + 1], max_run[MAX_LEVEL + 1]; | int8_t max_level[MAX_RUN + 1], max_run[MAX_LEVEL + 1]; | ||||
| uint8_t index_run[MAX_RUN + 1]; | uint8_t index_run[MAX_RUN + 1]; | ||||
| @@ -1055,7 +1055,7 @@ void init_rl(RLTable *rl, | |||||
| } | } | ||||
| } | } | ||||
| void init_vlc_rl(RLTable *rl) | |||||
| void ff_init_vlc_rl(RLTable *rl) | |||||
| { | { | ||||
| int i, q; | int i, q; | ||||
| @@ -262,7 +262,7 @@ av_cold void ff_msmpeg4_encode_init(MpegEncContext *s) | |||||
| init_mv_table(&mv_tables[0]); | init_mv_table(&mv_tables[0]); | ||||
| init_mv_table(&mv_tables[1]); | init_mv_table(&mv_tables[1]); | ||||
| for(i=0;i<NB_RL_TABLES;i++) | for(i=0;i<NB_RL_TABLES;i++) | ||||
| init_rl(&rl_table[i], static_rl_table_store[i]); | |||||
| ff_init_rl(&rl_table[i], static_rl_table_store[i]); | |||||
| for(i=0; i<NB_RL_TABLES; i++){ | for(i=0; i<NB_RL_TABLES; i++){ | ||||
| int level; | int level; | ||||
| @@ -1271,7 +1271,7 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx) | |||||
| done = 1; | done = 1; | ||||
| for(i=0;i<NB_RL_TABLES;i++) { | for(i=0;i<NB_RL_TABLES;i++) { | ||||
| init_rl(&rl_table[i], static_rl_table_store[i]); | |||||
| ff_init_rl(&rl_table[i], static_rl_table_store[i]); | |||||
| } | } | ||||
| INIT_VLC_RL(rl_table[0], 642); | INIT_VLC_RL(rl_table[0], 642); | ||||
| INIT_VLC_RL(rl_table[1], 1104); | INIT_VLC_RL(rl_table[1], 1104); | ||||
| @@ -53,8 +53,8 @@ typedef struct RLTable { | |||||
| * @param static_store static uint8_t array[2][2*MAX_RUN + MAX_LEVEL + 3] which will hold | * @param static_store static uint8_t array[2][2*MAX_RUN + MAX_LEVEL + 3] which will hold | ||||
| * the level and run tables, if this is NULL av_malloc() will be used | * the level and run tables, if this is NULL av_malloc() will be used | ||||
| */ | */ | ||||
| void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]); | |||||
| void init_vlc_rl(RLTable *rl); | |||||
| void ff_init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]); | |||||
| void ff_init_vlc_rl(RLTable *rl); | |||||
| #define INIT_VLC_RL(rl, static_size)\ | #define INIT_VLC_RL(rl, static_size)\ | ||||
| {\ | {\ | ||||
| @@ -68,7 +68,7 @@ void init_vlc_rl(RLTable *rl); | |||||
| for(q=0; q<32; q++)\ | for(q=0; q<32; q++)\ | ||||
| rl.rl_vlc[q]= rl_vlc_table[q];\ | rl.rl_vlc[q]= rl_vlc_table[q];\ | ||||
| \ | \ | ||||
| init_vlc_rl(&rl);\ | |||||
| ff_init_vlc_rl(&rl);\ | |||||
| }\ | }\ | ||||
| } | } | ||||
| @@ -131,10 +131,10 @@ static void rv34_gen_vlc(const uint8_t *bits, int size, VLC *vlc, const uint8_t | |||||
| vlc->table = &table_data[table_offs[num]]; | vlc->table = &table_data[table_offs[num]]; | ||||
| vlc->table_allocated = table_offs[num + 1] - table_offs[num]; | vlc->table_allocated = table_offs[num + 1] - table_offs[num]; | ||||
| init_vlc_sparse(vlc, FFMIN(maxbits, 9), realsize, | |||||
| bits2, 1, 1, | |||||
| cw, 2, 2, | |||||
| syms, 2, 2, INIT_VLC_USE_NEW_STATIC); | |||||
| ff_init_vlc_sparse(vlc, FFMIN(maxbits, 9), realsize, | |||||
| bits2, 1, 1, | |||||
| cw, 2, 2, | |||||
| syms, 2, 2, INIT_VLC_USE_NEW_STATIC); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -80,18 +80,18 @@ static av_cold void rv40_init_tables(void) | |||||
| for(i = 0; i < NUM_PTYPE_VLCS; i++){ | for(i = 0; i < NUM_PTYPE_VLCS; i++){ | ||||
| ptype_vlc[i].table = &ptype_table[i << PTYPE_VLC_BITS]; | ptype_vlc[i].table = &ptype_table[i << PTYPE_VLC_BITS]; | ||||
| ptype_vlc[i].table_allocated = 1 << PTYPE_VLC_BITS; | ptype_vlc[i].table_allocated = 1 << PTYPE_VLC_BITS; | ||||
| init_vlc_sparse(&ptype_vlc[i], PTYPE_VLC_BITS, PTYPE_VLC_SIZE, | |||||
| ptype_vlc_bits[i], 1, 1, | |||||
| ptype_vlc_codes[i], 1, 1, | |||||
| ptype_vlc_syms, 1, 1, INIT_VLC_USE_NEW_STATIC); | |||||
| ff_init_vlc_sparse(&ptype_vlc[i], PTYPE_VLC_BITS, PTYPE_VLC_SIZE, | |||||
| ptype_vlc_bits[i], 1, 1, | |||||
| ptype_vlc_codes[i], 1, 1, | |||||
| ptype_vlc_syms, 1, 1, INIT_VLC_USE_NEW_STATIC); | |||||
| } | } | ||||
| for(i = 0; i < NUM_BTYPE_VLCS; i++){ | for(i = 0; i < NUM_BTYPE_VLCS; i++){ | ||||
| btype_vlc[i].table = &btype_table[i << BTYPE_VLC_BITS]; | btype_vlc[i].table = &btype_table[i << BTYPE_VLC_BITS]; | ||||
| btype_vlc[i].table_allocated = 1 << BTYPE_VLC_BITS; | btype_vlc[i].table_allocated = 1 << BTYPE_VLC_BITS; | ||||
| init_vlc_sparse(&btype_vlc[i], BTYPE_VLC_BITS, BTYPE_VLC_SIZE, | |||||
| btype_vlc_bits[i], 1, 1, | |||||
| btype_vlc_codes[i], 1, 1, | |||||
| btype_vlc_syms, 1, 1, INIT_VLC_USE_NEW_STATIC); | |||||
| ff_init_vlc_sparse(&btype_vlc[i], BTYPE_VLC_BITS, BTYPE_VLC_SIZE, | |||||
| btype_vlc_bits[i], 1, 1, | |||||
| btype_vlc_codes[i], 1, 1, | |||||
| btype_vlc_syms, 1, 1, INIT_VLC_USE_NEW_STATIC); | |||||
| } | } | ||||
| } | } | ||||
| @@ -267,9 +267,9 @@ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int | |||||
| *recodes = huff.values; | *recodes = huff.values; | ||||
| if(vlc[0].table) | if(vlc[0].table) | ||||
| free_vlc(&vlc[0]); | |||||
| ff_free_vlc(&vlc[0]); | |||||
| if(vlc[1].table) | if(vlc[1].table) | ||||
| free_vlc(&vlc[1]); | |||||
| ff_free_vlc(&vlc[1]); | |||||
| av_free(tmp1.bits); | av_free(tmp1.bits); | ||||
| av_free(tmp1.lengths); | av_free(tmp1.lengths); | ||||
| av_free(tmp1.values); | av_free(tmp1.values); | ||||
| @@ -718,7 +718,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, | |||||
| for(i = 0; i < 4; i++) { | for(i = 0; i < 4; i++) { | ||||
| if(vlc[i].table) | if(vlc[i].table) | ||||
| free_vlc(&vlc[i]); | |||||
| ff_free_vlc(&vlc[i]); | |||||
| av_free(h[i].bits); | av_free(h[i].bits); | ||||
| av_free(h[i].lengths); | av_free(h[i].lengths); | ||||
| av_free(h[i].values); | av_free(h[i].values); | ||||
| @@ -187,7 +187,7 @@ static void tm2_free_codes(TM2Codes *code) | |||||
| { | { | ||||
| av_free(code->recode); | av_free(code->recode); | ||||
| if(code->vlc.table) | if(code->vlc.table) | ||||
| free_vlc(&code->vlc); | |||||
| ff_free_vlc(&code->vlc); | |||||
| } | } | ||||
| static inline int tm2_get_token(GetBitContext *gb, TM2Codes *code) | static inline int tm2_get_token(GetBitContext *gb, TM2Codes *code) | ||||
| @@ -103,10 +103,10 @@ static int build_huff(const uint8_t *src, VLC *vlc, int *fsym) | |||||
| code += 0x80000000u >> (he[i].len - 1); | code += 0x80000000u >> (he[i].len - 1); | ||||
| } | } | ||||
| return init_vlc_sparse(vlc, FFMIN(he[last].len, 9), last + 1, | |||||
| bits, sizeof(*bits), sizeof(*bits), | |||||
| codes, sizeof(*codes), sizeof(*codes), | |||||
| syms, sizeof(*syms), sizeof(*syms), 0); | |||||
| return ff_init_vlc_sparse(vlc, FFMIN(he[last].len, 9), last + 1, | |||||
| bits, sizeof(*bits), sizeof(*bits), | |||||
| codes, sizeof(*codes), sizeof(*codes), | |||||
| syms, sizeof(*syms), sizeof(*syms), 0); | |||||
| } | } | ||||
| static int decode_plane(UtvideoContext *c, int plane_no, | static int decode_plane(UtvideoContext *c, int plane_no, | ||||
| @@ -207,11 +207,11 @@ static int decode_plane(UtvideoContext *c, int plane_no, | |||||
| get_bits_left(&gb)); | get_bits_left(&gb)); | ||||
| } | } | ||||
| free_vlc(&vlc); | |||||
| ff_free_vlc(&vlc); | |||||
| return 0; | return 0; | ||||
| fail: | fail: | ||||
| free_vlc(&vlc); | |||||
| ff_free_vlc(&vlc); | |||||
| return AVERROR_INVALIDDATA; | return AVERROR_INVALIDDATA; | ||||
| } | } | ||||
| @@ -203,7 +203,7 @@ static void vorbis_free(vorbis_context *vc) | |||||
| for (i = 0; i < vc->codebook_count; ++i) { | for (i = 0; i < vc->codebook_count; ++i) { | ||||
| av_free(vc->codebooks[i].codevectors); | av_free(vc->codebooks[i].codevectors); | ||||
| free_vlc(&vc->codebooks[i].vlc); | |||||
| ff_free_vlc(&vc->codebooks[i].vlc); | |||||
| } | } | ||||
| av_freep(&vc->codebooks); | av_freep(&vc->codebooks); | ||||
| @@ -292,17 +292,17 @@ static av_cold int vp3_decode_end(AVCodecContext *avctx) | |||||
| return 0; | return 0; | ||||
| for (i = 0; i < 16; i++) { | for (i = 0; i < 16; i++) { | ||||
| free_vlc(&s->dc_vlc[i]); | |||||
| free_vlc(&s->ac_vlc_1[i]); | |||||
| free_vlc(&s->ac_vlc_2[i]); | |||||
| free_vlc(&s->ac_vlc_3[i]); | |||||
| free_vlc(&s->ac_vlc_4[i]); | |||||
| ff_free_vlc(&s->dc_vlc[i]); | |||||
| ff_free_vlc(&s->ac_vlc_1[i]); | |||||
| ff_free_vlc(&s->ac_vlc_2[i]); | |||||
| ff_free_vlc(&s->ac_vlc_3[i]); | |||||
| ff_free_vlc(&s->ac_vlc_4[i]); | |||||
| } | } | ||||
| free_vlc(&s->superblock_run_length_vlc); | |||||
| free_vlc(&s->fragment_run_length_vlc); | |||||
| free_vlc(&s->mode_code_vlc); | |||||
| free_vlc(&s->motion_vector_vlc); | |||||
| ff_free_vlc(&s->superblock_run_length_vlc); | |||||
| ff_free_vlc(&s->fragment_run_length_vlc); | |||||
| ff_free_vlc(&s->mode_code_vlc); | |||||
| ff_free_vlc(&s->motion_vector_vlc); | |||||
| /* release all frames */ | /* release all frames */ | ||||
| vp3_decode_flush(avctx); | vp3_decode_flush(avctx); | ||||
| @@ -233,7 +233,7 @@ static int vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[], | |||||
| nodes[map[2*i+1]].count = b + !b; | nodes[map[2*i+1]].count = b + !b; | ||||
| } | } | ||||
| free_vlc(vlc); | |||||
| ff_free_vlc(vlc); | |||||
| /* then build the huffman tree according to probabilities */ | /* then build the huffman tree according to probabilities */ | ||||
| return ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp, | return ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp, | ||||
| FF_HUFFMAN_FLAG_HNODE_FIRST); | FF_HUFFMAN_FLAG_HNODE_FIRST); | ||||
| @@ -611,11 +611,11 @@ static av_cold int vp6_decode_free(AVCodecContext *avctx) | |||||
| ff_vp56_free(avctx); | ff_vp56_free(avctx); | ||||
| for (pt=0; pt<2; pt++) { | for (pt=0; pt<2; pt++) { | ||||
| free_vlc(&s->dccv_vlc[pt]); | |||||
| free_vlc(&s->runv_vlc[pt]); | |||||
| ff_free_vlc(&s->dccv_vlc[pt]); | |||||
| ff_free_vlc(&s->runv_vlc[pt]); | |||||
| for (ct=0; ct<3; ct++) | for (ct=0; ct<3; ct++) | ||||
| for (cg=0; cg<6; cg++) | for (cg=0; cg<6; cg++) | ||||
| free_vlc(&s->ract_vlc[pt][ct][cg]); | |||||
| ff_free_vlc(&s->ract_vlc[pt][ct][cg]); | |||||
| } | } | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -417,13 +417,13 @@ int ff_wma_end(AVCodecContext *avctx) | |||||
| ff_mdct_end(&s->mdct_ctx[i]); | ff_mdct_end(&s->mdct_ctx[i]); | ||||
| if (s->use_exp_vlc) { | if (s->use_exp_vlc) { | ||||
| free_vlc(&s->exp_vlc); | |||||
| ff_free_vlc(&s->exp_vlc); | |||||
| } | } | ||||
| if (s->use_noise_coding) { | if (s->use_noise_coding) { | ||||
| free_vlc(&s->hgain_vlc); | |||||
| ff_free_vlc(&s->hgain_vlc); | |||||
| } | } | ||||
| for (i = 0; i < 2; i++) { | for (i = 0; i < 2; i++) { | ||||
| free_vlc(&s->coef_vlc[i]); | |||||
| ff_free_vlc(&s->coef_vlc[i]); | |||||
| av_free(s->run_table[i]); | av_free(s->run_table[i]); | ||||
| av_free(s->level_table[i]); | av_free(s->level_table[i]); | ||||
| av_free(s->int_table[i]); | av_free(s->int_table[i]); | ||||