forked from FFTW/fftw3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodelet-rdft.h
164 lines (133 loc) · 4.72 KB
/
codelet-rdft.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
* Copyright (c) 2003, 2007-11 Matteo Frigo
* Copyright (c) 2003, 2007-11 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* This header file must include every file or define every
* type or macro which is required to compile a codelet.
*/
#ifndef __RDFT_CODELET_H__
#define __RDFT_CODELET_H__
#include "ifftw.h"
/**************************************************************
* types of codelets
**************************************************************/
/* FOOab, with a,b in {0,1}, denotes the FOO transform
where a/b say whether the input/output are shifted by
half a sample/slot. */
typedef enum {
R2HC00, R2HC01, R2HC10, R2HC11,
HC2R00, HC2R01, HC2R10, HC2R11,
DHT,
REDFT00, REDFT01, REDFT10, REDFT11, /* real-even == DCT's */
RODFT00, RODFT01, RODFT10, RODFT11 /* real-odd == DST's */
} rdft_kind;
/* standard R2HC/HC2R transforms are unshifted */
#define R2HC R2HC00
#define HC2R HC2R00
#define R2HCII R2HC01
#define HC2RIII HC2R10
/* (k) >= R2HC00 produces a warning under gcc because checking x >= 0
is superfluous for unsigned values...but it is needed because other
compilers (e.g. icc) may define the enum to be a signed int...grrr. */
#define R2HC_KINDP(k) ((k) >= R2HC00 && (k) <= R2HC11) /* uses kr2hc_genus */
#define HC2R_KINDP(k) ((k) >= HC2R00 && (k) <= HC2R11) /* uses khc2r_genus */
#define R2R_KINDP(k) ((k) >= DHT) /* uses kr2r_genus */
#define REDFT_KINDP(k) ((k) >= REDFT00 && (k) <= REDFT11)
#define RODFT_KINDP(k) ((k) >= RODFT00 && (k) <= RODFT11)
#define REODFT_KINDP(k) ((k) >= REDFT00 && (k) <= RODFT11)
/* codelets with real input (output) and complex output (input) */
typedef struct kr2c_desc_s kr2c_desc;
typedef struct {
rdft_kind kind;
INT vl;
} kr2c_genus;
struct kr2c_desc_s {
INT n; /* size of transform computed */
const char *nam;
opcnt ops;
const kr2c_genus *genus;
};
typedef void (*kr2c) (R *R0, R *R1, R *Cr, R *Ci,
stride rs, stride csr, stride csi,
INT vl, INT ivs, INT ovs);
void X(kr2c_register)(planner *p, kr2c codelet, const kr2c_desc *desc);
/* half-complex to half-complex DIT/DIF codelets: */
typedef struct hc2hc_desc_s hc2hc_desc;
typedef struct {
rdft_kind kind;
INT vl;
} hc2hc_genus;
struct hc2hc_desc_s {
INT radix;
const char *nam;
const tw_instr *tw;
const hc2hc_genus *genus;
opcnt ops;
};
typedef void (*khc2hc) (R *rioarray, R *iioarray, const R *W,
stride rs, INT mb, INT me, INT ms);
void X(khc2hc_register)(planner *p, khc2hc codelet, const hc2hc_desc *desc);
/* half-complex to rdft2-complex DIT/DIF codelets: */
typedef struct hc2c_desc_s hc2c_desc;
typedef enum {
HC2C_VIA_RDFT,
HC2C_VIA_DFT
} hc2c_kind;
typedef struct {
int (*okp)(
const R *Rp, const R *Ip, const R *Rm, const R *Im,
INT rs, INT mb, INT me, INT ms,
const planner *plnr);
rdft_kind kind;
INT vl;
} hc2c_genus;
struct hc2c_desc_s {
INT radix;
const char *nam;
const tw_instr *tw;
const hc2c_genus *genus;
opcnt ops;
};
typedef void (*khc2c) (R *Rp, R *Ip, R *Rm, R *Im, const R *W,
stride rs, INT mb, INT me, INT ms);
void X(khc2c_register)(planner *p, khc2c codelet, const hc2c_desc *desc,
hc2c_kind hc2ckind);
extern const solvtab X(solvtab_rdft_r2cf);
extern const solvtab X(solvtab_rdft_r2cb);
extern const solvtab X(solvtab_rdft_sse2);
extern const solvtab X(solvtab_rdft_avx);
extern const solvtab X(solvtab_rdft_altivec);
extern const solvtab X(solvtab_rdft_neon);
/* real-input & output DFT-like codelets (DHT, etc.) */
typedef struct kr2r_desc_s kr2r_desc;
typedef struct {
INT vl;
} kr2r_genus;
struct kr2r_desc_s {
INT n; /* size of transform computed */
const char *nam;
opcnt ops;
const kr2r_genus *genus;
rdft_kind kind;
};
typedef void (*kr2r) (const R *I, R *O, stride is, stride os,
INT vl, INT ivs, INT ovs);
void X(kr2r_register)(planner *p, kr2r codelet, const kr2r_desc *desc);
extern const solvtab X(solvtab_rdft_r2r);
#endif /* __RDFT_CODELET_H__ */