Changeset 3b3b03e


Ignore:
Timestamp:
Sep 17, 2009, 1:25:10 AM (10 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
cfd35db
Parents:
06cae6c
Message:

src/spectral/filterbank.{c,h}: indent

Location:
src/spectral
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/spectral/filterbank.c

    r06cae6c r3b3b03e  
    2929
    3030/** \brief A structure to store a set of n_filters filters of lenghts win_s */
    31 struct aubio_filterbank_t_ {
    32     uint_t win_s;
    33     uint_t n_filters;
    34     fvec_t *filters;
     31struct aubio_filterbank_t_
     32{
     33  uint_t win_s;
     34  uint_t n_filters;
     35  fvec_t *filters;
    3536};
    3637
    37 aubio_filterbank_t * new_aubio_filterbank(uint_t n_filters, uint_t win_s){
     38aubio_filterbank_t *
     39new_aubio_filterbank (uint_t n_filters, uint_t win_s)
     40{
    3841  /* allocate space for filterbank object */
    39   aubio_filterbank_t * fb = AUBIO_NEW(aubio_filterbank_t);
    40   fb->win_s=win_s;
    41   fb->n_filters=n_filters;
     42  aubio_filterbank_t *fb = AUBIO_NEW (aubio_filterbank_t);
     43  fb->win_s = win_s;
     44  fb->n_filters = n_filters;
    4245
    4346  /* allocate filter tables, an fvec of length win_s and of filter_cnt channel */
    44   fb->filters = new_fvec(win_s, n_filters);
     47  fb->filters = new_fvec (win_s, n_filters);
    4548
    4649  return fb;
    4750}
    4851
    49 void del_aubio_filterbank(aubio_filterbank_t * fb){
    50   del_fvec(fb->filters);
    51   AUBIO_FREE(fb);
     52void
     53del_aubio_filterbank (aubio_filterbank_t * fb)
     54{
     55  del_fvec (fb->filters);
     56  AUBIO_FREE (fb);
    5257}
    5358
    54 void aubio_filterbank_do(aubio_filterbank_t * f, cvec_t * in, fvec_t *out) {
     59void
     60aubio_filterbank_do (aubio_filterbank_t * f, cvec_t * in, fvec_t * out)
     61{
    5562  uint_t i, j, fn;
    5663
    5764  /* apply filter to all input channel, provided out has enough channels */
    58   uint_t max_channels = MIN(in->channels, out->channels);
    59   uint_t max_filters  = MIN(f->n_filters, out->length);
     65  uint_t max_channels = MIN (in->channels, out->channels);
     66  uint_t max_filters = MIN (f->n_filters, out->length);
    6067
    6168  /* reset all values in output vector */
    62   fvec_zeros(out);
     69  fvec_zeros (out);
    6370
    6471  /* apply filters on all channels */
     
    6673
    6774    /* for each filter */
    68     for(fn = 0; fn < max_filters; fn++) {
     75    for (fn = 0; fn < max_filters; fn++) {
    6976
    7077      /* for each sample */
    71       for(j = 0; j < in->length; j++) {
    72           out->data[i][fn] += in->norm[i][j] * f->filters->data[fn][j];
     78      for (j = 0; j < in->length; j++) {
     79        out->data[i][fn] += in->norm[i][j] * f->filters->data[fn][j];
    7380      }
    7481
    7582      /* threshold to VERY_SMALL_NUMBER to avoid log oveflow */
    76       out->data[i][fn] = MAX(VERY_SMALL_NUMBER, out->data[i][fn]);
     83      out->data[i][fn] = MAX (VERY_SMALL_NUMBER, out->data[i][fn]);
    7784
    7885      /* compute logarithm */
    79       out->data[i][fn] = LOG(out->data[i][fn]);
     86      out->data[i][fn] = LOG (out->data[i][fn]);
    8087    }
    8188  }
     
    8491}
    8592
    86 fvec_t * aubio_filterbank_get_coeffs(aubio_filterbank_t * f) {
     93fvec_t *
     94aubio_filterbank_get_coeffs (aubio_filterbank_t * f)
     95{
    8796  return f->filters;
    8897}
  • src/spectral/filterbank.h

    r06cae6c r3b3b03e  
    3232
    3333#ifdef __cplusplus
    34 extern "C" {
     34extern "C"
     35{
    3536#endif
    3637
     
    4546*/
    4647
    47 aubio_filterbank_t * new_aubio_filterbank(uint_t n_filters, uint_t win_s);
     48aubio_filterbank_t *new_aubio_filterbank (uint_t n_filters, uint_t win_s);
    4849
    4950/** destroy filterbank object
     
    5253
    5354*/
    54 void del_aubio_filterbank(aubio_filterbank_t * fb);
     55void del_aubio_filterbank (aubio_filterbank_t * fb);
    5556
    5657/** compute filterbank
     
    6162
    6263*/
    63 void aubio_filterbank_do(aubio_filterbank_t * fb, cvec_t * in, fvec_t *out);
     64void aubio_filterbank_do (aubio_filterbank_t * fb, cvec_t * in, fvec_t * out);
    6465
    6566/** return a pointer to the fvec object containing all filter coefficients
     
    6869
    6970 */
    70 fvec_t * aubio_filterbank_get_coeffs(aubio_filterbank_t * f);
     71fvec_t *aubio_filterbank_get_coeffs (aubio_filterbank_t * f);
    7172
    7273#ifdef __cplusplus
     
    7475#endif
    7576
    76 #endif // FILTERBANK_H
     77#endif                          // FILTERBANK_H
Note: See TracChangeset for help on using the changeset viewer.