Changeset 1aeac4c for src


Ignore:
Timestamp:
Aug 22, 2005, 9:30:10 PM (19 years ago)
Author:
Paul Brossier <piem@altern.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:
f97445c
Parents:
162fd27
Message:

speeding up yin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/pitchyin.c

    r162fd27 r1aeac4c  
    9191uint_t aubio_pitchyin_getpitchfast(fvec_t * input, fvec_t * yin, smpl_t tol){
    9292        uint_t c=0,j,tau = 0;
    93         smpl_t tmp = 0;
    94         for (tau=0;tau<yin->length;tau++)
     93        smpl_t tmp = 0., tmp2 = 0.;
     94        yin->data[c][0] = 1.;
     95        for (tau=1;tau<yin->length;tau++)
    9596        {
    9697                yin->data[c][tau] = 0.;
    97         }
    98         for (tau=1;tau<yin->length;tau++)
    99         {
    10098                for (j=0;j<yin->length;j++)
    10199                {
     
    103101                        yin->data[c][tau] += SQR(tmp);
    104102                }
    105         }
    106         yin->data[c][0] = 1.;
    107         tmp = 0.;
    108         for (tau=1;tau<yin->length;tau++)
    109         {
    110                 tmp += yin->data[c][tau];
    111                 yin->data[c][tau] *= tau/tmp;
    112         }
    113         /* should merge the following with above */
    114         tau = 1;
    115         do
    116         {
    117                 if(yin->data[c][tau] < tol) {
    118                         while (yin->data[c][tau+1] < yin->data[c][tau]) {
    119                                 tau++;
    120                         }
    121                         return tau;
     103                tmp2 += yin->data[c][tau];
     104                yin->data[c][tau] *= tau/tmp2;
     105                if((yin->data[c][tau] < tol) &&
     106                                (yin->data[c][tau-1] < yin->data[c][tau])) {
     107                        return tau-1;
    122108                }
    123                 tau++;
    124         } while (tau<yin->length);
     109        }
    125110        return 0;
    126111}
Note: See TracChangeset for help on using the changeset viewer.