static int decodeTonalComponents (GetBitContext *gb, tonal_component *pComponent, int numBands)

{

    int i,j,k,cnt;

    int   components, coding_mode_selector, coding_mode, coded_values_per_component;

    int   sfIndx, coded_values, max_coded_values, quant_step_index, coded_components;

    int   band_flags[4], mantissa[8];

    float  *pCoef;

    float  scalefactor;

    int   component_count = 0;



    components = get_bits(gb,5);



    /* no tonal components */

    if (components == 0)

        return 0;



    coding_mode_selector = get_bits(gb,2);

    if (coding_mode_selector == 2)




    coding_mode = coding_mode_selector & 1;



    for (i = 0; i < components; i++) {

        for (cnt = 0; cnt <= numBands; cnt++)

            band_flags[cnt] = get_bits1(gb);



        coded_values_per_component = get_bits(gb,3);



        quant_step_index = get_bits(gb,3);

        if (quant_step_index <= 1)




        if (coding_mode_selector == 3)

            coding_mode = get_bits1(gb);



        for (j = 0; j < (numBands + 1) * 4; j++) {

            if (band_flags[j >> 2] == 0)

                continue;



            coded_components = get_bits(gb,3);



            for (k=0; k<coded_components; k++) {

                sfIndx = get_bits(gb,6);



                pComponent[component_count].pos = j * 64 + (get_bits(gb,6));

                max_coded_values = SAMPLES_PER_FRAME - pComponent[component_count].pos;

                coded_values = coded_values_per_component + 1;

                coded_values = FFMIN(max_coded_values,coded_values);



                scalefactor = ff_atrac_sf_table[sfIndx] * iMaxQuant[quant_step_index];



                readQuantSpectralCoeffs(gb, quant_step_index, coding_mode, mantissa, coded_values);



                pComponent[component_count].numCoefs = coded_values;



                /* inverse quant */

                pCoef = pComponent[component_count].coef;

                for (cnt = 0; cnt < coded_values; cnt++)

                    pCoef[cnt] = mantissa[cnt] * scalefactor;



                component_count++;

            }

        }

    }



    return component_count;

}
static int decodeTonalComponents (GetBitContext *gb, tonal_component *pComponent, int numBands)

{

    int i,j,k,cnt;

    int   components, coding_mode_selector, coding_mode, coded_values_per_component;

    int   sfIndx, coded_values, max_coded_values, quant_step_index, coded_components;

    int   band_flags[4], mantissa[8];

    float  *pCoef;

    float  scalefactor;

    int   component_count = 0;



    components = get_bits(gb,5);



    

    if (components == 0)

        return 0;



    coding_mode_selector = get_bits(gb,2);

    if (coding_mode_selector == 2)




    coding_mode = coding_mode_selector & 1;



    for (i = 0; i < components; i++) {

        for (cnt = 0; cnt <= numBands; cnt++)

            band_flags[cnt] = get_bits1(gb);



        coded_values_per_component = get_bits(gb,3);



        quant_step_index = get_bits(gb,3);

        if (quant_step_index <= 1)




        if (coding_mode_selector == 3)

            coding_mode = get_bits1(gb);



        for (j = 0; j < (numBands + 1) * 4; j++) {

            if (band_flags[j >> 2] == 0)

                continue;



            coded_components = get_bits(gb,3);



            for (k=0; k<coded_components; k++) {

                sfIndx = get_bits(gb,6);



                pComponent[component_count].pos = j * 64 + (get_bits(gb,6));

                max_coded_values = SAMPLES_PER_FRAME - pComponent[component_count].pos;

                coded_values = coded_values_per_component + 1;

                coded_values = FFMIN(max_coded_values,coded_values);



                scalefactor = ff_atrac_sf_table[sfIndx] * iMaxQuant[quant_step_index];



                readQuantSpectralCoeffs(gb, quant_step_index, coding_mode, mantissa, coded_values);



                pComponent[component_count].numCoefs = coded_values;



                

                pCoef = pComponent[component_count].coef;

                for (cnt = 0; cnt < coded_values; cnt++)

                    pCoef[cnt] = mantissa[cnt] * scalefactor;



                component_count++;

            }

        }

    }



    return component_count;

}
static int FUNC_0 (GetBitContext *VAR_0, tonal_component *VAR_1, int VAR_2)

