Revision 99c5f5cc libavcodec/alsdec.c

View differences:

libavcodec/alsdec.c
712 712
    int32_t *quant_cof        = bd->quant_cof;
713 713
    int32_t *lpc_cof          = bd->lpc_cof;
714 714
    int32_t *raw_samples      = bd->raw_samples;
715
    int32_t *raw_samples_end  = bd->raw_samples + bd->block_length;
716
    int32_t lpc_cof_reversed[opt_order];
715 717

  
716 718
    // reverse long-term prediction
717 719
    if (*bd->use_ltp) {
......
739 741
            y = 1 << 19;
740 742

  
741 743
            for (sb = 0; sb < smp; sb++)
742
                y += MUL64(lpc_cof[sb], *(raw_samples + smp - (sb + 1)));
744
                y += MUL64(lpc_cof[sb], raw_samples[-(sb + 1)]);
743 745

  
744
            raw_samples[smp] -= y >> 20;
746
            *raw_samples++ -= y >> 20;
745 747
            parcor_to_lpc(smp, quant_cof, lpc_cof);
746 748
        }
747 749
    } else {
......
775 777
                raw_samples[sb] >>= bd->shift_lsbs;
776 778
    }
777 779

  
780
    // reverse linear prediction coefficients for efficiency
781
    lpc_cof = lpc_cof + opt_order;
782

  
783
    for (sb = 0; sb < opt_order; sb++)
784
        lpc_cof_reversed[sb] = lpc_cof[-(sb + 1)];
785

  
778 786
    // reconstruct raw samples
779
    for (; smp < bd->block_length; smp++) {
787
    raw_samples = bd->raw_samples + smp;
788
    lpc_cof     = lpc_cof_reversed + opt_order;
789

  
790
    for (; raw_samples < raw_samples_end; raw_samples++) {
780 791
        y = 1 << 19;
781 792

  
782
        for (sb = 0; sb < opt_order; sb++)
783
            y += MUL64(bd->lpc_cof[sb], *(raw_samples + smp - (sb + 1)));
793
        for (sb = -opt_order; sb < 0; sb++)
794
            y += MUL64(lpc_cof[sb], raw_samples[sb]);
784 795

  
785
        raw_samples[smp] -= y >> 20;
796
        *raw_samples -= y >> 20;
786 797
    }
787 798

  
799
    raw_samples = bd->raw_samples;
800

  
788 801
    // restore previous samples in case that they have been altered
789 802
    if (bd->store_prev_samples)
790 803
        memcpy(raw_samples - sconf->max_order, bd->prev_raw_samples,

Also available in: Unified diff