DSPF_sp_autocor
4.2 Correlation
DSPF_sp_autocor
Function
Arguments
Description
Algorithm
Special Requirements
4-4
Single-precision autocorrelation
void DSPF_sp_autocor (float * restrict r, const float * restrict x, int nx, int nr)
r
Pointer to output array of autocorrelation of length nr
x
Pointer to input array of length nx+nr. Input data must be
padded with nr consecutive zeros at the beginning.
nx
Length of autocorrelation vector
nr
Length of lags
This routine performs the autocorrelation of the input array x. It is assumed that
the length of the input array, x, is a multiple of 2 and the length of the output
array, r, is a multiple of 4. The assembly routine computes 4 output samples
at a time. It is assumed that input vector x is padded with nr no of zeros in the
beginning.
This is the C equivalent of the assembly code. Note that the assembly code
is hand optimized and restrictions may apply.
void DSPF_sp_autocor(float * restrict r, const float *
restrict x,
int nx, int nr)
{
int i,k;
float sum;
for (i = 0; i < nr; i++)
{
sum = 0;
for (k = nr; k < nx+nr; k++)
sum += x[k] * x[k-i];
r[i] = sum ;
}
}
-
nx is a multiple of 2 and greater than or equal to 4.
-
nr is a multiple of 4 and greater than or equal to 4.
-
nx is greater than or equal to nr
-
x is double-word aligned.
Need help?
Do you have a question about the TMS320C67 DSP Series and is the answer not in the manual?
Questions and answers