Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 21 Jahren
vor 21 Jahren
vor 21 Jahren
vor 21 Jahren
vor 21 Jahren
vor 21 Jahren
vor 21 Jahren
vor 21 Jahren
vor 21 Jahren
vor 21 Jahren
vor 21 Jahren
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Atpdec
  3. * Copyright (c) 2003 by Thierry Leconte (F4DWV)
  4. *
  5. * $Id$
  6. *
  7. * This library is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Library General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. *
  21. */
  22. #include "filter.h"
  23. float fir( float *buff, const float *coeff, const int len)
  24. {
  25. int i;
  26. double r;
  27. r=0.0;
  28. for(i=0;i<len;i++) {
  29. r+=buff[i]*coeff[i];
  30. }
  31. return r;
  32. }
  33. void iqfir( float *buff, const float *Icoeff, const float *Qcoeff, const int len, float *Iptr,float *Qptr)
  34. {
  35. int i;
  36. float I,Q;
  37. I=Q=0.0;
  38. for(i=0;i<len;i++) {
  39. double v;
  40. v=buff[i];
  41. I+=v*Icoeff[i];
  42. Q+=v*Qcoeff[i];
  43. }
  44. *Iptr=I;
  45. *Qptr=Q;
  46. }
  47. float rsfir(float *buff,const float *coeff,const int len , const double offset , const double delta)
  48. {
  49. int i;
  50. double n;
  51. double out;
  52. out=0.0;
  53. for(i=0,n=offset;n<len-1;n+=delta,i++) {
  54. int k;
  55. double alpha;
  56. k=(int)n;
  57. alpha=n-k;
  58. out+=buff[i]*(coeff[k]*(1.0-alpha)+coeff[k+1]*alpha);
  59. }
  60. return out;
  61. }
  62. double iir(double x,iirbuff_t *buff,const iircoeff_t *coeff)
  63. {
  64. buff->x[4]=buff->x[3];
  65. buff->x[3]=buff->x[2];
  66. buff->x[2]=buff->x[1];
  67. buff->x[1]=buff->x[0];
  68. buff->x[0]=x/coeff->G;
  69. buff->y[2]=buff->y[1];
  70. buff->y[1]=buff->y[0];
  71. buff->y[0] = buff->x[4]
  72. + coeff->x[2] * buff->x[3]
  73. + coeff->x[1] * buff->x[2]
  74. + coeff->x[0] * buff->x[1]
  75. + buff->x[0]
  76. + coeff->y[1] * buff->y[2]
  77. + coeff->y[0] * buff->y[1];
  78. return (buff->y[0]);
  79. }