comparison src/scalar.c @ 47:c20e91e86f08

xtract_magnitude_spectrum() and xtract_peaks() share format of N/2 frequency values and N/2 magnitude coefficients. 'Fixed' xtract_loudness() so that N=1 can be used for specific loudness.
author Jamie Bullock <jamie@postlude.co.uk>
date Thu, 21 Dec 2006 11:31:51 +0000
parents 4725bee447c2
children 8703c202a247
comparison
equal deleted inserted replaced
46:4725bee447c2 47:c20e91e86f08
289 return SUCCESS; 289 return SUCCESS;
290 } 290 }
291 291
292 int xtract_loudness(const float *data, const int N, const void *argv, float *result){ 292 int xtract_loudness(const float *data, const int N, const void *argv, float *result){
293 293
294 int n = BARK_BANDS; 294 int n = N, rv;
295 295
296 /*if(n != N) return BAD_VECTOR_SIZE; */ 296 if(n > BARK_BANDS)
297 rv = BAD_VECTOR_SIZE;
298 else
299 rv = SUCCESS;
297 300
298 while(n--) 301 while(n--)
299 *result += pow(data[n], 0.23); 302 *result += pow(data[n], 0.23);
300 303
301 return SUCCESS; 304 return rv;
302 } 305 }
303 306
304 int xtract_flatness(const float *data, const int N, const void *argv, float *result){ 307 int xtract_flatness(const float *data, const int N, const void *argv, float *result){
305 308
306 int n; 309 int n;