hpOutput.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. }