Woolz Image Processing Version 1.4.0
AlgFourier

Files

file  AlgFourier.c
 

Fast Fourier and Hartley transform functions.


Functions

void AlgFourHart1D (double *data, int num, int step)
 Computes the Hartley transform of the given one dimensional data, and does it in place.
AlgError AlgFourHart2D (double **data, int useBuf, int numX, int numY)
 Computes the Hartley transform of the given two dimensional data, and does it in place.
void AlgFour1D (double *real, double *imag, int num, int step)
 Computes the Fourier transform of the given one dimensional complex data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n}$.
void AlgFourInv1D (double *real, double *imag, int num, int step)
 Computes the inverse Fourier transform of the given complex one dimensional data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n}$.
void AlgFourReal1D (double *real, int num, int step)
 Computes the Fourier transform of the given one dimensional real data, and does it in place. Data are returned in the array of size $N$ as: The data are returned in the array of size N with the layout as shown in the table (with 2M = N, r = real, i = imaginary): |----------| | r0 $ | | r1$ | | .. | | r(M-1) | | rM | | i1 | | i2 | | ... | | i(M - 1) | where the real and imaginary components are indexed as in the arrays computed with AlgFour1D(). The transformed values data are scaled by a factor of $\sqrt{n}$.
void AlgFourRealInv1D (double *real, int num, int step)
 Computes the inverse Fourier transform of the given one one dimensional real data, and does it in place. The data should layed out in the array as returned by AlgFourReal1D(). The transformed values data are scaled by a factor of $\sqrt{n}$.
AlgError AlgFour2D (double **real, double **imag, int useBuf, int numX, int numY)
 Computes the Fourier transform of the given two dimensional complex data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y}$.
AlgError AlgFourInv2D (double **real, double **imag, int useBuf, int numX, int numY)
 Computes the inverse Fourier transform of the given two dimensional complex data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y}$.
AlgError AlgFourReal2D (double **real, int useBuf, int numX, int numY)
 Computes the Fourier transform of the given two dimensional real data, and does it in place.
AlgError AlgFourRealInv2D (double **real, int useBuf, int numX, int numY)
 Computes the Fourier transform of the given two dimensional data which resulted from a transform using AlgFourReal2D(), and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y}$.
AlgError AlgFour3D (double ***real, double ***imag, int useBuf, int numX, int numY, int numZ)
 Computes the Fourier transform of the given three dimensional complex data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y} \sqrt{n_z}$.
AlgError AlgFourInv3D (double ***real, double ***imag, int useBuf, int numX, int numY, int numZ)
 Computes the inverse Fourier transform of the given three dimensional complex data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y} \sqrt{n_z}$.
AlgError AlgFourReal3D (double ***real, int useBuf, int numX, int numY, int numZ)
 Computes the Fourier transform of the given three dimensional real data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y} \sqrt{n_z}$.
AlgError AlgFourRealInv3D (double ***real, int useBuf, int numX, int numY, int numZ)
 Computes the Fourier transform of the given three dimensional data which resulted from a transform using AlgFourReal3D(), and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y} \sqrt{n_z}$.

Function Documentation

void AlgFourHart1D ( double *  data,
int  num,
int  step 
)

Computes the Hartley transform of the given one dimensional data, and does it in place.

Returns:
void
Parameters:
dataGiven data.
numNumber of data.
stepOffset in data elements between the data to be transformed.

References ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, and ALG_M_SQRT2.

Referenced by AlgFour1D(), AlgFourHart2D(), AlgFourInv1D(), AlgFourReal1D(), and AlgFourRealInv1D().

AlgError AlgFourHart2D ( double **  data,
int  useBuf,
int  numX,
int  numY 
)

Computes the Hartley transform of the given two dimensional data, and does it in place.

Returns:
Error code, may be set if buffers can not be allocated.
Parameters:
dataGiven data.
useBufAllocate private buffers to make columns contiguous.
numXNumber of data in each row.
numYNumber of data in each column.

References AlcFree(), AlcMalloc(), ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, ALG_ERR_MALLOC, ALG_ERR_NONE, and AlgFourHart1D().

void AlgFour1D ( double *  real,
double *  imag,
int  num,
int  step 
)

Computes the Fourier transform of the given one dimensional complex data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n}$.

Returns:
void
Parameters:
realGiven real data.
imagGiven imaginary data.
numNumber of data.
stepOffset in data elements between the data to be transformed.

References ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, and AlgFourHart1D().

void AlgFourInv1D ( double *  real,
double *  imag,
int  num,
int  step 
)

