diff options
author | Jamie Bullock <jamie@postlude.co.uk> | 2007-01-21 14:40:23 +0000 |
---|---|---|
committer | Jamie Bullock <jamie@postlude.co.uk> | 2007-01-21 14:40:23 +0000 |
commit | 64d6de56068584a090e555abf49a16d6bdf97696 (patch) | |
tree | d9c797059926b38069337aec6e872c9064387a7d /src/scalar.c | |
parent | 03faa4383048ec211eea920c6ec56544037191c9 (diff) | |
download | LibXtract-64d6de56068584a090e555abf49a16d6bdf97696.tar.gz LibXtract-64d6de56068584a090e555abf49a16d6bdf97696.tar.bz2 LibXtract-64d6de56068584a090e555abf49a16d6bdf97696.zip |
Finished the essentials of descriptors.c
Diffstat (limited to 'src/scalar.c')
-rw-r--r-- | src/scalar.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/scalar.c b/src/scalar.c index 6e7faeb..68b5b19 100644 --- a/src/scalar.c +++ b/src/scalar.c @@ -374,18 +374,20 @@ int xtract_zcr(const float *data, const int N, const void *argv, float *result){ int xtract_rolloff(const float *data, const int N, const void *argv, float *result){ int n = N; - float pivot, temp; + float pivot, temp, percentile; pivot = temp = 0.f; + percentile = ((float *)argv)[1]; while(n--) pivot += data[n]; - pivot *= ((float *)argv)[0]; + pivot *= percentile / 100.f; for(n = 0; temp < pivot; n++) temp += data[n]; - *result = (n / (float)N) * (((float *)argv)[1] * .5); + *result = n * ((float *)argv)[0]; + /* *result = (n / (float)N) * (((float *)argv)[1] * .5); */ return SUCCESS; } |