File: fftconvolver.h

package info (click to toggle)
wsclean 2.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 2,196 kB
  • sloc: cpp: 34,504; ansic: 234; python: 174; makefile: 10
file content (48 lines) | stat: -rw-r--r-- 1,838 bytes parent folder | download | duplicates (2)
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
#ifndef FFT_CONVOLVER_H
#define FFT_CONVOLVER_H

#include <cstring>
#include <mutex>

class FFTConvolver {
	
public:
	
	/**
	 * Convolve an image with a smaller kernel. No preparation of either image is needed.
	 * 
	 * This function assumes that (n+1)/2 is the middle pixel for uneven image sizes. In
	 * the case of even image sizes, the middle falls between two pixels.
	 */
	static void Convolve(class FFTWManager& fftw, double* image, size_t imgWidth, size_t imgHeight, const double* kernel, size_t kernelSize);
	
	/**
	 * Convolve an image with a smaller kernel. No preparation of either image is needed.
	 * 
	 * This function assumes that n/2 is the middle pixel, and reverses the kernel.
	 */
	static void ReverseAndConvolve(class FFTWManager& fftw, double* image, size_t imgWidth, size_t imgHeight, const double* kernel, size_t kernelSize);
	
	/**
	 * Prepare a smaller kernel for convolution with ConvolveSameSize. When the kernel is used
	 * more often, it is more efficient to call PrepareKernel() once and multiple times
	 * ConvolveSameSize(), than calling Convolve() multiple times.
	 */
	static void PrepareSmallKernel(double* dest, size_t imgWidth, size_t imgHeight, const double* kernel, size_t kernelSize);
	/**
	 * Prepare a kernel for convolution with ConvolveSameSize(). The kernel should be already
	 * of the same size as the image to be convolved, or otherwise PrepareSmallKernel() should be
	 * used.
	 */
	static void PrepareKernel(double* dest, const double* source, size_t imgWidth, size_t imgHeight);
	
	/**
	 * Convolve an image with an already prepared kernel of the same size.
	 */
	static void ConvolveSameSize(class FFTWManager& fftw, double* image, const double* kernel, size_t imgWidth, size_t imgHeight);
	
	static void Reverse(double* image, size_t imgWidth, size_t imgHeight);
private:
};

#endif