FIRF32.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #include "FIRF32.h"
  2. #include "Error.h"
  3. void FIRF32::test_fir_f32()
  4. {
  5. const float32_t *pSrc=samples.ptr();
  6. const float32_t *pCoefs=coefs.ptr();
  7. float32_t *pDst=output.ptr();
  8. arm_fir_f32(&instFir, pSrc, pDst, this->nbSamples);
  9. }
  10. void FIRF32::test_lms_f32()
  11. {
  12. const float32_t *pSrc=samples.ptr();
  13. const float32_t *pRef=refs.ptr();
  14. float32_t *pDst=output.ptr();
  15. float32_t *pErr=error.ptr();
  16. arm_lms_f32(&instLms, pSrc, (float32_t*)pRef, pDst, pErr,this->nbSamples);
  17. }
  18. void FIRF32::test_lms_norm_f32()
  19. {
  20. const float32_t *pSrc=samples.ptr();
  21. const float32_t *pRef=refs.ptr();
  22. float32_t *pDst=output.ptr();
  23. float32_t *pErr=error.ptr();
  24. arm_lms_norm_f32(&instLmsNorm, pSrc, (float32_t*)pRef, pDst, pErr,this->nbSamples);
  25. }
  26. void FIRF32::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
  27. {
  28. std::vector<Testing::param_t>::iterator it = params.begin();
  29. this->nbTaps = *it++;
  30. this->nbSamples = *it;
  31. samples.reload(FIRF32::SAMPLES1_F32_ID,mgr,this->nbSamples);
  32. coefs.reload(FIRF32::COEFS1_F32_ID,mgr,this->nbTaps);
  33. state.create(this->nbSamples + this->nbTaps - 1,FIRF32::STATE_F32_ID,mgr);
  34. output.create(this->nbSamples,FIRF32::OUT_SAMPLES_F32_ID,mgr);
  35. switch(id)
  36. {
  37. case TEST_FIR_F32_1:
  38. arm_fir_init_f32(&instFir,this->nbTaps,coefs.ptr(),state.ptr(),this->nbSamples);
  39. break;
  40. case TEST_LMS_F32_2:
  41. refs.reload(FIRF32::REFS1_F32_ID,mgr,this->nbSamples);
  42. error.create(this->nbSamples,FIRF32::ERR_F32_ID,mgr);
  43. arm_lms_init_f32(&instLms,this->nbTaps,coefs.ptr(),state.ptr(),0.1,this->nbSamples);
  44. break;
  45. case TEST_LMS_NORM_F32_3:
  46. refs.reload(FIRF32::REFS1_F32_ID,mgr,this->nbSamples);
  47. error.create(this->nbSamples,FIRF32::ERR_F32_ID,mgr);
  48. arm_lms_norm_init_f32(&instLmsNorm,this->nbTaps,coefs.ptr(),state.ptr(),0.1,this->nbSamples);
  49. break;
  50. }
  51. }
  52. void FIRF32::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  53. {
  54. }