Mercurial > libavcodec.hg
comparison dca.c @ 7739:47c118619225 libavcodec
Remove the cos_mod table that has become unused after replacing the imdct
by ff_imdct_half().
author | michael |
---|---|
date | Sat, 30 Aug 2008 11:01:58 +0000 |
parents | 93ba37a9098c |
children | 8ce423998cca |
comparison
equal
deleted
inserted
replaced
7738:93ba37a9098c | 7739:47c118619225 |
---|---|
81 | 81 |
82 static BitAlloc dca_bitalloc_index; ///< indexes for samples VLC select | 82 static BitAlloc dca_bitalloc_index; ///< indexes for samples VLC select |
83 static BitAlloc dca_tmode; ///< transition mode VLCs | 83 static BitAlloc dca_tmode; ///< transition mode VLCs |
84 static BitAlloc dca_scalefactor; ///< scalefactor VLCs | 84 static BitAlloc dca_scalefactor; ///< scalefactor VLCs |
85 static BitAlloc dca_smpl_bitalloc[11]; ///< samples VLCs | 85 static BitAlloc dca_smpl_bitalloc[11]; ///< samples VLCs |
86 | |
87 /** Pre-calculated cosine modulation coefs for the QMF */ | |
88 static float cos_mod[544]; | |
89 | 86 |
90 static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba, int idx) | 87 static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba, int idx) |
91 { | 88 { |
92 return get_vlc2(gb, ba->vlc[idx].table, ba->vlc[idx].bits, ba->wrap) + ba->offset; | 89 return get_vlc2(gb, ba->vlc[idx].table, ba->vlc[idx].bits, ba->wrap) + ba->offset; |
93 } | 90 } |
1191 } | 1188 } |
1192 | 1189 |
1193 | 1190 |
1194 | 1191 |
1195 /** | 1192 /** |
1196 * Build the cosine modulation tables for the QMF | |
1197 * | |
1198 * @param s pointer to the DCAContext | |
1199 */ | |
1200 | |
1201 static av_cold void pre_calc_cosmod(DCAContext * s) | |
1202 { | |
1203 int i, j, k; | |
1204 static int cosmod_initialized = 0; | |
1205 | |
1206 if(cosmod_initialized) return; | |
1207 for (j = 0, k = 0; k < 16; k++) | |
1208 for (i = 0; i < 16; i++) | |
1209 cos_mod[j++] = cos((2 * i + 1) * (2 * k + 1) * M_PI / 64); | |
1210 | |
1211 for (k = 0; k < 16; k++) | |
1212 for (i = 0; i < 16; i++) | |
1213 cos_mod[j++] = cos((i) * (2 * k + 1) * M_PI / 32); | |
1214 | |
1215 for (k = 0; k < 16; k++) | |
1216 cos_mod[j++] = 0.25 / (2 * cos((2 * k + 1) * M_PI / 128)); | |
1217 | |
1218 for (k = 0; k < 16; k++) | |
1219 cos_mod[j++] = -0.25 / (2.0 * sin((2 * k + 1) * M_PI / 128)); | |
1220 | |
1221 cosmod_initialized = 1; | |
1222 } | |
1223 | |
1224 | |
1225 /** | |
1226 * DCA initialization | 1193 * DCA initialization |
1227 * | 1194 * |
1228 * @param avctx pointer to the AVCodecContext | 1195 * @param avctx pointer to the AVCodecContext |
1229 */ | 1196 */ |
1230 | 1197 |
1233 DCAContext *s = avctx->priv_data; | 1200 DCAContext *s = avctx->priv_data; |
1234 int i; | 1201 int i; |
1235 | 1202 |
1236 s->avctx = avctx; | 1203 s->avctx = avctx; |
1237 dca_init_vlcs(); | 1204 dca_init_vlcs(); |
1238 pre_calc_cosmod(s); | |
1239 | 1205 |
1240 dsputil_init(&s->dsp, avctx); | 1206 dsputil_init(&s->dsp, avctx); |
1241 ff_mdct_init(&s->imdct, 6, 1); | 1207 ff_mdct_init(&s->imdct, 6, 1); |
1242 | 1208 |
1243 /* allow downmixing to stereo */ | 1209 /* allow downmixing to stereo */ |