1 /*
2 
3  * Revision 1.1  1996/08/19  22:30:58  jaf
4  * Initial revision
5  *
6 
7 */
8 
9 /*  -- translated by f2c (version 19951025).
10    You must link the resulting object file with the libraries:
11 	-lf2c -lm   (in that order)
12 */
13 
14 #include "f2c.h"
15 
16 extern int preemp_(real *inbuf, real *pebuf, integer *nsamp, real *coef, real *z__);
17 
18 /* ******************************************************************* */
19 
20 /* 	PREEMP Version 55 */
21 
22 /*
23  * Revision 1.1  1996/08/19  22:30:58  jaf
24  * Initial revision
25  * */
26 /* Revision 1.3  1996/03/14  23:16:29  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 
30 /* Revision 1.2  1996/03/11  23:23:34  jaf */
31 /* Added a bunch of comments to an otherwise simple subroutine. */
32 
33 /* Revision 1.1  1996/02/07 14:48:48  jaf */
34 /* Initial revision */
35 
36 
37 /* ******************************************************************* */
38 
39 /*   Preemphasize speech with a single-zero filter. */
40 /*  (When coef = .9375, preemphasis is as in LPC43.) */
41 
42 /* Inputs: */
43 /*  NSAMP  - Number of samples to filter */
44 /*  INBUF  - Input speech buffer */
45 /*           Indices 1 through NSAMP are read. */
46 /*  COEF   - Preemphasis coefficient */
47 /* Input/Output: */
48 /*  Z      - Filter state */
49 /* Output: */
50 /*  PEBUF  - Preemphasized speech buffer (can be equal to INBUF) */
51 /*           Indices 1 through NSAMP are modified. */
52 
53 /* This subroutine has no local state. */
54 
preemp_(real * inbuf,real * pebuf,integer * nsamp,real * coef,real * z__)55 /* Subroutine */ int preemp_(real *inbuf, real *pebuf, integer *nsamp, real *
56 	coef, real *z__)
57 {
58     /* System generated locals */
59     integer i__1;
60 
61     /* Local variables */
62     real temp;
63     integer i__;
64 
65 /*       Arguments */
66 /*       Local variables */
67 
68 /*       None of these need to have their values saved from one */
69 /*       invocation to the next. */
70 
71 /*       Logically, this subroutine computes the output sequence */
72 /*       pebuf(1:nsamp) defined by: */
73 
74 /*       pebuf(i) = inbuf(i) - coef * inbuf(i-1) */
75 
76 /*       where inbuf(0) is defined by the value of z given as input to */
77 /*       this subroutine. */
78 
79 /*       What is this filter's frequency response and phase response? */
80 
81 /*       Why is this filter applied to the speech? */
82 
83 /*       Could it be more efficient to apply multiple filters */
84 /*       simultaneously, by combining them into one equivalent filter? */
85 
86 /*       Are there ever cases when "factoring" one high-order filter into
87 */
88 /*       multiple smaller-order filter actually reduces the number of */
89 /*       arithmetic operations needed to perform them? */
90 /*       When I first read this subroutine, I didn't understand why the */
91 /*       variable temp was used.  It seemed that the statements in the do
92 */
93 /*       loop could be replaced with the following: */
94 
95 /*           pebuf(i) = inbuf(i) - coef * z */
96 /*           z = inbuf(i) */
97 
98 /*       The reason for temp is so that even if pebuf and inbuf are the */
99 /*       same arrays in memory (i.e., they are aliased), then this */
100 /*       subroutine will still work correctly.  I didn't realize this */
101 /*       until seeing the comment after PEBUF above that says "(can be */
102 /*       equal to INBUF)". */
103     /* Parameter adjustments */
104     --pebuf;
105     --inbuf;
106 
107     /* Function Body */
108     i__1 = *nsamp;
109     for (i__ = 1; i__ <= i__1; ++i__) {
110 	temp = inbuf[i__] - *coef * *z__;
111 	*z__ = inbuf[i__];
112 	pebuf[i__] = temp;
113 /* L10: */
114     }
115     return 0;
116 } /* preemp_ */
117 
118