static void do_bit_allocation1(AC3DecodeContext *ctx, int chnl)

{

    ac3_audio_block *ab = &ctx->audio_block;

    int sdecay, fdecay, sgain, dbknee, floor;

    int lowcomp = 0, fgain = 0, snroffset = 0, fastleak = 0, slowleak = 0;

    int psd[256], bndpsd[50], excite[50], mask[50], delta;

    int start = 0, end = 0, bin = 0, i = 0, j = 0, k = 0, lastbin = 0, bndstrt = 0;

    int bndend = 0, begin = 0, deltnseg = 0, band = 0, seg = 0, address = 0;

    int fscod = ctx->sync_info.fscod;

    uint8_t *exps, *deltoffst = 0, *deltlen = 0, *deltba = 0;

    uint8_t *baps;

    int do_delta = 0;



    /* initialization */

    sdecay = sdecaytab[ab->sdcycod];

    fdecay = fdecaytab[ab->fdcycod];

    sgain = sgaintab[ab->sgaincod];

    dbknee = dbkneetab[ab->dbpbcod];

    floor = floortab[ab->floorcod];



    if (chnl == 5) {

        start = ab->cplstrtmant;

        end = ab->cplendmant;

        fgain = fgaintab[ab->cplfgaincod];

        snroffset = (((ab->csnroffst - 15) << 4) + ab->cplfsnroffst) << 2;

        fastleak = (ab->cplfleak << 8) + 768;

        slowleak = (ab->cplsleak << 8) + 768;

        exps = ab->dcplexps;

        baps = ab->cplbap;

        if (ab->cpldeltbae == AC3_DBASTR_NEW || ab->cpldeltbae == AC3_DBASTR_REUSE) {

            do_delta = 1;

            deltnseg = ab->cpldeltnseg;

            deltoffst = ab->cpldeltoffst;

            deltlen = ab->cpldeltlen;

            deltba = ab->cpldeltba;

        }

    }

    else if (chnl == 6) {

        start = 0;

        end = 7;

        lowcomp = 0;

        fastleak = 0;

        slowleak = 0;

        fgain = fgaintab[ab->lfefgaincod];

        snroffset = (((ab->csnroffst - 15) << 4) + ab->lfefsnroffst) << 2;

        exps = ab->dlfeexps;

        baps = ab->lfebap;

    }

    else {

        start = 0;

        end = ab->endmant[chnl];

        lowcomp = 0;

        fastleak = 0;

        slowleak = 0;

        fgain = fgaintab[ab->fgaincod[chnl]];

        snroffset = (((ab->csnroffst - 15) << 4) + ab->fsnroffst[chnl]) << 2;

        exps = ab->dexps[chnl];

        baps = ab->bap[chnl];

        if (ab->deltbae[chnl] == AC3_DBASTR_NEW || ab->deltbae[chnl] == AC3_DBASTR_REUSE) {

            do_delta = 1;

            deltnseg = ab->deltnseg[chnl];

            deltoffst = ab->deltoffst[chnl];

            deltlen = ab->deltlen[chnl];

            deltba = ab->deltba[chnl];

        }

    }



    for (bin = start; bin < end; bin++) /* exponent mapping into psd */

        psd[bin] = (3072 - ((int)(exps[bin]) << 7));



    /* psd integration */

    j = start;

    k = masktab[start];

    do {

        lastbin = FFMIN(bndtab[k] + bndsz[k], end);

        bndpsd[k] = psd[j];

        j++;

        for (i = j; i < lastbin; i++) {

            bndpsd[k] = logadd(bndpsd[k], psd[j]);

            j++;

        }

        k++;

    } while (end > lastbin);



    /* compute the excite function */

    bndstrt = masktab[start];

    bndend = masktab[end - 1] + 1;

    if (bndstrt == 0) {

        lowcomp = calc_lowcomp(lowcomp, bndpsd[0], bndpsd[1], 0);

        excite[0] = bndpsd[0] - fgain - lowcomp;

        lowcomp = calc_lowcomp(lowcomp, bndpsd[1], bndpsd[2], 1);

        excite[1] = bndpsd[1] - fgain - lowcomp;

        begin = 7;

        for (bin = 2; bin < 7; bin++) {

            if (bndend != 7 || bin != 6)

                lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin);

            fastleak = bndpsd[bin] - fgain;

            slowleak = bndpsd[bin] - sgain;

            excite[bin] = fastleak - lowcomp;

            if (bndend != 7 || bin != 6)

                if (bndpsd[bin] <= bndpsd[bin + 1]) {

                    begin = bin + 1;

                    break;

                }

        }

        for (bin = begin; bin < FFMIN(bndend, 22); bin++) {

            if (bndend != 7 || bin != 6)

                lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin);

            fastleak -= fdecay;

            fastleak = FFMAX(fastleak, bndpsd[bin] - fgain);

            slowleak -= sdecay;

            slowleak = FFMAX(slowleak, bndpsd[bin] - sgain);

            excite[bin] = FFMAX(fastleak - lowcomp, slowleak);

        }

        begin = 22;

    }

    else {

        begin = bndstrt;

    }

    for (bin = begin; bin < bndend; bin++) {

        fastleak -= fdecay;

        fastleak = FFMAX(fastleak, bndpsd[bin] - fgain);

        slowleak -= sdecay;

        slowleak = FFMAX(slowleak, bndpsd[bin] - sgain);

        excite[bin] = FFMAX(fastleak, slowleak);

    }



    /* compute the masking curve */

    for (bin = bndstrt; bin < bndend; bin++) {

        if (bndpsd[bin] < dbknee)

            excite[bin] += ((dbknee - bndpsd[bin]) >> 2);

        mask[bin] = FFMAX(excite[bin], hth[bin][fscod]);

    }



    /* apply the delta bit allocation */

    if (do_delta) {

        band = 0;

        for (seg = 0; seg < deltnseg + 1; seg++) {

            band += (int)(deltoffst[seg]);

            if ((int)(deltba[seg]) >= 4)

                delta = ((int)(deltba[seg]) - 3) << 7;

            else

                delta = ((int)(deltba[seg]) - 4) << 7;

            for (k = 0; k < (int)(deltlen[seg]); k++) {

                mask[band] += delta;

                band++;

            }

        }

    }



    /*compute the bit allocation */

    i = start;

    j = masktab[start];

    do {

        lastbin = FFMIN(bndtab[j] + bndsz[j], end);

        mask[j] -= snroffset;

        mask[j] -= floor;

        if (mask[j] < 0)

            mask[j] = 0;

        mask[j] &= 0x1fe0;

        mask[j] += floor;

        for (k = i; k < lastbin; k++) {

            address = (psd[i] - mask[j]) >> 5;

            address = FFMIN(63, FFMAX(0, address));

            baps[i] = baptab[address];

            i++;

        }

        j++;

    } while (end > lastbin);

}

static void do_bit_allocation1(AC3DecodeContext *ctx, int chnl)

{

    ac3_audio_block *ab = &ctx->audio_block;

    int sdecay, fdecay, sgain, dbknee, floor;

    int lowcomp = 0, fgain = 0, snroffset = 0, fastleak = 0, slowleak = 0;

    int psd[256], bndpsd[50], excite[50], mask[50], delta;

    int start = 0, end = 0, bin = 0, i = 0, j = 0, k = 0, lastbin = 0, bndstrt = 0;

    int bndend = 0, begin = 0, deltnseg = 0, band = 0, seg = 0, address = 0;

    int fscod = ctx->sync_info.fscod;

    uint8_t *exps, *deltoffst = 0, *deltlen = 0, *deltba = 0;

    uint8_t *baps;

    int do_delta = 0;



    

    sdecay = sdecaytab[ab->sdcycod];

    fdecay = fdecaytab[ab->fdcycod];

    sgain = sgaintab[ab->sgaincod];

    dbknee = dbkneetab[ab->dbpbcod];

    floor = floortab[ab->floorcod];



    if (chnl == 5) {

        start = ab->cplstrtmant;

        end = ab->cplendmant;

        fgain = fgaintab[ab->cplfgaincod];

        snroffset = (((ab->csnroffst - 15) << 4) + ab->cplfsnroffst) << 2;

        fastleak = (ab->cplfleak << 8) + 768;

        slowleak = (ab->cplsleak << 8) + 768;

        exps = ab->dcplexps;

        baps = ab->cplbap;

        if (ab->cpldeltbae == AC3_DBASTR_NEW || ab->cpldeltbae == AC3_DBASTR_REUSE) {

            do_delta = 1;

            deltnseg = ab->cpldeltnseg;

            deltoffst = ab->cpldeltoffst;

            deltlen = ab->cpldeltlen;

            deltba = ab->cpldeltba;

        }

    }

    else if (chnl == 6) {

        start = 0;

        end = 7;

        lowcomp = 0;

        fastleak = 0;

        slowleak = 0;

        fgain = fgaintab[ab->lfefgaincod];

        snroffset = (((ab->csnroffst - 15) << 4) + ab->lfefsnroffst) << 2;

        exps = ab->dlfeexps;

        baps = ab->lfebap;

    }

    else {

        start = 0;

        end = ab->endmant[chnl];

        lowcomp = 0;

        fastleak = 0;

        slowleak = 0;

        fgain = fgaintab[ab->fgaincod[chnl]];

        snroffset = (((ab->csnroffst - 15) << 4) + ab->fsnroffst[chnl]) << 2;

        exps = ab->dexps[chnl];

        baps = ab->bap[chnl];

        if (ab->deltbae[chnl] == AC3_DBASTR_NEW || ab->deltbae[chnl] == AC3_DBASTR_REUSE) {

            do_delta = 1;

            deltnseg = ab->deltnseg[chnl];

            deltoffst = ab->deltoffst[chnl];

            deltlen = ab->deltlen[chnl];

            deltba = ab->deltba[chnl];

        }

    }



    for (bin = start; bin < end; bin++) 

        psd[bin] = (3072 - ((int)(exps[bin]) << 7));



    

    j = start;

    k = masktab[start];

    do {

        lastbin = FFMIN(bndtab[k] + bndsz[k], end);

        bndpsd[k] = psd[j];

        j++;

        for (i = j; i < lastbin; i++) {

            bndpsd[k] = logadd(bndpsd[k], psd[j]);

            j++;

        }

        k++;

    } while (end > lastbin);



    

    bndstrt = masktab[start];

    bndend = masktab[end - 1] + 1;

    if (bndstrt == 0) {

        lowcomp = calc_lowcomp(lowcomp, bndpsd[0], bndpsd[1], 0);

        excite[0] = bndpsd[0] - fgain - lowcomp;

        lowcomp = calc_lowcomp(lowcomp, bndpsd[1], bndpsd[2], 1);

        excite[1] = bndpsd[1] - fgain - lowcomp;

        begin = 7;

        for (bin = 2; bin < 7; bin++) {

            if (bndend != 7 || bin != 6)

                lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin);

            fastleak = bndpsd[bin] - fgain;

            slowleak = bndpsd[bin] - sgain;

            excite[bin] = fastleak - lowcomp;

            if (bndend != 7 || bin != 6)

                if (bndpsd[bin] <= bndpsd[bin + 1]) {

                    begin = bin + 1;

                    break;

                }

        }

        for (bin = begin; bin < FFMIN(bndend, 22); bin++) {

            if (bndend != 7 || bin != 6)

                lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin + 1], bin);

            fastleak -= fdecay;

            fastleak = FFMAX(fastleak, bndpsd[bin] - fgain);

            slowleak -= sdecay;

            slowleak = FFMAX(slowleak, bndpsd[bin] - sgain);

            excite[bin] = FFMAX(fastleak - lowcomp, slowleak);

        }

        begin = 22;

    }

    else {

        begin = bndstrt;

    }

    for (bin = begin; bin < bndend; bin++) {

        fastleak -= fdecay;

        fastleak = FFMAX(fastleak, bndpsd[bin] - fgain);

        slowleak -= sdecay;

        slowleak = FFMAX(slowleak, bndpsd[bin] - sgain);

        excite[bin] = FFMAX(fastleak, slowleak);

    }



    

    for (bin = bndstrt; bin < bndend; bin++) {

        if (bndpsd[bin] < dbknee)

            excite[bin] += ((dbknee - bndpsd[bin]) >> 2);

        mask[bin] = FFMAX(excite[bin], hth[bin][fscod]);

    }



    

    if (do_delta) {

        band = 0;

        for (seg = 0; seg < deltnseg + 1; seg++) {

            band += (int)(deltoffst[seg]);

            if ((int)(deltba[seg]) >= 4)

                delta = ((int)(deltba[seg]) - 3) << 7;

            else

                delta = ((int)(deltba[seg]) - 4) << 7;

            for (k = 0; k < (int)(deltlen[seg]); k++) {

                mask[band] += delta;

                band++;

            }

        }

    }



    

    i = start;

    j = masktab[start];

    do {

        lastbin = FFMIN(bndtab[j] + bndsz[j], end);

        mask[j] -= snroffset;

        mask[j] -= floor;

        if (mask[j] < 0)

            mask[j] = 0;

        mask[j] &= 0x1fe0;

        mask[j] += floor;

        for (k = i; k < lastbin; k++) {

            address = (psd[i] - mask[j]) >> 5;

            address = FFMIN(63, FFMAX(0, address));

            baps[i] = baptab[address];

            i++;

        }

        j++;

    } while (end > lastbin);

}

