Chris@0
|
1 /*
|
Chris@0
|
2 ** Copyright (C) 2002-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
|
Chris@0
|
3 **
|
Chris@0
|
4 ** This program is free software; you can redistribute it and/or modify
|
Chris@0
|
5 ** it under the terms of the GNU General Public License as published by
|
Chris@0
|
6 ** the Free Software Foundation; either version 2 of the License, or
|
Chris@0
|
7 ** (at your option) any later version.
|
Chris@0
|
8 **
|
Chris@0
|
9 ** This program is distributed in the hope that it will be useful,
|
Chris@0
|
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
Chris@0
|
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
Chris@0
|
12 ** GNU General Public License for more details.
|
Chris@0
|
13 **
|
Chris@0
|
14 ** You should have received a copy of the GNU General Public License
|
Chris@0
|
15 ** along with this program; if not, write to the Free Software
|
Chris@0
|
16 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
Chris@0
|
17 */
|
Chris@0
|
18
|
Chris@0
|
19 #define ABS(a) (((a) < 0) ? - (a) : (a))
|
Chris@0
|
20 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
Chris@0
|
21 #define MAX(a,b) (((a) >= (b)) ? (a) : (b))
|
Chris@0
|
22
|
Chris@0
|
23 #define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof ((x) [0])))
|
Chris@0
|
24
|
Chris@0
|
25 void gen_windowed_sines (int freq_count, const double *freqs, double max, float *output, int output_len) ;
|
Chris@0
|
26
|
Chris@0
|
27 void save_oct_float (char *filename, float *input, int in_len, float *output, int out_len) ;
|
Chris@0
|
28 void save_oct_double (char *filename, double *input, int in_len, double *output, int out_len) ;
|
Chris@0
|
29
|
Chris@0
|
30 void interleave_data (const float *in, float *out, int frames, int channels) ;
|
Chris@0
|
31
|
Chris@0
|
32 void deinterleave_data (const float *in, float *out, int frames, int channels) ;
|
Chris@0
|
33
|
Chris@0
|
34 void reverse_data (float *data, int datalen) ;
|
Chris@0
|
35
|
Chris@0
|
36 double calculate_snr (float *data, int len, int expected_peaks) ;
|
Chris@0
|
37
|
Chris@0
|
38 const char * get_cpu_name (void) ;
|
Chris@0
|
39
|
Chris@0
|
40 #if OS_IS_WIN32
|
Chris@0
|
41 /*
|
Chris@0
|
42 ** Extra Win32 hacks.
|
Chris@0
|
43 **
|
Chris@0
|
44 ** Despite Microsoft claim of windows being POSIX compatibile it has '_sleep'
|
Chris@0
|
45 ** instead of 'sleep'.
|
Chris@0
|
46 */
|
Chris@0
|
47
|
Chris@0
|
48 #define sleep _sleep
|
Chris@0
|
49 #endif
|
Chris@0
|
50
|