TransformF32.cpp 3.7 KB

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