comparison dct.c @ 12026:3f3d08bb5cf8 libavcodec

More mp{1,2,3} 32-point DCT transform to our common DCT framework. Should allow for future SIMD optimizations.
author vitor
date Wed, 30 Jun 2010 20:11:27 +0000
parents 7dd2a45249a9
children 1bf322283429
comparison
equal deleted inserted replaced
12025:2d730a4acc77 12026:3f3d08bb5cf8
29 29
30 #include <math.h> 30 #include <math.h>
31 #include "libavutil/mathematics.h" 31 #include "libavutil/mathematics.h"
32 #include "fft.h" 32 #include "fft.h"
33 33
34 #define DCT32_FLOAT
35 #include "dct32.c"
36
34 /* sin((M_PI * x / (2*n)) */ 37 /* sin((M_PI * x / (2*n)) */
35 #define SIN(s,n,x) (s->costab[(n) - (x)]) 38 #define SIN(s,n,x) (s->costab[(n) - (x)])
36 39
37 /* cos((M_PI * x / (2*n)) */ 40 /* cos((M_PI * x / (2*n)) */
38 #define COS(s,n,x) (s->costab[x]) 41 #define COS(s,n,x) (s->costab[x])
165 168
166 next += s * inr - c * ini; 169 next += s * inr - c * ini;
167 } 170 }
168 } 171 }
169 172
173 static void dct32_func(DCTContext *ctx, FFTSample *data)
174 {
175 ctx->dct32(data, data);
176 }
177
170 void ff_dct_calc(DCTContext *s, FFTSample *data) 178 void ff_dct_calc(DCTContext *s, FFTSample *data)
171 { 179 {
172 s->dct_calc(s, data); 180 s->dct_calc(s, data);
173 } 181 }
174 182
198 case DCT_I : s->dct_calc = ff_dct_calc_I_c; break; 206 case DCT_I : s->dct_calc = ff_dct_calc_I_c; break;
199 case DCT_II : s->dct_calc = ff_dct_calc_II_c ; break; 207 case DCT_II : s->dct_calc = ff_dct_calc_II_c ; break;
200 case DCT_III: s->dct_calc = ff_dct_calc_III_c; break; 208 case DCT_III: s->dct_calc = ff_dct_calc_III_c; break;
201 case DST_I : s->dct_calc = ff_dst_calc_I_c; break; 209 case DST_I : s->dct_calc = ff_dst_calc_I_c; break;
202 } 210 }
211
212 if (inverse == DCT_II && nbits == 5)
213 s->dct_calc = dct32_func;
214
215 s->dct32 = dct32;
216
203 return 0; 217 return 0;
204 } 218 }
205 219
206 av_cold void ff_dct_end(DCTContext *s) 220 av_cold void ff_dct_end(DCTContext *s)
207 { 221 {