fpc/packages/fftw
Jonas Maebe 8b0301409a + i386/iphonesim target for the new iPhoneSimulator in Xcode 3.2.4 and
later: the same as i386/darwin, except
      a) uses the non-fragile Objective-C ABI/runtime
      b) does not require stubs for direct calls/jumps (not required for
         i386/darwin under 10.6 and later either, but still generated
         there for backwards compatibility)
      c) only the same packages are enabled as for ARM/Darwin
      d) MacOSAll is compiled specifically for the iPhoneSimulator SDK
    This target also defines the symbol "darwin" apart from the target
    name "iphonesim" for source code compatibility reasons.

git-svn-id: trunk@16065 -
2010-09-29 21:56:47 +00:00
..
examples * Placed fftw_getmem and fftw_freemem in interface section 2009-01-04 12:41:56 +00:00
src * Fixed library name and compilation on windows, bug #12881 2009-05-09 10:05:44 +00:00
fpmake.pp * change externalurl to homepageurl 2008-11-18 23:58:52 +00:00
Makefile + i386/iphonesim target for the new iPhoneSimulator in Xcode 3.2.4 and 2010-09-29 21:56:47 +00:00
Makefile.fpc * Makefiles version 2.5.1 2009-08-13 21:21:28 +00:00
readme.txt * fftw, minor updates to xforms 2008-01-27 10:04:56 +00:00

Interface unit for Fastest Fourier in the West library
------------------------------------------------------

This unit is a Pascal interface to the FFTW library version 3. FFTW is
a library to compute fast fourier transforms extremely fast, it uses
a runtime code generator to generate the best algorithm for a specific
transformation.

The unit is experimental and community involvement is welcome.

At this time we provide a single precision interface only. 
Interfaces for the double and extended precision is a simpleprogramming
exercise, you can simply replace single by double everywhere. 

See http://www.fftw.org for extensive documentation.

Usage:
* Compile FFTW. Use the "--enable-single" option to configure to select single
  precision.
* We need libgcc. Its location should be present in your fpc.cfg. If not,
  please use the tool "samplecfg" that is shipped with the compiler to
  generate a new fpc.cfg.
* The compiler should be able to find libfftw3f.a. Put something like
  -Fl/path/to/libfftw3f.a in your fpc.cfg

Short example how to perform a Fourier transformation in Pascal:

begin
  {You can use getmem, but only fftw_getmem ensures 3DNOW/SSE
   algorithms.}
  fftw_getmem(i,count*sizeof(complex_single));
  fftw_getmem(o,count*sizeof(complex_single));

  {FFTW will now generate an algoritm to compute the FFT:}
  plan:=fftw_plan_dft_1d(count,i,o,fftw_forward,[fftw_estimate]);

  {Put code to fill i^ with input data here.}
  fftw_execute(p); {Execute FFT}
  {Output in o^}

  {We can repeat, and refill i with input data.}
  {Put code to fill i^ with input data here.}
  fftw_execute(p); {Execute FFT}
  {Output in o^}

  fftw_destroy_plan(p);
  fftw_freemem(i);
  fftw_freemem(o);
end;

Differences with C version:
  * To introduce strong typing:
  ** The sign (fftw_forward,fftw_backward) is an enumeration instead of an int
     with constants.
  ** The flags ([fftw_estimate]) is a flag set instead of an int with constants.
  ** The fftw_plan_single type is an opaque pointer incompatible with anything
     else;
  * To ease programming:
  ** Functions for complex to complex, real to complex, and complex to real are
     all called equally, the compiler will determine which one needs to be
     called. So we have just fftw_plan_dft_1d instead of fftw_plan_dft_1d,
     fftw_plan_dft_r2c_1d, fftw_plan_dft_c2r_1d, etc. 
  * fftw_getmem/fftw_freemem instead of fftw_malloc/fftw_free