void nelly_decode_block(NellyMoserDecodeContext *s, unsigned char block[NELLY_BLOCK_LEN], float audio[NELLY_SAMPLES])

{

    int i,j;

    float buf[NELLY_FILL_LEN], pows[NELLY_FILL_LEN];

    float *aptr, *bptr, *pptr, val, pval;

    int bits[NELLY_BUF_LEN];

    unsigned char v;



    init_get_bits(&s->gb, block, NELLY_BLOCK_LEN * 8);



    bptr = buf;

    pptr = pows;

    val = nelly_init_table[get_bits(&s->gb, 6)];

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

        if (i > 0)

            val += nelly_delta_table[get_bits(&s->gb, 5)];

        pval = pow(2, val/2048);

        for (j = 0; j < nelly_band_sizes_table[i]; j++) {

            *bptr++ = val;

            *pptr++ = pval;

        }



    }



    get_sample_bits(buf, bits);



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

        aptr = audio + i * NELLY_BUF_LEN;



        init_get_bits(&s->gb, block, NELLY_BLOCK_LEN * 8);

        skip_bits(&s->gb, NELLY_HEADER_BITS + i*NELLY_DETAIL_BITS);



        for (j = 0; j < NELLY_FILL_LEN; j++) {

            if (bits[j] <= 0) {

                aptr[j] = M_SQRT1_2*pows[j];

                if (av_random(&s->random_state) & 1)

                    aptr[j] *= -1.0;

            } else {

                v = get_bits(&s->gb, bits[j]);

                aptr[j] = dequantization_table[(1<<bits[j])-1+v]*pows[j];

            }

        }

        memset(&aptr[NELLY_FILL_LEN], 0,

               (NELLY_BUF_LEN - NELLY_FILL_LEN) * sizeof(float));



        s->imdct_ctx.fft.imdct_calc(&s->imdct_ctx, s->imdct_out,

                                    aptr, s->imdct_tmp);

        /* XXX: overlapping and windowing should be part of a more

           generic imdct function */

        for(j = 0; j < NELLY_BUF_LEN / 2; j++) {

            aptr[j] = s->imdct_out[j + NELLY_BUF_LEN + NELLY_BUF_LEN / 2];

            aptr[j + NELLY_BUF_LEN / 2] = s->imdct_out[j];

        }

        overlap_and_window(s, s->state, aptr);

    }

}

void nelly_decode_block(NellyMoserDecodeContext *s, unsigned char block[NELLY_BLOCK_LEN], float audio[NELLY_SAMPLES])

{

    int i,j;

    float buf[NELLY_FILL_LEN], pows[NELLY_FILL_LEN];

    float *aptr, *bptr, *pptr, val, pval;

    int bits[NELLY_BUF_LEN];

    unsigned char v;



    init_get_bits(&s->gb, block, NELLY_BLOCK_LEN * 8);



    bptr = buf;

    pptr = pows;

    val = nelly_init_table[get_bits(&s->gb, 6)];

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

        if (i > 0)

            val += nelly_delta_table[get_bits(&s->gb, 5)];

        pval = pow(2, val/2048);

        for (j = 0; j < nelly_band_sizes_table[i]; j++) {

            *bptr++ = val;

            *pptr++ = pval;

        }



    }



    get_sample_bits(buf, bits);



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

        aptr = audio + i * NELLY_BUF_LEN;



        init_get_bits(&s->gb, block, NELLY_BLOCK_LEN * 8);

        skip_bits(&s->gb, NELLY_HEADER_BITS + i*NELLY_DETAIL_BITS);



        for (j = 0; j < NELLY_FILL_LEN; j++) {

            if (bits[j] <= 0) {

                aptr[j] = M_SQRT1_2*pows[j];

                if (av_random(&s->random_state) & 1)

                    aptr[j] *= -1.0;

            } else {

                v = get_bits(&s->gb, bits[j]);

                aptr[j] = dequantization_table[(1<<bits[j])-1+v]*pows[j];

            }

        }

        memset(&aptr[NELLY_FILL_LEN], 0,

               (NELLY_BUF_LEN - NELLY_FILL_LEN) * sizeof(float));



        s->imdct_ctx.fft.imdct_calc(&s->imdct_ctx, s->imdct_out,

                                    aptr, s->imdct_tmp);

        



        for(j = 0; j < NELLY_BUF_LEN / 2; j++) {

            aptr[j] = s->imdct_out[j + NELLY_BUF_LEN + NELLY_BUF_LEN / 2];

            aptr[j + NELLY_BUF_LEN / 2] = s->imdct_out[j];

        }

        overlap_and_window(s, s->state, aptr);

    }

}

void FUNC_0(NellyMoserDecodeContext *VAR_0, unsigned char VAR_1[NELLY_BLOCK_LEN], float VAR_2[NELLY_SAMPLES])

