cannam@85: /* cannam@85: ** Copyright (C) 2002-2011 Erik de Castro Lopo cannam@85: ** cannam@85: ** This program is free software; you can redistribute it and/or modify cannam@85: ** it under the terms of the GNU General Public License as published by cannam@85: ** the Free Software Foundation; either version 2 of the License, or cannam@85: ** (at your option) any later version. cannam@85: ** cannam@85: ** This program is distributed in the hope that it will be useful, cannam@85: ** but WITHOUT ANY WARRANTY; without even the implied warranty of cannam@85: ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the cannam@85: ** GNU General Public License for more details. cannam@85: ** cannam@85: ** You should have received a copy of the GNU General Public License cannam@85: ** along with this program; if not, write to the Free Software cannam@85: ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. cannam@85: */ cannam@85: cannam@85: #define ABS(a) (((a) < 0) ? - (a) : (a)) cannam@85: #define MIN(a,b) (((a) < (b)) ? (a) : (b)) cannam@85: #define MAX(a,b) (((a) >= (b)) ? (a) : (b)) cannam@85: cannam@85: #define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof ((x) [0]))) cannam@85: cannam@85: void gen_windowed_sines (int freq_count, const double *freqs, double max, float *output, int output_len) ; cannam@85: cannam@85: void save_oct_float (char *filename, float *input, int in_len, float *output, int out_len) ; cannam@85: void save_oct_double (char *filename, double *input, int in_len, double *output, int out_len) ; cannam@85: cannam@85: void interleave_data (const float *in, float *out, int frames, int channels) ; cannam@85: cannam@85: void deinterleave_data (const float *in, float *out, int frames, int channels) ; cannam@85: cannam@85: void reverse_data (float *data, int datalen) ; cannam@85: cannam@85: double calculate_snr (float *data, int len, int expected_peaks) ; cannam@85: cannam@85: const char * get_cpu_name (void) ; cannam@85: cannam@85: #if OS_IS_WIN32 cannam@85: /* cannam@85: ** Extra Win32 hacks. cannam@85: ** cannam@85: ** Despite Microsoft claim of windows being POSIX compatibile it has '_sleep' cannam@85: ** instead of 'sleep'. cannam@85: */ cannam@85: cannam@85: #define sleep _sleep cannam@85: #endif cannam@85: