jamie@107: /* libxtract feature extraction library jamie@107: * jamie@107: * Copyright (C) 2006 Jamie Bullock jamie@107: * jamie@107: * This program is free software; you can redistribute it and/or modify jamie@107: * it under the terms of the GNU General Public License as published by jamie@107: * the Free Software Foundation; either version 2 of the License, or jamie@107: * (at your option) any later version. jamie@107: * jamie@107: * This program is distributed in the hope that it will be useful, jamie@107: * but WITHOUT ANY WARRANTY; without even the implied warranty of jamie@107: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jamie@107: * GNU General Public License for more details. jamie@107: * jamie@107: * You should have received a copy of the GNU General Public License jamie@107: * along with this program; if not, write to the Free Software jamie@107: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, jamie@107: * USA. jamie@107: */ jamie@107: jamie@107: /** \file xtract_helper.h: helper functions for making life with libxtract a bit more bearable */ jamie@107: jamie@107: #ifndef XTRACT_HELPER_H jamie@107: #define XTRACT_HELPER_H jamie@107: jamie@107: #ifdef __cplusplus jamie@107: extern "C" { jamie@107: #endif jamie@107: jamie@107: /** jamie@107: * \defgroup helper helper functions jamie@107: * jamie@107: * Declares helper functions, and their parameters. jamie@107: * jamie@107: * \note These functions don't necessarily conform to the prototype used in xtract_scalar.h and xtract_vector.h etc, and as such are intended to be called 'directly' rather than via the xtract[] function pointer array (libxtract.h) jamie@107: * jamie@107: * @{ jamie@107: */ jamie@107: jamie@107: /** \brief Apply a window function to an array of length N jamie@107: * jamie@107: * \param *data a pointer to an array of floats jamie@107: * \param N the number of elements in the array pointed to by *data jamie@107: * \param *argv a pointer to a window function as returned by xtract_make_window() jamie@107: * \param *result a pointer to the first element an array containing the windowed data jamie@107: * jamie@107: * It is up to the caller to generate and free the array containing the window, and to allocate and free memory of size N to hold the data pointed to by *result jamie@107: * jamie@107: */ jamie@107: int xtract_windowed(const float *data, const int N, const void *argv, float *result); jamie@107: jamie@107: /** \brief Divides the array pointed to by *data into two subframes, and applies a given feature to each subframe, returning them in a single array pointed to by result jamie@107: * jamie@107: * \param *data an array of floats jamie@107: * \param N the number of elements in the array pointed by *data jamie@107: * \param feature an integer representing the feature to be applied to each subframe in data. This will be a value as given in the enumeration xtract_features_ (libxtract.h) jamie@107: * \param *argv a pointer to the argument vector to be passed to the feature extraction function as determined by feature jamie@107: * \param *result a pointer to the 'packed' results of the feature calculation. This may be passed in as *data to xtract_features_from_subframes() to calculate further features on the subframes, or xtract_difference_vector(), to get the difference between the subframes. jamie@107: * jamie@108: * jamie@108: * It is important to ensure that any _init_*() functions that are called in preparation for functions that are called on subframes are given the subframe size as 'N', and not the frame size. i.e. if xtract_features_from_subframes() is called with N=64, and feature=XTRACT_SPECTRUM, then xtract_init_fft() should be called with N=32. jamie@108: * jamie@107: */ jamie@107: int xtract_features_from_subframes(const float *data, const int N, const int feature, const void *argv, float *result); jamie@107: jamie@113: /** \brief Test whether a number is denormal */ jamie@120: int xtract_is_denormal(double const d); jamie@113: jamie@107: /** @} */ jamie@107: jamie@107: #ifdef __cplusplus jamie@107: } jamie@107: #endif jamie@107: jamie@107: #endif jamie@107: jamie@107: jamie@107: