readme.txt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. Interface unit for Fastest Fourier in the West library
  2. ------------------------------------------------------
  3. This unit is a Pascal interface to the FFTW library version 3. FFTW is
  4. a library to compute fast fourier transforms extremely fast, it uses
  5. a runtime code generator to generate the best algorithm for a specific
  6. transformation.
  7. The unit is experimental and community involvement is welcome.
  8. At this time we provide a single precision interface only.
  9. Interfaces for the double and extended precision is a simpleprogramming
  10. exercise, you can simply replace single by double everywhere.
  11. See http://www.fftw.org for extensive documentation.
  12. Usage:
  13. * Compile FFTW. Use the "--enable-single" option to configure to select single
  14. precision.
  15. * We need libgcc. Its location should be present in your fpc.cfg. If not,
  16. please use the tool "samplecfg" that is shipped with the compiler to
  17. generate a new fpc.cfg.
  18. * The compiler should be able to find libfftw3f.a. Put something like
  19. -Fl/path/to/libfftw3f.a in your fpc.cfg
  20. Short example how to perform a Fourier transformation in Pascal:
  21. begin
  22. {You can use getmem, but only fftw_getmem ensures 3DNOW/SSE
  23. algorithms.}
  24. fftw_getmem(i,count*sizeof(complex_single));
  25. fftw_getmem(o,count*sizeof(complex_single));
  26. {FFTW will now generate an algoritm to compute the FFT:}
  27. plan:=fftw_plan_dft_1d(count,i,o,fftw_forward,[fftw_estimate]);
  28. {Put code to fill i^ with input data here.}
  29. fftw_execute(p); {Execute FFT}
  30. {Output in o^}
  31. {We can repeat, and refill i with input data.}
  32. {Put code to fill i^ with input data here.}
  33. fftw_execute(p); {Execute FFT}
  34. {Output in o^}
  35. fftw_destroy_plan(p);
  36. fftw_freemem(i);
  37. fftw_freemem(o);
  38. end;
  39. Differences with C version:
  40. * To introduce strong typing:
  41. ** The sign (fftw_forward,fftw_backward) is an enumeration instead of an int
  42. with constants.
  43. ** The flags ([fftw_estimate]) is a flag set instead of an int with constants.
  44. ** The fftw_plan_single type is an opaque pointer incompatible with anything
  45. else;
  46. * To ease programming:
  47. ** Functions for complex to complex, real to complex, and complex to real are
  48. all called equally, the compiler will determine which one needs to be
  49. called. So we have just fftw_plan_dft_1d instead of fftw_plan_dft_1d,
  50. fftw_plan_dft_r2c_1d, fftw_plan_dft_c2r_1d, etc.
  51. * fftw_getmem/fftw_freemem instead of fftw_malloc/fftw_free