5.5.13 IIRLattice

Description

IIRLattice uses a lattice structure implementation to apply an IIR filter to the sequence of the source samples. It then places the results in the sequence of the destination samples and updates the delay values.

Prototype

 typedef struct { 
  int order; 
  fractional* kappaVals; 
  fractional* gammaVals; 
  fractional* delay; 
} IIRLatticeStruct;

fractional* IIRLattice (int numSamps, fractional* dstSamps, fractional* srcSamps, IIRLatticeStruct* filter);

Arguments

Filter Structure:

Parameters

Description

order

Filter order (also M, M ≤ N; see FIRLattice for N)

kappaVals

Base address for lattice coefficients (also k), either in X-Data or program memory

gammaVals

Base address for ladder coefficients (also g), either in X-Data or program memory. If NULL, the function will implement an all-pole filter.

delay

Base address for delay (also d), only in Y-Data

Filter Description:

Parameters

Description

numSamps

Number of input samples to filter (also N; with N being multiple of R)

dstSamps

Pointer to the destination samples (also y)

srcSamps

Pointer to the source samples (also x)

filter

Pointer to the IIRLatticeStruct filter structure

Return

Pointer to the base address of the destination sample.

Remarks

Lattice coefficients, k[m], defined in 0 ≤ m ≤ M.

Ladder coefficients, g[m], defined in 0 ≤ m ≤ M (unless if implementing an all-pole filter).

Delay, d[m], defined in 0 ≤ m ≤ M.

Source samples, x[n], defined in 0 ≤ n < N.

Destination samples, y[n], defined in 0 ≤ n < N.

Note: The fractional implementation provided with this library is prone to saturation.

Appropriately scaling the input signal, prior to applying the filter, should prevent the fractional implementation from saturating.

Source File

  • iirlatt_aa.s

Cycle counts for PIC32A:

Source Vector SizeCycles if coefficients in X-memCycles if coefficients in P-mem

32

9586

15290

64

19122

30522

128

38194

60986

256

76338

121914

512

152626

243770

1024

305202

487482

2048

610254

774906

(*All values with M = 32)

System resource usage

  • W0…W7 - used, not restored
  • W8…W14 - saved, used, restored
  • ACCA - used, not restored
  • CORCON - saved, used, restored
  • REPEAT instruction(s) usage – None