FIRF16.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include "FIRF16.h"
  2. #include "Error.h"
  3. #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
  4. static __ALIGNED(8) float16_t coeffArray[64];
  5. #endif
  6. void FIRF16::test_fir_f16()
  7. {
  8. arm_fir_f16(&instFir, this->pSrc, this->pDst, this->nbSamples);
  9. }
  10. void FIRF16::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
  11. {
  12. std::vector<Testing::param_t>::iterator it = params.begin();
  13. this->nbTaps = *it++;
  14. this->nbSamples = *it;
  15. samples.reload(FIRF16::SAMPLES1_F16_ID,mgr,this->nbSamples);
  16. coefs.reload(FIRF16::COEFS1_F16_ID,mgr,this->nbTaps);
  17. state.create(ROUND_UP(this->nbSamples,8) + this->nbSamples + this->nbTaps - 1,FIRF16::STATE_F16_ID,mgr);
  18. output.create(this->nbSamples,FIRF16::OUT_SAMPLES_F16_ID,mgr);
  19. switch(id)
  20. {
  21. case TEST_FIR_F16_1:
  22. #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
  23. /* Copy coefficients and pad to zero
  24. */
  25. memset(coeffArray,0,32*sizeof(float16_t));
  26. float16_t *ptr;
  27. ptr=coefs.ptr();
  28. memcpy(coeffArray,ptr,this->nbTaps*sizeof(float16_t));
  29. this->pCoefs = coeffArray;
  30. #else
  31. this->pCoefs=coefs.ptr();
  32. #endif
  33. arm_fir_init_f16(&instFir,this->nbTaps,coefs.ptr(),state.ptr(),this->nbSamples);
  34. this->pSrc=samples.ptr();
  35. this->pDst=output.ptr();
  36. break;
  37. }
  38. }
  39. void FIRF16::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  40. {
  41. (void)id;
  42. (void)mgr;
  43. }