aboutsummaryrefslogtreecommitdiff
path: root/src/helper.c
diff options
context:
space:
mode:
authorJamie Bullock <jamie@jamiebullock.com>2013-01-07 16:27:15 +0000
committerJamie Bullock <jamie@jamiebullock.com>2013-01-07 16:39:29 +0000
commit144e7f8668166ee1779ad304cc5ac94d8e525529 (patch)
tree089b2bbbcf15ee8bdde390a4d270e4812e7e2228 /src/helper.c
parent0f46938156dedf13032bdb1fc914a63d46bae558 (diff)
downloadLibXtract-144e7f8668166ee1779ad304cc5ac94d8e525529.tar.gz
LibXtract-144e7f8668166ee1779ad304cc5ac94d8e525529.tar.bz2
LibXtract-144e7f8668166ee1779ad304cc5ac94d8e525529.zip
added Ooura implementation to repository
Diffstat (limited to 'src/helper.c')
-rw-r--r--src/helper.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/helper.c b/src/helper.c
index e9e79e5..4fd9975 100644
--- a/src/helper.c
+++ b/src/helper.c
@@ -1,5 +1,5 @@
/* libxtract feature extraction library
- *
+ *
* Copyright (C) 2006 Jamie Bullock
*
* This program is free software; you can redistribute it and/or modify
@@ -14,7 +14,7 @@
*
* 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,
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
@@ -33,7 +33,8 @@
#define INDEX 1
#endif
-int xtract_windowed(const float *data, const int N, const void *argv, float *result){
+int xtract_windowed(const float *data, const int N, const void *argv, float *result)
+{
int n;
const float *window;
@@ -48,7 +49,8 @@ int xtract_windowed(const float *data, const int N, const void *argv, float *res
}
-int xtract_features_from_subframes(const float *data, const int N, const int feature, const void *argv, float *result){
+int xtract_features_from_subframes(const float *data, const int N, const int feature, const void *argv, float *result)
+{
const float *frame1,
*frame2;
@@ -73,7 +75,8 @@ int xtract_features_from_subframes(const float *data, const int N, const int fea
}
-inline int xtract_is_denormal(double const d){
+inline int xtract_is_denormal(double const d)
+{
if(sizeof(d) != 2 * sizeof(int))
fprintf(stderr, "libxtract: Error: xtract_is_denormal() detects inconsistent wordlength for type 'double'\n");
@@ -81,3 +84,8 @@ inline int xtract_is_denormal(double const d){
return (l&0x7ff00000) == 0 && d!=0; //Check for 0 may not be necessary
}
+inline bool xtract_is_poweroftwo(unsigned int x)
+{
+ return ((x != 0) && !(x & (x - 1)));
+}
+