{

    int VAR_3,VAR_4;

    float VAR_5[NELLY_FILL_LEN], pows[NELLY_FILL_LEN];

    float *VAR_6, *VAR_7, *VAR_8, VAR_9, VAR_10;

    int VAR_11[NELLY_BUF_LEN];

    unsigned char VAR_12;



    init_get_bits(&VAR_0->gb, VAR_1, NELLY_BLOCK_LEN * 8);



    VAR_7 = VAR_5;

    VAR_8 = pows;

    VAR_9 = nelly_init_table[get_bits(&VAR_0->gb, 6)];

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

        if (VAR_3 > 0)

            VAR_9 += nelly_delta_table[get_bits(&VAR_0->gb, 5)];

        VAR_10 = pow(2, VAR_9/2048);

        for (VAR_4 = 0; VAR_4 < nelly_band_sizes_table[VAR_3]; VAR_4++) {

            *VAR_7++ = VAR_9;

            *VAR_8++ = VAR_10;

        }



    }



    get_sample_bits(VAR_5, VAR_11);



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

        VAR_6 = VAR_2 + VAR_3 * NELLY_BUF_LEN;



        init_get_bits(&VAR_0->gb, VAR_1, NELLY_BLOCK_LEN * 8);

        skip_bits(&VAR_0->gb, NELLY_HEADER_BITS + VAR_3*NELLY_DETAIL_BITS);



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

            if (VAR_11[VAR_4] <= 0) {

                VAR_6[VAR_4] = M_SQRT1_2*pows[VAR_4];

                if (av_random(&VAR_0->random_state) & 1)

                    VAR_6[VAR_4] *= -1.0;

            } else {

                VAR_12 = get_bits(&VAR_0->gb, VAR_11[VAR_4]);

                VAR_6[VAR_4] = dequantization_table[(1<<VAR_11[VAR_4])-1+VAR_12]*pows[VAR_4];

            }

        }

        memset(&VAR_6[NELLY_FILL_LEN], 0,

               (NELLY_BUF_LEN - NELLY_FILL_LEN) * sizeof(float));



        VAR_0->imdct_ctx.fft.imdct_calc(&VAR_0->imdct_ctx, VAR_0->imdct_out,

                                    VAR_6, VAR_0->imdct_tmp);

        



        for(VAR_4 = 0; VAR_4 < NELLY_BUF_LEN / 2; VAR_4++) {

            VAR_6[VAR_4] = VAR_0->imdct_out[VAR_4 + NELLY_BUF_LEN + NELLY_BUF_LEN / 2];

            VAR_6[VAR_4 + NELLY_BUF_LEN / 2] = VAR_0->imdct_out[VAR_4];

        }

        overlap_and_window(VAR_0, VAR_0->state, VAR_6);

    }

}

void FUNC_0(NellyMoserDecodeContext *VAR_0, unsigned char VAR_1[NELLY_BLOCK_LEN], float VAR_2[NELLY_SAMPLES])
{ int VAR_3,VAR_4; float VAR_5[NELLY_FILL_LEN], pows[NELLY_FILL_LEN]; float *VAR_6, *VAR_7, *VAR_8, VAR_9, VAR_10; int VAR_11[NELLY_BUF_LEN]; unsigned char VAR_12; init_get_bits(&VAR_0->gb, VAR_1, NELLY_BLOCK_LEN * 8); VAR_7 = VAR_5; VAR_8 = pows; VAR_9 = nelly_init_table[get_bits(&VAR_0->gb, 6)]; for (VAR_3=0 ; VAR_3<NELLY_BANDS ; VAR_3++) { if (VAR_3 > 0)
VAR_9 += nelly_delta_table[get_bits(&VAR_0->gb, 5)]; VAR_10 = pow(2, VAR_9/2048); for (VAR_4 = 0; VAR_4 < nelly_band_sizes_table[VAR_3]; VAR_4++) { *VAR_7++ = VAR_9; *VAR_8++ = VAR_10; } } get_sample_bits(VAR_5, VAR_11); for (VAR_3 = 0; VAR_3 < 2; VAR_3++) { VAR_6 = VAR_2 + VAR_3 * NELLY_BUF_LEN; init_get_bits(&VAR_0->gb, VAR_1, NELLY_BLOCK_LEN * 8); skip_bits(&VAR_0->gb, NELLY_HEADER_BITS + VAR_3*NELLY_DETAIL_BITS); for (VAR_4 = 0; VAR_4 < NELLY_FILL_LEN; VAR_4++) { if (VAR_11[VAR_4] <= 0) { VAR_6[VAR_4] = M_SQRT1_2*pows[VAR_4]; if (av_random(&VAR_0->random_state) & 1)
VAR_6[VAR_4] *= -1.0; } else { VAR_12 = get_bits(&VAR_0->gb, VAR_11[VAR_4]); VAR_6[VAR_4] = dequantization_table[(1<<VAR_11[VAR_4])-1+VAR_12]*pows[VAR_4]; } } memset(&VAR_6[NELLY_FILL_LEN], 0,
(NELLY_BUF_LEN - NELLY_FILL_LEN) * sizeof(float)); VAR_0->imdct_ctx.fft.imdct_calc(&VAR_0->imdct_ctx, VAR_0->imdct_out,
VAR_6, VAR_0->imdct_tmp); for(VAR_4 = 0; VAR_4 < NELLY_BUF_LEN / 2; VAR_4++) { VAR_6[VAR_4] = VAR_0->imdct_out[VAR_4 + NELLY_BUF_LEN + NELLY_BUF_LEN / 2]; VAR_6[VAR_4 + NELLY_BUF_LEN / 2] = VAR_0->imdct_out[VAR_4]; } overlap_and_window(VAR_0, VAR_0->state, VAR_6); } }