DECIMF32.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #include "DECIMF32.h"
  2. #include "Error.h"
  3. void DECIMF32::test_fir_decimate_f32()
  4. {
  5. arm_fir_decimate_f32(&instDecim,this->pSrc,this->pDst,this->nbSamples);
  6. }
  7. void DECIMF32::test_fir_interpolate_f32()
  8. {
  9. arm_fir_interpolate_f32(&instInterpol,this->pSrc,this->pDst,this->nbSamples);
  10. }
  11. void DECIMF32::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
  12. {
  13. std::vector<Testing::param_t>::iterator it = params.begin();
  14. this->nbTaps = *it++;
  15. this->nbSamples = *it++;
  16. samples.reload(DECIMF32::SAMPLES1_F32_ID,mgr,this->nbSamples);
  17. coefs.reload(DECIMF32::COEFS1_F32_ID,mgr,this->nbTaps);
  18. output.create(this->nbSamples,DECIMF32::OUT_SAMPLES_F32_ID,mgr);
  19. switch(id)
  20. {
  21. case TEST_FIR_DECIMATE_F32_1:
  22. this->decimationFactor = *it;
  23. state.create(this->nbSamples + this->nbTaps - 1,DECIMF32::STATE_F32_ID,mgr);
  24. arm_fir_decimate_init_f32(&instDecim,
  25. this->nbTaps,
  26. this->decimationFactor,
  27. coefs.ptr(),
  28. state.ptr(),
  29. this->nbSamples);
  30. break;
  31. case TEST_FIR_INTERPOLATE_F32_2:
  32. {
  33. this->interpolationFactor = *it;
  34. int phase = this->nbTaps / this->interpolationFactor;
  35. state.create(this->nbSamples + phase - 1,DECIMF32::STATE_F32_ID,mgr);
  36. arm_fir_interpolate_init_f32(&instInterpol,
  37. this->interpolationFactor,
  38. this->nbTaps,
  39. coefs.ptr(),
  40. state.ptr(),
  41. this->nbSamples);
  42. }
  43. break;
  44. }
  45. this->pSrc=samples.ptr();
  46. this->pDst=output.ptr();
  47. }
  48. void DECIMF32::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  49. {
  50. }