OLD | NEW |
1 /* | 1 /* |
2 * FFT/IFFT transforms | 2 * FFT/IFFT transforms |
3 * AltiVec-enabled | 3 * AltiVec-enabled |
4 * Copyright (c) 2003 Romain Dolbeau <romain@dolbeau.org> | 4 * Copyright (c) 2003 Romain Dolbeau <romain@dolbeau.org> |
5 * Based on code Copyright (c) 2002 Fabrice Bellard | 5 * Based on code Copyright (c) 2002 Fabrice Bellard |
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 #include "libavcodec/dsputil.h" | 23 #include "libavcodec/fft.h" |
24 #include "dsputil_ppc.h" | 24 #include "dsputil_ppc.h" |
25 #include "util_altivec.h" | 25 #include "util_altivec.h" |
| 26 #include "dsputil_altivec.h" |
| 27 |
26 /** | 28 /** |
27 * Do a complex FFT with the parameters defined in ff_fft_init(). The | 29 * Do a complex FFT with the parameters defined in ff_fft_init(). The |
28 * input data must be permuted before with s->revtab table. No | 30 * input data must be permuted before with s->revtab table. No |
29 * 1.0/sqrt(n) normalization is done. | 31 * 1.0/sqrt(n) normalization is done. |
30 * AltiVec-enabled | 32 * AltiVec-enabled |
31 * This code assumes that the 'z' pointer is 16 bytes-aligned | 33 * This code assumes that the 'z' pointer is 16 bytes-aligned |
32 * It also assumes all FFTComplex are 8 bytes-aligned pair of float | 34 * It also assumes all FFTComplex are 8 bytes-aligned pair of float |
33 * The code is exactly the same as the SSE version, except | 35 * The code is exactly the same as the SSE version, except |
34 * that successive MUL + ADD/SUB have been merged into | 36 * that successive MUL + ADD/SUB have been merged into |
35 * fused multiply-add ('vec_madd' in altivec) | 37 * fused multiply-add ('vec_madd' in altivec) |
36 */ | 38 */ |
37 void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z) | 39 static void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z) |
38 { | 40 { |
39 POWERPC_PERF_DECLARE(altivec_fft_num, s->nbits >= 6); | 41 POWERPC_PERF_DECLARE(altivec_fft_num, s->nbits >= 6); |
40 register const vector float vczero = (const vector float)vec_splat_u32(0.); | 42 register const vector float vczero = (const vector float)vec_splat_u32(0.); |
41 | 43 |
42 int ln = s->nbits; | 44 int ln = s->nbits; |
43 int j, np, np2; | 45 int j, np, np2; |
44 int nblocks, nloops; | 46 int nblocks, nloops; |
45 register FFTComplex *p, *q; | 47 register FFTComplex *p, *q; |
46 FFTComplex *cptr, *cptr1; | 48 FFTComplex *cptr, *cptr1; |
47 int k; | 49 int k; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 } while (nblocks != 0); | 134 } while (nblocks != 0); |
133 | 135 |
134 POWERPC_PERF_STOP_COUNT(altivec_fft_num, s->nbits >= 6); | 136 POWERPC_PERF_STOP_COUNT(altivec_fft_num, s->nbits >= 6); |
135 } | 137 } |
136 | 138 |
137 av_cold void ff_fft_init_altivec(FFTContext *s) | 139 av_cold void ff_fft_init_altivec(FFTContext *s) |
138 { | 140 { |
139 s->fft_calc = ff_fft_calc_altivec; | 141 s->fft_calc = ff_fft_calc_altivec; |
140 s->split_radix = 0; | 142 s->split_radix = 0; |
141 } | 143 } |
OLD | NEW |