static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,

                               unsigned int global_gain,

                               IndividualChannelStream *ics,

                               enum BandType band_type[120],

                               int band_type_run_end[120])

{

    int g, i, idx = 0;

    int offset[3] = { global_gain, global_gain - 90, 0 };

    int clipped_offset;

    int noise_flag = 1;

    static const char *const sf_str[3] = { "Global gain", "Noise gain", "Intensity stereo position" };

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

        for (i = 0; i < ics->max_sfb;) {

            int run_end = band_type_run_end[idx];

            if (band_type[idx] == ZERO_BT) {

                for (; i < run_end; i++, idx++)

                    sf[idx] = 0.;

            } else if ((band_type[idx] == INTENSITY_BT) || (band_type[idx] == INTENSITY_BT2)) {

                for (; i < run_end; i++, idx++) {

                    offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;

                    clipped_offset = av_clip(offset[2], -155, 100);

                    if (offset[2] != clipped_offset) {

                        av_log_ask_for_sample(ac->avctx, "Intensity stereo "

                                "position clipped (%d -> %d).\nIf you heard an "

                                "audible artifact, there may be a bug in the "

                                "decoder. ", offset[2], clipped_offset);

                    }

                    sf[idx] = ff_aac_pow2sf_tab[-clipped_offset + POW_SF2_ZERO];

                }

            } else if (band_type[idx] == NOISE_BT) {

                for (; i < run_end; i++, idx++) {

                    if (noise_flag-- > 0)

                        offset[1] += get_bits(gb, 9) - 256;

                    else

                        offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;

                    clipped_offset = av_clip(offset[1], -100, 155);

                    if (offset[1] != clipped_offset) {

                        av_log_ask_for_sample(ac->avctx, "Noise gain clipped "

                                "(%d -> %d).\nIf you heard an audible "

                                "artifact, there may be a bug in the decoder. ",

                                offset[1], clipped_offset);

                    }

                    sf[idx] = -ff_aac_pow2sf_tab[clipped_offset + POW_SF2_ZERO];

                }

            } else {

                for (; i < run_end; i++, idx++) {

                    offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;

                    if (offset[0] > 255U) {

                        av_log(ac->avctx, AV_LOG_ERROR,

                               "%s (%d) out of range.\n", sf_str[0], offset[0]);

                        return -1;

                    }

                    sf[idx] = -ff_aac_pow2sf_tab[offset[0] - 100 + POW_SF2_ZERO];

                }

            }

        }

    }

    return 0;

}

static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,

                               unsigned int global_gain,

                               IndividualChannelStream *ics,

                               enum BandType band_type[120],

                               int band_type_run_end[120])

