Bill Yi | 4e213d5 | 2015-06-23 13:53:11 -0700 | [diff] [blame] | 1 | .TH DSP 3 |
| 2 | .SH NAME |
| 3 | initdp, freedp, dotprod, sumsq, peakval -\ SIMD-assisted |
| 4 | digital signal processing primitives |
| 5 | .SH SYNOPSIS |
| 6 | .nf |
| 7 | .ft |
| 8 | #include "fec.h" |
| 9 | |
| 10 | void *initdp(signed short *coeffs,int len); |
| 11 | long dotprod(void *p,signed short *a); |
| 12 | void freedp(void *p); |
| 13 | |
| 14 | unsigned long long sumsq(signed short *in,int cnt); |
| 15 | |
| 16 | int peakval(signed short *b,int cnt); |
| 17 | |
| 18 | .SH DESCRIPTION |
| 19 | These functions provide several basic primitives useful in digital |
| 20 | signal processing (DSP), especially in modems. The \fBinitdp\fR, |
| 21 | \fBdotprod\fR and \fBfreedp\fR functions implement an integer dot |
| 22 | product useful in correlation and filtering operations on signed |
| 23 | 16-bit integers. \fBsumsq\fR computes the sum |
| 24 | of the squares of an array of signed 16-bit integers, |
| 25 | useful for measuring the energy of a signal. \fBpeakval\fR returns the |
| 26 | absolute value of the largest magitude element in the input array, |
| 27 | useful for scaling a signal's amplitude. |
| 28 | |
| 29 | Each function uses IA32 or PowerPC Altivec instructions when |
| 30 | available; otherwise, a portable C version is used. |
| 31 | |
| 32 | .SH USAGE |
| 33 | To create a FIR filter or correlator, call \fBinitdp\fR with the |
| 34 | coefficients in \fBcoeff\fR and their number in \fBlen\fR. This |
| 35 | creates the appropriate data structures and returns a handle. |
| 36 | |
| 37 | To compute a dot product, pass the handle from \fBinitdp\fR and the |
| 38 | input array to \fBdotprod\fR. No length field is needed as the number |
| 39 | of samples will be taken from the \fBlen\fR parameter originally given |
| 40 | to \fBinitdp\fR. There must be at least as many samples in the input |
| 41 | array as there were coefficients passed to \fBinitdp\fR. |
| 42 | |
| 43 | When the filter or correlator is no longer needed, the data structures |
| 44 | may be freed by passing the handle to \fBfreedp\fR. |
| 45 | |
| 46 | The user is responsible for scaling the inputs to \fBinitdp\fR and |
| 47 | \fBdotprod\fR, as the 32-bit result from \fBdotprod\fR will silently |
| 48 | wrap around in the event of overflow. |
| 49 | |
| 50 | To compute the sum of the squares of an array of signed 16-bit |
| 51 | integers, use sumsq\fR. This returns a 64 bit sum. |
| 52 | |
| 53 | \fBpeakval\fR computes the absolute value of each 16-bit element in |
| 54 | the input array and returns the largest. |
| 55 | |
| 56 | .SH RETURN VALUES |
| 57 | |
| 58 | \fBinitdp\fR returns a handle that points to a control block, or NULL in |
| 59 | the event of an error (such as a memory allocation failure). \fBsumsq\fR |
| 60 | and \fBpeakval\fR have no error returns. |
| 61 | |
| 62 | .SH AUTHOR and COPYRIGHT |
| 63 | Phil Karn, KA9Q (karn@ka9q.net) |