From bc65a0395e6c3930bac0440cc894990dd04cb704 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 13 Jul 2018 16:20:07 +0200 Subject: Reorganize more filter size functions --- cuda/2d/fbp.cu | 16 +++------------- cuda/2d/fft.cu | 2 +- 2 files changed, 4 insertions(+), 14 deletions(-) (limited to 'cuda') diff --git a/cuda/2d/fbp.cu b/cuda/2d/fbp.cu index e8a224e..a5b8a7a 100644 --- a/cuda/2d/fbp.cu +++ b/cuda/2d/fbp.cu @@ -42,20 +42,10 @@ along with the ASTRA Toolbox. If not, see . namespace astraCUDA { - -static int calcNextPowerOfTwo(int n) -{ - int x = 1; - while (x < n) - x *= 2; - - return x; -} - // static int FBP::calcFourierFilterSize(int _iDetectorCount) { - int iFFTRealDetCount = calcNextPowerOfTwo(2 * _iDetectorCount); + int iFFTRealDetCount = astra::calcNextPowerOfTwo(2 * _iDetectorCount); int iFreqBinCount = astra::calcFFTFourierSize(iFFTRealDetCount); // CHECKME: Matlab makes this at least 64. Do we also need to? @@ -101,7 +91,7 @@ bool FBP::setFilter(const astra::SFilterConfig &_cfg) return true; // leave D_filter set to 0 - int iFFTRealDetCount = calcNextPowerOfTwo(2 * dims.iProjDets); + int iFFTRealDetCount = astra::calcNextPowerOfTwo(2 * dims.iProjDets); int iFreqBinCount = astra::calcFFTFourierSize(iFFTRealDetCount); cufftComplex * pHostFilter = new cufftComplex[dims.iProjAngles * iFreqBinCount]; @@ -311,7 +301,7 @@ bool FBP::iterate(unsigned int iterations) if (D_filter) { - int iFFTRealDetCount = calcNextPowerOfTwo(2 * dims.iProjDets); + int iFFTRealDetCount = astra::calcNextPowerOfTwo(2 * dims.iProjDets); int iFFTFourDetCount = astra::calcFFTFourierSize(iFFTRealDetCount); cufftComplex * pDevComplexSinogram = NULL; diff --git a/cuda/2d/fft.cu b/cuda/2d/fft.cu index dc0edc3..2e94b79 100644 --- a/cuda/2d/fft.cu +++ b/cuda/2d/fft.cu @@ -293,7 +293,7 @@ void genCuFFTFilter(const SFilterConfig &_cfg, int _iProjectionCount, cufftComplex * _pFilter, int _iFFTRealDetectorCount, int _iFFTFourierDetectorCount) { - float * pfFilt = astra::genFilter(_cfg, _iProjectionCount, + float * pfFilt = astra::genFilter(_cfg, _iFFTRealDetectorCount, _iFFTFourierDetectorCount); -- cgit v1.2.3