diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/fini.c | 48 | ||||
-rw-r--r-- | src/xtract_globals_private.h | 36 |
2 files changed, 84 insertions, 0 deletions
diff --git a/src/fini.c b/src/fini.c new file mode 100644 index 0000000..3ec9133 --- /dev/null +++ b/src/fini.c @@ -0,0 +1,48 @@ +/* libxtract feature extraction library + * + * Copyright (C) 2006 Jamie Bullock + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + */ + +/* fini.c: Contains library destructor routine */ + +#ifdef XTRACT_FFT +#include <fftw3.h> +#include "xtract_globals_private.h" +#endif + +#ifdef __GNUC__ +__attribute__((destructor)) void fini() +#else +void _fini() +#endif +{ +#ifdef XTRACT_FFT + if(spectrum_plan != NULL) + fftwf_destroy_plan(spectrum_plan); + if(autocorrelation_fft_plan_1 != NULL) + fftwf_destroy_plan(autocorrelation_fft_plan_1); + if(autocorrelation_fft_plan_2 != NULL) + fftwf_destroy_plan(autocorrelation_fft_plan_2); + if(dct_plan != NULL) + fftwf_destroy_plan(dct_plan); + fftwf_cleanup(); +#endif +} + + + diff --git a/src/xtract_globals_private.h b/src/xtract_globals_private.h new file mode 100644 index 0000000..ab96044 --- /dev/null +++ b/src/xtract_globals_private.h @@ -0,0 +1,36 @@ +/* libxtract feature extraction library + * + * Copyright (C) 2006 Jamie Bullock + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + */ + +/* xtract_globals_private.h: declares private global variables */ + +#ifndef XTRACT_GLOBALS_PRIVATE_H +#define XTRACT_GLOBALS_PRIVATE_H + +#ifdef XTRACT_FFT +#include <fftw3.h> + +fftwf_plan spectrum_plan, + autocorrelation_fft_plan_1, + autocorrelation_fft_plan_2, + dct_plan; +#endif + +#endif + |