Loading...
Searching...
No Matches
FFTW wrappers

## Typedefs

typedef enum _cpl_fft_mode_ | cpl_fft_mode
| The CPL fft mode.

## Enumerations

enum | _cpl_fft_mode_ { CPL_FFT_FORWARD , CPL_FFT_BACKWARD , CPL_FFT_NOSCALE , CPL_FFT_FIND_MEASURE , CPL_FFT_FIND_PATIENT , CPL_FFT_FIND_EXHAUSTIVE }
| The supported values of the CPL fft mode. More...

## Functions

cpl_error_code | cpl_fft_image (cpl_image *self, const cpl_image *other, cpl_fft_mode mode)
| Perform a FFT operation on an image.
cpl_error_code | cpl_fft_imagelist (cpl_imagelist *self, const cpl_imagelist *other, cpl_fft_mode mode)
| Perform a FFT operation on the images in an imagelist.

## Detailed Description

This module provides FFTW wrappers

Synopsis:
  #include "cpl_fft.h"

## Typedef Documentation

## cpl_fft_mode

typedef enum _cpl_fft_mode_ cpl_fft_mode

The CPL fft mode.

## Enumeration Type Documentation

## _cpl_fft_mode_

enum _cpl_fft_mode_

The supported values of the CPL fft mode.

Enumerator
CPL_FFT_FORWARD | The forward transform
CPL_FFT_BACKWARD | The backward transform
CPL_FFT_NOSCALE | Transform without scaling (has no effect on forward transform)
CPL_FFT_FIND_MEASURE | Spend time finding the best transform
CPL_FFT_FIND_PATIENT | Spend more time finding the best transform
CPL_FFT_FIND_EXHAUSTIVE | Spend even more time finding the best transform

## Function Documentation

## cpl_fft_image()

cpl_error_code cpl_fft_image | ( | cpl_image * | self,
|  | const cpl_image * | other,
|  | cpl_fft_mode | mode )

Perform a FFT operation on an image.

Parameters

  self | Pre-allocated output image to transform to
  other | Input image to transform from, use self for in-place transform
  mode | CPL_FFT_FORWARD or CPL_FFT_BACKWARD, optionally CPL_FFT_NOSCALE

Returns
  CPL_ERROR_NONE or the corresponding _cpl_error_code_ on error

This function performs an FFT on an image, using FFTW. CPL may be configured without this library, in this case an otherwise valid call will set and return the error CPL_ERROR_UNSUPPORTED_MODE.

The input and output images must match in precision level. Integer images are not supported.

In a forward transform the input image may be non-complex. In this case a real-to-complex transform is performed. This will only compute the first nx/2 + 1 columns of the transform. In this transform it is allowed to pass an output image with nx/2 + 1 columns.

Similarly, in a backward transform the output image may be non-complex. In this case a complex-to-real transform is performed. This will only transform the first nx/2 + 1 columns of the input. In this transform it is allowed to pass an input image with nx/2 + 1 columns.

Per default the backward transform scales (divides) the result with the number of elements transformed (i.e. the number of pixels in the result image). This scaling can be turned off with CPL_FFT_NOSCALE.

If many transformations in the same direction are to be done on data of the same size and type, a reduction in the time required to perform the transformations can be achieved by adding the flag CPL_FFT_FIND_MEASURE to the first transformation. For a larger number of transformations a further reduction may be achived with the flag CPL_FFT_FIND_PATIENT and for an even larger number of transformations a further reduction may be achived with the flag CPL_FFT_FIND_EXHAUSTIVE.

If many transformations are to be done then a reduction in the time required to perform the transformations can be achieved by using cpl_fft_imagelist().

Possible _cpl_error_code_ set in this function:

- CPL_ERROR_NULL_INPUT if an image is NULL
- CPL_ERROR_ILLEGAL_INPUT if the mode is illegal
- CPL_ERROR_INCOMPATIBLE_INPUT if the image sizes do not match
- CPL_ERROR_TYPE_MISMATCH if the image types are incompatible with each other or with the transform
- CPL_ERROR_UNSUPPORTED_MODE if FFTW has not been installed

References CPL_ERROR_NONE.

## cpl_fft_imagelist()

cpl_error_code cpl_fft_imagelist | ( | cpl_imagelist * | self,
|  | const cpl_imagelist * | other,
|  | cpl_fft_mode | mode )

Perform a FFT operation on the images in an imagelist.

Parameters

  self | Pre-allocated output imagelist to transform to
  other | Input imagelist to transform from
  mode | CPL_FFT_FORWARD or CPL_FFT_BACKWARD, optionally CPL_FFT_NOSCALE

Returns
  CPL_ERROR_NONE or the corresponding _cpl_error_code_ on error

See also
  cpl_fft_image()

References cpl_ensure_code, CPL_ERROR_INCOMPATIBLE_INPUT, CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, cpl_imagelist_get(), cpl_imagelist_get_const(), and cpl_imagelist_get_size().