TwiceAsNice  2019-02-18
Macros | Enumerations | Functions
libdspau.h File Reference
This graph shows which files directly or indirectly include this file:

Macros

#define min(a, b)
 
#define max(a, b)
 
#define M_PI   3.14159265358979323846
 
#define DLL_EXPORT   extern
 

Enumerations

enum  dspau_conversiontype {
  magnitude = 0, magnitude_dbv = 1, magnitude_rooted = 2, magnitude_squared = 3,
  phase_degrees = 4, phase_radians = 5
}
 

Functions

DLL_EXPORT int dspau_spectrum (double *in, double *out, int dims, int *sizes, int conversion)
 Create a spectrum from a double array of values. More...
 
DLL_EXPORT int dspau_squarelawfilter (double *in, double *out, int len)
 A square law filter. More...
 
DLL_EXPORT int dspau_lowpassfilter (double *in, double *out, int len, double samplingfrequency, double frequency, double q)
 A low pass filter. More...
 
DLL_EXPORT int dspau_highpassfilter (double *in, double *out, int len, double samplingfrequency, double frequency, double q)
 A high pass filter. More...
 
DLL_EXPORT int dspau_bandpassfilter (double *in, double *out, int len, double samplingfrequency, double frequency, double q)
 A band pass filter. More...
 
DLL_EXPORT int dspau_bandrejectfilter (double *in, double *out, int len, double samplingfrequency, double frequency, double q)
 A band reject filter. More...
 
DLL_EXPORT int dspau_autocorrelate (double *in, double *out, int *len)
 An auto-correlator. More...
 
double dspau_crosscorrelate (double *in1, double *in2, double *out, int len1, int len2, int *len)
 A cross-correlator. More...
 
DLL_EXPORT int dspau_bandpasscorrelate (double *in, double *out, int *len, int skip, double Q)
 A band-pass auto-correlator (Warning: high memory usage!) More...
 
double dspau_minmidmax (double *in, int len, double *min, double *max)
 Gets minimum, mid, and maximum values of the input stream. More...
 
double dspau_mean (double *in, int len)
 A mean calculator. More...
 
DLL_EXPORT int dspau_removemean (double *in, double *out, int len)
 Subtract mean from stream. More...
 
DLL_EXPORT int dspau_stretch (double *in, double *out, int len, double min, double max)
 Stretch minimum and maximum values of the input stream. More...
 
DLL_EXPORT int dspau_normalize (double *in, double *out, int len, double min, double max)
 Normalize the input stream to the minimum and maximum values. More...
 
DLL_EXPORT int dspau_sub (double *in1, double *in2, double *out, int len)
 Subtract elements of one stream from another's. More...
 
DLL_EXPORT int dspau_sum (double *in1, double *in2, double *out, int len)
 Sum elements of one stream to another's. More...
 
DLL_EXPORT int dspau_div (double *in1, double *in2, double *out, int len)
 Divide elements of one stream to another's. More...
 
DLL_EXPORT int dspau_mul (double *in1, double *in2, double *out, int len)
 Multiply elements of one stream to another's. More...
 
DLL_EXPORT int dspau_sub1 (double *in, double *out, int len, double val)
 Subtract a value from elements of the input stream. More...
 
DLL_EXPORT int dspau_sum1 (double *in, double *out, int len, double val)
 Sum elements of the input stream to a value. More...
 
DLL_EXPORT int dspau_div1 (double *in, double *out, int len, double val)
 Divide elements of the input stream to a value. More...
 
DLL_EXPORT int dspau_mul1 (double *in, double *out, int len, double val)
 Multiply elements of the input stream to a value. More...
 
DLL_EXPORT int dspau_median (double *in, double *out, int len, int size, int median)
 Median elements of the inut stream. More...
 
DLL_EXPORT int dspau_u8todouble (unsigned char *in, double *out, int len)
 Convert an 8bit unsigned array into a double array. More...
 
DLL_EXPORT int dspau_u16todouble (unsigned short int *in, double *out, int len)
 Convert a 16bit unsigned array into a double array. More...
 
