4 Revision 1.15 2004/06/26 03:50:14 markster
5 Merge source cleanups (bug #1911)
7 Revision 1.14 2003/02/12 13:59:15 matteo
8 mer feb 12 14:56:57 CET 2003
10 Revision 1.1.1.1 2003/02/12 13:59:15 matteo
11 mer feb 12 14:56:57 CET 2003
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
16 * Revision 1.1 1996/08/19 22:30:58 jaf
22 /* -- translated by f2c (version 19951025).
23 You must link the resulting object file with the libraries:
24 -lf2c -lm (in that order)
29 #ifdef P_R_O_T_O_T_Y_P_E_S
30 extern int preemp_(real
*inbuf
, real
*pebuf
, integer
*nsamp
, real
*coef
, real
*z__
);
33 /* ******************************************************************* */
35 /* PREEMP Version 55 */
38 * Revision 1.15 2004/06/26 03:50:14 markster
39 * Merge source cleanups (bug #1911)
41 * Revision 1.14 2003/02/12 13:59:15 matteo
42 * mer feb 12 14:56:57 CET 2003
44 * Revision 1.1.1.1 2003/02/12 13:59:15 matteo
45 * mer feb 12 14:56:57 CET 2003
47 * Revision 1.2 2000/01/05 08:20:39 markster
48 * Some OSS fixes and a few lpc changes to make it actually work
50 * Revision 1.1 1996/08/19 22:30:58 jaf
53 /* Revision 1.3 1996/03/14 23:16:29 jaf */
54 /* Just added a few comments about which array indices of the arguments */
55 /* are used, and mentioning that this subroutine has no local state. */
57 /* Revision 1.2 1996/03/11 23:23:34 jaf */
58 /* Added a bunch of comments to an otherwise simple subroutine. */
60 /* Revision 1.1 1996/02/07 14:48:48 jaf */
61 /* Initial revision */
64 /* ******************************************************************* */
66 /* Preemphasize speech with a single-zero filter. */
67 /* (When coef = .9375, preemphasis is as in LPC43.) */
70 /* NSAMP - Number of samples to filter */
71 /* INBUF - Input speech buffer */
72 /* Indices 1 through NSAMP are read. */
73 /* COEF - Preemphasis coefficient */
75 /* Z - Filter state */
77 /* PEBUF - Preemphasized speech buffer (can be equal to INBUF) */
78 /* Indices 1 through NSAMP are modified. */
80 /* This subroutine has no local state. */
82 /* Subroutine */ int preemp_(real
*inbuf
, real
*pebuf
, integer
*nsamp
, real
*
85 /* System generated locals */
95 /* None of these need to have their values saved from one */
96 /* invocation to the next. */
98 /* Logically, this subroutine computes the output sequence */
99 /* pebuf(1:nsamp) defined by: */
101 /* pebuf(i) = inbuf(i) - coef * inbuf(i-1) */
103 /* where inbuf(0) is defined by the value of z given as input to */
104 /* this subroutine. */
106 /* What is this filter's frequency response and phase response? */
108 /* Why is this filter applied to the speech? */
110 /* Could it be more efficient to apply multiple filters */
111 /* simultaneously, by combining them into one equivalent filter? */
113 /* Are there ever cases when "factoring" one high-order filter into
115 /* multiple smaller-order filter actually reduces the number of */
116 /* arithmetic operations needed to perform them? */
117 /* When I first read this subroutine, I didn't understand why the */
118 /* variable temp was used. It seemed that the statements in the do
120 /* loop could be replaced with the following: */
122 /* pebuf(i) = inbuf(i) - coef * z */
125 /* The reason for temp is so that even if pebuf and inbuf are the */
126 /* same arrays in memory (i.e., they are aliased), then this */
127 /* subroutine will still work correctly. I didn't realize this */
128 /* until seeing the comment after PEBUF above that says "(can be */
129 /* equal to INBUF)". */
130 /* Parameter adjustments */
136 for (i__
= 1; i__
<= i__1
; ++i__
) {
137 temp
= inbuf
[i__
] - *coef
* *z__
;