{

    int g, i, idx = 0;

    int offset[3] = { global_gain, global_gain - 90, 0 };

    int clipped_offset;

    int noise_flag = 1;

    static const char *const sf_str[3] = { "Global gain", "Noise gain", "Intensity stereo position" };

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

        for (i = 0; i < ics->max_sfb;) {

            int run_end = band_type_run_end[idx];

            if (band_type[idx] == ZERO_BT) {

                for (; i < run_end; i++, idx++)

                    sf[idx] = 0.;

            } else if ((band_type[idx] == INTENSITY_BT) || (band_type[idx] == INTENSITY_BT2)) {

                for (; i < run_end; i++, idx++) {

                    offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;

                    clipped_offset = av_clip(offset[2], -155, 100);

                    if (offset[2] != clipped_offset) {

                        av_log_ask_for_sample(ac->avctx, "Intensity stereo "

                                "position clipped (%d -> %d).\nIf you heard an "

                                "audible artifact, there may be a bug in the "

                                "decoder. ", offset[2], clipped_offset);

                    }

                    sf[idx] = ff_aac_pow2sf_tab[-clipped_offset + POW_SF2_ZERO];

                }

            } else if (band_type[idx] == NOISE_BT) {

                for (; i < run_end; i++, idx++) {

                    if (noise_flag-- > 0)

                        offset[1] += get_bits(gb, 9) - 256;

                    else

                        offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;

                    clipped_offset = av_clip(offset[1], -100, 155);

                    if (offset[1] != clipped_offset) {

                        av_log_ask_for_sample(ac->avctx, "Noise gain clipped "

                                "(%d -> %d).\nIf you heard an audible "

                                "artifact, there may be a bug in the decoder. ",

                                offset[1], clipped_offset);

                    }

                    sf[idx] = -ff_aac_pow2sf_tab[clipped_offset + POW_SF2_ZERO];

                }

            } else {

                for (; i < run_end; i++, idx++) {

                    offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;

                    if (offset[0] > 255U) {

                        av_log(ac->avctx, AV_LOG_ERROR,

                               "%s (%d) out of range.\n", sf_str[0], offset[0]);

                        return -1;

                    }

                    sf[idx] = -ff_aac_pow2sf_tab[offset[0] - 100 + POW_SF2_ZERO];

                }

            }

        }

    }

    return 0;

}

    static const char *const sf_str[3] = { "Global gain", "Noise gain", "Intensity stereo position" };                                "%s (%d) out of range.\n", sf_str[0], offset[0]);
static int FUNC_0(AACContext *VAR_0, float VAR_1[120], GetBitContext *VAR_2,

                               unsigned int VAR_3,

                               IndividualChannelStream *VAR_4,

                               enum BandType VAR_5[120],

                               int VAR_6[120])

{

    int VAR_7, VAR_8, VAR_9 = 0;

    int VAR_10[3] = { VAR_3, VAR_3 - 90, 0 };

    int VAR_11;

    int VAR_12 = 1;

    static const char *const VAR_13[3] = { "Global gain", "Noise gain", "Intensity stereo position" };

    for (VAR_7 = 0; VAR_7 < VAR_4->num_window_groups; VAR_7++) {

        for (VAR_8 = 0; VAR_8 < VAR_4->max_sfb;) {

            int run_end = VAR_6[VAR_9];

            if (VAR_5[VAR_9] == ZERO_BT) {

                for (; VAR_8 < run_end; VAR_8++, VAR_9++)

                    VAR_1[VAR_9] = 0.;

            } else if ((VAR_5[VAR_9] == INTENSITY_BT) || (VAR_5[VAR_9] == INTENSITY_BT2)) {

                for (; VAR_8 < run_end; VAR_8++, VAR_9++) {

                    VAR_10[2] += get_vlc2(VAR_2, vlc_scalefactors.table, 7, 3) - 60;

                    VAR_11 = av_clip(VAR_10[2], -155, 100);

                    if (VAR_10[2] != VAR_11) {

                        av_log_ask_for_sample(VAR_0->avctx, "Intensity stereo "

                                "position clipped (%d -> %d).\nIf you heard an "

                                "audible artifact, there may be a bug in the "

                                "decoder. ", VAR_10[2], VAR_11);

                    }

                    VAR_1[VAR_9] = ff_aac_pow2sf_tab[-VAR_11 + POW_SF2_ZERO];

                }

            } else if (VAR_5[VAR_9] == NOISE_BT) {

                for (; VAR_8 < run_end; VAR_8++, VAR_9++) {

                    if (VAR_12-- > 0)

                        VAR_10[1] += get_bits(VAR_2, 9) - 256;

                    else

                        VAR_10[1] += get_vlc2(VAR_2, vlc_scalefactors.table, 7, 3) - 60;

                    VAR_11 = av_clip(VAR_10[1], -100, 155);

                    if (VAR_10[1] != VAR_11) {

                        av_log_ask_for_sample(VAR_0->avctx, "Noise gain clipped "

                                "(%d -> %d).\nIf you heard an audible "

                                "artifact, there may be a bug in the decoder. ",

                                VAR_10[1], VAR_11);

                    }

                    VAR_1[VAR_9] = -ff_aac_pow2sf_tab[VAR_11 + POW_SF2_ZERO];

                }

            } else {

                for (; VAR_8 < run_end; VAR_8++, VAR_9++) {

                    VAR_10[0] += get_vlc2(VAR_2, vlc_scalefactors.table, 7, 3) - 60;

                    if (VAR_10[0] > 255U) {

                        av_log(VAR_0->avctx, AV_LOG_ERROR,

                               "%s (%d) out of range.\n", VAR_13[0], VAR_10[0]);

                        return -1;

                    }

                    VAR_1[VAR_9] = -ff_aac_pow2sf_tab[VAR_10[0] - 100 + POW_SF2_ZERO];

                }

            }

        }

    }

    return 0;

}

