2020-11-25 20:55:38 +00:00
|
|
|
/*
|
2020-11-18 07:22:37 +00:00
|
|
|
* @file cuOverSampler.h
|
|
|
|
* @brief Oversampling with FFT padding method
|
|
|
|
*
|
|
|
|
* Define cuOverSampler class, to save cufft plans and perform oversampling calculations
|
|
|
|
* For float images use cuOverSamplerR2R
|
|
|
|
* For complex images use cuOverSamplerC2C
|
|
|
|
* @todo use template class to unify these two classes
|
2019-01-16 19:40:08 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CUOVERSAMPLER_H
|
|
|
|
#define __CUOVERSAMPLER_H
|
2020-11-25 20:55:38 +00:00
|
|
|
|
2019-01-16 19:40:08 +00:00
|
|
|
#include "cuArrays.h"
|
|
|
|
#include "cudaUtil.h"
|
|
|
|
|
2020-11-18 07:22:37 +00:00
|
|
|
// FFT Oversampler for complex images
|
2019-01-16 19:40:08 +00:00
|
|
|
class cuOverSamplerC2C
|
|
|
|
{
|
|
|
|
private:
|
2020-11-25 20:55:38 +00:00
|
|
|
cufftHandle forwardPlan; // forward fft handle
|
|
|
|
cufftHandle backwardPlan; // backward fft handle
|
|
|
|
cudaStream_t stream; // cuda stream
|
2020-11-18 07:22:37 +00:00
|
|
|
cuArrays<float2> *workIn; // work array to hold forward fft data
|
|
|
|
cuArrays<float2> *workOut; // work array to hold padded data
|
2019-01-16 19:40:08 +00:00
|
|
|
public:
|
2020-11-18 07:22:37 +00:00
|
|
|
// disable the default constructor
|
|
|
|
cuOverSamplerC2C() = delete;
|
|
|
|
// constructor
|
2020-11-25 20:55:38 +00:00
|
|
|
cuOverSamplerC2C(int inNX, int inNY, int outNX, int outNY, int nImages, cudaStream_t stream_);
|
|
|
|
// set cuda stream
|
|
|
|
void setStream(cudaStream_t stream_);
|
2020-11-18 07:22:37 +00:00
|
|
|
// execute oversampling
|
|
|
|
void execute(cuArrays<float2> *imagesIn, cuArrays<float2> *imagesOut, int deramp_method=0);
|
|
|
|
// destructor
|
2020-11-25 20:55:38 +00:00
|
|
|
~cuOverSamplerC2C();
|
2019-01-16 19:40:08 +00:00
|
|
|
};
|
|
|
|
|
2020-11-18 07:22:37 +00:00
|
|
|
// FFT Oversampler for complex images
|
2019-01-16 19:40:08 +00:00
|
|
|
class cuOverSamplerR2R
|
|
|
|
{
|
|
|
|
private:
|
2020-11-25 20:55:38 +00:00
|
|
|
cufftHandle forwardPlan;
|
|
|
|
cufftHandle backwardPlan;
|
|
|
|
cudaStream_t stream;
|
|
|
|
cuArrays<float2> *workSizeIn;
|
|
|
|
cuArrays<float2> *workSizeOut;
|
2020-11-18 07:22:37 +00:00
|
|
|
|
2019-01-16 19:40:08 +00:00
|
|
|
public:
|
2020-11-18 07:22:37 +00:00
|
|
|
cuOverSamplerR2R() = delete;
|
2020-11-25 20:55:38 +00:00
|
|
|
cuOverSamplerR2R(int inNX, int inNY, int outNX, int outNY, int nImages, cudaStream_t stream_);
|
|
|
|
void setStream(cudaStream_t stream_);
|
|
|
|
void execute(cuArrays<float> *imagesIn, cuArrays<float> *imagesOut);
|
|
|
|
~cuOverSamplerR2R();
|
2019-01-16 19:40:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-11-18 07:22:37 +00:00
|
|
|
#endif //__CUOVERSAMPLER_H
|
|
|
|
// end of file
|
2019-01-16 19:40:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|