libcm is a C development framework with an emphasis on audio signal processing applications.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

cmComplexTypes.c 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include "cmPrefix.h"
  2. #include "cmGlobal.h"
  3. #include "cmFloatTypes.h"
  4. #include "cmComplexTypes.h"
  5. void cmVOCR_MultVVV( cmComplexR_t* y, const cmComplexS_t* x0, const cmComplexR_t* x1, unsigned n )
  6. {
  7. unsigned i;
  8. for(i=0; i<n; ++i)
  9. {
  10. y[i] = x0[i] * x1[i];
  11. /*
  12. cmReal_t ab = x0[i].r * x1[i].r;
  13. cmReal_t bd = x0[i].i * x1[i].i;
  14. cmReal_t bc = x0[i].i * x1[i].r;
  15. cmReal_t ad = x0[i].r * x1[i].i;
  16. y[i].r = ab - bd;
  17. y[i].i = bc + ad;
  18. */
  19. }
  20. }
  21. void cmVOCR_MultVFV( cmComplexR_t* y, const float* x, unsigned n )
  22. {
  23. unsigned i;
  24. for(i=0; i<n; ++i)
  25. {
  26. y[i] *= x[i];
  27. }
  28. }
  29. void cmVOCR_DivVFV( cmComplexR_t* y, const float* x, unsigned n )
  30. {
  31. unsigned i;
  32. for(i=0; i<n; ++i)
  33. {
  34. y[i] /= x[i];
  35. }
  36. }
  37. void cmVOCR_Abs( cmSample_t* y, const cmComplexR_t* x, unsigned n )
  38. {
  39. unsigned i;
  40. for(i=0; i<n; ++i)
  41. y[i] = (cmSample_t)cmCabsR(x[i]);
  42. }
  43. void cmVOCR_DivR_VV( cmComplexR_t* y, const cmReal_t* x, unsigned n )
  44. {
  45. unsigned i;
  46. for(i=0; i<n; ++i)
  47. {
  48. y[i] /= x[i];
  49. //y[i].r /= x[i];
  50. //y[i].i /= x[i];
  51. }
  52. }