DLL_EXPORT int dspau_u32todouble (unsigned int *in, double *out, int len)
 Convert a 32bit unsigned array into a double array. More...
 
DLL_EXPORT int dspau_u64todouble (unsigned long int *in, double *out, int len)
 Convert a 64bit unsigned array into a double array. More...
 
DLL_EXPORT int dspau_s8todouble (signed char *in, double *out, int len)
 Convert an 8bit signed array into a double array. More...
 
DLL_EXPORT int dspau_s16todouble (signed short int *in, double *out, int len)
 Convert a 16bit signed array into a double array. More...
 
DLL_EXPORT int dspau_s32todouble (signed int *in, double *out, int len)
 Convert a 32bit signed array into a double array. More...
 
DLL_EXPORT int dspau_s64todouble (signed long int *in, double *out, int len)
 Convert a 64bit signed array into a double array. More...
 
DLL_EXPORT int dspau_doubletou8 (double *in, unsigned char *out, int len)
 Convert a double array into a 8bit unsigned array. More...
 
DLL_EXPORT int dspau_doubletou16 (double *in, unsigned short int *out, int len)
 Convert a double array into a 16bit unsigned array. More...
 
DLL_EXPORT int dspau_doubletou32 (double *in, unsigned int *out, int len)
 Convert a double array into a 32bit unsigned array. More...
 
DLL_EXPORT int dspau_doubletou64 (double *in, unsigned long int *out, int len)
 Convert a double array into a 64bit unsigned array. More...
 
DLL_EXPORT int dspau_doubletos8 (double *in, signed char *out, int len)
 Convert a double array into an 8bit signed array. More...
 
DLL_EXPORT int dspau_doubletos16 (double *in, signed short int *out, int len)
 Convert a double array into a 16bit signed array. More...
 
DLL_EXPORT int dspau_doubletos32 (double *in, signed int *out, int len)
 Convert a double array into a 32bit signed array. More...
 
DLL_EXPORT int dspau_doubletos64 (double *in, signed long int *out, int len)
 Convert a double array into a 64bit signed array. More...
 

Macro Definition Documentation

◆ DLL_EXPORT

#define DLL_EXPORT   extern

◆ M_PI

#define M_PI   3.14159265358979323846

◆ max

#define max (   a,
  b 
)
Value:
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; })
Definition: base.hpp:36
list a
Definition: lutinvert.py:10
b
Definition: lmdemo.m:75

◆ min

#define min (   a,
  b 
)
Value:
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; })
Definition: base.hpp:36
list a
Definition: lutinvert.py:10
b
Definition: lmdemo.m:75

Enumeration Type Documentation

◆ dspau_conversiontype

Enumerator
magnitude 
magnitude_dbv 
magnitude_rooted 
magnitude_squared 
phase_degrees 
phase_radians 

Function Documentation

◆ dspau_autocorrelate()

DLL_EXPORT int dspau_autocorrelate ( double *  in,
double *  out,
int *  len 
)

An auto-correlator.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream (input/output).
skipskip n values at beginning (resulting len will be reduced).
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_bandpasscorrelate()

DLL_EXPORT int dspau_bandpasscorrelate ( double *  in,
double *  out,
int *  len,
int  skip,
double  Q 
)

A band-pass auto-correlator (Warning: high memory usage!)

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream. (input/output)
skipskip n values at beginning (resulting len will be reduced).
Qthe slope of the band-pass filters.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_bandpassfilter()

DLL_EXPORT int dspau_bandpassfilter ( double *  in,
double *  out,
int  len,
double  samplingfrequency,
double  frequency,
double  q 
)

A band pass filter.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
samplingfrequencythe sampling frequency of the input stream.
frequencythe center frequency of the filter.
qthe cutoff slope.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_bandrejectfilter()

DLL_EXPORT int dspau_bandrejectfilter ( double *  in,
double *  out,
int  len,
double  samplingfrequency,
double  frequency,
double  q 
)

A band reject filter.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
samplingfrequencythe sampling frequency of the input stream.
frequencythe center frequency of the filter.
qthe cutoff slope.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_crosscorrelate()

