• Rémi Denis-Courmont's avatar
    lavc/lpc: R-V V compute_autocorr · 918b3ed2
    Rémi Denis-Courmont authored
    The loop iterates over the length of the vector, not the order. This is
    to avoid reloading the same data for each lag value. However this means
    the loop only works if the maximum order is no larger than VLENB.
    
    The loop is roughly equivalent to:
    
        for (size_t j = 0; j < lag; j++)
            autoc[j] = 1.;
    
        while (len > lag) {
            for (ptrdiff_t j = 0; j < lag; j++)
                autoc[j] += data[j] * *data;
            data++;
            len--;
        }
    
        while (len > 0) {
            for (ptrdiff_t j = 0; j < len; j++)
                autoc[j] += data[j] * *data;
            data++;
            len--;
        }
    
    Since register pressure is only at 50%, it should be possible to implement
    the same loop for order up to 2xVLENB. But this is left for future work.
    
    Performance numbers are all over the place from ~1.25x to ~4x speedups,
    but at least they are always noticeably better than nothing.
    918b3ed2
lpc_init.c 1.46 KB