Asterisk - The Open Source Telephony Project GIT-master-f36a736
hp100.c
Go to the documentation of this file.
1/*
2
3$Log$
4Revision 1.15 2004/06/26 03:50:14 markster
5Merge source cleanups (bug #1911)
6
7Revision 1.14 2003/02/12 13:59:15 matteo
8mer feb 12 14:56:57 CET 2003
9
10Revision 1.1.1.1 2003/02/12 13:59:15 matteo
11mer feb 12 14:56:57 CET 2003
12
13Revision 1.2 2000/01/05 08:20:39 markster
14Some OSS fixes and a few lpc changes to make it actually work
15
16 * Revision 1.2 1996/08/20 20:28:05 jaf
17 * Removed all static local variables that were SAVE'd in the Fortran
18 * code, and put them in struct lpc10_encoder_state that is passed as an
19 * argument.
20 *
21 * Removed init function, since all initialization is now done in
22 * init_lpc10_encoder_state().
23 *
24 * Revision 1.1 1996/08/19 22:32:04 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
38extern int hp100_(real *speech, integer *start, integer *end,
39 struct lpc10_encoder_state *st);
40extern int inithp100_(void);
41#endif
42
43/* ********************************************************************* */
44
45/* HP100 Version 55 */
46
47/* $Log$
48 * Revision 1.15 2004/06/26 03:50:14 markster
49 * Merge source cleanups (bug #1911)
50 *
51 * Revision 1.14 2003/02/12 13:59:15 matteo
52 * mer feb 12 14:56:57 CET 2003
53 *
54 * Revision 1.1.1.1 2003/02/12 13:59:15 matteo
55 * mer feb 12 14:56:57 CET 2003
56 *
57 * Revision 1.2 2000/01/05 08:20:39 markster
58 * Some OSS fixes and a few lpc changes to make it actually work
59 *
60 * Revision 1.2 1996/08/20 20:28:05 jaf
61 * Removed all static local variables that were SAVE'd in the Fortran
62 * code, and put them in struct lpc10_encoder_state that is passed as an
63 * argument.
64 *
65 * Removed init function, since all initialization is now done in
66 * init_lpc10_encoder_state().
67 *
68 * Revision 1.1 1996/08/19 22:32:04 jaf
69 * Initial revision
70 * */
71/* Revision 1.6 1996/03/15 16:45:25 jaf */
72/* Rearranged a few comments. */
73
74/* Revision 1.5 1996/03/14 23:20:54 jaf */
75/* Added comments about when INITHP100 should be used. */
76
77/* Revision 1.4 1996/03/14 23:08:08 jaf */
78/* Added an entry named INITHP100 that initializes the local state of */
79/* subroutine HP100. */
80
81/* Revision 1.3 1996/03/14 22:09:20 jaf */
82/* Comments added explaining which of the local variables of this */
83/* subroutine need to be saved from one invocation to the next, and which */
84/* do not. */
85
86/* Revision 1.2 1996/02/12 15:05:54 jaf */
87/* Added lots of comments explaining why I changed one line, which was a */
88/* declaration with initializations. */
89
90/* Revision 1.1 1996/02/07 14:47:12 jaf */
91/* Initial revision */
92
93
94/* ********************************************************************* */
95
96/* 100 Hz High Pass Filter */
97
98/* Jan 92 - corrected typo (1.937148 to 1.935715), */
99/* rounded coefficients to 7 places, */
100/* corrected and merged gain (.97466**4), */
101/* merged numerator into first two sections. */
102
103/* Input: */
104/* start, end - Range of samples to filter */
105/* Input/Output: */
106/* speech(end) - Speech data. */
107/* Indices start through end are read and modified. */
108
109/* This subroutine maintains local state from one call to the next. If */
110/* you want to switch to using a new audio stream for this filter, or */
111/* reinitialize its state for any other reason, call the ENTRY */
112/* INITHP100. */
113/* Subroutine */ int hp100_(real *speech, integer *start, integer *end,
114 struct lpc10_encoder_state *st)
115{
116 /* Temporary local copies of variables in lpc10_encoder_state.
117 I've only created these because it might cause the loop below
118 to execute a bit faster to access local variables, rather than
119 variables in the lpc10_encoder_state structure. It is just a
120 guess that it will be faster. */
121
122 real z11;
123 real z21;
124 real z12;
125 real z22;
126
127 /* System generated locals */
128 integer i__1;
129
130 /* Local variables */
131 integer i__;
132 real si, err;
133
134/* Arguments */
135/* Local variables that need not be saved */
136/* Local state */
137 /* Parameter adjustments */
138 if (speech) {
139 --speech;
140 }
141
142 /* Function Body */
143
144 z11 = st->z11;
145 z21 = st->z21;
146 z12 = st->z12;
147 z22 = st->z22;
148
149 i__1 = *end;
150 for (i__ = *start; i__ <= i__1; ++i__) {
151 si = speech[i__];
152 err = si + z11 * 1.859076f - z21 * .8648249f;
153 si = err - z11 * 2.f + z21;
154 z21 = z11;
155 z11 = err;
156 err = si + z12 * 1.935715f - z22 * .9417004f;
157 si = err - z12 * 2.f + z22;
158 z22 = z12;
159 z12 = err;
160 speech[i__] = si * .902428f;
161 }
162
163 st->z11 = z11;
164 st->z21 = z21;
165 st->z12 = z12;
166 st->z22 = z22;
167
168 return 0;
169} /* hp100_ */
char * end
Definition: eagi_proxy.c:73
int inithp100_(void)
int hp100_(real *speech, integer *start, integer *end, struct lpc10_encoder_state *st)
Definition: hp100.c:113
float real
Definition: lpc10.h:79
INT32 integer
Definition: lpc10.h:80