annotate src/xtract_macros_private.h @ 124:fc4bc58b92da

- fixed xtract_spread() -- now just calls xtract_spectral_variance()
author Jamie Bullock <jamie@postlude.co.uk>
date Thu, 31 Mar 2011 12:22:29 +0000
parents d9c5cd78abaa
children e4f704649c50
rev   line source
jamie@57 1 /* libxtract feature extraction library
jamie@57 2 *
jamie@57 3 * Copyright (C) 2006 Jamie Bullock
jamie@57 4 *
jamie@57 5 * This program is free software; you can redistribute it and/or modify
jamie@57 6 * it under the terms of the GNU General Public License as published by
jamie@57 7 * the Free Software Foundation; either version 2 of the License, or
jamie@57 8 * (at your option) any later version.
jamie@57 9 *
jamie@57 10 * This program is distributed in the hope that it will be useful,
jamie@57 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jamie@57 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
jamie@57 13 * GNU General Public License for more details.
jamie@57 14 *
jamie@57 15 * You should have received a copy of the GNU General Public License
jamie@57 16 * along with this program; if not, write to the Free Software
jamie@57 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
jamie@57 18 * USA.
jamie@57 19 */
jamie@57 20
jamie@57 21 /** \file xtract_macros_private.h: defines useful internal macros */
jamie@57 22
jamie@57 23 #ifndef XTRACT_MACROS_PRIVATE_H
jamie@57 24 #define XTRACT_MACROS_PRIVATE_H
jamie@57 25
jamie@57 26 #include <stdio.h>
jamie@57 27
jamie@57 28 #define XTRACT_SQ(a) ((a) * (a))
jamie@57 29 #define XTRACT_MIN(a, b) ((a) < (b) ? (a) : (b))
jamie@57 30 #define XTRACT_MAX(a, b) ((a) > (b) ? (a) : (b))
jamie@57 31 #define XTRACT_NEEDS_FFTW printf("LibXtract must be compiled with fftw support to use this function.\n")
jamie@57 32 #define XTRACT_VERY_SMALL_NUMBER 2e-42
jamie@57 33 #define XTRACT_LOG_LIMIT XTRACT_VERY_SMALL_NUMBER
jamie@73 34 #define XTRACT_LOG_LIMIT_DB -96.0
jamie@73 35 #define XTRACT_DB_SCALE_OFFSET 96.0
jamie@57 36 #define XTRACT_VERY_BIG_NUMBER 2e42
jamie@73 37 #define XTRACT_SR_UPPER_LIMIT 192000.0
jamie@73 38 #define XTRACT_SR_LOWER_LIMIT 22050.0
jamie@73 39 #define XTRACT_SR_DEFAULT 44100.0
jamie@73 40 #define XTRACT_FUNDAMENTAL_DEFAULT 440.0
jamie@57 41 #define XTRACT_CHECK_nyquist if(!nyquist) nyquist = XTRACT_SR_DEFAULT / 2
jamie@57 42 #define XTRACT_CHECK_q if(!q) q = XTRACT_SR_DEFAULT / N
jamie@120 43 #define XTRACT_GET_MAX max = result[m] > max ? result[m] : max
jamie@120 44 #define XTRACT_SET_FREQUENCY result[M + m] = n * q
jamie@59 45 #define XTRACT_IS_ODD(x) (x % 2 != 0 ? 1 : 0)
jamie@57 46 #define XTRACT_SR_LIMIT SR_UPPER_LIMIT
jamie@57 47 #define XTRACT_FFT_BANDS_MIN 16
jamie@57 48 #define XTRACT_FFT_BANDS_MAX 65536
jamie@57 49 #define XTRACT_FFT_BANDS_DEF 1024
jamie@57 50 #define XTRACT_SPEC_BW_MIN 0.168 /* Minimum spectral bandwidth \
jamie@57 51 (= SR_LOWER_LIMIT / FFT_BANDS_MAX*/
jamie@73 52 #define XTRACT_SPEC_BW_MAX 12000.0 /* SR_UPPER_LIMIT / FFT_BANDS_MIN */
jamie@57 53 #define XTRACT_SPEC_BW_DEF 43.066 /* SR_DEFAULT / FFT_BANDS_DEF */
jamie@98 54 #define XTRACT_ARRAY_ELEMENTS(_array) (sizeof(_array)/sizeof(_array[0]))
jamie@57 55
jamie@57 56 #endif