BIQUADF16.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #include "BIQUADF16.h"
  2. #include "Error.h"
  3. void BIQUADF16::test_biquad_cascade_df1_f16()
  4. {
  5. arm_biquad_cascade_df1_f16(&instBiquadDf1, this->pSrc, this->pDst, this->nbSamples);
  6. }
  7. void BIQUADF16::test_biquad_cascade_df2T_f16()
  8. {
  9. arm_biquad_cascade_df2T_f16(&instBiquadDf2T, this->pSrc, this->pDst, this->nbSamples);
  10. }
  11. void BIQUADF16::test_biquad_cascade_stereo_df2T_f16()
  12. {
  13. arm_biquad_cascade_stereo_df2T_f16(&instStereo, this->pSrc, this->pDst, this->nbSamples);
  14. }
  15. void BIQUADF16::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->numStages = *it++;
  19. this->nbSamples = *it;
  20. switch(id)
  21. {
  22. case TEST_BIQUAD_CASCADE_DF1_F16_1:
  23. samples.reload(BIQUADF16::SAMPLES1_F16_ID,mgr,this->nbSamples);
  24. output.create(this->nbSamples,BIQUADF16::OUT_SAMPLES_F16_ID,mgr);
  25. coefs.reload(BIQUADF16::COEFS1_F16_ID,mgr,this->numStages * 5);
  26. state.create(4*this->numStages,BIQUADF16::STATE_F16_ID,mgr);
  27. arm_biquad_cascade_df1_init_f16(&instBiquadDf1,
  28. this->numStages,
  29. coefs.ptr(),
  30. state.ptr());
  31. break;
  32. case TEST_BIQUAD_CASCADE_DF2T_F16_2:
  33. samples.reload(BIQUADF16::SAMPLES1_F16_ID,mgr,this->nbSamples);
  34. output.create(this->nbSamples,BIQUADF16::OUT_SAMPLES_F16_ID,mgr);
  35. coefs.reload(BIQUADF16::COEFS1_F16_ID,mgr,this->numStages * 5);
  36. state.create(2*this->numStages,BIQUADF16::STATE_F16_ID,mgr);
  37. #if defined(ARM_MATH_NEON)
  38. // For Neon, neonCoefs is the coef array and is bigger
  39. neonCoefs.create(8*this->numStages,BIQUADF16::STATE_F16_ID,mgr);
  40. arm_biquad_cascade_df2T_init_f16(&instBiquadDf2T,
  41. this->numStages,
  42. neonCoefs.ptr(),
  43. state.ptr());
  44. // Those Neon coefs must be computed from original coefs
  45. arm_biquad_cascade_df2T_compute_coefs_f16(&instBiquadDf2T,this->numStages,coefs.ptr());
  46. #else
  47. // For cortex-M, coefs is the coef array
  48. arm_biquad_cascade_df2T_init_f16(&instBiquadDf2T,
  49. this->numStages,
  50. coefs.ptr(),
  51. state.ptr());
  52. #endif
  53. break;
  54. case TEST_BIQUAD_CASCADE_STEREO_DF2T_F16_3:
  55. samples.reload(BIQUADF16::SAMPLES1_F16_ID,mgr,2*this->nbSamples);
  56. output.create(2*this->nbSamples,BIQUADF16::OUT_SAMPLES_F16_ID,mgr);
  57. coefs.reload(BIQUADF16::COEFS1_F16_ID,mgr,this->numStages * 5);
  58. state.create(4*this->numStages,BIQUADF16::STATE_F16_ID,mgr);
  59. arm_biquad_cascade_stereo_df2T_init_f16(&instStereo,
  60. this->numStages,
  61. coefs.ptr(),
  62. state.ptr());
  63. break;
  64. }
  65. this->pSrc=samples.ptr();
  66. this->pDst=output.ptr();
  67. }
  68. void BIQUADF16::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  69. {
  70. (void)id;
  71. (void)mgr;
  72. }