DSP_fir_sym
DSP_fir_sym | Symmetric FIR Filter | |||
Function |
|
|
| |
| void DSP_fir_sym (const short * restrict x, const short * restrict h, short * re- | |||
|
| strict r, int nh, int nr, int s) | ||
Arguments |
| x[nr+2*nh] | Pointer to input array of size nr + 2*nh. Must be | |
|
|
| aligned. | |
|
| h[nh+1] | Pointer to coefficient array of size nh + 1. Coefficients are in | |
|
|
| normal order and only half (nh+1 out of 2*nh+1) are required. | |
|
|
| Must be | |
|
| r[nr] | Pointer to output array of size nr. Must be word aligned. | |
|
| nh | Number of coefficients. Must be multiple of 8. The number of | |
|
|
| original symmetric coefficients is 2*nh+1. | |
|
| nr | Number of samples to calculate. Must be multiple of 4. | |
|
| s | Number of insignificant digits to truncate; e.g., 15 for Q.15 | |
|
|
| input data and coefficients. | |
Description |
| This function applies a symmetric filter to the input samples. The filter tap array | ||
|
| h[] provides ‘nh+1’ total filter taps. The filter tap at h[nh] forms the center point | ||
|
| of the filter. The taps at h[nh − 1] through h[0] form a symmetric filter about this | ||
|
| central tap. The effective filter length is thus 2*nh+1 taps. | ||
|
| The filter is performed on | ||
|
| intermediate results to | ||
|
| truncated according to the value provided in ‘s’. This allows a variety of | ||
|
| |||
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_fir_sym(short *x, short *h, short *r, int nh, int nr, | ||
|
| int s) |
|
|
| { |
|
|
int | i, j; |
long | y0; |
long | round = (long) 1 << (s − 1); |
for (j = 0; j < nr; j++) { y0 = round;
for (i = 0; i < nh; i++)