static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)

{

    int num_gain = 0;

    int c, g, sfb, ret;

    int sign;

    INTFLOAT scale;

    SingleChannelElement *sce = &che->ch[0];

    ChannelCoupling     *coup = &che->coup;



    coup->coupling_point = 2 * get_bits1(gb);

    coup->num_coupled = get_bits(gb, 3);

    for (c = 0; c <= coup->num_coupled; c++) {

        num_gain++;

        coup->type[c] = get_bits1(gb) ? TYPE_CPE : TYPE_SCE;

        coup->id_select[c] = get_bits(gb, 4);

        if (coup->type[c] == TYPE_CPE) {

            coup->ch_select[c] = get_bits(gb, 2);

            if (coup->ch_select[c] == 3)

                num_gain++;

        } else

            coup->ch_select[c] = 2;

    }

    coup->coupling_point += get_bits1(gb) || (coup->coupling_point >> 1);



    sign  = get_bits(gb, 1);

    scale = AAC_RENAME(cce_scale)[get_bits(gb, 2)];



    if ((ret = decode_ics(ac, sce, gb, 0, 0)))

        return ret;



    for (c = 0; c < num_gain; c++) {

        int idx  = 0;

        int cge  = 1;

        int gain = 0;

        INTFLOAT gain_cache = FIXR10(1.);

        if (c) {

            cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb);

            gain = cge ? get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60: 0;

            gain_cache = GET_GAIN(scale, gain);

        }

        if (coup->coupling_point == AFTER_IMDCT) {

            coup->gain[c][0] = gain_cache;

        } else {

            for (g = 0; g < sce->ics.num_window_groups; g++) {

                for (sfb = 0; sfb < sce->ics.max_sfb; sfb++, idx++) {

                    if (sce->band_type[idx] != ZERO_BT) {

                        if (!cge) {

                            int t = get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;

                            if (t) {

                                int s = 1;

                                t = gain += t;

                                if (sign) {

                                    s  -= 2 * (t & 0x1);

                                    t >>= 1;

                                }

                                gain_cache = GET_GAIN(scale, t) * s;

                            }

                        }

                        coup->gain[c][idx] = gain_cache;

                    }

                }

            }

        }

    }

    return 0;

}

static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)

{

    int num_gain = 0;

    int c, g, sfb, ret;

    int sign;

    INTFLOAT scale;

    SingleChannelElement *sce = &che->ch[0];

    ChannelCoupling     *coup = &che->coup;



    coup->coupling_point = 2 * get_bits1(gb);

    coup->num_coupled = get_bits(gb, 3);

    for (c = 0; c <= coup->num_coupled; c++) {

        num_gain++;

        coup->type[c] = get_bits1(gb) ? TYPE_CPE : TYPE_SCE;

        coup->id_select[c] = get_bits(gb, 4);

        if (coup->type[c] == TYPE_CPE) {

            coup->ch_select[c] = get_bits(gb, 2);

            if (coup->ch_select[c] == 3)

                num_gain++;

        } else

            coup->ch_select[c] = 2;

    }

    coup->coupling_point += get_bits1(gb) || (coup->coupling_point >> 1);



    sign  = get_bits(gb, 1);

    scale = AAC_RENAME(cce_scale)[get_bits(gb, 2)];



    if ((ret = decode_ics(ac, sce, gb, 0, 0)))

        return ret;



    for (c = 0; c < num_gain; c++) {

        int idx  = 0;

        int cge  = 1;

        int gain = 0;

        INTFLOAT gain_cache = FIXR10(1.);

        if (c) {

            cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb);

            gain = cge ? get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60: 0;

            gain_cache = GET_GAIN(scale, gain);

        }

        if (coup->coupling_point == AFTER_IMDCT) {

            coup->gain[c][0] = gain_cache;

        } else {

            for (g = 0; g < sce->ics.num_window_groups; g++) {

                for (sfb = 0; sfb < sce->ics.max_sfb; sfb++, idx++) {

                    if (sce->band_type[idx] != ZERO_BT) {

                        if (!cge) {

                            int t = get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;

                            if (t) {

                                int s = 1;

                                t = gain += t;

                                if (sign) {

                                    s  -= 2 * (t & 0x1);

                                    t >>= 1;

                                }

                                gain_cache = GET_GAIN(scale, t) * s;

                            }

                        }

                        coup->gain[c][idx] = gain_cache;

                    }

                }

            }

        }

    }

    return 0;

}

    scale = AAC_RENAME(cce_scale)[get_bits(gb, 2)];
static int FUNC_0(AACContext *VAR_0, GetBitContext *VAR_1, ChannelElement *VAR_2)

