comparison msmpeg4.c @ 2370:26560d4fdb1f libavcodec

Memory leak fix patch by (Burkhard Plaum <plaum >at< ipf.uni-stuttgart )dot( de>)
author michael
date Sat, 27 Nov 2004 18:10:06 +0000
parents 15cfba1b97b5
children ab390f13c7f5
comparison
equal deleted inserted replaced
2369:ce47b1d51cb1 2370:26560d4fdb1f
237 /* init various encoding tables */ 237 /* init various encoding tables */
238 init_done = 1; 238 init_done = 1;
239 init_mv_table(&mv_tables[0]); 239 init_mv_table(&mv_tables[0]);
240 init_mv_table(&mv_tables[1]); 240 init_mv_table(&mv_tables[1]);
241 for(i=0;i<NB_RL_TABLES;i++) 241 for(i=0;i<NB_RL_TABLES;i++)
242 init_rl(&rl_table[i]); 242 init_rl(&rl_table[i], 1);
243 243
244 for(i=0; i<NB_RL_TABLES; i++){ 244 for(i=0; i<NB_RL_TABLES; i++){
245 int level; 245 int level;
246 for(level=0; level<=MAX_LEVEL; level++){ 246 for(level=0; level<=MAX_LEVEL; level++){
247 int run; 247 int run;
1109 1109
1110 if (!done) { 1110 if (!done) {
1111 done = 1; 1111 done = 1;
1112 1112
1113 for(i=0;i<NB_RL_TABLES;i++) { 1113 for(i=0;i<NB_RL_TABLES;i++) {
1114 init_rl(&rl_table[i]); 1114 init_rl(&rl_table[i], 1);
1115 init_vlc_rl(&rl_table[i]); 1115 init_vlc_rl(&rl_table[i], 1);
1116 } 1116 }
1117 for(i=0;i<2;i++) { 1117 for(i=0;i<2;i++) {
1118 mv = &mv_tables[i]; 1118 mv = &mv_tables[i];
1119 init_vlc(&mv->vlc, MV_VLC_BITS, mv->n + 1, 1119 init_vlc(&mv->vlc, MV_VLC_BITS, mv->n + 1,
1120 mv->table_mv_bits, 1, 1, 1120 mv->table_mv_bits, 1, 1,
1121 mv->table_mv_code, 2, 2); 1121 mv->table_mv_code, 2, 2, 1);
1122 } 1122 }
1123 1123
1124 init_vlc(&dc_lum_vlc[0], DC_VLC_BITS, 120, 1124 init_vlc(&dc_lum_vlc[0], DC_VLC_BITS, 120,
1125 &table0_dc_lum[0][1], 8, 4, 1125 &table0_dc_lum[0][1], 8, 4,
1126 &table0_dc_lum[0][0], 8, 4); 1126 &table0_dc_lum[0][0], 8, 4, 1);
1127 init_vlc(&dc_chroma_vlc[0], DC_VLC_BITS, 120, 1127 init_vlc(&dc_chroma_vlc[0], DC_VLC_BITS, 120,
1128 &table0_dc_chroma[0][1], 8, 4, 1128 &table0_dc_chroma[0][1], 8, 4,
1129 &table0_dc_chroma[0][0], 8, 4); 1129 &table0_dc_chroma[0][0], 8, 4, 1);
1130 init_vlc(&dc_lum_vlc[1], DC_VLC_BITS, 120, 1130 init_vlc(&dc_lum_vlc[1], DC_VLC_BITS, 120,
1131 &table1_dc_lum[0][1], 8, 4, 1131 &table1_dc_lum[0][1], 8, 4,
1132 &table1_dc_lum[0][0], 8, 4); 1132 &table1_dc_lum[0][0], 8, 4, 1);
1133 init_vlc(&dc_chroma_vlc[1], DC_VLC_BITS, 120, 1133 init_vlc(&dc_chroma_vlc[1], DC_VLC_BITS, 120,
1134 &table1_dc_chroma[0][1], 8, 4, 1134 &table1_dc_chroma[0][1], 8, 4,
1135 &table1_dc_chroma[0][0], 8, 4); 1135 &table1_dc_chroma[0][0], 8, 4, 1);
1136 1136
1137 init_vlc(&v2_dc_lum_vlc, DC_VLC_BITS, 512, 1137 init_vlc(&v2_dc_lum_vlc, DC_VLC_BITS, 512,
1138 &v2_dc_lum_table[0][1], 8, 4, 1138 &v2_dc_lum_table[0][1], 8, 4,
1139 &v2_dc_lum_table[0][0], 8, 4); 1139 &v2_dc_lum_table[0][0], 8, 4, 1);
1140 init_vlc(&v2_dc_chroma_vlc, DC_VLC_BITS, 512, 1140 init_vlc(&v2_dc_chroma_vlc, DC_VLC_BITS, 512,
1141 &v2_dc_chroma_table[0][1], 8, 4, 1141 &v2_dc_chroma_table[0][1], 8, 4,
1142 &v2_dc_chroma_table[0][0], 8, 4); 1142 &v2_dc_chroma_table[0][0], 8, 4, 1);
1143 1143
1144 init_vlc(&cbpy_vlc, CBPY_VLC_BITS, 16, 1144 init_vlc(&cbpy_vlc, CBPY_VLC_BITS, 16,
1145 &cbpy_tab[0][1], 2, 1, 1145 &cbpy_tab[0][1], 2, 1,
1146 &cbpy_tab[0][0], 2, 1); 1146 &cbpy_tab[0][0], 2, 1, 1);
1147 init_vlc(&v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 4, 1147 init_vlc(&v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 4,
1148 &v2_intra_cbpc[0][1], 2, 1, 1148 &v2_intra_cbpc[0][1], 2, 1,
1149 &v2_intra_cbpc[0][0], 2, 1); 1149 &v2_intra_cbpc[0][0], 2, 1, 1);
1150 init_vlc(&v2_mb_type_vlc, V2_MB_TYPE_VLC_BITS, 8, 1150 init_vlc(&v2_mb_type_vlc, V2_MB_TYPE_VLC_BITS, 8,
1151 &v2_mb_type[0][1], 2, 1, 1151 &v2_mb_type[0][1], 2, 1,
1152 &v2_mb_type[0][0], 2, 1); 1152 &v2_mb_type[0][0], 2, 1, 1);
1153 init_vlc(&v2_mv_vlc, V2_MV_VLC_BITS, 33, 1153 init_vlc(&v2_mv_vlc, V2_MV_VLC_BITS, 33,
1154 &mvtab[0][1], 2, 1, 1154 &mvtab[0][1], 2, 1,
1155 &mvtab[0][0], 2, 1); 1155 &mvtab[0][0], 2, 1, 1);
1156 1156
1157 for(i=0; i<4; i++){ 1157 for(i=0; i<4; i++){
1158 init_vlc(&mb_non_intra_vlc[i], MB_NON_INTRA_VLC_BITS, 128, 1158 init_vlc(&mb_non_intra_vlc[i], MB_NON_INTRA_VLC_BITS, 128,
1159 &wmv2_inter_table[i][0][1], 8, 4, 1159 &wmv2_inter_table[i][0][1], 8, 4,
1160 &wmv2_inter_table[i][0][0], 8, 4); //FIXME name? 1160 &wmv2_inter_table[i][0][0], 8, 4, 1); //FIXME name?
1161 } 1161 }
1162 1162
1163 init_vlc(&mb_intra_vlc, MB_INTRA_VLC_BITS, 64, 1163 init_vlc(&mb_intra_vlc, MB_INTRA_VLC_BITS, 64,
1164 &table_mb_intra[0][1], 4, 2, 1164 &table_mb_intra[0][1], 4, 2,
1165 &table_mb_intra[0][0], 4, 2); 1165 &table_mb_intra[0][0], 4, 2, 1);
1166 1166
1167 init_vlc(&v1_intra_cbpc_vlc, V1_INTRA_CBPC_VLC_BITS, 8, 1167 init_vlc(&v1_intra_cbpc_vlc, V1_INTRA_CBPC_VLC_BITS, 8,
1168 intra_MCBPC_bits, 1, 1, 1168 intra_MCBPC_bits, 1, 1,
1169 intra_MCBPC_code, 1, 1); 1169 intra_MCBPC_code, 1, 1, 1);
1170 init_vlc(&v1_inter_cbpc_vlc, V1_INTER_CBPC_VLC_BITS, 25, 1170 init_vlc(&v1_inter_cbpc_vlc, V1_INTER_CBPC_VLC_BITS, 25,
1171 inter_MCBPC_bits, 1, 1, 1171 inter_MCBPC_bits, 1, 1,
1172 inter_MCBPC_code, 1, 1); 1172 inter_MCBPC_code, 1, 1, 1);
1173 1173
1174 init_vlc(&inter_intra_vlc, INTER_INTRA_VLC_BITS, 4, 1174 init_vlc(&inter_intra_vlc, INTER_INTRA_VLC_BITS, 4,
1175 &table_inter_intra[0][1], 2, 1, 1175 &table_inter_intra[0][1], 2, 1,
1176 &table_inter_intra[0][0], 2, 1); 1176 &table_inter_intra[0][0], 2, 1, 1);
1177 } 1177 }
1178 1178
1179 switch(s->msmpeg4_version){ 1179 switch(s->msmpeg4_version){
1180 case 1: 1180 case 1:
1181 case 2: 1181 case 2: