TransformF32.cpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #include "TransformF32.h"
  2. #include "Error.h"
  3. #include "arm_math.h"
  4. void TransformF32::test_cfft_f32()
  5. {
  6. arm_cfft_f32(&(this->cfftInstance), this->pDst, this->ifft,this->bitRev);
  7. }
  8. void TransformF32::test_rfft_f32()
  9. {
  10. arm_rfft_fast_f32(&this->rfftFastInstance, this->pSrc, this->pDst, this->ifft);
  11. }
  12. void TransformF32::test_dct4_f32()
  13. {
  14. arm_dct4_f32(
  15. &this->dct4Instance,
  16. this->pState,
  17. this->pDst);
  18. }
  19. void TransformF32::test_cfft_radix4_f32()
  20. {
  21. arm_cfft_radix4_f32(&this->cfftRadix4Instance,this->pDst);
  22. }
  23. void TransformF32::test_cfft_radix2_f32()
  24. {
  25. arm_cfft_radix2_f32(&this->cfftRadix2Instance,this->pDst);
  26. }
  27. void TransformF32::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
  28. {
  29. float32_t normalize;
  30. std::vector<Testing::param_t>::iterator it = params.begin();
  31. this->nbSamples = *it++;
  32. this->ifft = *it++;
  33. this->bitRev = *it;
  34. switch(id)
  35. {
  36. case TEST_CFFT_F32_1:
  37. samples.reload(TransformF32::INPUTC_F32_ID,mgr,2*this->nbSamples);
  38. output.create(2*this->nbSamples,TransformF32::OUT_F32_ID,mgr);
  39. this->pSrc=samples.ptr();
  40. this->pDst=output.ptr();
  41. status=arm_cfft_init_f32(&cfftInstance,this->nbSamples);
  42. memcpy(this->pDst,this->pSrc,2*sizeof(float32_t)*this->nbSamples);
  43. break;
  44. case TEST_RFFT_F32_2:
  45. samples.reload(TransformF32::INPUTR_F32_ID,mgr,this->nbSamples);
  46. output.create(this->nbSamples,TransformF32::OUT_F32_ID,mgr);
  47. this->pSrc=samples.ptr();
  48. this->pDst=output.ptr();
  49. arm_rfft_fast_init_f32(&this->rfftFastInstance, this->nbSamples);
  50. break;
  51. case TEST_DCT4_F32_3:
  52. samples.reload(TransformF32::INPUTR_F32_ID,mgr,this->nbSamples);
  53. output.create(this->nbSamples,TransformF32::OUT_F32_ID,mgr);
  54. state.create(2*this->nbSamples,TransformF32::STATE_F32_ID,mgr);
  55. this->pSrc=samples.ptr();
  56. this->pDst=output.ptr();
  57. this->pState=state.ptr();
  58. normalize = sqrt((2.0f/(float32_t)this->nbSamples));
  59. memcpy(this->pDst,this->pSrc,sizeof(float32_t)*this->nbSamples);
  60. arm_dct4_init_f32(
  61. &this->dct4Instance,
  62. &this->rfftInstance,
  63. &this->cfftRadix4Instance,
  64. this->nbSamples,
  65. this->nbSamples/2,
  66. normalize);
  67. break;
  68. case TEST_CFFT_RADIX4_F32_4:
  69. samples.reload(TransformF32::INPUTC_F32_ID,mgr,2*this->nbSamples);
  70. output.create(2*this->nbSamples,TransformF32::OUT_F32_ID,mgr);
  71. this->pSrc=samples.ptr();
  72. this->pDst=output.ptr();
  73. memcpy(this->pDst,this->pSrc,2*sizeof(float32_t)*this->nbSamples);
  74. arm_cfft_radix4_init_f32(&this->cfftRadix4Instance,
  75. this->nbSamples,
  76. this->ifft,
  77. this->bitRev);
  78. break;
  79. case TEST_CFFT_RADIX2_F32_5:
  80. samples.reload(TransformF32::INPUTC_F32_ID,mgr,2*this->nbSamples);
  81. output.create(2*this->nbSamples,TransformF32::OUT_F32_ID,mgr);
  82. this->pSrc=samples.ptr();
  83. this->pDst=output.ptr();
  84. memcpy(this->pDst,this->pSrc,2*sizeof(float32_t)*this->nbSamples);
  85. arm_cfft_radix2_init_f32(&this->cfftRadix2Instance,
  86. this->nbSamples,
  87. this->ifft,
  88. this->bitRev);
  89. break;
  90. }
  91. }
  92. void TransformF32::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  93. {
  94. }