138{
139
140 integer inbuf_offset, lpbuf_offset, i__1;
142
143
146
147
151 real ap_rms__, e_0__, oldsgn, lp_rms__, e_b__, e_f__, r_b__, r_f__, e0ap;
152
153
154
155
156
157
158
159
160 --vwin;
161 --buflim;
162 lpbuf_offset = buflim[3];
163 lpbuf -= lpbuf_offset;
164 inbuf_offset = buflim[1];
165 inbuf -= inbuf_offset;
166
167
168 lp_rms__ = 0.f;
169 ap_rms__ = 0.f;
170 e_pre__ = 0.f;
171 e0ap = 0.f;
172 *rc1 = 0.f;
173 e_0__ = 0.f;
174 e_b__ = 0.f;
175 e_f__ = 0.f;
176 r_f__ = 0.f;
177 r_b__ = 0.f;
178 *zc = 0;
179 vlen = vwin[2] - vwin[1] + 1;
180 start = vwin[1] + (*half - 1) * vlen / 2 + 1;
181 stop = start + vlen / 2 - 1;
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196 r__1 =
inbuf[start - 1] - *dither;
199 for (i__ = start; i__ <= i__1; ++i__) {
200 lp_rms__ += (r__1 = lpbuf[i__],
abs(r__1));
201 ap_rms__ += (r__1 =
inbuf[i__],
abs(r__1));
203
205 e0ap += r__1 * r__1;
207
208 r__1 = lpbuf[i__];
209 e_0__ += r__1 * r__1;
210
211 r__1 = lpbuf[i__ - *mintau];
212 e_b__ += r__1 * r__1;
213
214 r__1 = lpbuf[i__ + *mintau];
215 e_f__ += r__1 * r__1;
216 r_f__ += lpbuf[i__] * lpbuf[i__ + *mintau];
217 r_b__ += lpbuf[i__] * lpbuf[i__ - *mintau];
218 r__1 =
inbuf[i__] + *dither;
220 ++(*zc);
221 oldsgn = -oldsgn;
222 }
223 *dither = -(*dither);
224 }
225
226
227 *rc1 /=
max(e0ap,1.f);
228
229
230
231
232 r__1 = ap_rms__ * 2.f;
233 *qs = e_pre__ /
max(r__1,1.f);
234
235
236 *ar_b__ = r_b__ /
max(e_b__,1.f) * (r_b__ /
max(e_0__,1.f));
237
238
239 *ar_f__ = r_f__ /
max(e_f__,1.f) * (r_f__ /
max(e_0__,1.f));
240
241
242 r__2 = (
real) (*zc << 1);
243 r__1 = r__2 * (90.f / vlen);
245
246 r__1 = lp_rms__ / 4 * (90.f / vlen);
248 *lbe =
min(i__1,32767);
249
250 r__1 = ap_rms__ / 4 * (90.f / vlen);
252 *fbe =
min(i__1,32767);
253 return 0;
254}
double r_sign(real *a, real *b)
static int inbuf(struct baseio *bio, FILE *fi)
utility used by inchar(), for base_encode()