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

Linux/Unix编程

开发平台:

Visual C++

  1. /*
  2. $Log: deemp.c,v $
  3. Revision 1.1.1.1  2002/07/28 05:23:23  freeman_yong
  4. lpc10 codec
  5.  * Revision 1.2  1996/08/20  20:23:46  jaf
  6.  * Removed all static local variables that were SAVE'd in the Fortran
  7.  * code, and put them in struct lpc10_decoder_state that is passed as an
  8.  * argument.
  9.  *
  10.  * Removed init function, since all initialization is now done in
  11.  * init_lpc10_decoder_state().
  12.  *
  13.  * Revision 1.1  1996/08/19  22:32:34  jaf
  14.  * Initial revision
  15.  *
  16. */
  17. #ifdef P_R_O_T_O_T_Y_P_E_S
  18. extern int deemp_(real *x, integer *n, struct lpc10_decoder_state *st);
  19. #endif
  20. /*  -- translated by f2c (version 19951025).
  21.    You must link the resulting object file with the libraries:
  22. -lf2c -lm   (in that order)
  23. */
  24. #include "f2c.h"
  25. /* ***************************************************************** */
  26. /*  DEEMP Version 48 */
  27. /* $Log: deemp.c,v $
  28. /* Revision 1.1.1.1  2002/07/28 05:23:23  freeman_yong
  29. /* lpc10 codec
  30. /*
  31.  * Revision 1.2  1996/08/20  20:23:46  jaf
  32.  * Removed all static local variables that were SAVE'd in the Fortran
  33.  * code, and put them in struct lpc10_decoder_state that is passed as an
  34.  * argument.
  35.  *
  36.  * Removed init function, since all initialization is now done in
  37.  * init_lpc10_decoder_state().
  38.  *
  39.  * Revision 1.1  1996/08/19  22:32:34  jaf
  40.  * Initial revision
  41.  * */
  42. /* Revision 1.3  1996/03/20  15:54:37  jaf */
  43. /* Added comments about which indices of array arguments are read or */
  44. /* written. */
  45. /* Added entry INITDEEMP to reinitialize the local state variables, if */
  46. /* desired. */
  47. /* Revision 1.2  1996/03/14  22:11:13  jaf */
  48. /* Comments added explaining which of the local variables of this */
  49. /* subroutine need to be saved from one invocation to the next, and which */
  50. /* do not. */
  51. /* Revision 1.1  1996/02/07 14:44:53  jaf */
  52. /* Initial revision */
  53. /* ***************************************************************** */
  54. /*  De-Emphasize output speech with   1 / ( 1 - .75z**-1 ) */
  55. /*    cascaded with 200 Hz high pass filter */
  56. /*    ( 1 - 1.9998z**-1 + z**-2 ) / ( 1 - 1.75z**-1 + .78z**-2 ) */
  57. /*  WARNING!  The coefficients above may be out of date with the code */
  58. /*  below.  Either that, or some kind of transformation was performed */
  59. /*  on the coefficients above to create the code below. */
  60. /* Input: */
  61. /*  N  - Number of samples */
  62. /* Input/Output: */
  63. /*  X  - Speech */
  64. /*       Indices 1 through N are read before being written. */
  65. /* This subroutine maintains local state from one call to the next.  If */
  66. /* you want to switch to using a new audio stream for this filter, or */
  67. /* reinitialize its state for any other reason, call the ENTRY */
  68. /* INITDEEMP. */
  69. /* Subroutine */ int deemp_(real *x, integer *n, struct lpc10_decoder_state *st)
  70. {
  71.     /* Initialized data */
  72.     real *dei1;
  73.     real *dei2;
  74.     real *deo1;
  75.     real *deo2;
  76.     real *deo3;
  77.     /* System generated locals */
  78.     integer i__1;
  79.     real r__1;
  80.     /* Local variables */
  81.     integer k;
  82.     real dei0;
  83. /*       Arguments */
  84. /*       Local variables that need not be saved */
  85. /*       Local state */
  86. /*       All of the locals saved below were not given explicit initial */
  87. /*       values in the original code.  I think 0 is a safe choice. */
  88.     /* Parameter adjustments */
  89.     if (x) {
  90. --x;
  91. }
  92.     /* Function Body */
  93.     dei1 = &(st->dei1);
  94.     dei2 = &(st->dei2);
  95.     deo1 = &(st->deo1);
  96.     deo2 = &(st->deo2);
  97.     deo3 = &(st->deo3);
  98.     i__1 = *n;
  99.     for (k = 1; k <= i__1; ++k) {
  100. dei0 = x[k];
  101. r__1 = x[k] - *dei1 * 1.9998f + *dei2;
  102. x[k] = r__1 + *deo1 * 2.5f - *deo2 * 2.0925f + *deo3 * .585f;
  103. *dei2 = *dei1;
  104. *dei1 = dei0;
  105. *deo3 = *deo2;
  106. *deo2 = *deo1;
  107. *deo1 = x[k];
  108.     }
  109.     return 0;
  110. } /* deemp_ */