DSP_autocor

4.2 Correlation

DSP_autocor

AutoCorrelation

Function

 

void DSP_autocor(short * restrict r, const short * restrict x, int nx, int nr)

 

Arguments

 

r[nr]

Output array

 

 

x[nx+nr]

Input array. Must be double-word aligned.

 

 

nx

Length of autocorrelation. Must be a multiple of 8.

 

 

nr

Number of lags. Must be a multiple of 4.

Description

 

This routine accepts an input array of length nx + nr and performs nr

 

 

autocorrelations each of length nx producing nr output results. This is typically

 

 

used in VSELP code.

Algorithm

 

This is the C equivalent of the assembly code without restrictions. Note that

 

 

the assembly code is hand optimized and restrictions may apply.

void DSP_autocor(short r[ ],short x[ ], int nx, int nr)

{

int i,k,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 >> 15);

}

}

Special Requirements

-nx must be a multiple of 8.

-nr must be a multiple of 4.

-x[ ] must be double-word aligned.

4-4

Page 32
Image 32
Texas Instruments TMS320C64X manual DSPautocor, AutoCorrelation