From a2f3555489f509d3c223f44a356da960f9974a5f Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Wed, 21 Nov 2007 12:53:28 +0100 Subject: [PATCH] pitchyin.c: redo indentation --- src/pitchyin.c | 134 ++++++++++++++++++++++++------------------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/src/pitchyin.c b/src/pitchyin.c index eb6dec77..01636079 100644 --- a/src/pitchyin.c +++ b/src/pitchyin.c @@ -32,84 +32,84 @@ /* outputs the difference function */ void aubio_pitchyin_diff(fvec_t * input, fvec_t * yin){ - uint_t c,j,tau; - smpl_t tmp; - for (c=0;cchannels;c++) - { - for (tau=0;taulength;tau++) - { - yin->data[c][tau] = 0.; - } - for (tau=1;taulength;tau++) - { - for (j=0;jlength;j++) - { - tmp = input->data[c][j] - input->data[c][j+tau]; - yin->data[c][tau] += SQR(tmp); - } - } - } + uint_t c,j,tau; + smpl_t tmp; + for (c=0;cchannels;c++) + { + for (tau=0;taulength;tau++) + { + yin->data[c][tau] = 0.; + } + for (tau=1;taulength;tau++) + { + for (j=0;jlength;j++) + { + tmp = input->data[c][j] - input->data[c][j+tau]; + yin->data[c][tau] += SQR(tmp); + } + } + } } /* cumulative mean normalized difference function */ void aubio_pitchyin_getcum(fvec_t * yin) { - uint_t c,tau; - smpl_t tmp; - for (c=0;cchannels;c++) - { - tmp = 0.; - yin->data[c][0] = 1.; - //AUBIO_DBG("%f\t",yin->data[c][0]); - for (tau=1;taulength;tau++) - { - tmp += yin->data[c][tau]; - yin->data[c][tau] *= tau/tmp; - //AUBIO_DBG("%f\t",yin->data[c][tau]); - } - //AUBIO_DBG("\n"); - } + uint_t c,tau; + smpl_t tmp; + for (c=0;cchannels;c++) + { + tmp = 0.; + yin->data[c][0] = 1.; + //AUBIO_DBG("%f\t",yin->data[c][0]); + for (tau=1;taulength;tau++) + { + tmp += yin->data[c][tau]; + yin->data[c][tau] *= tau/tmp; + //AUBIO_DBG("%f\t",yin->data[c][tau]); + } + //AUBIO_DBG("\n"); + } } uint_t aubio_pitchyin_getpitch(fvec_t * yin) { - uint_t c=0,tau=1; - do - { - if(yin->data[c][tau] < 0.1) { - while (yin->data[c][tau+1] < yin->data[c][tau]) { - tau++; - } - return tau; - } - tau++; - } while (taulength); - //AUBIO_DBG("No pitch found"); - return 0; + uint_t c=0,tau=1; + do + { + if(yin->data[c][tau] < 0.1) { + while (yin->data[c][tau+1] < yin->data[c][tau]) { + tau++; + } + return tau; + } + tau++; + } while (taulength); + //AUBIO_DBG("No pitch found"); + return 0; } /* all the above in one */ smpl_t aubio_pitchyin_getpitchfast(fvec_t * input, fvec_t * yin, smpl_t tol){ - uint_t c=0,j,tau = 0; - sint_t period; - smpl_t tmp = 0., tmp2 = 0.; - yin->data[c][0] = 1.; - for (tau=1;taulength;tau++) - { - yin->data[c][tau] = 0.; - for (j=0;jlength;j++) - { - tmp = input->data[c][j] - input->data[c][j+tau]; - yin->data[c][tau] += SQR(tmp); - } - tmp2 += yin->data[c][tau]; - yin->data[c][tau] *= tau/tmp2; - period = tau-3; - if(tau > 4 && (yin->data[c][period] < tol) && - (yin->data[c][period] < yin->data[c][period+1])) { - return vec_quadint_min(yin,period,1); - } - } - return vec_quadint_min(yin,vec_min_elem(yin),1); - //return 0; + uint_t c=0,j,tau = 0; + sint_t period; + smpl_t tmp = 0., tmp2 = 0.; + yin->data[c][0] = 1.; + for (tau=1;taulength;tau++) + { + yin->data[c][tau] = 0.; + for (j=0;jlength;j++) + { + tmp = input->data[c][j] - input->data[c][j+tau]; + yin->data[c][tau] += SQR(tmp); + } + tmp2 += yin->data[c][tau]; + yin->data[c][tau] *= tau/tmp2; + period = tau-3; + if(tau > 4 && (yin->data[c][period] < tol) && + (yin->data[c][period] < yin->data[c][period+1])) { + return vec_quadint_min(yin,period,1); + } + } + return vec_quadint_min(yin,vec_min_elem(yin),1); + //return 0; } -- 2.26.2