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