Collaboration diagram for DSP_autocor:
void | DSP_autocor (short *restrict r, const short *restrict x, int nx, int nr) |
void DSP_autocor | ( | short *restrict | r, | |
const short *restrict | x, | |||
int | nx, | |||
int | nr | |||
) |
This routine performs an autocorrelation of an input vector x. The length of the autocorrelation is nx samples. Since nr such autocorrelations are performed, input vector x needs to be of length nx + nr. This produces nr output results which are stored in an output array r.
The following diagram illustrates how the correlations are obtained.
Example for nr=8, nx=24:
0 nr nx+nr-1
|-------|----------------------| <- x[]
| |----------------------| -> r[0]
| |----------------------| -> r[1]
| |----------------------| -> r[2]
| |----------------------| -> r[3]
| |----------------------| -> r[4]
| |----------------------| -> r[5]
| |----------------------| -> r[6]
Note that x[0] is never used, but is required for padding to make x[nr] double-word aligned.
r | = Output data array of shorts | |
x | = Input data array of shorts | |
nx | = Length of autocorrelation | |
nr | = Number of lags |