comparison src/fftw-3.3.3/kernel/cpy1d.c @ 95:89f5e221ed7b

Add FFTW3
author Chris Cannam <cannam@all-day-breakfast.com>
date Wed, 20 Mar 2013 15:35:50 +0000
parents
children
comparison
equal deleted inserted replaced
94:d278df1123f9 95:89f5e221ed7b
1 /*
2 * Copyright (c) 2003, 2007-11 Matteo Frigo
3 * Copyright (c) 2003, 2007-11 Massachusetts Institute of Technology
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 */
20
21 /* out of place 1D copy routine */
22 #include "ifftw.h"
23
24 void X(cpy1d)(R *I, R *O, INT n0, INT is0, INT os0, INT vl)
25 {
26 INT i0, v;
27
28 A(I != O);
29 switch (vl) {
30 case 1:
31 if ((n0 & 1) || is0 != 1 || os0 != 1) {
32 for (; n0 > 0; --n0, I += is0, O += os0)
33 *O = *I;
34 break;
35 }
36 n0 /= 2; is0 = 2; os0 = 2;
37 /* fall through */
38 case 2:
39 if ((n0 & 1) || is0 != 2 || os0 != 2) {
40 for (; n0 > 0; --n0, I += is0, O += os0) {
41 R x0 = I[0];
42 R x1 = I[1];
43 O[0] = x0;
44 O[1] = x1;
45 }
46 break;
47 }
48 n0 /= 2; is0 = 4; os0 = 4;
49 /* fall through */
50 case 4:
51 for (; n0 > 0; --n0, I += is0, O += os0) {
52 R x0 = I[0];
53 R x1 = I[1];
54 R x2 = I[2];
55 R x3 = I[3];
56 O[0] = x0;
57 O[1] = x1;
58 O[2] = x2;
59 O[3] = x3;
60 }
61 break;
62 default:
63 for (i0 = 0; i0 < n0; ++i0)
64 for (v = 0; v < vl; ++v) {
65 R x0 = I[i0 * is0 + v];
66 O[i0 * os0 + v] = x0;
67 }
68 break;
69 }
70 }