262{
  263    
  264 
  266    static real vdc[100]     = { 0.f,1714.f,-110.f,
 
  267        334.f,-4096.f,-654.f,3752.f,3769.f,0.f,1181.f,0.f,874.f,-97.f,
  268        300.f,-4096.f,-1021.f,2451.f,2527.f,0.f,-500.f,0.f,510.f,-70.f,
  269        250.f,-4096.f,-1270.f,2194.f,2491.f,0.f,-1500.f,0.f,500.f,-10.f,
  270        200.f,-4096.f,-1300.f,2e3f,2e3f,0.f,-2e3f,0.f,500.f,0.f,0.f,
  271        -4096.f,-1300.f,2e3f,2e3f,0.f,-2500.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,
  272        0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,
  273        0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,
  274        0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f };
  276    static real vdcl[10] = { 600.f,450.f,300.f,200.f,0.f,0.f,0.f,0.f,0.f,0.f }
 
  277        ;
  278 
  279    
  280    integer inbuf_offset = 0, lpbuf_offset = 0, i__1, i__2;
 
  282 
  283    
  286 
  287    
  289    integer *lbve, *lbue, *fbve, *fbue;
 
  307 
  308
  309
  310
  311
  312
  313
  314
  315
  316
  317
  318
  319
  320
  321
  322
  323
  324
  325
  326
  327
  328
  329
  330
  331
  332
  333
  334
  335
  336
  337
  338
  339
  340 
  341
  342
  343
  344 
  345
  346
  347 
  348
  349 
  350
  351 
  352
  353
  354 
  355
  356 
  357
  358 
  359
  360
  361
  362
  363
  364
  365
  366
  367
  368
  369
  370
  371
  372
  373
  374
  375
  376
  377
  378
  379
  380
  381
  382
  383
  384
  385
  386
  387
  388
  389
  390
  391
  392
  393 
  394
  395
  396
  397 
  398
  399
  400
  401
  402
  403
  404
  405
  406
  407
  408
  409
  410
  411
  412
  413
  414
  415
  416
  417
  418
  419
  420
  421
  422
  423
  424
  425
  426
  427
  428
  429 
  430
  431
  432
  433
  434
  435
  436
  437
  438
  439
  440
  441
  442
  443 
  444
  445
  446 
  447
  448
  449
  450 
  451
  452
  453
  454
  455
  456
  457
  458
  459 
  460
  461
  462
  463
  464
  465
  466
  467
  468 
  469
  470
  471 
  472
  473 
  477    voice = (&st->
voice[0]);
 
  482    ofbue = (&st->
ofbue);
 
  483    olbue = (&st->
olbue);
 
  484    sfbue = (&st->
sfbue);
 
  485    slbue = (&st->
slbue);
 
  486 
  487    
  488    if (vwin) {
  489    --vwin;
  490    }
  491    if (buflim) {
  492    --buflim;
  493    }
  495    inbuf_offset = buflim[1];
  496    inbuf -= inbuf_offset;
 
  497    }
  498    if (lpbuf) {
  499    lpbuf_offset = buflim[3];
  500    lpbuf -= lpbuf_offset;
  501    }
  502    if (ivrc) {
  503    --ivrc;
  504    }
  505    if (obound) {
  506    --obound;
  507    }
  508    if (voibuf) {
  509    --voibuf;
  510    }
  511 
  512    
  513 
  514
  515
  516
  517
  518
  519 
  520
  521
  522 
  523
  524
  525
  526 
  527
  528 
  529
  530
  531
  532
  533
  534
  535
  536
  537
  538
  539
  540
  541
  542
  543
  544 
  545
  546
  547
  548
  549
  550
  551
  552 
  553
  554 
  555
  556
  557 
  558
  559    if (*half == 1) {
  560    voice[0] = voice[2];
  561    voice[1] = voice[3];
  562    voice[2] = voice[4];
  563    voice[3] = voice[5];
  564    *maxmin = *maxamd / 
max(*minamd,1.f);
 
  565    }
  566
  567    vparms_(&vwin[1], &
inbuf[inbuf_offset], &lpbuf[lpbuf_offset], &buflim[1],
 
  568        half, dither, mintau, &zc, &lbe, &fbe, &qs, &rc1, &ar_b__, &
  569        ar_f__);
  570
  571
  572
  573
  574
  575    r__1 = (*snr + *fbve / (
real) 
max(*fbue,1)) * 63 / 64.f;
 
  577    snr2 = *snr * *fbue / 