{

    int VAR_3 = 0;

    int VAR_4, VAR_5, VAR_6, VAR_7;

    int VAR_8;

    INTFLOAT scale;

    SingleChannelElement *sce = &VAR_2->ch[0];

    ChannelCoupling     *coup = &VAR_2->coup;



    coup->coupling_point = 2 * get_bits1(VAR_1);

    coup->num_coupled = get_bits(VAR_1, 3);

    for (VAR_4 = 0; VAR_4 <= coup->num_coupled; VAR_4++) {

        VAR_3++;

        coup->type[VAR_4] = get_bits1(VAR_1) ? TYPE_CPE : TYPE_SCE;

        coup->id_select[VAR_4] = get_bits(VAR_1, 4);

        if (coup->type[VAR_4] == TYPE_CPE) {

            coup->ch_select[VAR_4] = get_bits(VAR_1, 2);

            if (coup->ch_select[VAR_4] == 3)

                VAR_3++;

        } else

            coup->ch_select[VAR_4] = 2;

    }

    coup->coupling_point += get_bits1(VAR_1) || (coup->coupling_point >> 1);



    VAR_8  = get_bits(VAR_1, 1);

    scale = AAC_RENAME(cce_scale)[get_bits(VAR_1, 2)];



    if ((VAR_7 = decode_ics(VAR_0, sce, VAR_1, 0, 0)))

        return VAR_7;



    for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) {

        int VAR_9  = 0;

        int VAR_10  = 1;

        int VAR_11 = 0;

        INTFLOAT gain_cache = FIXR10(1.);

        if (VAR_4) {

            VAR_10 = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(VAR_1);

            VAR_11 = VAR_10 ? get_vlc2(VAR_1, vlc_scalefactors.table, 7, 3) - 60: 0;

            gain_cache = GET_GAIN(scale, VAR_11);

        }

        if (coup->coupling_point == AFTER_IMDCT) {

            coup->VAR_11[VAR_4][0] = gain_cache;

        } else {

            for (VAR_5 = 0; VAR_5 < sce->ics.num_window_groups; VAR_5++) {

                for (VAR_6 = 0; VAR_6 < sce->ics.max_sfb; VAR_6++, VAR_9++) {

                    if (sce->band_type[VAR_9] != ZERO_BT) {

                        if (!VAR_10) {

                            int t = get_vlc2(VAR_1, vlc_scalefactors.table, 7, 3) - 60;

                            if (t) {

                                int s = 1;

                                t = VAR_11 += t;

                                if (VAR_8) {

                                    s  -= 2 * (t & 0x1);

                                    t >>= 1;

                                }

                                gain_cache = GET_GAIN(scale, t) * s;

                            }

                        }

                        coup->VAR_11[VAR_4][VAR_9] = gain_cache;

                    }

                }

            }

        }

    }

    return 0;

}

static int FUNC_0(AACContext *VAR_0, GetBitContext *VAR_1, ChannelElement *VAR_2)
{ int VAR_3 = 0; int VAR_4, VAR_5, VAR_6, VAR_7; int VAR_8; INTFLOAT scale; SingleChannelElement *sce = &VAR_2->ch[0]; ChannelCoupling     *coup = &VAR_2->coup; coup->coupling_point = 2 * get_bits1(VAR_1); coup->num_coupled = get_bits(VAR_1, 3); for (VAR_4 = 0; VAR_4 <= coup->num_coupled; VAR_4++) { VAR_3++; coup->type[VAR_4] = get_bits1(VAR_1) ? TYPE_CPE : TYPE_SCE; coup->id_select[VAR_4] = get_bits(VAR_1, 4); if (coup->type[VAR_4] == TYPE_CPE) { coup->ch_select[VAR_4] = get_bits(VAR_1, 2); if (coup->ch_select[VAR_4] == 3)
VAR_3++; } else coup->ch_select[VAR_4] = 2; } coup->coupling_point += get_bits1(VAR_1) || (coup->coupling_point >> 1); VAR_8  = get_bits(VAR_1, 1); scale = AAC_RENAME(cce_scale)[get_bits(VAR_1, 2)]; if ((VAR_7 = decode_ics(VAR_0, sce, VAR_1, 0, 0)))
return VAR_7; for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) { int VAR_9  = 0; int VAR_10  = 1; int VAR_11 = 0; INTFLOAT gain_cache = FIXR10(1.); if (VAR_4) { VAR_10 = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(VAR_1); VAR_11 = VAR_10 ? get_vlc2(VAR_1, vlc_scalefactors.table, 7, 3) - 60: 0; gain_cache = GET_GAIN(scale, VAR_11); } if (coup->coupling_point == AFTER_IMDCT) { coup->VAR_11[VAR_4][0] = gain_cache; } else { for (VAR_5 = 0; VAR_5 < sce->ics.num_window_groups; VAR_5++) { for (VAR_6 = 0; VAR_6 < sce->ics.max_sfb; VAR_6++, VAR_9++) { if (sce->band_type[VAR_9] != ZERO_BT) { if (!VAR_10) { int t = get_vlc2(VAR_1, vlc_scalefactors.table, 7, 3) - 60; if (t) { int s = 1; t = VAR_11 += t; if (VAR_8) { s  -= 2 * (t & 0x1); t >>= 1; } gain_cache = GET_GAIN(scale, t) * s; } } coup->VAR_11[VAR_4][VAR_9] = gain_cache; } } } } } return 0; }