Debian Codegraph @

tests/util.h

raw
1 /*
2 ** Copyright (c) 2002-2016, Erik de Castro Lopo <[email protected]>
3 ** All rights reserved.
4 **
5 ** This code is released under 2-clause BSD license. Please see the
6 ** file at : https://github.com/libsndfile/libsamplerate/blob/master/COPYING
7 */
8
9 #define ABS(a) (((a) < 0) ? - (a) : (a))
10
11 #ifndef MAX
12 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
13 #endif
14
15 #ifndef MIN
16 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
17 #endif
18
19 #define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof ((x) [0])))
20
21 void gen_windowed_sines (int freq_count, const double *freqs, double max, float *output, int output_len) ;
22
23 void save_oct_float (char *filename, float *input, int in_len, float *output, int out_len) ;
24 void save_oct_double (char *filename, double *input, int in_len, double *output, int out_len) ;
25
26 void interleave_data (const float *in, float *out, int frames, int channels) ;
27
28 void deinterleave_data (const float *in, float *out, int frames, int channels) ;
29
30 void reverse_data (float *data, int datalen) ;
31
32 double calculate_snr (float *data, int len, int expected_peaks) ;
33
34 const char * get_cpu_name (void) ;
35
36 #define ASSERT(condition) \
37 if (!(condition)) \
38 { printf ("Condition failed on Line %d : %s\n\n", __LINE__, #condition) ; \
39 exit (1) ; \
40 } ;
41