static int FUNC_0(AACContext *VAR_0, float VAR_1[120], GetBitContext *VAR_2,
unsigned int VAR_3,
IndividualChannelStream *VAR_4,
enum BandType VAR_5[120],
int VAR_6[120])
{ int VAR_7, VAR_8, VAR_9 = 0; int VAR_10[3] = { VAR_3, VAR_3 - 90, 0 }; int VAR_11; int VAR_12 = 1; static const char *const VAR_13[3] = { "Global gain", "Noise gain", "Intensity stereo position" }; for (VAR_7 = 0; VAR_7 < VAR_4->num_window_groups; VAR_7++) { for (VAR_8 = 0; VAR_8 < VAR_4->max_sfb;) { int run_end = VAR_6[VAR_9]; if (VAR_5[VAR_9] == ZERO_BT) { for (; VAR_8 < run_end; VAR_8++, VAR_9++) VAR_1[VAR_9] = 0.; } else if ((VAR_5[VAR_9] == INTENSITY_BT) || (VAR_5[VAR_9] == INTENSITY_BT2)) { for (; VAR_8 < run_end; VAR_8++, VAR_9++) { VAR_10[2] += get_vlc2(VAR_2, vlc_scalefactors.table, 7, 3) - 60; VAR_11 = av_clip(VAR_10[2], -155, 100); if (VAR_10[2] != VAR_11) { av_log_ask_for_sample(VAR_0->avctx, "Intensity stereo "
"position clipped (%d -> %d).\nIf you heard an "
"audible artifact, there may be a bug in the "
"decoder. ", VAR_10[2], VAR_11); } VAR_1[VAR_9] = ff_aac_pow2sf_tab[-VAR_11 + POW_SF2_ZERO]; } } else if (VAR_5[VAR_9] == NOISE_BT) { for (; VAR_8 < run_end; VAR_8++, VAR_9++) { if (VAR_12-- > 0)
VAR_10[1] += get_bits(VAR_2, 9) - 256; else
VAR_10[1] += get_vlc2(VAR_2, vlc_scalefactors.table, 7, 3) - 60; VAR_11 = av_clip(VAR_10[1], -100, 155); if (VAR_10[1] != VAR_11) { av_log_ask_for_sample(VAR_0->avctx, "Noise gain clipped "
"(%d -> %d).\nIf you heard an audible "
"artifact, there may be a bug in the decoder. ",
VAR_10[1], VAR_11); } VAR_1[VAR_9] = -ff_aac_pow2sf_tab[VAR_11 + POW_SF2_ZERO]; } } else { for (; VAR_8 < run_end; VAR_8++, VAR_9++) { VAR_10[0] += get_vlc2(VAR_2, vlc_scalefactors.table, 7, 3) - 60; if (VAR_10[0] > 255U) { av_log(VAR_0->avctx, AV_LOG_ERROR,
"%s (%d) out of range.\n", VAR_13[0], VAR_10[0]); return -1; } VAR_1[VAR_9] = -ff_aac_pow2sf_tab[VAR_10[0] - 100 + POW_SF2_ZERO]; } } } } return 0; }