125{
126
127
130 static integer kexc[25] = { 8,-16,26,-48,86,-162,294,-502,718,-728,184,
131 672,-610,-672,184,728,718,502,294,162,86,48,26,16,8 };
140
141
144
145
147
148
151 real noise[166], pulse;
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321 if (coef) {
322 --coef;
323 }
324 if (sout) {
325 --sout;
326 }
327
328
331 exc2 = &(st->
exc2[0]);
339
340
341
342
343 r__1 = *rmso / (*rms + 1e-6f);
345 *rmso = *rms;
347 for (i__ = 1; i__ <= i__1; ++i__) {
348 exc2[i__ - 1] = exc2[*ipo + i__ - 1] * xy;
349 }
350 *ipo = *ip;
351 if (*iv == 0) {
352
353 i__1 = *ip;
354 for (i__ = 1; i__ <= i__1; ++i__) {
356 }
357
358
359
360
361
362
363
364
366 r__1 = *ratio / 4 * 1.f;
367 pulse = r__1 * 342;
368 if (pulse > 2e3f) {
369 pulse = 2e3f;
370 }
371 exc[px - 1] += pulse;
372 exc[px] -= pulse;
373
374 } else {
375 sscale = (
real)sqrt((
real) (*ip)) / 6.928f;
376 i__1 = *ip;
377 for (i__ = 1; i__ <= i__1; ++i__) {
378 exc[
contrl_1.order + i__ - 1] = 0.f;
379 if (i__ <= 25) {
380 exc[
contrl_1.order + i__ - 1] = sscale * kexc[i__ - 1];
381 }
382 lpi0 = exc[
contrl_1.order + i__ - 1];
383 r__2 = exc[
contrl_1.order + i__ - 1] * .125f + *lpi1 * .75f;
384 r__1 = r__2 + *lpi2 * .125f;
385 exc[
contrl_1.order + i__ - 1] = r__1 + *lpi3 * 0.f;
386 *lpi3 = *lpi2;
387 *lpi2 = *lpi1;
388 *lpi1 = lpi0;
389 }
390 i__1 = *ip;
391 for (i__ = 1; i__ <= i__1; ++i__) {
393 hpi0 = noise[
contrl_1.order + i__ - 1];
394 r__2 = noise[
contrl_1.order + i__ - 1] * -.125f + *hpi1 * .25f;
395 r__1 = r__2 + *hpi2 * -.125f;
396 noise[
contrl_1.order + i__ - 1] = r__1 + *hpi3 * 0.f;
397 *hpi3 = *hpi2;
398 *hpi2 = *hpi1;
399 *hpi1 = hpi0;
400 }
401 i__1 = *ip;
402 for (i__ = 1; i__ <= i__1; ++i__) {
404 }
405 }
406
407
408 xssq = 0.f;
409 i__1 = *ip;
410 for (i__ = 1; i__ <= i__1; ++i__) {
412 sum = 0.f;
414 for (j = 1; j <= i__2; ++j) {
415 sum += coef[j] * exc[k - j - 1];
416 }
417 sum *= *g2pass;
418 exc2[k - 1] = sum + exc[k - 1];
419 }
420
421 i__1 = *ip;
422 for (i__ = 1; i__ <= i__1; ++i__) {
424 sum = 0.f;
426 for (j = 1; j <= i__2; ++j) {
427 sum += coef[j] * exc2[k - j - 1];
428 }
429 exc2[k - 1] = sum + exc2[k - 1];
430 xssq += exc2[k - 1] * exc2[k - 1];
431 }
432
434 for (i__ = 1; i__ <= i__1; ++i__) {
435 exc[i__ - 1] = exc[*ip + i__ - 1];
436 exc2[i__ - 1] = exc2[*ip + i__ - 1];
437 }
438
439 r__1 = *rms * *rms;
440 ssq = r__1 * *ip;
441 gain = (
real)sqrt(ssq / xssq);
442 i__1 = *ip;
443 for (i__ = 1; i__ <= i__1; ++i__) {
444 sout[i__] = gain * exc2[
contrl_1.order + i__ - 1];
445 }
446 return 0;
447}
integer random_(struct lpc10_decoder_state *st)