OLD | NEW |
1 /* | 1 /* |
2 * FFT/IFFT transforms | 2 * FFT/IFFT transforms |
3 * Copyright (c) 2008 Loren Merritt | 3 * Copyright (c) 2008 Loren Merritt |
4 * Copyright (c) 2002 Fabrice Bellard | 4 * Copyright (c) 2002 Fabrice Bellard |
5 * Partly based on libdjbfft by D. J. Bernstein | 5 * Partly based on libdjbfft by D. J. Bernstein |
6 * | 6 * |
7 * This file is part of FFmpeg. | 7 * This file is part of FFmpeg. |
8 * | 8 * |
9 * FFmpeg is free software; you can redistribute it and/or | 9 * FFmpeg is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Lesser General Public | 10 * modify it under the terms of the GNU Lesser General Public |
11 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
12 * version 2.1 of the License, or (at your option) any later version. | 12 * version 2.1 of the License, or (at your option) any later version. |
13 * | 13 * |
14 * FFmpeg is distributed in the hope that it will be useful, | 14 * FFmpeg is distributed in the hope that it will be useful, |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 * Lesser General Public License for more details. | 17 * Lesser General Public License for more details. |
18 * | 18 * |
19 * You should have received a copy of the GNU Lesser General Public | 19 * You should have received a copy of the GNU Lesser General Public |
20 * License along with FFmpeg; if not, write to the Free Software | 20 * License along with FFmpeg; if not, write to the Free Software |
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
22 */ | 22 */ |
23 | 23 |
24 /** | 24 /** |
25 * @file libavcodec/fft.c | 25 * @file libavcodec/fft.c |
26 * FFT/IFFT transforms. | 26 * FFT/IFFT transforms. |
27 */ | 27 */ |
28 | 28 |
29 #include "dsputil.h" | 29 #include "libavutil/mathematics.h" |
| 30 #include "fft.h" |
30 | 31 |
31 /* cos(2*pi*x/n) for 0<=x<=n/4, followed by its reverse */ | 32 /* cos(2*pi*x/n) for 0<=x<=n/4, followed by its reverse */ |
32 #if !CONFIG_HARDCODED_TABLES | 33 #if !CONFIG_HARDCODED_TABLES |
33 COSTABLE(16); | 34 COSTABLE(16); |
34 COSTABLE(32); | 35 COSTABLE(32); |
35 COSTABLE(64); | 36 COSTABLE(64); |
36 COSTABLE(128); | 37 COSTABLE(128); |
37 COSTABLE(256); | 38 COSTABLE(256); |
38 COSTABLE(512); | 39 COSTABLE(512); |
39 COSTABLE(1024); | 40 COSTABLE(1024); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 goto fail; | 93 goto fail; |
93 s->revtab = av_malloc(n * sizeof(uint16_t)); | 94 s->revtab = av_malloc(n * sizeof(uint16_t)); |
94 if (!s->revtab) | 95 if (!s->revtab) |
95 goto fail; | 96 goto fail; |
96 s->inverse = inverse; | 97 s->inverse = inverse; |
97 | 98 |
98 s2 = inverse ? 1.0 : -1.0; | 99 s2 = inverse ? 1.0 : -1.0; |
99 | 100 |
100 s->fft_permute = ff_fft_permute_c; | 101 s->fft_permute = ff_fft_permute_c; |
101 s->fft_calc = ff_fft_calc_c; | 102 s->fft_calc = ff_fft_calc_c; |
| 103 #if CONFIG_MDCT |
102 s->imdct_calc = ff_imdct_calc_c; | 104 s->imdct_calc = ff_imdct_calc_c; |
103 s->imdct_half = ff_imdct_half_c; | 105 s->imdct_half = ff_imdct_half_c; |
104 s->mdct_calc = ff_mdct_calc_c; | 106 s->mdct_calc = ff_mdct_calc_c; |
| 107 #endif |
105 s->exptab1 = NULL; | 108 s->exptab1 = NULL; |
106 s->split_radix = 1; | 109 s->split_radix = 1; |
107 | 110 |
108 if (ARCH_ARM) ff_fft_init_arm(s); | 111 if (ARCH_ARM) ff_fft_init_arm(s); |
109 if (HAVE_ALTIVEC) ff_fft_init_altivec(s); | 112 if (HAVE_ALTIVEC) ff_fft_init_altivec(s); |
110 if (HAVE_MMX) ff_fft_init_mmx(s); | 113 if (HAVE_MMX) ff_fft_init_mmx(s); |
111 | 114 |
112 if (s->split_radix) { | 115 if (s->split_radix) { |
113 for(j=4; j<=nbits; j++) { | 116 for(j=4; j<=nbits; j++) { |
114 ff_init_ff_cos_tabs(j); | 117 ff_init_ff_cos_tabs(j); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 static void (* const fft_dispatch[])(FFTComplex*) = { | 357 static void (* const fft_dispatch[])(FFTComplex*) = { |
355 fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024, | 358 fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024, |
356 fft2048, fft4096, fft8192, fft16384, fft32768, fft65536, | 359 fft2048, fft4096, fft8192, fft16384, fft32768, fft65536, |
357 }; | 360 }; |
358 | 361 |
359 void ff_fft_calc_c(FFTContext *s, FFTComplex *z) | 362 void ff_fft_calc_c(FFTContext *s, FFTComplex *z) |
360 { | 363 { |
361 fft_dispatch[s->nbits-2](z); | 364 fft_dispatch[s->nbits-2](z); |
362 } | 365 } |
363 | 366 |
OLD | NEW |