dcbias.c
上传用户:zslianheng
上传日期:2013-04-03
资源大小:946k
文件大小:2k
源码类别:

Linux/Unix编程

开发平台:

Visual C++

  1. /*
  2. $Log: dcbias.c,v $
  3. Revision 1.1.1.1  2002/07/28 05:23:19  freeman_yong
  4. lpc10 codec
  5.  * Revision 1.1  1996/08/19  22:40:23  jaf
  6.  * Initial revision
  7.  *
  8. */
  9. #ifdef P_R_O_T_O_T_Y_P_E_S
  10. extern int dcbias_(integer *len, real *speech, real *sigout);
  11. #endif
  12. /*  -- translated by f2c (version 19951025).
  13.    You must link the resulting object file with the libraries:
  14. -lf2c -lm   (in that order)
  15. */
  16. #include "f2c.h"
  17. /* ********************************************************************* */
  18. /*  DCBIAS Version 50 */
  19. /* $Log: dcbias.c,v $
  20. /* Revision 1.1.1.1  2002/07/28 05:23:19  freeman_yong
  21. /* lpc10 codec
  22. /*
  23.  * Revision 1.1  1996/08/19  22:40:23  jaf
  24.  * Initial revision
  25.  * */
  26. /* Revision 1.3  1996/03/18  21:19:22  jaf */
  27. /* Just added a few comments about which array indices of the arguments */
  28. /* are used, and mentioning that this subroutine has no local state. */
  29. /* Revision 1.2  1996/03/13  16:44:53  jaf */
  30. /* Comments added explaining that none of the local variables of this */
  31. /* subroutine need to be saved from one invocation to the next. */
  32. /* Revision 1.1  1996/02/07 14:44:21  jaf */
  33. /* Initial revision */
  34. /* ********************************************************************* */
  35. /* Calculate and remove DC bias from buffer. */
  36. /* Input: */
  37. /*  LEN    - Length of speech buffers */
  38. /*  SPEECH - Input speech buffer */
  39. /*           Indices 1 through LEN read. */
  40. /* Output: */
  41. /*  SIGOUT - Output speech buffer */
  42. /*           Indices 1 through LEN written */
  43. /* This subroutine has no local state. */
  44. /* Subroutine */ int dcbias_(integer *len, real *speech, real *sigout)
  45. {
  46.     /* System generated locals */
  47.     integer i__1;
  48.     /* Local variables */
  49.     real bias;
  50.     integer i__;
  51. /*  Arguments */
  52. /*       Local variables that need not be saved */
  53.     /* Parameter adjustments */
  54.     --sigout;
  55.     --speech;
  56.     /* Function Body */
  57.     bias = 0.f;
  58.     i__1 = *len;
  59.     for (i__ = 1; i__ <= i__1; ++i__) {
  60. bias += speech[i__];
  61.     }
  62.     bias /= *len;
  63.     i__1 = *len;
  64.     for (i__ = 1; i__ <= i__1; ++i__) {
  65. sigout[i__] = speech[i__] - bias;
  66.     }
  67.     return 0;
  68. } /* dcbias_ */