diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-05-30 21:08:41 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-05-30 21:08:41 +0000 |
commit | ceaaf78bb758396657a77811a3c38478843afad0 (patch) | |
tree | 10aa937648a23fe3b5086f8c4e9c2393b6090ab2 /libavcodec | |
parent | 2d80ce2bdf8241ff67e00118ef00d47e7f0dbb5d (diff) | |
download | ffmpeg-ceaaf78bb758396657a77811a3c38478843afad0.tar.gz |
Change init_vlc_rl() so it does not use *alloc_static() anymore.
Originally committed as revision 13567 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h261dec.c | 2 | ||||
-rw-r--r-- | libavcodec/h263.c | 10 | ||||
-rw-r--r-- | libavcodec/mpegvideo.c | 15 | ||||
-rw-r--r-- | libavcodec/msmpeg4.c | 7 | ||||
-rw-r--r-- | libavcodec/rl.h | 18 |
5 files changed, 30 insertions, 22 deletions
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index 1d1e838ab8..45c39726a7 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -66,7 +66,7 @@ static av_cold void h261_decode_init_vlc(H261Context *h){ &h261_cbp_tab[0][1], 2, 1, &h261_cbp_tab[0][0], 2, 1, 1); init_rl(&h261_rl_tcoeff, ff_h261_rl_table_store); - init_vlc_rl(&h261_rl_tcoeff, 1); + INIT_VLC_RL(h261_rl_tcoeff, 552); } } diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 57573d354c..28e532ff09 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -2924,11 +2924,11 @@ void h263_decode_init_vlc(MpegEncContext *s) init_rl(&rvlc_rl_inter, static_rl_table_store[3]); init_rl(&rvlc_rl_intra, static_rl_table_store[4]); init_rl(&rl_intra_aic, static_rl_table_store[2]); - init_vlc_rl(&rl_inter, 1); - init_vlc_rl(&rl_intra, 1); - init_vlc_rl(&rvlc_rl_inter, 1); - init_vlc_rl(&rvlc_rl_intra, 1); - init_vlc_rl(&rl_intra_aic, 1); + INIT_VLC_RL(rl_inter, 554); + INIT_VLC_RL(rl_intra, 554); + INIT_VLC_RL(rvlc_rl_inter, 1072); + INIT_VLC_RL(rvlc_rl_intra, 1072); + INIT_VLC_RL(rl_intra_aic, 554); init_vlc(&dc_lum, DC_VLC_BITS, 10 /* 13 */, &DCtab_lum[0][1], 2, 1, &DCtab_lum[0][0], 2, 1, 1); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 7a2deae72a..2ffb7a247f 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -722,19 +722,10 @@ void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]) } } -void init_vlc_rl(RLTable *rl, int use_static) +void init_vlc_rl(RLTable *rl) { int i, q; - /* Return if static table is already initialized */ - if(use_static && rl->rl_vlc[0]) - return; - - init_vlc(&rl->vlc, 9, rl->n + 1, - &rl->table_vlc[0][1], 4, 2, - &rl->table_vlc[0][0], 4, 2, use_static); - - for(q=0; q<32; q++){ int qmul= q*2; int qadd= (q-1)|1; @@ -743,10 +734,6 @@ void init_vlc_rl(RLTable *rl, int use_static) qmul=1; qadd=0; } - if(use_static) - rl->rl_vlc[q]= av_mallocz_static(rl->vlc.table_size*sizeof(RL_VLC_ELEM)); - else - rl->rl_vlc[q]= av_malloc(rl->vlc.table_size*sizeof(RL_VLC_ELEM)); for(i=0; i<rl->vlc.table_size; i++){ int code= rl->vlc.table[i][0]; int len = rl->vlc.table[i][1]; diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index ce3756bb37..efe5344a11 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -1063,8 +1063,13 @@ int ff_msmpeg4_decode_init(MpegEncContext *s) for(i=0;i<NB_RL_TABLES;i++) { init_rl(&rl_table[i], static_rl_table_store[i]); - init_vlc_rl(&rl_table[i], 1); } + INIT_VLC_RL(rl_table[0], 642); + INIT_VLC_RL(rl_table[1], 1104); + INIT_VLC_RL(rl_table[2], 554); + INIT_VLC_RL(rl_table[3], 940); + INIT_VLC_RL(rl_table[4], 962); + INIT_VLC_RL(rl_table[5], 554); for(i=0;i<2;i++) { mv = &mv_tables[i]; init_vlc(&mv->vlc, MV_VLC_BITS, mv->n + 1, diff --git a/libavcodec/rl.h b/libavcodec/rl.h index 03d2e56e4f..d71d3711bd 100644 --- a/libavcodec/rl.h +++ b/libavcodec/rl.h @@ -54,7 +54,23 @@ typedef struct RLTable { * 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, int use_static); +void init_vlc_rl(RLTable *rl); + +#define INIT_VLC_RL(rl, static_size)\ +{\ + int q;\ + static RL_VLC_ELEM rl_vlc_table[32][static_size];\ + INIT_VLC_STATIC(&rl.vlc, 9, rl.n + 1,\ + &rl.table_vlc[0][1], 4, 2,\ + &rl.table_vlc[0][0], 4, 2, static_size);\ +\ + if(!rl.rl_vlc[0]){\ + for(q=0; q<32; q++)\ + rl.rl_vlc[q]= rl_vlc_table[q];\ +\ + init_vlc_rl(&rl);\ + }\ +} static inline int get_rl_index(const RLTable *rl, int last, int run, int level) { |