Asterisk - The Open Source Telephony Project  18.5.0
deemp.c
Go to the documentation of this file.
1 /*
2 
3 $Log$
4 Revision 1.15 2004/06/26 03:50:14 markster
5 Merge source cleanups (bug #1911)
6 
7 Revision 1.14 2003/02/12 13:59:14 matteo
8 mer feb 12 14:56:57 CET 2003
9 
10 Revision 1.1.1.1 2003/02/12 13:59:14 matteo
11 mer feb 12 14:56:57 CET 2003
12 
13 Revision 1.2 2000/01/05 08:20:39 markster
14 Some OSS fixes and a few lpc changes to make it actually work
15 
16  * Revision 1.2 1996/08/20 20:23:46 jaf
17  * Removed all static local variables that were SAVE'd in the Fortran
18  * code, and put them in struct lpc10_decoder_state that is passed as an
19  * argument.
20  *
21  * Removed init function, since all initialization is now done in
22  * init_lpc10_decoder_state().
23  *
24  * Revision 1.1 1996/08/19 22:32:34 jaf
25  * Initial revision
26  *
27 
28 */
29 
30 /* -- translated by f2c (version 19951025).
31  You must link the resulting object file with the libraries:
32  -lf2c -lm (in that order)
33 */
34 
35 #include "f2c.h"
36 
37 #ifdef P_R_O_T_O_T_Y_P_E_S
38 extern int deemp_(real *x, integer *n, struct lpc10_decoder_state *st);
39 #endif
40 
41 /* ***************************************************************** */
42 
43 /* DEEMP Version 48 */
44 
45 /* $Log$
46  * Revision 1.15 2004/06/26 03:50:14 markster
47  * Merge source cleanups (bug #1911)
48  *
49  * Revision 1.14 2003/02/12 13:59:14 matteo
50  * mer feb 12 14:56:57 CET 2003
51  *
52  * Revision 1.1.1.1 2003/02/12 13:59:14 matteo
53  * mer feb 12 14:56:57 CET 2003
54  *
55  * Revision 1.2 2000/01/05 08:20:39 markster
56  * Some OSS fixes and a few lpc changes to make it actually work
57  *
58  * Revision 1.2 1996/08/20 20:23:46 jaf
59  * Removed all static local variables that were SAVE'd in the Fortran
60  * code, and put them in struct lpc10_decoder_state that is passed as an
61  * argument.
62  *
63  * Removed init function, since all initialization is now done in
64  * init_lpc10_decoder_state().
65  *
66  * Revision 1.1 1996/08/19 22:32:34 jaf
67  * Initial revision
68  * */
69 /* Revision 1.3 1996/03/20 15:54:37 jaf */
70 /* Added comments about which indices of array arguments are read or */
71 /* written. */
72 
73 /* Added entry INITDEEMP to reinitialize the local state variables, if */
74 /* desired. */
75 
76 /* Revision 1.2 1996/03/14 22:11:13 jaf */
77 /* Comments added explaining which of the local variables of this */
78 /* subroutine need to be saved from one invocation to the next, and which */
79 /* do not. */
80 
81 /* Revision 1.1 1996/02/07 14:44:53 jaf */
82 /* Initial revision */
83 
84 
85 /* ***************************************************************** */
86 
87 /* De-Emphasize output speech with 1 / ( 1 - .75z**-1 ) */
88 /* cascaded with 200 Hz high pass filter */
89 /* ( 1 - 1.9998z**-1 + z**-2 ) / ( 1 - 1.75z**-1 + .78z**-2 ) */
90 
91 /* WARNING! The coefficients above may be out of date with the code */
92 /* below. Either that, or some kind of transformation was performed */
93 /* on the coefficients above to create the code below. */
94 
95 /* Input: */
96 /* N - Number of samples */
97 /* Input/Output: */
98 /* X - Speech */
99 /* Indices 1 through N are read before being written. */
100 
101 /* This subroutine maintains local state from one call to the next. If */
102 /* you want to switch to using a new audio stream for this filter, or */
103 /* reinitialize its state for any other reason, call the ENTRY */
104 /* INITDEEMP. */
105 
106 /* Subroutine */ int deemp_(real *x, integer *n, struct lpc10_decoder_state *st)
107 {
108  /* Initialized data */
109 
110  real *dei1;
111  real *dei2;
112  real *deo1;
113  real *deo2;
114  real *deo3;
115 
116  /* System generated locals */
117  integer i__1;
118  real r__1;
119 
120  /* Local variables */
121  integer k;
122  real dei0;
123 
124 /* Arguments */
125 /* Local variables that need not be saved */
126 /* Local state */
127 /* All of the locals saved below were not given explicit initial */
128 /* values in the original code. I think 0 is a safe choice. */
129  /* Parameter adjustments */
130  if (x) {
131  --x;
132  }
133 
134  /* Function Body */
135 
136  dei1 = &(st->dei1);
137  dei2 = &(st->dei2);
138  deo1 = &(st->deo1);
139  deo2 = &(st->deo2);
140  deo3 = &(st->deo3);
141 
142  i__1 = *n;
143  for (k = 1; k <= i__1; ++k) {
144  dei0 = x[k];
145  r__1 = x[k] - *dei1 * 1.9998f + *dei2;
146  x[k] = r__1 + *deo1 * 2.5f - *deo2 * 2.0925f + *deo3 * .585f;
147  *dei2 = *dei1;
148  *dei1 = dei0;
149  *deo3 = *deo2;
150  *deo2 = *deo1;
151  *deo1 = x[k];
152  }
153  return 0;
154 } /* deemp_ */
int deemp_(real *x, integer *n, struct lpc10_decoder_state *st)
Definition: deemp.c:106
float real
Definition: lpc10.h:79
INT32 integer
Definition: lpc10.h:80