annotate src/libsamplerate-0.1.8/tests/util.h @ 85:545efbb81310

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