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.8KB

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