From: Paul Brossier Date: Wed, 16 Sep 2009 23:25:10 +0000 (+0200) Subject: src/spectral/filterbank.{c,h}: indent X-Git-Tag: bzr2git~359 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3b3b03e80b53e26cf812f2fca0387bc71b221089;p=aubio.git src/spectral/filterbank.{c,h}: indent --- diff --git a/src/spectral/filterbank.c b/src/spectral/filterbank.c index 8b1fdf8f..516b30b7 100644 --- a/src/spectral/filterbank.c +++ b/src/spectral/filterbank.c @@ -28,61 +28,70 @@ #define VERY_SMALL_NUMBER 2e-42 /** \brief A structure to store a set of n_filters filters of lenghts win_s */ -struct aubio_filterbank_t_ { - uint_t win_s; - uint_t n_filters; - fvec_t *filters; +struct aubio_filterbank_t_ +{ + uint_t win_s; + uint_t n_filters; + fvec_t *filters; }; -aubio_filterbank_t * new_aubio_filterbank(uint_t n_filters, uint_t win_s){ +aubio_filterbank_t * +new_aubio_filterbank (uint_t n_filters, uint_t win_s) +{ /* allocate space for filterbank object */ - aubio_filterbank_t * fb = AUBIO_NEW(aubio_filterbank_t); - fb->win_s=win_s; - fb->n_filters=n_filters; + aubio_filterbank_t *fb = AUBIO_NEW (aubio_filterbank_t); + fb->win_s = win_s; + fb->n_filters = n_filters; /* allocate filter tables, an fvec of length win_s and of filter_cnt channel */ - fb->filters = new_fvec(win_s, n_filters); + fb->filters = new_fvec (win_s, n_filters); return fb; } -void del_aubio_filterbank(aubio_filterbank_t * fb){ - del_fvec(fb->filters); - AUBIO_FREE(fb); +void +del_aubio_filterbank (aubio_filterbank_t * fb) +{ + del_fvec (fb->filters); + AUBIO_FREE (fb); } -void aubio_filterbank_do(aubio_filterbank_t * f, cvec_t * in, fvec_t *out) { +void +aubio_filterbank_do (aubio_filterbank_t * f, cvec_t * in, fvec_t * out) +{ uint_t i, j, fn; /* apply filter to all input channel, provided out has enough channels */ - uint_t max_channels = MIN(in->channels, out->channels); - uint_t max_filters = MIN(f->n_filters, out->length); + uint_t max_channels = MIN (in->channels, out->channels); + uint_t max_filters = MIN (f->n_filters, out->length); /* reset all values in output vector */ - fvec_zeros(out); + fvec_zeros (out); /* apply filters on all channels */ for (i = 0; i < max_channels; i++) { /* for each filter */ - for(fn = 0; fn < max_filters; fn++) { + for (fn = 0; fn < max_filters; fn++) { /* for each sample */ - for(j = 0; j < in->length; j++) { - out->data[i][fn] += in->norm[i][j] * f->filters->data[fn][j]; + for (j = 0; j < in->length; j++) { + out->data[i][fn] += in->norm[i][j] * f->filters->data[fn][j]; } /* threshold to VERY_SMALL_NUMBER to avoid log oveflow */ - out->data[i][fn] = MAX(VERY_SMALL_NUMBER, out->data[i][fn]); + out->data[i][fn] = MAX (VERY_SMALL_NUMBER, out->data[i][fn]); /* compute logarithm */ - out->data[i][fn] = LOG(out->data[i][fn]); + out->data[i][fn] = LOG (out->data[i][fn]); } } return; } -fvec_t * aubio_filterbank_get_coeffs(aubio_filterbank_t * f) { +fvec_t * +aubio_filterbank_get_coeffs (aubio_filterbank_t * f) +{ return f->filters; } diff --git a/src/spectral/filterbank.h b/src/spectral/filterbank.h index 4c8b04ee..44d36d47 100644 --- a/src/spectral/filterbank.h +++ b/src/spectral/filterbank.h @@ -31,7 +31,8 @@ #define FILTERBANK_H #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif /** filterbank object */ @@ -44,14 +45,14 @@ typedef struct aubio_filterbank_t_ aubio_filterbank_t; */ -aubio_filterbank_t * new_aubio_filterbank(uint_t n_filters, uint_t win_s); +aubio_filterbank_t *new_aubio_filterbank (uint_t n_filters, uint_t win_s); /** destroy filterbank object \param fb filterbank, as returned by new_aubio_filterbank method */ -void del_aubio_filterbank(aubio_filterbank_t * fb); +void del_aubio_filterbank (aubio_filterbank_t * fb); /** compute filterbank @@ -60,17 +61,17 @@ void del_aubio_filterbank(aubio_filterbank_t * fb); \param out output vector containing chans x nfilt output values */ -void aubio_filterbank_do(aubio_filterbank_t * fb, cvec_t * in, fvec_t *out); +void aubio_filterbank_do (aubio_filterbank_t * fb, cvec_t * in, fvec_t * out); /** return a pointer to the fvec object containing all filter coefficients \param f filterbank object to get coefficients from */ -fvec_t * aubio_filterbank_get_coeffs(aubio_filterbank_t * f); +fvec_t *aubio_filterbank_get_coeffs (aubio_filterbank_t * f); #ifdef __cplusplus } #endif -#endif // FILTERBANK_H +#endif // FILTERBANK_H