hpOutput.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /******************************************************************
  2. iLBC Speech Coder ANSI-C Source Code
  3. hpOutput.c
  4. Copyright (C) The Internet Society (2004).
  5. All Rights Reserved.
  6. ******************************************************************/
  7. #include "constants.h"
  8. /*----------------------------------------------------------------*
  9. * Output high-pass filter
  10. *---------------------------------------------------------------*/
  11. void hpOutput(
  12. float *In, /* (i) vector to filter */
  13. int len,/* (i) length of vector to filter */
  14. float *Out, /* (o) the resulting filtered vector */
  15. float *mem /* (i/o) the filter state */
  16. ){
  17. int i;
  18. float *pi, *po;
  19. /* all-zero section*/
  20. pi = &In[0];
  21. po = &Out[0];
  22. for (i=0; i<len; i++) {
  23. *po = hpo_zero_coefsTbl[0] * (*pi);
  24. *po += hpo_zero_coefsTbl[1] * mem[0];
  25. *po += hpo_zero_coefsTbl[2] * mem[1];
  26. mem[1] = mem[0];
  27. mem[0] = *pi;
  28. po++;
  29. pi++;
  30. }
  31. /* all-pole section*/
  32. po = &Out[0];
  33. for (i=0; i<len; i++) {
  34. *po -= hpo_pole_coefsTbl[1] * mem[2];
  35. *po -= hpo_pole_coefsTbl[2] * mem[3];
  36. mem[3] = mem[2];
  37. mem[2] = *po;
  38. po++;
  39. }
  40. }