24 #ifndef CUDA_KERNELS_FILTER_H_ 25 #define CUDA_KERNELS_FILTER_H_ 27 #define _USE_MATH_DEFINES 33 __global__
void filterSL(
int x,
int y, cufftComplex *data) {
34 int j = blockIdx.y * blockDim.y + threadIdx.y;
35 int i = blockIdx.x * blockDim.x + threadIdx.x;
37 const float w = (float) i / (
float) (x - 1) * M_PI;
38 const float divisor = 2.0 * (x - 1);
43 temp = w * fabsf(sinf(w) / (M_PI * w));
44 data[i + j * x].x *= temp / divisor;
45 data[i + j * x].y *= temp / divisor;
49 __global__
void filterRamp(
int x,
int y, cufftComplex *data) {
50 int j = blockIdx.y * blockDim.y + threadIdx.y;
51 int i = blockIdx.x * blockDim.x + threadIdx.x;
54 const float divisor = 2 * (x - 1);
55 data[i + j * x].x *= (float) i / (x - 1) * M_PI / divisor;
56 data[i + j * x].y *= (float) i / (x - 1) * M_PI / divisor;
61 int j = blockIdx.y * blockDim.y + threadIdx.y;
62 int i = blockIdx.x * blockDim.x + threadIdx.x;
65 const float divisor = 2 * (x - 1);
66 const float w = (float) i / (x - 1) * M_PI;
70 temp = w * (0.54 + 0.46 * cosf(w));
71 data[i + j * x].x *= temp / divisor;
72 data[i + j * x].y *= temp / divisor;
77 int j = blockIdx.y * blockDim.y + threadIdx.y;
78 int i = blockIdx.x * blockDim.x + threadIdx.x;
81 const float divisor = 2 * (x - 1);
82 const float w = (float) i / (x - 1) * M_PI;
86 temp = w * (0.5 + 0.5 * cosf(w));
87 data[i + j * x].x *= temp / divisor;
88 data[i + j * x].y *= temp / divisor;
101 const T ret = std::sin(w/(2.0*d))/(w/(2.0*d));
112 template <
typename T>
113 auto inline cosine(
const T w,
const T d) -> T {
114 const T ret = std::cos(w/(2.0*d));
125 template <
typename T>
126 auto inline hamming(
const T w,
const T d) -> T {
127 const T ret = 0.54 + 0.46 * std::cos(w/d);
138 template <
typename T>
139 auto inline hanning(
const T w,
const T d) -> T {
140 const T ret = (1 + std::cos(w/d))/ 2.;
auto cosine(const T w, const T d) -> T
computes the value of the Cosine-filter function
__global__ void filterHanning(int x, int y, cufftComplex *data)
auto sheppLogan(const T w, const T d) -> T
computes the value of the Shepp-Logan-filter function
__global__ void filterRamp(int x, int y, cufftComplex *data)
auto hanning(const T w, const T d) -> T
computes the value of the Hanning-filter function
__global__ void filterHamming(int x, int y, cufftComplex *data)
__global__ void filterSL(int x, int y, cufftComplex *data)
auto hamming(const T w, const T d) -> T
computes the value of the Hamming-filter function