fvec_t * hist;
uint_t nelems;
uint_t channels;
- smpl_t * cent;
+ fvec_t * cent;
aubio_scale_t *scaler;
};
s->channels = channels;
s->nelems = nelems;
s->hist = new_fvec(nelems, channels);
- s->cent = AUBIO_ARRAY(smpl_t, nelems);
+ s->cent = new_fvec(nelems, 1);
/* use scale to map ilow/ihig -> 0/nelems */
s->scaler = new_aubio_scale(ilow,ihig,0,nelems);
/* calculate centers now once */
- s->cent[0] = ilow + 0.5 * step;
+ s->cent->data[0][0] = ilow + 0.5 * step;
for (i=1; i < s->nelems; i++, accum+=step )
- s->cent[i] = s->cent[0] + accum;
+ s->cent->data[0][i] = s->cent->data[0][0] + accum;
return s;
}
void del_aubio_hist(aubio_hist_t *s) {
del_fvec(s->hist);
- AUBIO_FREE(s->cent);
+ del_fvec(s->cent);
del_aubio_scale(s->scaler);
AUBIO_FREE(s);
}
aubio_scale_set(s->scaler, ilow, ihig, 0, s->nelems);
/* recalculate centers */
- s->cent[0] = ilow + 0.5f * step;
+ s->cent->data[0][0] = ilow + 0.5f * step;
for (i=1; i < s->nelems; i++)
- s->cent[i] = s->cent[0] + i * step;
+ s->cent->data[0][i] = s->cent->data[0][0] + i * step;
/* scale */
aubio_scale_do(s->scaler, input);
uint_t i,j;
for (i=0; i < s->channels; i++)
for (j=0; j < s->nelems; j++) {
- s->hist->data[i][j] *= s->cent[j];
+ s->hist->data[i][j] *= s->cent->data[0][j];
}
}