FFTRealUseTrigo.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*****************************************************************************
  2. FFTRealUseTrigo.hpp
  3. By Laurent de Soras
  4. --- Legal stuff ---
  5. This program is free software. It comes without any warranty, to
  6. the extent permitted by applicable law. You can redistribute it
  7. and/or modify it under the terms of the Do What The Fuck You Want
  8. To Public License, Version 2, as published by Sam Hocevar. See
  9. http://sam.zoy.org/wtfpl/COPYING for more details.
  10. *Tab=3***********************************************************************/
  11. #if defined (ffft_FFTRealUseTrigo_CURRENT_CODEHEADER)
  12. #error Recursive inclusion of FFTRealUseTrigo code header.
  13. #endif
  14. #define ffft_FFTRealUseTrigo_CURRENT_CODEHEADER
  15. #if ! defined (ffft_FFTRealUseTrigo_CODEHEADER_INCLUDED)
  16. #define ffft_FFTRealUseTrigo_CODEHEADER_INCLUDED
  17. /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  18. #include "ffft/OscSinCos.h"
  19. namespace ffft
  20. {
  21. /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  22. template <int ALGO>
  23. void FFTRealUseTrigo <ALGO>::prepare (OscType &osc)
  24. {
  25. osc.clear_buffers ();
  26. }
  27. template <>
  28. inline void FFTRealUseTrigo <0>::prepare (OscType &osc)
  29. {
  30. // Nothing
  31. }
  32. template <int ALGO>
  33. void FFTRealUseTrigo <ALGO>::iterate (OscType &osc, DataType &c, DataType &s, const DataType cos_ptr [], long index_c, long index_s)
  34. {
  35. osc.step ();
  36. c = osc.get_cos ();
  37. s = osc.get_sin ();
  38. }
  39. template <>
  40. inline void FFTRealUseTrigo <0>::iterate (OscType &osc, DataType &c, DataType &s, const DataType cos_ptr [], long index_c, long index_s)
  41. {
  42. c = cos_ptr [index_c];
  43. s = cos_ptr [index_s];
  44. }
  45. /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  46. /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  47. } // namespace ffft
  48. #endif // ffft_FFTRealUseTrigo_CODEHEADER_INCLUDED
  49. #undef ffft_FFTRealUseTrigo_CURRENT_CODEHEADER
  50. /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/