DSP_autocor_rA8

DSP_autocor_rA8 AutoCorrelation

Function

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

Arguments

r[nr]

Output array, Must be double word aligned.

 

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.

-r[ ] must be double-word aligned.

Implementation Notes

-Bank Conflicts: No bank conflicts occur.

-Interruptibility: The code is interruptible.

-The inner loop is unrolled 8 times.

-The outer loop is unrolled 4 times.

4-6

Page 34
Image 34
Texas Instruments TMS320C64X manual DSPautocorrA8 AutoCorrelation