Revision e71365f4

View differences:

libavcodec/mlpdec.c
652 652
                           unsigned int channel)
653 653
{
654 654
    SubStream *s = &m->substream[substr];
655
    int32_t filter_state_buffer[NUM_FILTERS][MAX_BLOCKSIZE + MAX_FIR_ORDER];
656
    FilterParams *fp[NUM_FILTERS] = { &m->channel_params[channel].filter_params[FIR],
657
                                      &m->channel_params[channel].filter_params[IIR], };
658
    unsigned int filter_shift = fp[FIR]->shift;
655
    int32_t firbuf[MAX_BLOCKSIZE + MAX_FIR_ORDER];
656
    int32_t iirbuf[MAX_BLOCKSIZE + MAX_IIR_ORDER];
657
    FilterParams *fir = &m->channel_params[channel].filter_params[FIR];
658
    FilterParams *iir = &m->channel_params[channel].filter_params[IIR];
659
    unsigned int filter_shift = fir->shift;
659 660
    int32_t mask = MSB_MASK(s->quant_step_size[channel]);
660 661
    int index = MAX_BLOCKSIZE;
661 662
    int i;
662 663

  
663
    memcpy(&filter_state_buffer[FIR][MAX_BLOCKSIZE], &fp[FIR]->state[0],
664
    memcpy(&firbuf[MAX_BLOCKSIZE], &fir->state[0],
664 665
            MAX_FIR_ORDER * sizeof(int32_t));
665
    memcpy(&filter_state_buffer[IIR][MAX_BLOCKSIZE], &fp[IIR]->state[0],
666
    memcpy(&iirbuf[MAX_BLOCKSIZE], &iir->state[0],
666 667
            MAX_IIR_ORDER * sizeof(int32_t));
667 668

  
668 669
    for (i = 0; i < s->blocksize; i++) {
......
673 674

  
674 675
        /* TODO: Move this code to DSPContext? */
675 676

  
676
        for (order = 0; order < fp[FIR]->order; order++)
677
            accum += (int64_t)filter_state_buffer[FIR][index + order] *
678
                                fp[FIR]->coeff[order];
679
        for (order = 0; order < fp[IIR]->order; order++)
680
            accum += (int64_t)filter_state_buffer[IIR][index + order] *
681
                                fp[IIR]->coeff[order];
677
        for (order = 0; order < fir->order; order++)
678
            accum += (int64_t)firbuf[index + order] *
679
                                fir->coeff[order];
680
        for (order = 0; order < iir->order; order++)
681
            accum += (int64_t)iirbuf[index + order] *
682
                                iir->coeff[order];
682 683

  
683 684
        accum  = accum >> filter_shift;
684 685
        result = (accum + residual) & mask;
685 686

  
686 687
        --index;
687 688

  
688
        filter_state_buffer[FIR][index] = result;
689
        filter_state_buffer[IIR][index] = result - accum;
689
        firbuf[index] = result;
690
        iirbuf[index] = result - accum;
690 691

  
691 692
        m->sample_buffer[i + s->blockpos][channel] = result;
692 693
    }
693 694

  
694
    memcpy(&fp[FIR]->state[0], &filter_state_buffer[FIR][index],
695
    memcpy(&fir->state[0], &firbuf[index],
695 696
            MAX_FIR_ORDER * sizeof(int32_t));
696
    memcpy(&fp[IIR]->state[0], &filter_state_buffer[IIR][index],
697
    memcpy(&iir->state[0], &iirbuf[index],
697 698
            MAX_IIR_ORDER * sizeof(int32_t));
698 699
}
699 700

  

Also available in: Unified diff