Let's also include aclocal.m4
[asterisk-bristuff.git] / codecs / lpc10 / preemp.c
blob645428c3cb1affa2bf153fd32d24b1fba0e068fb
1 /*
3 $Log$
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
17 * Initial revision
22 /* -- translated by f2c (version 19951025).
23 You must link the resulting object file with the libraries:
24 -lf2c -lm (in that order)
27 #include "f2c.h"
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__);
31 #endif
33 /* ******************************************************************* */
35 /* PREEMP Version 55 */
37 /* $Log$
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
51 * Initial revision
52 * */
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.) */
69 /* Inputs: */
70 /* NSAMP - Number of samples to filter */
71 /* INBUF - Input speech buffer */
72 /* Indices 1 through NSAMP are read. */
73 /* COEF - Preemphasis coefficient */
74 /* Input/Output: */
75 /* Z - Filter state */
76 /* Output: */
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 *
83 coef, real *z__)
85 /* System generated locals */
86 integer i__1;
88 /* Local variables */
89 real temp;
90 integer i__;
92 /* Arguments */
93 /* Local variables */
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 */
123 /* z = inbuf(i) */
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 */
131 --pebuf;
132 --inbuf;
134 /* Function Body */
135 i__1 = *nsamp;
136 for (i__ = 1; i__ <= i__1; ++i__) {
137 temp = inbuf[i__] - *coef * *z__;
138 *z__ = inbuf[i__];
139 pebuf[i__] = temp;
140 /* L10: */
142 return 0;
143 } /* preemp_ */