static void FUNC_0(AC3DecodeContext *VAR_0, int VAR_1)

{

    ac3_audio_block *ab = &VAR_0->audio_block;

    int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;

    int VAR_7 = 0, VAR_8 = 0, VAR_9 = 0, VAR_10 = 0, VAR_11 = 0;

    int VAR_12[256], VAR_13[50], VAR_14[50], VAR_15[50], VAR_16;

    int VAR_17 = 0, VAR_18 = 0, VAR_19 = 0, VAR_20 = 0, VAR_21 = 0, VAR_22 = 0, VAR_23 = 0, VAR_24 = 0;

    int VAR_25 = 0, VAR_26 = 0, VAR_27 = 0, VAR_28 = 0, VAR_29 = 0, VAR_30 = 0;

    int VAR_31 = VAR_0->sync_info.VAR_31;

    uint8_t *exps, *deltoffst = 0, *deltlen = 0, *deltba = 0;

    uint8_t *baps;

    int VAR_32 = 0;



    

    VAR_2 = sdecaytab[ab->sdcycod];

    VAR_3 = fdecaytab[ab->fdcycod];

    VAR_4 = sgaintab[ab->sgaincod];

    VAR_5 = dbkneetab[ab->dbpbcod];

    VAR_6 = floortab[ab->floorcod];



    if (VAR_1 == 5) {

        VAR_17 = ab->cplstrtmant;

        VAR_18 = ab->cplendmant;

        VAR_8 = fgaintab[ab->cplfgaincod];

        VAR_9 = (((ab->csnroffst - 15) << 4) + ab->cplfsnroffst) << 2;

        VAR_10 = (ab->cplfleak << 8) + 768;

        VAR_11 = (ab->cplsleak << 8) + 768;

        exps = ab->dcplexps;

        baps = ab->cplbap;

        if (ab->cpldeltbae == AC3_DBASTR_NEW || ab->cpldeltbae == AC3_DBASTR_REUSE) {

            VAR_32 = 1;

            VAR_27 = ab->cpldeltnseg;

            deltoffst = ab->cpldeltoffst;

            deltlen = ab->cpldeltlen;

            deltba = ab->cpldeltba;

        }

    }

    else if (VAR_1 == 6) {

        VAR_17 = 0;

        VAR_18 = 7;

        VAR_7 = 0;

        VAR_10 = 0;

        VAR_11 = 0;

        VAR_8 = fgaintab[ab->lfefgaincod];

        VAR_9 = (((ab->csnroffst - 15) << 4) + ab->lfefsnroffst) << 2;

        exps = ab->dlfeexps;

        baps = ab->lfebap;

    }

    else {

        VAR_17 = 0;

        VAR_18 = ab->endmant[VAR_1];

        VAR_7 = 0;

        VAR_10 = 0;

        VAR_11 = 0;

        VAR_8 = fgaintab[ab->fgaincod[VAR_1]];

        VAR_9 = (((ab->csnroffst - 15) << 4) + ab->fsnroffst[VAR_1]) << 2;

        exps = ab->dexps[VAR_1];

        baps = ab->bap[VAR_1];

        if (ab->deltbae[VAR_1] == AC3_DBASTR_NEW || ab->deltbae[VAR_1] == AC3_DBASTR_REUSE) {

            VAR_32 = 1;

            VAR_27 = ab->VAR_27[VAR_1];

            deltoffst = ab->deltoffst[VAR_1];

            deltlen = ab->deltlen[VAR_1];

            deltba = ab->deltba[VAR_1];

        }

    }



    for (VAR_19 = VAR_17; VAR_19 < VAR_18; VAR_19++) 

        VAR_12[VAR_19] = (3072 - ((int)(exps[VAR_19]) << 7));



    

    VAR_21 = VAR_17;

    VAR_22 = masktab[VAR_17];

    do {

        VAR_23 = FFMIN(bndtab[VAR_22] + bndsz[VAR_22], VAR_18);

        VAR_13[VAR_22] = VAR_12[VAR_21];

        VAR_21++;

        for (VAR_20 = VAR_21; VAR_20 < VAR_23; VAR_20++) {

            VAR_13[VAR_22] = logadd(VAR_13[VAR_22], VAR_12[VAR_21]);

            VAR_21++;

        }

        VAR_22++;

    } while (VAR_18 > VAR_23);



    

    VAR_24 = masktab[VAR_17];

    VAR_25 = masktab[VAR_18 - 1] + 1;

    if (VAR_24 == 0) {

        VAR_7 = calc_lowcomp(VAR_7, VAR_13[0], VAR_13[1], 0);

        VAR_14[0] = VAR_13[0] - VAR_8 - VAR_7;

        VAR_7 = calc_lowcomp(VAR_7, VAR_13[1], VAR_13[2], 1);

        VAR_14[1] = VAR_13[1] - VAR_8 - VAR_7;

        VAR_26 = 7;

        for (VAR_19 = 2; VAR_19 < 7; VAR_19++) {

            if (VAR_25 != 7 || VAR_19 != 6)

                VAR_7 = calc_lowcomp(VAR_7, VAR_13[VAR_19], VAR_13[VAR_19 + 1], VAR_19);

            VAR_10 = VAR_13[VAR_19] - VAR_8;

            VAR_11 = VAR_13[VAR_19] - VAR_4;

            VAR_14[VAR_19] = VAR_10 - VAR_7;

            if (VAR_25 != 7 || VAR_19 != 6)

                if (VAR_13[VAR_19] <= VAR_13[VAR_19 + 1]) {

                    VAR_26 = VAR_19 + 1;

                    break;

                }

        }

        for (VAR_19 = VAR_26; VAR_19 < FFMIN(VAR_25, 22); VAR_19++) {

            if (VAR_25 != 7 || VAR_19 != 6)

                VAR_7 = calc_lowcomp(VAR_7, VAR_13[VAR_19], VAR_13[VAR_19 + 1], VAR_19);

            VAR_10 -= VAR_3;

            VAR_10 = FFMAX(VAR_10, VAR_13[VAR_19] - VAR_8);

            VAR_11 -= VAR_2;

            VAR_11 = FFMAX(VAR_11, VAR_13[VAR_19] - VAR_4);

            VAR_14[VAR_19] = FFMAX(VAR_10 - VAR_7, VAR_11);

        }

        VAR_26 = 22;

    }

    else {

        VAR_26 = VAR_24;

    }

    for (VAR_19 = VAR_26; VAR_19 < VAR_25; VAR_19++) {

        VAR_10 -= VAR_3;

        VAR_10 = FFMAX(VAR_10, VAR_13[VAR_19] - VAR_8);

        VAR_11 -= VAR_2;

        VAR_11 = FFMAX(VAR_11, VAR_13[VAR_19] - VAR_4);

        VAR_14[VAR_19] = FFMAX(VAR_10, VAR_11);

    }



    

    for (VAR_19 = VAR_24; VAR_19 < VAR_25; VAR_19++) {

        if (VAR_13[VAR_19] < VAR_5)

            VAR_14[VAR_19] += ((VAR_5 - VAR_13[VAR_19]) >> 2);

        VAR_15[VAR_19] = FFMAX(VAR_14[VAR_19], hth[VAR_19][VAR_31]);

    }



    

    if (VAR_32) {

        VAR_28 = 0;

        for (VAR_29 = 0; VAR_29 < VAR_27 + 1; VAR_29++) {

            VAR_28 += (int)(deltoffst[VAR_29]);

            if ((int)(deltba[VAR_29]) >= 4)

                VAR_16 = ((int)(deltba[VAR_29]) - 3) << 7;

            else

                VAR_16 = ((int)(deltba[VAR_29]) - 4) << 7;

            for (VAR_22 = 0; VAR_22 < (int)(deltlen[VAR_29]); VAR_22++) {

                VAR_15[VAR_28] += VAR_16;

                VAR_28++;

            }

        }

    }



    

    VAR_20 = VAR_17;

    VAR_21 = masktab[VAR_17];

    do {

        VAR_23 = FFMIN(bndtab[VAR_21] + bndsz[VAR_21], VAR_18);

        VAR_15[VAR_21] -= VAR_9;

        VAR_15[VAR_21] -= VAR_6;

        if (VAR_15[VAR_21] < 0)

            VAR_15[VAR_21] = 0;

        VAR_15[VAR_21] &= 0x1fe0;

        VAR_15[VAR_21] += VAR_6;

        for (VAR_22 = VAR_20; VAR_22 < VAR_23; VAR_22++) {

            VAR_30 = (VAR_12[VAR_20] - VAR_15[VAR_21]) >> 5;

            VAR_30 = FFMIN(63, FFMAX(0, VAR_30));

            baps[VAR_20] = baptab[VAR_30];

            VAR_20++;

        }

        VAR_21++;

    } while (VAR_18 > VAR_23);

}

