Texas Instruments TMS320C64X User Manual

Page 72

Advertising
background image

DSP_fir_gen_hM17_rA8X8

4-44

FIR Filter

DSP_fir_gen_hM17_rA8X8

Function

void DSP_fir_gen_hM17_rA8X8 (const short * restrict x, const short * restrict
h, short * restrict r, int nh, int nr)

Arguments

x[nr+nh−1]

Pointer to input array of size nr + nh − 1.

h[nh]

Pointer to coefficient array of size nh (coefficients must be in
reverse order).

r[nr]

Pointer to output array of size nr. Must be double word
aligned.

nh

Number of coefficients. Must be

17.

nr

Number of samples to calculate. Must be a multiple of 8.

Description

Computes a real FIR filter (direct-form) using coefficients stored in vector h[ ].
The real data input is stored in vector x[ ]. The filter output result is stored in
vector r[ ]. It operates on 16-bit data with a 32-bit accumulate. The filter
calculates nr output samples using nh coefficients.

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_gen(short *x, short *h, short *r, int nh, int nr)

{

int i, j, sum;

for (j = 0; j < nr; j++) {

sum = 0;

for (i = 0; i < nh; i++)

sum += x[i + j] * h[i];

r[j] = sum >> 15;

}

}

Advertising