comparison msmpeg4.c @ 4668:1f1a0e67b961 libavcodec

kill av_mallocz_static() calls in init_rl()
author michael
date Wed, 14 Mar 2007 13:19:19 +0000
parents 8535fcac43c1
children 9fb6d2125500
comparison
equal deleted inserted replaced
4667:b3f099adfb36 4668:1f1a0e67b961
89 89
90 #ifdef CONFIG_ENCODERS //strangely gcc includes this even if its not references 90 #ifdef CONFIG_ENCODERS //strangely gcc includes this even if its not references
91 static uint8_t rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2]; 91 static uint8_t rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2];
92 #endif //CONFIG_ENCODERS 92 #endif //CONFIG_ENCODERS
93 93
94 static uint8_t static_rl_table_store[NB_RL_TABLES][2][2*MAX_RUN + MAX_LEVEL + 3];
95
94 static void common_init(MpegEncContext * s) 96 static void common_init(MpegEncContext * s)
95 { 97 {
96 static int inited=0; 98 static int inited=0;
97 99
98 switch(s->msmpeg4_version){ 100 switch(s->msmpeg4_version){
184 /* init various encoding tables */ 186 /* init various encoding tables */
185 init_done = 1; 187 init_done = 1;
186 init_mv_table(&mv_tables[0]); 188 init_mv_table(&mv_tables[0]);
187 init_mv_table(&mv_tables[1]); 189 init_mv_table(&mv_tables[1]);
188 for(i=0;i<NB_RL_TABLES;i++) 190 for(i=0;i<NB_RL_TABLES;i++)
189 init_rl(&rl_table[i], 1); 191 init_rl(&rl_table[i], static_rl_table_store[i]);
190 192
191 for(i=0; i<NB_RL_TABLES; i++){ 193 for(i=0; i<NB_RL_TABLES; i++){
192 int level; 194 int level;
193 for(level=0; level<=MAX_LEVEL; level++){ 195 for(level=0; level<=MAX_LEVEL; level++){
194 int run; 196 int run;
1049 1051
1050 if (!done) { 1052 if (!done) {
1051 done = 1; 1053 done = 1;
1052 1054
1053 for(i=0;i<NB_RL_TABLES;i++) { 1055 for(i=0;i<NB_RL_TABLES;i++) {
1054 init_rl(&rl_table[i], 1); 1056 init_rl(&rl_table[i], static_rl_table_store[i]);
1055 init_vlc_rl(&rl_table[i], 1); 1057 init_vlc_rl(&rl_table[i], 1);
1056 } 1058 }
1057 for(i=0;i<2;i++) { 1059 for(i=0;i<2;i++) {
1058 mv = &mv_tables[i]; 1060 mv = &mv_tables[i];
1059 init_vlc(&mv->vlc, MV_VLC_BITS, mv->n + 1, 1061 init_vlc(&mv->vlc, MV_VLC_BITS, mv->n + 1,