static void filter_channel(MLPDecodeContext *m, unsigned int substr,

                           unsigned int channel)

{

    SubStream *s = &m->substream[substr];

    int32_t firbuf[MAX_BLOCKSIZE + MAX_FIR_ORDER];

    int32_t iirbuf[MAX_BLOCKSIZE + MAX_IIR_ORDER];

    FilterParams *fir = &m->channel_params[channel].filter_params[FIR];

    FilterParams *iir = &m->channel_params[channel].filter_params[IIR];

    unsigned int filter_shift = fir->shift;

    int32_t mask = MSB_MASK(s->quant_step_size[channel]);

    int index = MAX_BLOCKSIZE;

    int i;



    memcpy(&firbuf[MAX_BLOCKSIZE], &fir->state[0],

            MAX_FIR_ORDER * sizeof(int32_t));

    memcpy(&iirbuf[MAX_BLOCKSIZE], &iir->state[0],

            MAX_IIR_ORDER * sizeof(int32_t));



    for (i = 0; i < s->blocksize; i++) {

        int32_t residual = m->sample_buffer[i + s->blockpos][channel];

        unsigned int order;

        int64_t accum = 0;

        int32_t result;



        /* TODO: Move this code to DSPContext? */



        for (order = 0; order < fir->order; order++)

            accum += (int64_t)firbuf[index + order] *

                                fir->coeff[order];

        for (order = 0; order < iir->order; order++)

            accum += (int64_t)iirbuf[index + order] *

                                iir->coeff[order];



        accum  = accum >> filter_shift;

        result = (accum + residual) & mask;



        --index;



        firbuf[index] = result;

        iirbuf[index] = result - accum;



        m->sample_buffer[i + s->blockpos][channel] = result;

    }



    memcpy(&fir->state[0], &firbuf[index],

            MAX_FIR_ORDER * sizeof(int32_t));

    memcpy(&iir->state[0], &iirbuf[index],

            MAX_IIR_ORDER * sizeof(int32_t));

}

static void filter_channel(MLPDecodeContext *m, unsigned int substr,

                           unsigned int channel)

{

    SubStream *s = &m->substream[substr];

    int32_t firbuf[MAX_BLOCKSIZE + MAX_FIR_ORDER];

    int32_t iirbuf[MAX_BLOCKSIZE + MAX_IIR_ORDER];

    FilterParams *fir = &m->channel_params[channel].filter_params[FIR];

    FilterParams *iir = &m->channel_params[channel].filter_params[IIR];

    unsigned int filter_shift = fir->shift;

    int32_t mask = MSB_MASK(s->quant_step_size[channel]);

    int index = MAX_BLOCKSIZE;

    int i;



    memcpy(&firbuf[MAX_BLOCKSIZE], &fir->state[0],

            MAX_FIR_ORDER * sizeof(int32_t));

    memcpy(&iirbuf[MAX_BLOCKSIZE], &iir->state[0],

            MAX_IIR_ORDER * sizeof(int32_t));



    for (i = 0; i < s->blocksize; i++) {

        int32_t residual = m->sample_buffer[i + s->blockpos][channel];

        unsigned int order;

        int64_t accum = 0;

        int32_t result;



        



        for (order = 0; order < fir->order; order++)

            accum += (int64_t)firbuf[index + order] *

                                fir->coeff[order];

        for (order = 0; order < iir->order; order++)

            accum += (int64_t)iirbuf[index + order] *

                                iir->coeff[order];



        accum  = accum >> filter_shift;

        result = (accum + residual) & mask;



        --index;



        firbuf[index] = result;

        iirbuf[index] = result - accum;



        m->sample_buffer[i + s->blockpos][channel] = result;

    }



    memcpy(&fir->state[0], &firbuf[index],

            MAX_FIR_ORDER * sizeof(int32_t));

    memcpy(&iir->state[0], &iirbuf[index],

            MAX_IIR_ORDER * sizeof(int32_t));

}

static void FUNC_0(MLPDecodeContext *VAR_0, unsigned int VAR_1,

                           unsigned int VAR_2)

