BIQUADF32.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #include "BIQUADF32.h"
  2. #include "Error.h"
  3. void BIQUADF32::test_biquad_cascade_df1_f32()
  4. {
  5. arm_biquad_cascade_df1_f32(&instBiquadDf1, this->pSrc, this->pDst, this->nbSamples);
  6. }
  7. void BIQUADF32::test_biquad_cascade_df2T_f32()
  8. {
  9. arm_biquad_cascade_df2T_f32(&instBiquadDf2T, this->pSrc, this->pDst, this->nbSamples);
  10. }
  11. void BIQUADF32::test_biquad_cascade_stereo_df2T_f32()
  12. {
  13. arm_biquad_cascade_stereo_df2T_f32(&instStereo, this->pSrc, this->pDst, this->nbSamples);
  14. }
  15. void BIQUADF32::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_F32_1:
  23. samples.reload(BIQUADF32::SAMPLES1_F32_ID,mgr,this->nbSamples);
  24. output.create(this->nbSamples,BIQUADF32::OUT_SAMPLES_F32_ID,mgr);
  25. coefs.reload(BIQUADF32::COEFS1_F32_ID,mgr,this->numStages * 5);
  26. state.create(4*this->numStages,BIQUADF32::STATE_F32_ID,mgr);
  27. arm_biquad_cascade_df1_init_f32(&instBiquadDf1,
  28. this->numStages,
  29. coefs.ptr(),
  30. state.ptr());
  31. break;
  32. case TEST_BIQUAD_CASCADE_DF2T_F32_2:
  33. samples.reload(BIQUADF32::SAMPLES1_F32_ID,mgr,this->nbSamples);
  34. output.create(this->nbSamples,BIQUADF32::OUT_SAMPLES_F32_ID,mgr);
  35. coefs.reload(BIQUADF32::COEFS1_F32_ID,mgr,this->numStages * 5);
  36. state.create(2*this->numStages,BIQUADF32::STATE_F32_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,BIQUADF32::STATE_F32_ID,mgr);
  40. arm_biquad_cascade_df2T_init_f32(&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_f32(&instBiquadDf2T,this->numStages,coefs.ptr());
  46. #else
  47. // For cortex-M, coefs is the coef array
  48. arm_biquad_cascade_df2T_init_f32(&instBiquadDf2T,
  49. this->numStages,
  50. coefs.ptr(),
  51. state.ptr());
  52. #endif
  53. break;
  54. case TEST_BIQUAD_CASCADE_STEREO_DF2T_F32_3:
  55. samples.reload(BIQUADF32::SAMPLES1_F32_ID,mgr,2*this->nbSamples);
  56. output.create(2*this->nbSamples,BIQUADF32::OUT_SAMPLES_F32_ID,mgr);
  57. coefs.reload(BIQUADF32::COEFS1_F32_ID,mgr,this->numStages * 5);
  58. state.create(4*this->numStages,BIQUADF32::STATE_F32_ID,mgr);
  59. arm_biquad_cascade_stereo_df2T_init_f32(&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 BIQUADF32::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  69. {
  70. }