Changeset 812b376


Ignore:
Timestamp:
Nov 4, 2007, 4:44:54 PM (16 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
3c707f7
Parents:
274839f
Message:

hist.c: move hist cent to a structure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/hist.c

    r274839f r812b376  
    3131        uint_t nelems;
    3232        uint_t channels;
    33         smpl_t * cent;
     33        fvec_t * cent;
    3434        aubio_scale_t *scaler;
    3535};
     
    4646        s->nelems = nelems;
    4747  s->hist = new_fvec(nelems, channels);
    48         s->cent = AUBIO_ARRAY(smpl_t, nelems);
     48        s->cent = new_fvec(nelems, 1);
    4949       
    5050        /* use scale to map ilow/ihig -> 0/nelems */
    5151        s->scaler = new_aubio_scale(ilow,ihig,0,nelems);
    5252        /* calculate centers now once */
    53         s->cent[0] = ilow + 0.5 * step;
     53        s->cent->data[0][0] = ilow + 0.5 * step;
    5454        for (i=1; i < s->nelems; i++, accum+=step )
    55                 s->cent[i] = s->cent[0] + accum;
     55                s->cent->data[0][i] = s->cent->data[0][0] + accum;
    5656       
    5757        return s;       
     
    6060void del_aubio_hist(aubio_hist_t *s) {
    6161  del_fvec(s->hist);
    62         AUBIO_FREE(s->cent);
     62        del_fvec(s->cent);
    6363        del_aubio_scale(s->scaler);
    6464        AUBIO_FREE(s);
     
    121121
    122122        /* recalculate centers */
    123         s->cent[0] = ilow + 0.5f * step;
     123        s->cent->data[0][0] = ilow + 0.5f * step;
    124124        for (i=1; i < s->nelems; i++)
    125                 s->cent[i] = s->cent[0] + i * step;
     125                s->cent->data[0][i] = s->cent->data[0][0] + i * step;
    126126
    127127        /* scale */     
     
    149149        for (i=0; i < s->channels; i++)
    150150                for (j=0; j < s->nelems; j++) {
    151                         s->hist->data[i][j] *= s->cent[j];
     151                        s->hist->data[i][j] *= s->cent->data[0][j];
    152152                }
    153153}
Note: See TracChangeset for help on using the changeset viewer.