-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathminidsp.h
67 lines (52 loc) · 1.92 KB
/
minidsp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @file minidsp.h
* @brief A mini library of DSP-related routines.
*
*/
#ifndef MINIDSP_H
#define MINIDSP_H
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <float.h>
#include <complex.h>
#include <fftw3.h>
double MD_dot(const double* const a, const double* const b, const unsigned N);
double MD_entropy(const double* const a, const unsigned N, const bool clip);
double MD_energy(const double* const a, const unsigned N);
double MD_power(const double* const a, const unsigned N);
double MD_power_db(const double* const a, const unsigned N);
double MD_scale(const double in, const double oldmin, const double oldmax,
const double newmin, const double newmax);
void MD_scale_vec(double* const in, double* const out, const unsigned N,
const double oldmin, const double oldmax,
const double newmin, const double newmax);
void MD_fit_within_range(double* const in, double* const out,
const unsigned N, const double newmin,
const double newmax);
void MD_adjust_dblevel(const double* const in, double* const out,
const unsigned N, const double dblevel);
void MD_Gen_Hann_Win(double* out, unsigned n);
void MD_shutdown(void);
/**
* Possible weighting types for Generalized Cross Correlation.
*
*/
enum MD_GCC_WEIGHTING_TYPE {
SIMP, /**< Simple \f$1/N\f$ weighting */
PHAT /**< Phase Transform (PHAT) weighting */
};
/*
* Routines for computing delays between signals
*/
void MD_get_multiple_delays(const double** const sigs, const unsigned M, const unsigned N,
const unsigned margin, const int weightfunc, int* outdelays);
int MD_get_delay(const double* const siga, const double* const sigb, const unsigned N,
double* const ent,
const unsigned margin,
const int weightfunc);
void MD_gcc(const double* const siga, const double* const sigb, const unsigned N,
double* const lagvals, const int weightfunc);
#endif