hpOutput.c 1.3 KB

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