Computes the inverse Fourier transform of the given complex one dimensional data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n}$.

Returns:
void
Parameters:
realGiven real data.
imagGiven imaginary data.
numNumber of data.
stepOffset in data elements between the data to be transformed.

References ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, and AlgFourHart1D().

void AlgFourReal1D ( double *  real,
int  num,
int  step 
)

Computes the Fourier transform of the given one dimensional real data, and does it in place. Data are returned in the array of size $N$ as: The data are returned in the array of size N with the layout as shown in the table (with 2M = N, r = real, i = imaginary): |----------| | r0 $ | | r1$ | | .. | | r(M-1) | | rM | | i1 | | i2 | | ... | | i(M - 1) | where the real and imaginary components are indexed as in the arrays computed with AlgFour1D(). The transformed values data are scaled by a factor of $\sqrt{n}$.

Returns:
void
Parameters:
realGiven real data.
numNumber of data (N).
stepOffset in data elements between the data to be transformed.

References ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, and AlgFourHart1D().

void AlgFourRealInv1D ( double *  real,
int  num,
int  step 
)

Computes the inverse Fourier transform of the given one one dimensional real data, and does it in place. The data should layed out in the array as returned by AlgFourReal1D(). The transformed values data are scaled by a factor of $\sqrt{n}$.

Returns:
void
Parameters:
realGiven real/complex data.
numNumber of data.
stepOffset in data elements between the data to be transformed.

References ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, and AlgFourHart1D().

AlgError AlgFour2D ( double **  real,
double **  imag,
int  useBuf,
int  numX,
int  numY 
)

Computes the Fourier transform of the given two dimensional complex data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y}$.

Returns:
Error code, may be set if buffers can not be allocated.
Parameters:
realGiven real data.
imagGiven imaginary data.
useBufAllocate private buffers to make columns contiguous.
numXNumber of data in each row.
numYNumber of data in each column.

References ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, ALG_ERR_NONE, ALG_FOUR_AXIS_X, ALG_FOUR_AXIS_Y, and ALG_FOUR_DIR_FWD.

AlgError AlgFourInv2D ( double **  real,
double **  imag,
int  useBuf,
int  numX,
int  numY 
)

Computes the inverse Fourier transform of the given two dimensional complex data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y}$.

Returns:
Error code, may be set if buffers can not be allocated.
Parameters:
realGiven real data.
imagGiven imaginary data.
useBufAllocate private buffers to make columns contiguous.
numXNumber of data in each row.
numYNumber of data in each column.

References ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, ALG_ERR_NONE, ALG_FOUR_AXIS_X, ALG_FOUR_AXIS_Y, and ALG_FOUR_DIR_INV.

AlgError AlgFourReal2D ( double **  real,
int  useBuf,
int  numX,
int  numY 
)

Computes the Fourier transform of the given two dimensional real data, and does it in place.

Returns:
Error code, may be set if buffers can not be allocated.

The layout of the array is similar to that in AlgFourReal1D() and as shown in the table (with 2M = N, r = real, i = imaginary):

-------|--------|---|------------|-------|--------|---|----------- r00 |r01 |...|r0(M-1) |r0M |i01 |...|i0(M-1) ... |... |...|... |... |... |...|... r(M-1)0|r(M-1)1 |...|r(M-1)(M-1) |r(M-1)M|i(M-1)1 |...|i(M-1)(M-1) rM0 |rM1 |...|rM(M-1) |rMM |iM1 |...|iM(M-1) i10 |r(M+1)1 |...|r(M+1)(M-1) |i1M |i(M+1)1 |...|i(M+1)(M-1) ... |... |...|... |... |... |...|... i(M-1)0|r(2M-1)1|...|r(2M-1)(M-1)|i(M-1)M|i(2M-1)1|...|i(2M-1)(M-1)

Using contiguous buffers has a large effect for data larger than a CPU's fastest cache and little cost for smaller data arrays. The times below were measured for on a Lenovo T430s with a i7-2640M with 4kB cache. Data sizes are the number of double values. These times include buffer allocation but not array allocation or file I/O and are the mean of 5 runs using elapsed (wall clock) time. data sz | tm (no buf, 1 thr) | tm (buf, 1 thr) | tm (buf, 2 thr) --------|--------------------|-----------------|------------- 256^2 | 3ms | 3ms | 2ms 512^2 | 12ms | 6ms | 4ms 1024^2 | 120ms | 44ms | 35ms 2048^2 | 600ms | 170ms | 110ms 4096^2 | 3300ms | 764ms | 460ms 8192^2 | 17000ms | 3600ms | 2100ms The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y}$.

