![](/images/new-backgrounds/1139870/139870135x1.webp)
DSP_fir_cplx_hM4X4
DSP_fir_cplx_hM4X4 Complex FIR Filter
Function | void DSP_fir_cplx _hM4X4(const short * restrict x, const short * restrict h, short | |
| * restrict r, int nh, int nr) | |
Arguments | x[2*(nr+nh−1)] | Complex input data. x must point to x[2*(nh−1)]. |
| h[2*nh] | Complex coefficients (in normal order). |
| r[2*nr] | Complex output data. |
| nh | Number of complex coefficients. Must be a multiple of 4. |
| nr | Number of complex output samples. Must be a multiple of 4. |
Description | This function implements the FIR filter for complex input data. The filter has | |
| nr output samples and nh coefficients. Each array consists of an even and odd | |
| term with even terms representing the real part and the odd terms the | |
| imaginary part of the element. The pointer to input array x must point to the | |
| (nh)th complex sample; i.e., element 2*(nh−1), upon entry to the function. The | |
| coefficients are expected in normal order. | |
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_cplx(short *x, short *h, short *r,short nh, short nr)
{
short i,j;
int imag, real;
for (i = 0; i < 2*nr; i += 2){ imag = 0;
real = 0;
for (j = 0; j < 2*nh; j += 2){
real += h[j] * x[i−j] − h[j+1] * x[i+1−j]; imag += h[j] * x[i+1−j] + h[j+1] * x[i−j];
}
r[i] = (real >> 15); r[i+1] = (imag >> 15);
}
}