Man page - dsp(3)
Packages contains this manual
Manual
DSP
NAMESYNOPSIS
DESCRIPTION
USAGE
RETURN VALUES
AUTHOR and COPYRIGHT
NAME
initdp, freedp, dotprod, sumsq, peakval - SIMD-assisted digital signal processing primitives
SYNOPSIS
#include "fec.h"
void
*initdp(signed short *coeffs,int len);
long dotprod(void *p,signed short *a);
void freedp(void *p);
unsigned long long sumsq(signed short *in,int cnt);
int peakval(signed short *b,int cnt);
DESCRIPTION
These functions provide several basic primitives useful in digital signal processing (DSP), especially in modems. The initdp , dotprod and freedp functions implement an integer dot product useful in correlation and filtering operations on signed 16-bit integers. sumsq computes the sum of the squares of an array of signed 16-bit integers, useful for measuring the energy of a signal. peakval returns the absolute value of the largest magitude element in the input array, useful for scaling a signal’s amplitude.
Each function uses IA32 or PowerPC Altivec instructions when available; otherwise, a portable C version is used.
USAGE
To create a FIR filter or correlator, call initdp with the coefficients in coeff and their number in len . This creates the appropriate data structures and returns a handle.
To compute a dot product, pass the handle from initdp and the input array to dotprod . No length field is needed as the number of samples will be taken from the len parameter originally given to initdp . There must be at least as many samples in the input array as there were coefficients passed to initdp .
When the filter or correlator is no longer needed, the data structures may be freed by passing the handle to freedp .
The user is responsible for scaling the inputs to initdp and dotprod , as the 32-bit result from dotprod will silently wrap around in the event of overflow.
To compute the sum of the squares of an array of signed 16-bit integers, use sumsq. This returns a 64 bit sum.
peakval computes the absolute value of each 16-bit element in the input array and returns the largest.
RETURN VALUES
initdp returns a handle that points to a control block, or NULL in the event of an error (such as a memory allocation failure). sumsq and peakval have no error returns.
AUTHOR and COPYRIGHT
Phil Karn, KA9Q (karn@ka9q.net)