DSP_iir
DSP_iir | IIR With 5 Coefficients | |||
Function |
|
|
| |
| void DSP_iir (short * restrict r1, const short * restrict x, short * restrict r2, const | |||
|
| short * restrict h2, const short * restrict h1, int nr) | ||
Arguments |
| r1[nr+4] | Output array (used in actual computation. First four elements | |
|
| must | have the previous outputs.) | |
|
| x[nr+4] | Input array | |
|
| r2[nr] | Output array (stored) | |
|
| h2[5] | ||
|
| h1[5] | ||
|
| nr | Number of output samples. Must be ≥ 8. | |
Description |
| The IIR performs an | ||
|
| |||
|
| nr output samples. | ||
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_iir(short *r1, short *x, short *r2, short *h2, short *h1, int nr)
{
int j,i; int sum;
for (i=0; i<nr; i++){ sum = h2[0] * x[4+i]; for (j = 1; j <= 4; j++)
sum += h2[j]*x[4+i−j]−h1[j]*r1[4+i−j]; r1[4+i] = (sum >> 15);
r2[i] = r1[4+i];
}
}