static void FUNC_0(AC3DecodeContext *VAR_0, int VAR_1)
{ ac3_audio_block *ab = &VAR_0->audio_block; int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; int VAR_7 = 0, VAR_8 = 0, VAR_9 = 0, VAR_10 = 0, VAR_11 = 0; int VAR_12[256], VAR_13[50], VAR_14[50], VAR_15[50], VAR_16; int VAR_17 = 0, VAR_18 = 0, VAR_19 = 0, VAR_20 = 0, VAR_21 = 0, VAR_22 = 0, VAR_23 = 0, VAR_24 = 0; int VAR_25 = 0, VAR_26 = 0, VAR_27 = 0, VAR_28 = 0, VAR_29 = 0, VAR_30 = 0; int VAR_31 = VAR_0->sync_info.VAR_31; uint8_t *exps, *deltoffst = 0, *deltlen = 0, *deltba = 0; uint8_t *baps; int VAR_32 = 0; VAR_2 = sdecaytab[ab->sdcycod]; VAR_3 = fdecaytab[ab->fdcycod]; VAR_4 = sgaintab[ab->sgaincod]; VAR_5 = dbkneetab[ab->dbpbcod]; VAR_6 = floortab[ab->floorcod]; if (VAR_1 == 5) { VAR_17 = ab->cplstrtmant; VAR_18 = ab->cplendmant; VAR_8 = fgaintab[ab->cplfgaincod]; VAR_9 = (((ab->csnroffst - 15) << 4) + ab->cplfsnroffst) << 2; VAR_10 = (ab->cplfleak << 8) + 768; VAR_11 = (ab->cplsleak << 8) + 768; exps = ab->dcplexps; baps = ab->cplbap; if (ab->cpldeltbae == AC3_DBASTR_NEW || ab->cpldeltbae == AC3_DBASTR_REUSE) { VAR_32 = 1; VAR_27 = ab->cpldeltnseg; deltoffst = ab->cpldeltoffst; deltlen = ab->cpldeltlen; deltba = ab->cpldeltba; } } else if (VAR_1 == 6) { VAR_17 = 0; VAR_18 = 7; VAR_7 = 0; VAR_10 = 0; VAR_11 = 0; VAR_8 = fgaintab[ab->lfefgaincod]; VAR_9 = (((ab->csnroffst - 15) << 4) + ab->lfefsnroffst) << 2; exps = ab->dlfeexps; baps = ab->lfebap; } else { VAR_17 = 0; VAR_18 = ab->endmant[VAR_1]; VAR_7 = 0; VAR_10 = 0; VAR_11 = 0; VAR_8 = fgaintab[ab->fgaincod[VAR_1]]; VAR_9 = (((ab->csnroffst - 15) << 4) + ab->fsnroffst[VAR_1]) << 2; exps = ab->dexps[VAR_1]; baps = ab->bap[VAR_1]; if (ab->deltbae[VAR_1] == AC3_DBASTR_NEW || ab->deltbae[VAR_1] == AC3_DBASTR_REUSE) { VAR_32 = 1; VAR_27 = ab->VAR_27[VAR_1]; deltoffst = ab->deltoffst[VAR_1]; deltlen = ab->deltlen[VAR_1]; deltba = ab->deltba[VAR_1]; } } for (VAR_19 = VAR_17; VAR_19 < VAR_18; VAR_19++) VAR_12[VAR_19] = (3072 - ((int)(exps[VAR_19]) << 7)); VAR_21 = VAR_17; VAR_22 = masktab[VAR_17]; do { VAR_23 = FFMIN(bndtab[VAR_22] + bndsz[VAR_22], VAR_18); VAR_13[VAR_22] = VAR_12[VAR_21]; VAR_21++; for (VAR_20 = VAR_21; VAR_20 < VAR_23; VAR_20++) { VAR_13[VAR_22] = logadd(VAR_13[VAR_22], VAR_12[VAR_21]); VAR_21++; } VAR_22++; } while (VAR_18 > VAR_23); VAR_24 = masktab[VAR_17]; VAR_25 = masktab[VAR_18 - 1] + 1; if (VAR_24 == 0) { VAR_7 = calc_lowcomp(VAR_7, VAR_13[0], VAR_13[1], 0); VAR_14[0] = VAR_13[0] - VAR_8 - VAR_7; VAR_7 = calc_lowcomp(VAR_7, VAR_13[1], VAR_13[2], 1); VAR_14[1] = VAR_13[1] - VAR_8 - VAR_7; VAR_26 = 7; for (VAR_19 = 2; VAR_19 < 7; VAR_19++) { if (VAR_25 != 7 || VAR_19 != 6)
VAR_7 = calc_lowcomp(VAR_7, VAR_13[VAR_19], VAR_13[VAR_19 + 1], VAR_19); VAR_10 = VAR_13[VAR_19] - VAR_8; VAR_11 = VAR_13[VAR_19] - VAR_4; VAR_14[VAR_19] = VAR_10 - VAR_7; if (VAR_25 != 7 || VAR_19 != 6)
if (VAR_13[VAR_19] <= VAR_13[VAR_19 + 1]) { VAR_26 = VAR_19 + 1; break; } } for (VAR_19 = VAR_26; VAR_19 < FFMIN(VAR_25, 22); VAR_19++) { if (VAR_25 != 7 || VAR_19 != 6)
VAR_7 = calc_lowcomp(VAR_7, VAR_13[VAR_19], VAR_13[VAR_19 + 1], VAR_19); VAR_10 -= VAR_3; VAR_10 = FFMAX(VAR_10, VAR_13[VAR_19] - VAR_8); VAR_11 -= VAR_2; VAR_11 = FFMAX(VAR_11, VAR_13[VAR_19] - VAR_4); VAR_14[VAR_19] = FFMAX(VAR_10 - VAR_7, VAR_11); } VAR_26 = 22; } else { VAR_26 = VAR_24; } for (VAR_19 = VAR_26; VAR_19 < VAR_25; VAR_19++) { VAR_10 -= VAR_3; VAR_10 = FFMAX(VAR_10, VAR_13[VAR_19] - VAR_8); VAR_11 -= VAR_2; VAR_11 = FFMAX(VAR_11, VAR_13[VAR_19] - VAR_4); VAR_14[VAR_19] = FFMAX(VAR_10, VAR_11); } for (VAR_19 = VAR_24; VAR_19 < VAR_25; VAR_19++) { if (VAR_13[VAR_19] < VAR_5)
VAR_14[VAR_19] += ((VAR_5 - VAR_13[VAR_19]) >> 2); VAR_15[VAR_19] = FFMAX(VAR_14[VAR_19], hth[VAR_19][VAR_31]); } if (VAR_32) { VAR_28 = 0; for (VAR_29 = 0; VAR_29 < VAR_27 + 1; VAR_29++) { VAR_28 += (int)(deltoffst[VAR_29]); if ((int)(deltba[VAR_29]) >= 4)
VAR_16 = ((int)(deltba[VAR_29]) - 3) << 7; else
VAR_16 = ((int)(deltba[VAR_29]) - 4) << 7; for (VAR_22 = 0; VAR_22 < (int)(deltlen[VAR_29]); VAR_22++) { VAR_15[VAR_28] += VAR_16; VAR_28++; } } } VAR_20 = VAR_17; VAR_21 = masktab[VAR_17]; do { VAR_23 = FFMIN(bndtab[VAR_21] + bndsz[VAR_21], VAR_18); VAR_15[VAR_21] -= VAR_9; VAR_15[VAR_21] -= VAR_6; if (VAR_15[VAR_21] < 0)
VAR_15[VAR_21] = 0; VAR_15[VAR_21] &= 0x1fe0; VAR_15[VAR_21] += VAR_6; for (VAR_22 = VAR_20; VAR_22 < VAR_23; VAR_22++) { VAR_30 = (VAR_12[VAR_20] - VAR_15[VAR_21]) >> 5; VAR_30 = FFMIN(63, FFMAX(0, VAR_30)); baps[VAR_20] = baptab[VAR_30]; VAR_20++; } VAR_21++; } while (VAR_18 > VAR_23); }