{

    SubStream *s = &VAR_0->substream[VAR_1];

    int32_t firbuf[MAX_BLOCKSIZE + MAX_FIR_ORDER];

    int32_t iirbuf[MAX_BLOCKSIZE + MAX_IIR_ORDER];

    FilterParams *fir = &VAR_0->channel_params[VAR_2].filter_params[FIR];

    FilterParams *iir = &VAR_0->channel_params[VAR_2].filter_params[IIR];

    unsigned int VAR_3 = fir->shift;

    int32_t mask = MSB_MASK(s->quant_step_size[VAR_2]);

    int VAR_4 = MAX_BLOCKSIZE;

    int VAR_5;



    memcpy(&firbuf[MAX_BLOCKSIZE], &fir->state[0],

            MAX_FIR_ORDER * sizeof(int32_t));

    memcpy(&iirbuf[MAX_BLOCKSIZE], &iir->state[0],

            MAX_IIR_ORDER * sizeof(int32_t));



    for (VAR_5 = 0; VAR_5 < s->blocksize; VAR_5++) {

        int32_t residual = VAR_0->sample_buffer[VAR_5 + s->blockpos][VAR_2];

        unsigned int order;

        int64_t accum = 0;

        int32_t result;



        



        for (order = 0; order < fir->order; order++)

            accum += (int64_t)firbuf[VAR_4 + order] *

                                fir->coeff[order];

        for (order = 0; order < iir->order; order++)

            accum += (int64_t)iirbuf[VAR_4 + order] *

                                iir->coeff[order];



        accum  = accum >> VAR_3;

        result = (accum + residual) & mask;



        --VAR_4;



        firbuf[VAR_4] = result;

        iirbuf[VAR_4] = result - accum;



        VAR_0->sample_buffer[VAR_5 + s->blockpos][VAR_2] = result;

    }



    memcpy(&fir->state[0], &firbuf[VAR_4],

            MAX_FIR_ORDER * sizeof(int32_t));

    memcpy(&iir->state[0], &iirbuf[VAR_4],

            MAX_IIR_ORDER * sizeof(int32_t));

}

static void FUNC_0(MLPDecodeContext *VAR_0, unsigned int VAR_1,
unsigned int VAR_2)
{ SubStream *s = &VAR_0->substream[VAR_1]; int32_t firbuf[MAX_BLOCKSIZE + MAX_FIR_ORDER]; int32_t iirbuf[MAX_BLOCKSIZE + MAX_IIR_ORDER]; FilterParams *fir = &VAR_0->channel_params[VAR_2].filter_params[FIR]; FilterParams *iir = &VAR_0->channel_params[VAR_2].filter_params[IIR]; unsigned int VAR_3 = fir->shift; int32_t mask = MSB_MASK(s->quant_step_size[VAR_2]); int VAR_4 = MAX_BLOCKSIZE; int VAR_5; memcpy(&firbuf[MAX_BLOCKSIZE], &fir->state[0],
MAX_FIR_ORDER * sizeof(int32_t)); memcpy(&iirbuf[MAX_BLOCKSIZE], &iir->state[0],
MAX_IIR_ORDER * sizeof(int32_t)); for (VAR_5 = 0; VAR_5 < s->blocksize; VAR_5++) { int32_t residual = VAR_0->sample_buffer[VAR_5 + s->blockpos][VAR_2]; unsigned int order; int64_t accum = 0; int32_t result; for (order = 0; order < fir->order; order++) accum += (int64_t)firbuf[VAR_4 + order] *
fir->coeff[order]; for (order = 0; order < iir->order; order++) accum += (int64_t)iirbuf[VAR_4 + order] *
iir->coeff[order]; accum  = accum >> VAR_3; result = (accum + residual) & mask; --VAR_4; firbuf[VAR_4] = result; iirbuf[VAR_4] = result - accum; VAR_0->sample_buffer[VAR_5 + s->blockpos][VAR_2] = result; } memcpy(&fir->state[0], &firbuf[VAR_4],
MAX_FIR_ORDER * sizeof(int32_t)); memcpy(&iir->state[0], &iirbuf[VAR_4],
MAX_IIR_ORDER * sizeof(int32_t)); }