jamie@107
|
1 /* libxtract feature extraction library
|
jamie@107
|
2 *
|
jamie@107
|
3 * Copyright (C) 2006 Jamie Bullock
|
jamie@107
|
4 *
|
jamie@107
|
5 * This program is free software; you can redistribute it and/or modify
|
jamie@107
|
6 * it under the terms of the GNU General Public License as published by
|
jamie@107
|
7 * the Free Software Foundation; either version 2 of the License, or
|
jamie@107
|
8 * (at your option) any later version.
|
jamie@107
|
9 *
|
jamie@107
|
10 * This program is distributed in the hope that it will be useful,
|
jamie@107
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
jamie@107
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
jamie@107
|
13 * GNU General Public License for more details.
|
jamie@107
|
14 *
|
jamie@107
|
15 * You should have received a copy of the GNU General Public License
|
jamie@107
|
16 * along with this program; if not, write to the Free Software
|
jamie@107
|
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
jamie@107
|
18 * USA.
|
jamie@107
|
19 */
|
jamie@107
|
20
|
jamie@107
|
21 /** \file xtract_helper.h: helper functions for making life with libxtract a bit more bearable */
|
jamie@107
|
22
|
jamie@107
|
23 #ifndef XTRACT_HELPER_H
|
jamie@107
|
24 #define XTRACT_HELPER_H
|
jamie@107
|
25
|
jamie@107
|
26 #ifdef __cplusplus
|
jamie@107
|
27 extern "C" {
|
jamie@107
|
28 #endif
|
jamie@107
|
29
|
jamie@107
|
30 /**
|
jamie@107
|
31 * \defgroup helper helper functions
|
jamie@107
|
32 *
|
jamie@107
|
33 * Declares helper functions, and their parameters.
|
jamie@107
|
34 *
|
jamie@107
|
35 * \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
|
36 *
|
jamie@107
|
37 * @{
|
jamie@107
|
38 */
|
jamie@107
|
39
|
jamie@107
|
40 /** \brief Apply a window function to an array of length N
|
jamie@107
|
41 *
|
jamie@107
|
42 * \param *data a pointer to an array of floats
|
jamie@107
|
43 * \param N the number of elements in the array pointed to by *data
|
jamie@107
|
44 * \param *argv a pointer to a window function as returned by xtract_make_window()
|
jamie@107
|
45 * \param *result a pointer to the first element an array containing the windowed data
|
jamie@107
|
46 *
|
jamie@107
|
47 * 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
|
48 *
|
jamie@107
|
49 */
|
jamie@107
|
50 int xtract_windowed(const float *data, const int N, const void *argv, float *result);
|
jamie@107
|
51
|
jamie@107
|
52 /** \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
|
53 *
|
jamie@107
|
54 * \param *data an array of floats
|
jamie@107
|
55 * \param N the number of elements in the array pointed by *data
|
jamie@107
|
56 * \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
|
57 * \param *argv a pointer to the argument vector to be passed to the feature extraction function as determined by feature
|
jamie@107
|
58 * \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
|
59 *
|
jamie@108
|
60 *
|
jamie@108
|
61 * 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
|
62 *
|
jamie@107
|
63 */
|
jamie@107
|
64 int xtract_features_from_subframes(const float *data, const int N, const int feature, const void *argv, float *result);
|
jamie@107
|
65
|
jamie@113
|
66 /** \brief Test whether a number is denormal */
|
jamie@120
|
67 int xtract_is_denormal(double const d);
|
jamie@113
|
68
|
jamie@107
|
69 /** @} */
|
jamie@107
|
70
|
jamie@107
|
71 #ifdef __cplusplus
|
jamie@107
|
72 }
|
jamie@107
|
73 #endif
|
jamie@107
|
74
|
jamie@107
|
75 #endif
|
jamie@107
|
76
|
jamie@107
|
77
|
jamie@107
|
78
|