max(*lbue,1);
 
  578
  579    snrl = 1;
  580    i__1 = nvdcl - 1;
  581    for (snrl = 1; snrl <= i__1; ++snrl) {
  582    if (snr2 > vdcl[snrl - 1]) {
  583        goto L69;
  584    }
  585    }
  586
  587L69:
  588
  597
  598    voice[*half + 3] = vdc[snrl * 10 - 1];
  599    for (i__ = 1; i__ <= 8; ++i__) {
  600    voice[*half + 3] += vdc[i__ + snrl * 10 - 11] * 
value[i__ - 1];
 
  601    }
  602
  603
  604    if (voice[*half + 3] > 0.f) {
  605    voibuf[*half + 6] = 1;
  606    } else {
  607    voibuf[*half + 6] = 0;
  608    }
  609
  610
  611
  612
  613
  614
  615
  616    vstate = -1;
  617    if (*half == 1) {
  618    goto L99;
  619    }
  620
  621 
  622
  623
  624 
  625
  626
  627
  628 
  629
  630
  631
  632 
  633
  634
  635
  636
  637
  638 
  639
  640
  641
  642
  643
  644
  645
  646
  647
  648
  649
  650
  651
  652
  653
  654
  655
  656
  657 
  658
  659
  660
  661    ot = ((obound[1] & 2) != 0 || obound[2] == 1) && (obound[3] & 1) == 0;
  662
  663    vstate = (voibuf[3] << 3) + (voibuf[4] << 2) + (voibuf[5] << 1) + voibuf[
  664        6];
  665    switch (vstate + 1) {
  666    case 1:  goto L99;
  667    case 2:  goto L1;
  668    case 3:  goto L2;
  669    case 4:  goto L99;
  670    case 5:  goto L4;
  671    case 6:  goto L5;
  672    case 7:  goto L6;
  673    case 8:  goto L7;
  674    case 9:  goto L8;
  675    case 10:  goto L99;
  676    case 11:  goto L10;
  677    case 12:  goto L11;
  678    case 13:  goto L99;
  679    case 14:  goto L13;
  680    case 15:  goto L14;
  681    case 16:  goto L99;
  682    }
  683L1:
  684    if (ot && voibuf[7] == 1) {
  685    voibuf[5] = 1;
  686    }
  687    goto L99;
  688L2:
  689    if (voibuf[7] == 0 || voice[2] < -voice[3]) {
  690    voibuf[5] = 0;
  691    } else {
  692    voibuf[6] = 1;
  693    }
  694    goto L99;
  695L4:
  696    voibuf[4] = 0;
  697    goto L99;
  698L5:
  699    if (voice[1] < -voice[2]) {
  700    voibuf[4] = 0;
  701    } else {
  702    voibuf[5] = 1;
  703    }
  704    goto L99;
  705
  706L6:
  707    if (voibuf[1] == 1 || voibuf[7] == 1 || voice[3] > voice[0]) {
  708    voibuf[6] = 1;
  709    } else {
  710    voibuf[3] = 1;
  711    }
  712    goto L99;
  713L7:
  714    if (ot) {
  715    voibuf[4] = 0;
  716    }
  717    goto L99;
  718L8:
  719    if (ot) {
  720    voibuf[4] = 1;
  721    }
  722    goto L99;
  723L10:
  724    if (voice[2] < -voice[1]) {
  725    voibuf[5] = 0;
  726    } else {
  727    voibuf[4] = 1;
  728    }
  729    goto L99;
  730L11:
  731    voibuf[4] = 1;
  732    goto L99;
  733L13:
  734    if (voibuf[7] == 0 && voice[3] < -voice[2]) {
  735    voibuf[6] = 0;
  736    } else {
  737    voibuf[5] = 1;
  738    }
  739    goto L99;
  740L14:
  741    if (ot && voibuf[7] == 0) {
  742    voibuf[5] = 0;
  743    }
  744
  745L99:
  746
  747
  748 
  749
  750
  751
  752
  753
  754
  755
  756
  757    if (voibuf[*half + 6] == 0) {
  758
  759    i__1 = fbe, i__2 = *ofbue * 3;
  760    r__1 = (*sfbue * 63 + (
min(i__1,i__2) << 3)) / 64.f;
 
  762    *fbue = *sfbue / 8;
  763    *ofbue = fbe;
  764
  765    i__1 = lbe, i__2 = *olbue * 3;
  766    r__1 = (*slbue * 63 + (
min(i__1,i__2) << 3)) / 64.f;
 
  768    *lbue = *slbue / 8;
  769    *olbue = lbe;
  770    } else {
  771    r__1 = (*lbve * 63 + lbe) / 64.f;
  773    r__1 = (*fbve * 63 + fbe) / 64.f;
  775    }
  776
  777
  778
  779
  780
  781    r__2 = (
real)(sqrt((
real) (*lbue * *lbve)) * 64 / 3000);
 
  782    r__1 = 
max(r__2,1.f);
 
  783    *dither = 
min(r__1,20.f);
 
  784
  785    return 0;
  786} 
int vparms_(integer *vwin, real *inbuf, real *lpbuf, integer *buflim, integer *half, real *dither, integer *mintau, integer *zc, integer *lbe, integer *fbe, real *qs, real *rc1, real *ar_b__, real *ar_f__)
static int inbuf(struct baseio *bio, FILE *fi)
utility used by inchar(), for base_encode()