From c0b295c7380f35851e124b0cedd01e7620725bec Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 2 Oct 2009 02:05:23 +0200 Subject: [PATCH] src/mathutils.c: rename fvec_dc_removal to fvec_min_removal --- src/mathutils.c | 13 ++++++++----- src/mathutils.h | 4 ++-- src/pitch/pitchmcomb.c | 4 ++-- swig/aubio.i | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/mathutils.c b/src/mathutils.c index c92155e5..8e2a65a5 100644 --- a/src/mathutils.c +++ b/src/mathutils.c @@ -180,13 +180,16 @@ smpl_t fvec_alpha_norm(fvec_t * DF, smpl_t alpha) { return POW(tmp/DF->length,1./alpha); } -void fvec_dc_removal(fvec_t * mag) { - smpl_t mini = 0.; - uint_t length = mag->length, i=0, j; - mini = fvec_min(mag); - for (j=0;jchannels; i++) { + for (j = 0; j < o->length; j++) { mag->data[i][j] -= mini; } + } } void fvec_alpha_normalise(fvec_t * mag, uint_t alpha) { diff --git a/src/mathutils.h b/src/mathutils.h index 295de4b1..f01bee12 100644 --- a/src/mathutils.h +++ b/src/mathutils.h @@ -119,8 +119,8 @@ smpl_t fvec_local_hfc(fvec_t * f); * \bug should not use POW :( */ smpl_t fvec_alpha_norm(fvec_t * DF, smpl_t alpha); -/** dc(min) removal */ -void fvec_dc_removal(fvec_t * mag); +/** min removal */ +void fvec_min_removal(fvec_t * mag); /** alpha normalisation */ void fvec_alpha_normalise(fvec_t * mag, uint_t alpha); /** add a constant to all members of a vector */ diff --git a/src/pitch/pitchmcomb.c b/src/pitch/pitchmcomb.c index 68964a10..cf284b7a 100644 --- a/src/pitch/pitchmcomb.c +++ b/src/pitch/pitchmcomb.c @@ -158,9 +158,9 @@ void aubio_pitchmcomb_spectral_pp(aubio_pitchmcomb_t * p, fvec_t * newmag) { for (j=0;jdata[i][j] = newmag->data[i][j]; } - fvec_dc_removal(mag); /* dc removal */ + fvec_min_removal(mag); /* min removal */ fvec_alpha_normalise(mag,p->alpha); /* alpha normalisation */ - /* skipped */ /* low pass filtering */ + /* skipped */ /* low pass filtering */ /** \bug fvec_moving_thres may write out of bounds */ fvec_adapt_thres(mag,tmp,p->win_post,p->win_pre); /* adaptative threshold */ fvec_add(mag,-p->threshold); /* fixed threshold */ diff --git a/swig/aubio.i b/swig/aubio.i index 651f2492..3a437fa9 100644 --- a/swig/aubio.i +++ b/swig/aubio.i @@ -139,7 +139,7 @@ smpl_t fvec_sum(fvec_t *s); smpl_t fvec_local_energy(fvec_t * f); smpl_t fvec_local_hfc(fvec_t * f); smpl_t fvec_alpha_norm(fvec_t * DF, smpl_t alpha); -void fvec_dc_removal(fvec_t * mag); +void fvec_min_removal(fvec_t * mag); void fvec_alpha_normalise(fvec_t * mag, uint_t alpha); void fvec_add(fvec_t * mag, smpl_t threshold); void fvec_adapt_thres(fvec_t * vec, fvec_t * tmp, uint_t post, uint_t pre); -- 2.26.2