Mercurial > libavcodec.hg
comparison imc.c @ 4198:18a371831f05 libavcodec
Remove log2() usage.
author | banan |
---|---|
date | Tue, 14 Nov 2006 18:54:42 +0000 |
parents | f97a2081b5b1 |
children | 68288509a159 |
comparison
equal
deleted
inserted
replaced
4197:bbe0bc387a19 | 4198:18a371831f05 |
---|---|
78 int skipFlags[COEFFS]; ///< skip coefficient decoding or not | 78 int skipFlags[COEFFS]; ///< skip coefficient decoding or not |
79 int codewords[COEFFS]; ///< raw codewords read from bitstream | 79 int codewords[COEFFS]; ///< raw codewords read from bitstream |
80 float sqrt_tab[30]; | 80 float sqrt_tab[30]; |
81 GetBitContext gb; | 81 GetBitContext gb; |
82 VLC huffman_vlc[4][4]; | 82 VLC huffman_vlc[4][4]; |
83 float flcf1, flcf2; | |
84 int decoder_reset; | 83 int decoder_reset; |
85 float one_div_log2; | 84 float one_div_log2; |
86 | 85 |
87 DSPContext dsp; | 86 DSPContext dsp; |
88 FFTContext fft; | 87 FFTContext fft; |
123 q->pre_coef2[i] = (r1 - r2) * sqrt(2.0); | 122 q->pre_coef2[i] = (r1 - r2) * sqrt(2.0); |
124 } | 123 } |
125 | 124 |
126 q->last_fft_im[i] = 0; | 125 q->last_fft_im[i] = 0; |
127 } | 126 } |
128 q->flcf1 = log2(10) * 0.05703125; | |
129 q->flcf2 = log2(10) * 0.25; | |
130 | 127 |
131 /* Generate a square root table */ | 128 /* Generate a square root table */ |
132 | 129 |
133 for(i = 0; i < 30; i++) { | 130 for(i = 0; i < 30; i++) { |
134 q->sqrt_tab[i] = sqrt(i); | 131 q->sqrt_tab[i] = sqrt(i); |
234 { | 231 { |
235 int i, level; | 232 int i, level; |
236 float tmp, tmp2; | 233 float tmp, tmp2; |
237 //maybe some frequency division thingy | 234 //maybe some frequency division thingy |
238 | 235 |
239 flcoeffs1[0] = 20000.0 / pow (2, levlCoeffBuf[0] * q->flcf1); | 236 flcoeffs1[0] = 20000.0 / pow (2, levlCoeffBuf[0] * 0.18945); // 0.18945 = log2(10) * 0.05703125 |
240 flcoeffs2[0] = log2(flcoeffs1[0]); | 237 flcoeffs2[0] = log(flcoeffs1[0])/log(2); |
241 tmp = flcoeffs1[0]; | 238 tmp = flcoeffs1[0]; |
242 tmp2 = flcoeffs2[0]; | 239 tmp2 = flcoeffs2[0]; |
243 | 240 |
244 for(i = 1; i < BANDS; i++) { | 241 for(i = 1; i < BANDS; i++) { |
245 level = levlCoeffBuf[i]; | 242 level = levlCoeffBuf[i]; |
253 level -=32; | 250 level -=32; |
254 else | 251 else |
255 level -=16; | 252 level -=16; |
256 | 253 |
257 tmp *= imc_exp_tab[15 + level]; | 254 tmp *= imc_exp_tab[15 + level]; |
258 tmp2 += q->flcf2 * level; | 255 tmp2 += 0.83048 * level; // 0.83048 = log2(10) * 0.25 |
259 flcoeffs1[i] = tmp; | 256 flcoeffs1[i] = tmp; |
260 flcoeffs2[i] = tmp2; | 257 flcoeffs2[i] = tmp2; |
261 } | 258 } |
262 } | 259 } |
263 } | 260 } |
271 // might be incomplete due to a missing table that is in the binary code | 268 // might be incomplete due to a missing table that is in the binary code |
272 for(i = 0; i < BANDS; i++) { | 269 for(i = 0; i < BANDS; i++) { |
273 flcoeffs1[i] = 0; | 270 flcoeffs1[i] = 0; |
274 if(levlCoeffBuf[i] < 16) { | 271 if(levlCoeffBuf[i] < 16) { |
275 flcoeffs1[i] = imc_exp_tab2[levlCoeffBuf[i]] * old_floor[i]; | 272 flcoeffs1[i] = imc_exp_tab2[levlCoeffBuf[i]] * old_floor[i]; |
276 flcoeffs2[i] = (levlCoeffBuf[i]-7) * q->flcf2 + flcoeffs2[i]; | 273 flcoeffs2[i] = (levlCoeffBuf[i]-7) * 0.83048 + flcoeffs2[i]; // 0.83048 = log2(10) * 0.25 |
277 } else { | 274 } else { |
278 flcoeffs1[i] = old_floor[i]; | 275 flcoeffs1[i] = old_floor[i]; |
279 } | 276 } |
280 } | 277 } |
281 } | 278 } |