FIRQ31.cpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #include "FIRQ31.h"
  2. #include "Error.h"
  3. void FIRQ31::test_fir_q31()
  4. {
  5. arm_fir_q31(&instFir, pSrc, pDst, this->nbSamples);
  6. }
  7. void FIRQ31::test_lms_q31()
  8. {
  9. arm_lms_q31(&instLms, pSrc, (q31_t*)pRef, pDst, pErr,this->nbSamples);
  10. }
  11. void FIRQ31::test_lms_norm_q31()
  12. {
  13. arm_lms_norm_q31(&instLmsNorm, pSrc, (q31_t*)pRef, pDst, pErr,this->nbSamples);
  14. }
  15. void FIRQ31::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(FIRQ31::SAMPLES1_Q31_ID,mgr,this->nbSamples);
  21. coefs.reload(FIRQ31::COEFS1_Q31_ID,mgr,this->nbTaps);
  22. state.create(this->nbSamples + this->nbTaps - 1,FIRQ31::STATE_Q31_ID,mgr);
  23. output.create(this->nbSamples,FIRQ31::OUT_SAMPLES_Q31_ID,mgr);
  24. switch(id)
  25. {
  26. case TEST_FIR_Q31_1:
  27. arm_fir_init_q31(&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_Q31_2:
  33. refs.reload(FIRQ31::REFS1_Q31_ID,mgr,this->nbSamples);
  34. error.create(this->nbSamples,FIRQ31::ERR_Q31_ID,mgr);
  35. // Value of mu and postShift are arbitrary just for benchmark
  36. arm_lms_init_q31(&instLms,this->nbTaps,coefs.ptr(),state.ptr(),100,this->nbSamples,1);
  37. this->pSrc=samples.ptr();
  38. this->pRef=refs.ptr();
  39. this->pDst=output.ptr();
  40. this->pErr=error.ptr();
  41. break;
  42. case TEST_LMS_NORM_Q31_3:
  43. refs.reload(FIRQ31::REFS1_Q31_ID,mgr,this->nbSamples);
  44. error.create(this->nbSamples,FIRQ31::ERR_Q31_ID,mgr);
  45. // Value of mu and postShift are arbitrary just for benchmark
  46. arm_lms_norm_init_q31(&instLmsNorm,this->nbTaps,coefs.ptr(),state.ptr(),100,this->nbSamples,1);
  47. this->pSrc=samples.ptr();
  48. this->pRef=refs.ptr();
  49. this->pDst=output.ptr();
  50. this->pErr=error.ptr();
  51. break;
  52. }
  53. }
  54. void FIRQ31::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  55. {
  56. }