libcm is a C development framework with an emphasis on audio signal processing applications.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmComplexTypes.h 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef cmComplexTypes_h
  2. #define cmComplexTypes_h
  3. #include <complex.h>
  4. #include <fftw3.h>
  5. #if CM_FLOAT_SMP == 1
  6. #define cmCabsS cabsf
  7. #define cmCatanS catanf
  8. #define cmCrealS crealf
  9. #define cmCimagS cimagf
  10. #define cmCargS cargf
  11. #define cmCconjS conjf
  12. #define cmFftPlanAllocS fftwf_plan_dft_r2c_1d
  13. #define cmFft1dPlanAllocS fftwf_plan_dft_1d
  14. #define cmIFftPlanAllocS fftwf_plan_dft_c2r_1d
  15. #define cmFftPlanFreeS fftwf_destroy_plan
  16. #define cmFftMallocS fftwf_malloc
  17. #define cmFftFreeMemS fftwf_free
  18. #define cmFftExecuteS fftwf_execute
  19. typedef fftwf_plan cmFftPlanS_t;
  20. #else
  21. #define cmCabsS cabs
  22. #define cmCatanS catan
  23. #define cmCrealS creal
  24. #define cmCimagS cimag
  25. #define cmCargS carg
  26. #define cmCconjS conj
  27. #define cmFftPlanAllocS fftw_plan_dft_r2c_1d
  28. #define cmFft1dPlanAllocS fftw_plan_dft_1d
  29. #define cmIFftPlanAllocS fftw_plan_dft_c2r_1d
  30. #define cmFftPlanFreeS fftw_destroy_plan
  31. #define cmFftMallocS fftw_malloc
  32. #define cmFftFreeMemS fftw_free
  33. #define cmFftExecuteS fftw_execute
  34. typedef fftw_plan cmFftPlanS_t;
  35. #endif
  36. //-----------------------------------------------------------------
  37. //-----------------------------------------------------------------
  38. //-----------------------------------------------------------------
  39. #if CM_FLOAT_REAL == 1
  40. #define cmCabsR cabsf
  41. #define cmCatanR catanf
  42. #define cmCrealR crealf
  43. #define cmCimagR cimagf
  44. #define cmCargR cargf
  45. #define cmCconjR conjf
  46. #define cmFftPlanAllocR fftwf_plan_dft_r2c_1d
  47. #define cmFft1dPlanAllocR fftwf_plan_dft_1d
  48. #define cmIFftPlanAllocR fftwf_plan_dft_c2r_1d
  49. #define cmFftPlanFreeR fftwf_destroy_plan
  50. #define cmFftMallocR fftwf_malloc
  51. #define cmFftFreeMemR fftwf_free
  52. #define cmFftExecuteR fftwf_execute
  53. typedef fftwf_plan cmFftPlanR_t;
  54. #else
  55. #define cmCabsR cabs
  56. #define cmCatanR catan
  57. #define cmCrealR creal
  58. #define cmCimagR cimag
  59. #define cmCargR carg
  60. #define cmCconjR conj
  61. #define cmFftPlanAllocR fftw_plan_dft_r2c_1d
  62. #define cmFft1dPlanAllocR fftw_plan_dft_1d
  63. #define cmIFftPlanAllocR fftw_plan_dft_c2r_1d
  64. #define cmFftPlanFreeR fftw_destroy_plan
  65. #define cmFftMallocR fftw_malloc
  66. #define cmFftFreeMemR fftw_free
  67. #define cmFftExecuteR fftw_execute
  68. typedef fftw_plan cmFftPlanR_t;
  69. #endif
  70. void cmVOCR_MultVVV( cmComplexR_t* y, const cmComplexS_t* x0, const cmComplexR_t* x1, unsigned n );
  71. void cmVOCR_MultVFV( cmComplexR_t* y, const float* x, unsigned n );
  72. void cmVOCR_DivVFV( cmComplexR_t* y, const float_t* x, unsigned n );
  73. void cmVOCR_Abs( cmSample_t* y, const cmComplexR_t* x, unsigned n );
  74. void cmVOCR_MultVS( cmComplexR_t* y, cmReal_t v, unsigned n );
  75. void cmVOCR_DivVS( cmComplexR_t* y, cmReal_t v, unsigned n );
  76. #endif