DSP(3)
DSP(3) ๐โจ
okay bestie, welcome to DSP(3) from the Library Functions Manual โ this is the digital signal processing girlie page and honestly? it's giving modem core ๐
โจ 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 ๐ฆ
so these functions are the little squad of basic primitives that are useful in digital signal processing (DSP), especially in modems. ๐ซถ
initdp,dotprodandfreedptogether implement an integer dot product, which is useful in correlation and filtering operations on signed 16-bit integers. iykyk ๐ฅsumsqcomputes the sum of the squares of an array of signed 16-bit integers โ so useful for measuring the energy of a signal โกpeakvalreturns the absolute value of the largest magnitude element in the input array โ great for scaling a signal's amplitude, periodt ๐
and the best part?? each function uses IA32 or PowerPC Altivec instructions when they're available ๐โจ otherwise a portable C version is used. no cap, it just adapts. main character energy fr fr.
๐ USAGE ๐
okay so here's how you actually use these:
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. don't play with that.
when the filter or correlator is no longer needed, the data structures may be freed by passing the handle to freedp. bye bestie ๐๐
the user is responsible for scaling the inputs toinitdpanddotprod, because the 32-bit result fromdotprodwill silently wrap around in the event of overflow. SILENTLY. it will not tell you. it will not warn you. it will just wrap. ๐ญ be careful.
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 โญ
initdpreturns a handle that points to a control block, orNULLin the event of an error (such as a memory allocation failure). ๐ญsumsqandpeakvalhave no error returns. they simply do not miss. ๐
๐ AUTHOR and COPYRIGHT ๐
Phil Karn, KA9Q (karn@ka9q.net) โ an absolute legend, we stan ๐ซถ๐ธ
and that's the whole page bestie!! ๐ this was DSP(3) from the Library Functions Manual, so if you see DSP(3) down at the bottom of your terminal, that's just this page saying hi. go forth and filter those signals, you got this ๐โจ๐ฆ
๐ฆ where this page comes from
- debian bookworm: libfec-dev 1.0-26-gc5d935f-1 ยท LGPL
- debian trixie: libfec-dev 1.0-26-gc5d935f-1+b3 ยท LGPL
- ubuntu jammy: libfec-dev 1.0+20161003-4 ยท LGPL
- ubuntu noble: libfec-dev 1.0-26-gc5d935f-1 ยท LGPL
- ubuntu questing: libfec-dev 1.0-26-gc5d935f-1
- ubuntu resolute: libfec-dev 1.0-26-gc5d935f-1build1 ยท LGPL
- ubuntu stonking: libfec-dev 1.0-26-gc5d935f-1build1 ยท LGPL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms