DSP_iirlat

DSP_iirlat

All-Pole IIR Lattice Filter

 

 

Function

 

 

 

 

void DSP_iirlat(const short * restrict x, int nx, const short * restrict k, int nk, int

 

 

* restrict b, short * restrict r)

 

 

Arguments

 

x[nx]

Input vector (16-bit).

 

 

 

 

nx

Length of input vector.

 

 

 

 

k[nk]

Reflection coefficients in Q.15 format.

 

 

nk

Number of reflection coefficients/lattice stages. Must be >=4.

 

 

 

Make multiple of 2 to avoid bank conflicts.

 

 

b[nk+1]

Delay line elements from previous call. Should be initialized to

 

 

 

all zeros prior to the first call.

 

 

r[nx]

Output vector (16-bit).

 

 

Description

 

This routine implements a real all-pole IIR filter in lattice structure (AR lattice).

 

 

The filter consists of nk lattice stages. Each stage requires one reflection

 

 

coefficient k and one delay element b. The routine takes an input vector x[] and

 

 

returns the filter output in r[]. Prior to the first call of the routine, the delay

 

 

elements in b[] should be set to zero. The input data may have to be pre-scaled

 

 

to avoid overflow or achieve better SNR. The reflections coefficients lie in the

 

 

range −1.0 < k < 1.0. The order of the coefficients is such that k[nk−1]

 

 

corresponds to the first lattice stage after the input and k[0] corresponds to the

 

 

last stage.

 

 

 

 

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 iirlat(short *x, int nx, short *k, int nk, int *b,

 

 

short *r)

 

 

 

 

 

{

 

 

 

 

 

 

int rt;

/* output

*/

 

 

 

int i, j;

 

 

 

for (j=0; j<nx; j++)

{

rt = x[j] << 15;

for (i = nk − 1; i >= 0; i−−)

{

4-56

Page 84
Image 84
Texas Instruments TMS320C64X manual DSPiirlat, All-Pole IIR Lattice Filter