FIRF32.cpp 2.3 KB

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