comparison src/fftw-3.3.8/kernel/tile2d.c @ 82:d0c2a83c1364

Add FFTW 3.3.8 source, and a Linux build
author Chris Cannam
date Tue, 19 Nov 2019 14:52:55 +0000
parents
children
comparison
equal deleted inserted replaced
81:7029a4916348 82:d0c2a83c1364
1 /*
2 * Copyright (c) 2003, 2007-14 Matteo Frigo
3 * Copyright (c) 2003, 2007-14 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 2D copy routines */
22 #include "kernel/ifftw.h"
23
24 void X(tile2d)(INT n0l, INT n0u, INT n1l, INT n1u, INT tilesz,
25 void (*f)(INT n0l, INT n0u, INT n1l, INT n1u, void *args),
26 void *args)
27 {
28 INT d0, d1;
29
30 A(tilesz > 0); /* infinite loops otherwise */
31
32 tail:
33 d0 = n0u - n0l;
34 d1 = n1u - n1l;
35
36 if (d0 >= d1 && d0 > tilesz) {
37 INT n0m = (n0u + n0l) / 2;
38 X(tile2d)(n0l, n0m, n1l, n1u, tilesz, f, args);
39 n0l = n0m; goto tail;
40 } else if (/* d1 >= d0 && */ d1 > tilesz) {
41 INT n1m = (n1u + n1l) / 2;
42 X(tile2d)(n0l, n0u, n1l, n1m, tilesz, f, args);
43 n1l = n1m; goto tail;
44 } else {
45 f(n0l, n0u, n1l, n1u, args);
46 }
47 }
48
49 INT X(compute_tilesz)(INT vl, int how_many_tiles_in_cache)
50 {
51 return X(isqrt)(CACHESIZE /
52 (((INT)sizeof(R)) * vl * (INT)how_many_tiles_in_cache));
53 }