Parameters:
realGiven real data.
useBufAllocate private buffers to make columns contiguous.
numXNumber of data in each row.
numYNumber of data in each column.

References ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, ALG_ERR_NONE, ALG_FOUR_AXIS_X, ALG_FOUR_AXIS_Y, and ALG_FOUR_DIR_FWD.

Referenced by AlgAutoCorrelate2D(), and AlgCrossCorrelate2D().

AlgError AlgFourRealInv2D ( double **  real,
int  useBuf,
int  numX,
int  numY 
)

Computes the Fourier transform of the given two dimensional data which resulted from a transform using AlgFourReal2D(), and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y}$.

Returns:
Error code, may be set if buffers can not be allocated.
Parameters:
realGiven real/complex data.
useBufAllocate private buffers to make columns contiguous.
numXNumber of data in each row.
numYNumber of data in each column.

References ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, ALG_ERR_NONE, ALG_FOUR_AXIS_X, ALG_FOUR_AXIS_Y, and ALG_FOUR_DIR_INV.

Referenced by AlgAutoCorrelate2D(), and AlgCrossCorrelate2D().

AlgError AlgFour3D ( double ***  real,
double ***  imag,
int  useBuf,
int  numX,
int  numY,
int  numZ 
)

Computes the Fourier transform of the given three dimensional complex data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y} \sqrt{n_z}$.

Returns:
Error code, may be set if buffers can not be allocated.

Using contiguous buffers has a large effect for data larger than a CPU's fastest cache and little cost for smaller data arrays.

Parameters:
realGiven real data.
imagGiven imaginary data.
useBufAllocate private buffers to make columns contiguous.
numXNumber of data in each row.
numYNumber of data in each column.
numZNumber of data in each plane.

References ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, ALG_ERR_NONE, ALG_FOUR_AXIS_X, ALG_FOUR_AXIS_Y, ALG_FOUR_AXIS_Z, and ALG_FOUR_DIR_FWD.

AlgError AlgFourInv3D ( double ***  real,
double ***  imag,
int  useBuf,
int  numX,
int  numY,
int  numZ 
)

Computes the inverse Fourier transform of the given three dimensional complex data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y} \sqrt{n_z}$.

Returns:
Error code, may be set if buffers can not be allocated.
Parameters:
realGiven real data.
imagGiven imaginary data.
useBufAllocate private buffers to make columns contiguous.
numXNumber of data in each row.
numYNumber of data in each column.
numZNumber of data in each plane.

References ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, ALG_ERR_NONE, ALG_FOUR_AXIS_X, ALG_FOUR_AXIS_Y, ALG_FOUR_AXIS_Z, and ALG_FOUR_DIR_INV.

AlgError AlgFourReal3D ( double ***  real,
int  useBuf,
int  numX,
int  numY,
int  numZ 
)

Computes the Fourier transform of the given three dimensional real data, and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y} \sqrt{n_z}$.

Returns:
Error code, may be set if buffers can not be allocated.

Using contiguous buffers has a large effect for data larger than a CPU's fastest cache and little

Parameters:
realGiven real data.
useBufAllocate private buffers to make columns contiguous.
numXNumber of data in each row.
numYNumber of data in each column.
numZNumber of data in each plane.

References ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, ALG_ERR_NONE, ALG_FOUR_AXIS_X, ALG_FOUR_AXIS_Y, ALG_FOUR_AXIS_Z, and ALG_FOUR_DIR_FWD.

AlgError AlgFourRealInv3D ( double ***  real,
int  useBuf,
int  numX,
int  numY,
int  numZ 
)

Computes the Fourier transform of the given three dimensional data which resulted from a transform using AlgFourReal3D(), and does it in place. The transformed values data are scaled by a factor of $\sqrt{n_x} \sqrt{n_y} \sqrt{n_z}$.

Returns:
Error code, may be set if buffers can not be allocated.
Parameters:
realGiven real/complex data.
useBufAllocate private buffers to make columns contiguous.
numXNumber of data in each row.
numYNumber of data in each column.
numZNumber of data in each plane.

References ALG_DBG, ALG_DBG_LVL_1, ALG_DBG_LVL_FN, ALG_ERR_NONE, ALG_FOUR_AXIS_X, ALG_FOUR_AXIS_Y, ALG_FOUR_AXIS_Z, and ALG_FOUR_DIR_INV.