double dspau_crosscorrelate ( double *  in1,
double *  in2,
double *  out,
int  len1,
int  len2,
int *  len 
)

A cross-correlator.

Parameters
in1the first input stream. (input)
in2the second input stream. (input)
outthe output stream. (output)
len1the length of the first input stream. (input)
len2the length of the second input stream. (input)
lenthe length of the output stream. (output)
Returns
the resulting correlation degree.
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_div()

DLL_EXPORT int dspau_div ( double *  in1,
double *  in2,
double *  out,
int  len 
)

Divide elements of one stream to another's.

Parameters
in1the Numerators input stream. (input)
in2the Denominators input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_div1()

DLL_EXPORT int dspau_div1 ( double *  in,
double *  out,
int  len,
double  val 
)

Divide elements of the input stream to a value.

Parameters
inthe Numerators input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
valthe denominator.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_doubletos16()

DLL_EXPORT int dspau_doubletos16 ( double *  in,
signed short int *  out,
int  len 
)

Convert a double array into a 16bit signed array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_doubletos32()

DLL_EXPORT int dspau_doubletos32 ( double *  in,
signed int *  out,
int  len 
)

Convert a double array into a 32bit signed array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_doubletos64()

DLL_EXPORT int dspau_doubletos64 ( double *  in,
signed long int *  out,
int  len 
)

Convert a double array into a 64bit signed array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_doubletos8()

DLL_EXPORT int dspau_doubletos8 ( double *  in,
signed char *  out,
int  len 
)

Convert a double array into an 8bit signed array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_doubletou16()

DLL_EXPORT int dspau_doubletou16 ( double *  in,
unsigned short int *  out,
int  len 
)

Convert a double array into a 16bit unsigned array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_doubletou32()

DLL_EXPORT int dspau_doubletou32 ( double *  in,
unsigned int *  out,
int  len 
)

Convert a double array into a 32bit unsigned array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_doubletou64()

DLL_EXPORT int dspau_doubletou64 ( double *  in,
unsigned long int *  out,
int  len 
)

Convert a double array into a 64bit unsigned array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_doubletou8()

DLL_EXPORT int dspau_doubletou8 ( double *  in,
unsigned char *  out,
int  len 
)

Convert a double array into a 8bit unsigned array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_highpassfilter()

DLL_EXPORT int dspau_highpassfilter ( double *  in,
double *  out,
int  len,
double  samplingfrequency,
double  frequency,
double  q 
)

A high pass filter.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
samplingfrequencythe sampling frequency of the input stream.
frequencythe cutoff frequency of the filter.
qthe cutoff slope.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_lowpassfilter()

DLL_EXPORT int dspau_lowpassfilter ( double *  in,
double *  out,
int  len,
double  samplingfrequency,
double  frequency,
double  q 
)

A low pass filter.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
samplingfrequencythe sampling frequency of the input stream.
frequencythe cutoff frequency of the filter.
qthe cutoff slope.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_mean()

double dspau_mean ( double *  in,
int  len 
)

A mean calculator.

Parameters
inthe input stream. (input)
lenthe length of the input stream.
Returns
the mean value of the stream. Return mean if success.

◆ dspau_median()

DLL_EXPORT int dspau_median ( double *  in,
double *  out,
int  len,
int  size,
int  median 
)

Median elements of the inut stream.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
sizethe length of the median.
medianthe location of the median value.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_minmidmax()

double dspau_minmidmax ( double *  in,
int  len,
double *  min,
double *  max 
)

Gets minimum, mid, and maximum values of the input stream.

Parameters
inthe input stream. (input)
lenthe length of the input stream.
minthe minimum value (output).
maxthe maximum value (output).
Returns
the mid value (max - min) / 2 + min. Return mid if success.

◆ dspau_mul()

DLL_EXPORT int dspau_mul ( double *  in1,
double *  in2,
double *  out,
int  len 
)

Multiply elements of one stream to another's.

Parameters
in1the first input stream. (input)
in2the second input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_mul1()

