diff options
author | Jamie Bullock <jamie@postlude.co.uk> | 2008-02-15 12:43:13 +0000 |
---|---|---|
committer | Jamie Bullock <jamie@postlude.co.uk> | 2008-02-15 12:43:13 +0000 |
commit | e876da1b38221d8020d81b72926d2dee5c2bdc55 (patch) | |
tree | 5795d6dca0e668a43298f1099a61f19831f419f7 /src/helper.c | |
parent | 24738b0d1371876dc18cb21b516b3e43984e6dbc (diff) | |
download | LibXtract-e876da1b38221d8020d81b72926d2dee5c2bdc55.tar.gz LibXtract-e876da1b38221d8020d81b72926d2dee5c2bdc55.tar.bz2 LibXtract-e876da1b38221d8020d81b72926d2dee5c2bdc55.zip |
- Fixed bugs in xtract_flatness(), or at least added necessary
documentation and error checking to avoid problems
- Added xtract_is_denormal() helper function and XTRACT_DENORMAL_FOUND
return code
- Replaced all instances of log, sqrt, exp etc. with respective
floating point counterparts (logf etc.)
- Added check for architecture endianness to configure script
- Bug fix to PD example, now no longer crashes if no arguments are
given
- Minor documentation updates
Diffstat (limited to 'src/helper.c')
-rw-r--r-- | src/helper.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/helper.c b/src/helper.c index 60b3af7..e9e79e5 100644 --- a/src/helper.c +++ b/src/helper.c @@ -21,8 +21,18 @@ /* helper.c: helper functions. */ +#include <config.h> + +#include <stdio.h> + #include "xtract/libxtract.h" +#ifdef WORDS_BIGENDIAN +#define INDEX 0 +#else +#define INDEX 1 +#endif + int xtract_windowed(const float *data, const int N, const void *argv, float *result){ int n; @@ -45,8 +55,7 @@ int xtract_features_from_subframes(const float *data, const int N, const int fea float *result1, *result2; - int n, i, - rv; + int n, rv; n = N >> 1; @@ -63,3 +72,12 @@ int xtract_features_from_subframes(const float *data, const int N, const int fea return rv; } + +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"); + + int l = ((int *)&d)[INDEX]; + return (l&0x7ff00000) == 0 && d!=0; //Check for 0 may not be necessary +} + |