5.5.15 IIRTransposed
Description
IIRTransposed applies an IIR filter, using a cascade of transposed (direct form II) biquadratic sections, to the sequence of the source samples. It places the results in the sequence of the destination samples and updates the delay values.
Prototype
typedef struct {
int numSectionsLess1;
fractional* coeffsBase;
fractional* delayBase1;
fractional* delayBase2;
int finalShift;
} IIRTransposedStruct;
fractional* IIRTransposed (int numSamps, fractional* dstSamps, fractional* srcSamps, IIRTransposedStruct* filter);
Arguments
Filter Structure:
Parameters | Description |
---|---|
numSectionsLess1 |
One less than the number of cascaded second order (biquadratic) sections (also S-1) |
coeffsBase |
Pointer to filter coefficients (also {a, b}), either in X-Data or program memory |
delayBase1 |
Pointer to filter state 1, with one word of delay per second order section (also d1), only in Y-Data |
delayBase2 |
Pointer to filter state 2, with one word of delay per second order section (also d2), only in Y-Data |
finalShift |
Output scaling (shift left) |
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 IIRTransposedStruct filter structure |
Return
Pointer to the base address of the destination sample.
Remarks
There are five coefficients per second order (biquadratic) sections (generated externally) arranged in the ordered set - {b0[s], b1[s], a1[s], b2[s], a2[s]}, 0 ≤ s < S.
The delay is made up of two words of the filter state per section {d1[s], d2[s]}, 0 ≤ s < S.
Source samples, x[n], defined in 0 ≤ n < N.
Destination samples, y[n], defined in 0 ≤ n < N.
The output scale is applied as a shift to the output of the filter structure prior to storing the result in the output sequence. It is used to restore the filter gain to 0 dB. The shift count may be zero; if not zero, it represents the number of bits to shift: negative indicates shift left and positive is shift right.
Source File
- iirtrans_aa.s
Cycle counts for PIC32A:
Source Vector Size | Cycles if coefficients in X-mem | Cycles if coefficients in P-mem |
---|---|---|
32 |
2508 |
4112 |
64 |
4972 |
8176 |
128 |
9900 |
16304 |
256 |
19756 |
32560 |
512 |
39468 |
65072 |
1024 |
78892 |
130096 |
2048 |
157740 |
260144 |
(*All values with S = 5)
System resource usage
- W0…W7 - used, not restored
- W8…W10 - saved, used, restored
- ACCA - used, not restored
- CORCON - saved, used, restored
- REPEAT instruction(s) usage – None