DLL_EXPORT int dspau_mul1 ( double *  in,
double *  out,
int  len,
double  val 
)

Multiply elements of the input stream to a value.

Parameters
inthe first input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
valthe value used for this operation.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_normalize()

DLL_EXPORT int dspau_normalize ( double *  in,
double *  out,
int  len,
double  min,
double  max 
)

Normalize the input stream to the minimum and maximum values.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
minthe clamping minimum value.
maxthe clamping maximum value.
Returns
the output stream if successfull elaboration. NULL if an error is encountered.

Return 0 if success. Return -1 if any error occurs.

◆ dspau_removemean()

DLL_EXPORT int dspau_removemean ( double *  in,
double *  out,
int  len 
)

Subtract mean from stream.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_s16todouble()

DLL_EXPORT int dspau_s16todouble ( signed short int *  in,
double *  out,
int  len 
)

Convert a 16bit signed array into a double array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_s32todouble()

DLL_EXPORT int dspau_s32todouble ( signed int *  in,
double *  out,
int  len 
)

Convert a 32bit signed array into a double array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_s64todouble()

DLL_EXPORT int dspau_s64todouble ( signed long int *  in,
double *  out,
int  len 
)

Convert a 64bit signed array into a double array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_s8todouble()

DLL_EXPORT int dspau_s8todouble ( signed char *  in,
double *  out,
int  len 
)

Convert an 8bit signed array into a double array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_spectrum()

DLL_EXPORT int dspau_spectrum ( double *  in,
double *  out,
int  dims,
int *  sizes,
int  conversion 
)

Create a spectrum from a double array of values.

Parameters
inthe input stream. (input)
outthe output stream. (output)
dimsthe number of dimensions of the input stream (input).
sizesarray with the lengths of each dimension of the input stream (input).
conversionthe output magnitude dspau_conversiontype type.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_squarelawfilter()

DLL_EXPORT int dspau_squarelawfilter ( double *  in,
double *  out,
int  len 
)

A square law filter.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_stretch()

DLL_EXPORT int dspau_stretch ( double *  in,
double *  out,
int  len,
double  min,
double  max 
)

Stretch minimum and maximum values of the input stream.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
minthe desired minimum value.
maxthe desired maximum value.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_sub()

DLL_EXPORT int dspau_sub ( double *  in1,
double *  in2,
double *  out,
int  len 
)

Subtract elements of one stream from another's.

Parameters
in1the input stream to be subtracted. (input)
in2the input stream with subtraction values. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_sub1()

DLL_EXPORT int dspau_sub1 ( double *  in,
double *  out,
int  len,
double  val 
)

Subtract a value from elements of the input stream.

Parameters
inthe Numerators input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
valthe value to be subtracted.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_sum()

DLL_EXPORT int dspau_sum ( double *  in1,
double *  in2,
double *  out,
int  len 
)

Sum elements of one stream to another's.

Parameters
in1the first input stream. (input)
in2the second input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_sum1()

DLL_EXPORT int dspau_sum1 ( double *  in,
double *  out,
int  len,
double  val 
)

Sum elements of the input stream to a value.

Parameters
inthe first input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
valthe value used for this operation.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_u16todouble()

DLL_EXPORT int dspau_u16todouble ( unsigned short int *  in,
double *  out,
int  len 
)

Convert a 16bit unsigned array into a double array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_u32todouble()

DLL_EXPORT int dspau_u32todouble ( unsigned int *  in,
double *  out,
int  len 
)

Convert a 32bit unsigned array into a double array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_u64todouble()

DLL_EXPORT int dspau_u64todouble ( unsigned long int *  in,
double *  out,
int  len 
)

Convert a 64bit unsigned array into a double array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.

◆ dspau_u8todouble()

DLL_EXPORT int dspau_u8todouble ( unsigned char *  in,
double *  out,
int  len 
)

Convert an 8bit unsigned array into a double array.

Parameters
inthe input stream. (input)
outthe output stream. (output)
lenthe length of the input stream.
Returns
the output stream if successfull elaboration. NULL if an error is encountered. Return 0 if success. Return -1 if any error occurs.