158 static integer ivtab[32] = { 24960,24960,24960,24960,25480,25480,25483,
159 25480,16640,1560,1560,1560,16640,1816,1563,1560,24960,24960,24859,
160 24856,26001,25881,25915,25913,1560,1560,7800,3640,1561,1561,3643,
162 static real corth[32] = { 32767.f,10.f,5.f,0.f,
163 32767.f,8.f,4.f,0.f,32.f,6.4f,3.2f,0.f,32.f,6.4f,3.2f,0.f,32.f,
164 11.2f,6.4f,0.f,32.f,11.2f,6.4f,0.f,16.f,5.6f,3.2f,0.f,16.f,5.6f,
166 static integer detau[128] = { 0,0,0,3,0,3,3,31,0,3,3,21,3,3,29,30,0,3,3,
167 20,3,25,27,26,3,23,58,22,3,24,28,3,0,3,3,3,3,39,33,32,3,37,35,36,
168 3,38,34,3,3,42,46,44,50,40,48,3,54,3,56,3,52,3,3,1,0,3,3,108,3,78,
169 100,104,3,84,92,88,156,80,96,3,3,74,70,72,66,76,68,3,62,3,60,3,64,
170 3,3,1,3,116,132,112,148,152,3,3,140,3,136,3,144,3,3,1,124,120,128,
171 3,3,3,3,1,3,3,3,1,3,1,1,1 };
172 static integer rmst[64] = { 1024,936,856,784,718,656,600,550,502,460,420,
173 384,352,328,294,270,246,226,206,188,172,158,144,132,120,110,102,
174 92,84,78,70,64,60,54,50,46,42,38,34,32,30,26,24,22,20,18,17,16,15,
175 14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 };
176 static integer detab7[32] = { 4,11,18,25,32,39,46,53,60,66,72,77,82,87,92,
177 96,101,104,108,111,114,115,117,119,121,122,123,124,125,126,127,
179 static real descl[8] = { .6953f,.625f,.5781f,.5469f,.5312f,.5391f,.4688f,
182 static integer deadd[8] = { 1152,-2816,-1536,-3584,-1280,-2432,768,-1920 }
184 static integer qb[8] = { 511,511,1023,1023,1023,1023,2047,4095 };
185 static integer nbit[10] = { 8,8,5,5,4,4,4,4,3,2 };
186 static integer zrc[10] = { 0,0,0,0,0,3,0,2,0,0 };
187 static integer bit[5] = { 2,4,8,16,32 };
204 integer ipit, iout, i__, icorf, index, ivoic, ixcor, i1, i2, i4;
401 first = &(st->
first);
402 ivp2h = &(st->
ivp2h);
404 iavgp = &(st->
iavgp);
405 erate = &(st->
erate);
407 dpit = &(st->
dpit[0]);
408 drms = &(st->
drms[0]);
421 if (*ipitv == 0 || *ipitv == 2) {
428 if (voice[1] == 1 && voice[2] == 1) {
431 if (voice[1] != voice[2]) {
440 *iavgp = (*iavgp * 15 + i4 + 8) / 16;
447 for (i__ = 1; i__ <= i__1; ++i__) {
448 drc[i__ * 3 - 3] = irc[i__];
452 index = (*ivp2h << 4) + (*iovoic << 2) + ivoic + 1;
453 i1 = ivtab[index - 1];
456 if (*erate < ethrs) {
461 if (*erate < ethrs3) {
464 if (*erate < ethrs2) {
467 if (*erate < ethrs1) {
471 voice[1] = icorf / 2 & 1;
472 voice[2] = icorf & 1;
491 if ((icorf & bit[3]) != 0) {
494 index = (drc[22] << 4) + drms[1] / 2;
495 ham84_(&index, &iout, &errcnt);
498 drms[1] = (iout << 1) + lsb;
500 for (i__ = 1; i__ <= 4; ++i__) {
502 i1 = ((drc[25] & 7) << 1) + (drc[28] & 1);
504 i1 = drc[(9 - i__) * 3 - 2] & 15;
506 i2 = drc[(5 - i__) * 3 - 2] & 31;
508 index = (i1 << 4) + i2 / 2;
509 ham84_(&index, &iout, &errcnt);
511 iout = (iout << 1) + lsb;
512 if ((iout & 16) == 16) {
516 iout = drc[(5 - i__) * 3 - 1];
518 drc[(5 - i__) * 3 - 2] = iout;
521 *erate = (
integer)(*erate * .96875f + errcnt * 102);
526 for (i__ = 1; i__ <= i__1; ++i__) {
527 irc[i__] = drc[i__ * 3 - 2];
537 if ((icorf & bit[1]) != 0) {
538 if ((i__1 = drms[1] - drms[0], (
real)
abs(i__1)) >= corth[ixcor + 3]
539 && (i__2 = drms[1] - drms[2], (
real)
abs(i__2)) >= corth[
541 *irms =
median_(&drms[2], &drms[1], drms);
543 for (i__ = 1; i__ <= 6; ++i__) {
544 if ((i__1 = drc[i__ * 3 - 2] - drc[i__ * 3 - 3], (
real)
abs(i__1))
545 >= corth[ixcor + ((i__ + 2) << 2) - 5] && (i__2 = drc[i__ *
546 3 - 2] - drc[i__ * 3 - 1], (
real)
abs(i__2)) >= corth[
547 ixcor + ((i__ + 2) << 2) - 5]) {
548 irc[i__] =
median_(&drc[i__ * 3 - 1], &drc[i__ * 3 - 2], &drc[
554 if ((icorf & bit[2]) != 0) {
555 if ((i__1 = dpit[1] - dpit[0], (
real)
abs(i__1)) >= corth[ixcor - 1]
556 && (i__2 = dpit[1] - dpit[2], (
real)
abs(i__2)) >= corth[
558 *pitch =
median_(&dpit[2], &dpit[1], dpit);
565 if ((icorf & bit[4]) != 0) {
567 for (i__ = 5; i__ <= i__1; ++i__) {
568 irc[i__] = zrc[i__ - 1];
579 for (i__ = 1; i__ <= i__1; ++i__) {
580 drc[i__ * 3 - 1] = drc[i__ * 3 - 2];
581 drc[i__ * 3 - 2] = drc[i__ * 3 - 3];
587 *irms = rmst[(31 - *irms) * 2];
590 for (i__ = 1; i__ <= 2; ++i__) {
604 ishift = 15 - nbit[i__ - 1];
609 for (i__ = 3; i__ <= i__1; ++i__) {
611 ishift = 15 - nbit[i__ - 1];
614 irc[i__] = (
integer)(i2 * descl[i__ - 3] + deadd[i__ - 3]);
619 *rms = (
real) (*irms);
621 for (i__ = 1; i__ <= i__1; ++i__) {
622 rc[i__] = irc[i__] / 16384.f;
integer pow_ii(integer *ap, integer *bp)
integer median_(integer *d1, integer *d2, integer *d3)
struct sla_ringing_trunk * first
int ham84_(integer *input, integer *output, integer *errcnt)