{

    int VAR_3,VAR_4,VAR_5,VAR_6;

    int   VAR_7, VAR_8, VAR_9, VAR_10;

    int   VAR_11, VAR_12, VAR_13, VAR_14, VAR_15;

    int   VAR_16[4], VAR_17[8];

    float  *VAR_18;

    float  VAR_19;

    int   VAR_20 = 0;



    VAR_7 = get_bits(VAR_0,5);



    

    if (VAR_7 == 0)

        return 0;



    VAR_8 = get_bits(VAR_0,2);

    if (VAR_8 == 2)




    VAR_9 = VAR_8 & 1;



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

        for (VAR_6 = 0; VAR_6 <= VAR_2; VAR_6++)

            VAR_16[VAR_6] = get_bits1(VAR_0);



        VAR_10 = get_bits(VAR_0,3);



        VAR_14 = get_bits(VAR_0,3);

        if (VAR_14 <= 1)




        if (VAR_8 == 3)

            VAR_9 = get_bits1(VAR_0);



        for (VAR_4 = 0; VAR_4 < (VAR_2 + 1) * 4; VAR_4++) {

            if (VAR_16[VAR_4 >> 2] == 0)

                continue;



            VAR_15 = get_bits(VAR_0,3);



            for (VAR_5=0; VAR_5<VAR_15; VAR_5++) {

                VAR_11 = get_bits(VAR_0,6);



                VAR_1[VAR_20].pos = VAR_4 * 64 + (get_bits(VAR_0,6));

                VAR_13 = SAMPLES_PER_FRAME - VAR_1[VAR_20].pos;

                VAR_12 = VAR_10 + 1;

                VAR_12 = FFMIN(VAR_13,VAR_12);



                VAR_19 = ff_atrac_sf_table[VAR_11] * iMaxQuant[VAR_14];



                readQuantSpectralCoeffs(VAR_0, VAR_14, VAR_9, VAR_17, VAR_12);



                VAR_1[VAR_20].numCoefs = VAR_12;



                

                VAR_18 = VAR_1[VAR_20].coef;

                for (VAR_6 = 0; VAR_6 < VAR_12; VAR_6++)

                    VAR_18[VAR_6] = VAR_17[VAR_6] * VAR_19;



                VAR_20++;

            }

        }

    }



    return VAR_20;

}
static int FUNC_0 (GetBitContext *VAR_0, tonal_component *VAR_1, int VAR_2)
{ int VAR_3,VAR_4,VAR_5,VAR_6; int   VAR_7, VAR_8, VAR_9, VAR_10; int   VAR_11, VAR_12, VAR_13, VAR_14, VAR_15; int   VAR_16[4], VAR_17[8]; float  *VAR_18; float  VAR_19; int   VAR_20 = 0; VAR_7 = get_bits(VAR_0,5); if (VAR_7 == 0)
return 0; VAR_8 = get_bits(VAR_0,2); if (VAR_8 == 2)
VAR_9 = VAR_8 & 1; for (VAR_3 = 0; VAR_3 < VAR_7; VAR_3++) { for (VAR_6 = 0; VAR_6 <= VAR_2; VAR_6++) VAR_16[VAR_6] = get_bits1(VAR_0); VAR_10 = get_bits(VAR_0,3); VAR_14 = get_bits(VAR_0,3); if (VAR_14 <= 1)
if (VAR_8 == 3)
VAR_9 = get_bits1(VAR_0); for (VAR_4 = 0; VAR_4 < (VAR_2 + 1) * 4; VAR_4++) { if (VAR_16[VAR_4 >> 2] == 0)
continue; VAR_15 = get_bits(VAR_0,3); for (VAR_5=0; VAR_5<VAR_15; VAR_5++) { VAR_11 = get_bits(VAR_0,6); VAR_1[VAR_20].pos = VAR_4 * 64 + (get_bits(VAR_0,6)); VAR_13 = SAMPLES_PER_FRAME - VAR_1[VAR_20].pos; VAR_12 = VAR_10 + 1; VAR_12 = FFMIN(VAR_13,VAR_12); VAR_19 = ff_atrac_sf_table[VAR_11] * iMaxQuant[VAR_14]; readQuantSpectralCoeffs(VAR_0, VAR_14, VAR_9, VAR_17, VAR_12); VAR_1[VAR_20].numCoefs = VAR_12; VAR_18 = VAR_1[VAR_20].coef; for (VAR_6 = 0; VAR_6 < VAR_12; VAR_6++) VAR_18[VAR_6] = VAR_17[VAR_6] * VAR_19; VAR_20++; } } } return VAR_20; }