TransformF16.cpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #include "TransformF16.h"
  2. #include "Error.h"
  3. void TransformF16::test_cfft_f16()
  4. {
  5. arm_cfft_f16(&(this->cfftInstance), this->pDst, this->ifft,this->bitRev);
  6. }
  7. void TransformF16::test_rfft_f16()
  8. {
  9. arm_rfft_fast_f16(&this->rfftFastInstance, this->pTmp, this->pDst, this->ifft);
  10. }
  11. void TransformF16::test_cfft_radix4_f16()
  12. {
  13. arm_cfft_radix4_f16(&this->cfftRadix4Instance,this->pDst);
  14. }
  15. void TransformF16::test_cfft_radix2_f16()
  16. {
  17. arm_cfft_radix2_f16(&this->cfftRadix2Instance,this->pDst);
  18. }
  19. void TransformF16::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
  20. {
  21. std::vector<Testing::param_t>::iterator it = params.begin();
  22. this->nbSamples = *it++;
  23. this->ifft = *it++;
  24. this->bitRev = *it;
  25. switch(id)
  26. {
  27. case TEST_CFFT_F16_1:
  28. samples.reload(TransformF16::INPUTC_F16_ID,mgr,2*this->nbSamples);
  29. output.create(2*this->nbSamples,TransformF16::OUT_F16_ID,mgr);
  30. this->pSrc=samples.ptr();
  31. this->pDst=output.ptr();
  32. status=arm_cfft_init_f16(&cfftInstance,this->nbSamples);
  33. memcpy(this->pDst,this->pSrc,2*sizeof(float16_t)*this->nbSamples);
  34. break;
  35. case TEST_RFFT_F16_2:
  36. {
  37. // Factor 2 for irfft
  38. samples.reload(TransformF16::INPUTR_F16_ID,mgr,2*this->nbSamples);
  39. output.create(2*this->nbSamples,TransformF16::OUT_F16_ID,mgr);
  40. tmp.create(2*this->nbSamples,TransformF16::TMP_F16_ID,mgr);
  41. this->pSrc=samples.ptr();
  42. this->pDst=output.ptr();
  43. this->pTmp=tmp.ptr();
  44. memcpy(this->pTmp,this->pSrc,sizeof(float16_t)*this->nbSamples);
  45. arm_rfft_fast_init_f16(&this->rfftFastInstance, this->nbSamples);
  46. }
  47. break;
  48. case TEST_CFFT_RADIX4_F16_3:
  49. samples.reload(TransformF16::INPUTC_F16_ID,mgr,2*this->nbSamples);
  50. output.create(2*this->nbSamples,TransformF16::OUT_F16_ID,mgr);
  51. this->pSrc=samples.ptr();
  52. this->pDst=output.ptr();
  53. memcpy(this->pDst,this->pSrc,2*sizeof(float16_t)*this->nbSamples);
  54. arm_cfft_radix4_init_f16(&this->cfftRadix4Instance,
  55. this->nbSamples,
  56. this->ifft,
  57. this->bitRev);
  58. break;
  59. case TEST_CFFT_RADIX2_F16_4:
  60. samples.reload(TransformF16::INPUTC_F16_ID,mgr,2*this->nbSamples);
  61. output.create(2*this->nbSamples,TransformF16::OUT_F16_ID,mgr);
  62. this->pSrc=samples.ptr();
  63. this->pDst=output.ptr();
  64. memcpy(this->pDst,this->pSrc,2*sizeof(float16_t)*this->nbSamples);
  65. arm_cfft_radix2_init_f16(&this->cfftRadix2Instance,
  66. this->nbSamples,
  67. this->ifft,
  68. this->bitRev);
  69. break;
  70. }
  71. }
  72. void TransformF16::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  73. {
  74. (void)id;
  75. (void)mgr;
  76. }