comparison ac3enc.c @ 6141:932523fb0562 libavcodec

Get rid of fft_rev table, use ff_reverse and a shift. Reduces maximum allowed value for MDCT_NBITS to 10 (current value is 9)
author reimar
date Sun, 13 Jan 2008 08:33:00 +0000
parents bf4d7ce32af5
children e2a00da5866c
comparison
equal deleted inserted replaced
6140:bf4d7ce32af5 6141:932523fb0562
62 int mant1_cnt, mant2_cnt, mant4_cnt; 62 int mant1_cnt, mant2_cnt, mant4_cnt;
63 } AC3EncodeContext; 63 } AC3EncodeContext;
64 64
65 static int16_t costab[64]; 65 static int16_t costab[64];
66 static int16_t sintab[64]; 66 static int16_t sintab[64];
67 static int16_t fft_rev[512];
68 static int16_t xcos1[128]; 67 static int16_t xcos1[128];
69 static int16_t xsin1[128]; 68 static int16_t xsin1[128];
70 69
71 #define MDCT_NBITS 9 70 #define MDCT_NBITS 9
72 #define N (1 << MDCT_NBITS) 71 #define N (1 << MDCT_NBITS)
100 99
101 for(i=0;i<(n/2);i++) { 100 for(i=0;i<(n/2);i++) {
102 alpha = 2 * M_PI * (float)i / (float)n; 101 alpha = 2 * M_PI * (float)i / (float)n;
103 costab[i] = fix15(cos(alpha)); 102 costab[i] = fix15(cos(alpha));
104 sintab[i] = fix15(sin(alpha)); 103 sintab[i] = fix15(sin(alpha));
105 }
106
107 for(i=0;i<n;i++) {
108 m=0;
109 for(j=0;j<ln;j++) {
110 m |= ((i >> j) & 1) << (ln-j-1);
111 }
112 fft_rev[i]=m;
113 } 104 }
114 } 105 }
115 106
116 /* butter fly op */ 107 /* butter fly op */
117 #define BF(pre, pim, qre, qim, pre1, pim1, qre1, qim1) \ 108 #define BF(pre, pim, qre, qim, pre1, pim1, qre1, qim1) \
146 137
147 np = 1 << ln; 138 np = 1 << ln;
148 139
149 /* reverse */ 140 /* reverse */
150 for(j=0;j<np;j++) { 141 for(j=0;j<np;j++) {
151 int k; 142 int k = ff_reverse[j] >> (8 - ln);
152 k = fft_rev[j];
153 if (k < j) 143 if (k < j)
154 FFSWAP(IComplex, z[k], z[j]); 144 FFSWAP(IComplex, z[k], z[j]);
155 } 145 }
156 146
157 /* pass 0 */ 147 /* pass 0 */