36 #if !CONFIG_HARDCODED_TABLES 74 if(n <= 2)
return i&1;
84 #if !CONFIG_HARDCODED_TABLES 87 double freq = 2*
M_PI/
m;
90 tab[i] =
FIX15(cos(i*freq));
97 0, 4, 1, 5, 8, 12, 9, 13, 2, 6, 3, 7, 10, 14, 11, 15
117 for (i = 0; i <
n; i += 16) {
120 for (k = 0; k < 16; k++)
125 for (k = 0; k < 16; k++) {
127 j = (j & ~7) | ((j >> 1) & 3) | ((j << 2) & 4);
138 if (nbits < 2 || nbits > 16)
171 for(j=4; j<=nbits; j++) {
181 j = (j&~3) | ((j>>1)&1) | ((j<<1)&2);
196 const uint16_t *revtab = s->
revtab;
199 for(j=0;j<np;j++) s->
tmp_buf[revtab[j]] = z[j];
209 #define BUTTERFLIES(a0,a1,a2,a3) {\ 211 BF(a2.re, a0.re, a0.re, t5);\ 212 BF(a3.im, a1.im, a1.im, t3);\ 214 BF(a3.re, a1.re, a1.re, t4);\ 215 BF(a2.im, a0.im, a0.im, t6);\ 221 #define BUTTERFLIES_BIG(a0,a1,a2,a3) {\ 222 FFTSample r0=a0.re, i0=a0.im, r1=a1.re, i1=a1.im;\ 224 BF(a2.re, a0.re, r0, t5);\ 225 BF(a3.im, a1.im, i1, t3);\ 227 BF(a3.re, a1.re, r1, t4);\ 228 BF(a2.im, a0.im, i0, t6);\ 231 #define TRANSFORM(a0,a1,a2,a3,wre,wim) {\ 232 CMUL(t1, t2, a2.re, a2.im, wre, -wim);\ 233 CMUL(t5, t6, a3.re, a3.im, wre, wim);\ 234 BUTTERFLIES(a0,a1,a2,a3)\ 237 #define TRANSFORM_ZERO(a0,a1,a2,a3) {\ 242 BUTTERFLIES(a0,a1,a2,a3)\ 247 static void name(FFTComplex *z, const FFTSample *wre, unsigned int n)\ 249 FFTDouble t1, t2, t3, t4, t5, t6;\ 253 const FFTSample *wim = wre+o1;\ 256 TRANSFORM_ZERO(z[0],z[o1],z[o2],z[o3]);\ 257 TRANSFORM(z[1],z[o1+1],z[o2+1],z[o3+1],wre[1],wim[-1]);\ 262 TRANSFORM(z[0],z[o1],z[o2],z[o3],wre[0],wim[0]);\ 263 TRANSFORM(z[1],z[o1+1],z[o2+1],z[o3+1],wre[1],wim[-1]);\ 269 #define BUTTERFLIES BUTTERFLIES_BIG 272 #define DECL_FFT(n,n2,n4)\ 273 static void fft##n(FFTComplex *z)\ 278 pass(z,FFT_NAME(ff_cos_##n),n4/2);\ 285 BF(t3, t1, z[0].
re, z[1].re);
286 BF(t8, t6, z[3].re, z[2].re);
287 BF(z[2].re, z[0].re, t1, t6);
288 BF(t4, t2, z[0].
im, z[1].im);
289 BF(t7, t5, z[2].im, z[3].im);
290 BF(z[3].im, z[1].im, t4, t8);
291 BF(z[3].re, z[1].re, t3, t7);
292 BF(z[2].im, z[0].im, t2, t5);
301 BF(t1, z[5].
re, z[4].re, -z[5].re);
302 BF(t2, z[5].
im, z[4].im, -z[5].im);
303 BF(t5, z[7].re, z[6].re, -z[7].re);
304 BF(t6, z[7].im, z[6].im, -z[7].im);
323 TRANSFORM(z[1],z[5],z[9],z[13],cos_16_1,cos_16_3);
324 TRANSFORM(z[3],z[7],z[11],z[15],cos_16_3,cos_16_1);
335 #define pass pass_big 346 fft4,
fft8,
fft16, fft32, fft64, fft128, fft256, fft512, fft1024,
347 fft2048, fft4096, fft8192, fft16384, fft32768, fft65536,
av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
Set up a complex FFT.
static int is_second_half_of_fft32(int i, int n)
av_cold void ff_fft_end(FFTContext *s)
static void fft4(FFTComplex *z)
void ff_fft_init_altivec(FFTContext *s)
COSTABLE_CONST FFTSample *const FFT_NAME(ff_cos_tabs)[]
#define BUTTERFLIES(a0, a1, a2, a3)
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
av_cold void ff_fft_init_arm(FFTContext *s)
#define FF_FFT_PERM_DEFAULT
static void ff_fft_calc_c(FFTContext *s, FFTComplex *z)
void(* fft_permute)(struct FFTContext *s, FFTComplex *z)
Do the permutation needed BEFORE calling fft_calc().
void(* mdct_calcw)(struct FFTContext *s, FFTDouble *output, const FFTSample *input)
void(* mdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input)
void(* imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input)
av_cold void ff_fft_fixed_init_arm(FFTContext *s)
static void(*const fft_dispatch[])(FFTComplex *)
#define TRANSFORM_ZERO(a0, a1, a2, a3)
static av_cold void fft_perm_avx(FFTContext *s)
#define FF_FFT_PERM_SWAP_LSBS
#define DECL_FFT(n, n2, n4)
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
synthesis window for stochastic i
void(* imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input)
void ff_mdct_calcw_c(FFTContext *s, FFTDouble *output, const FFTSample *input)
void(* fft_calc)(struct FFTContext *s, FFTComplex *z)
Do a complex FFT with the parameters defined in ff_fft_init().
#define TRANSFORM(a0, a1, a2, a3, wre, wim)
static void fft16(FFTComplex *z)
static void ff_fft_permute_c(FFTContext *s, FFTComplex *z)
void ff_fft_init_mips(FFTContext *s)
FFT transform.
static int split_radix_permutation(int i, int n, int inverse)
static void fft8(FFTComplex *z)
static const struct twinvq_data tab
av_cold void ff_init_ff_cos_tabs(int index)
Initialize the cosine table in ff_cos_tabs[index].
static uint32_t inverse(uint32_t v)
find multiplicative inverse modulo 2 ^ 32
static const int avx_tab[]
void ff_fft_init_x86(FFTContext *s)