Changeset 72db1cf


Ignore:
Timestamp:
Feb 10, 2013, 3:18:37 AM (12 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:
320ce80
Parents:
ce12f3a
Message:

src/tempo/beattracking.c: avoid casting, make sure b is well behaved

Many thanks to Olivier Robert for his patch, and sorry for the delay!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tempo/beattracking.c

    rce12f3a r72db1cf  
    136136  smpl_t beat;                  // beat position
    137137  smpl_t bp;                    // beat period
    138   uint_t a; sint_t b;           // used to build shift invariant comb filterbank
     138  uint_t a, b;                  // used to build shift invariant comb filterbank
    139139  uint_t kmax;                  // number of elements used to find beat phase
    140140
     
    160160  for (i = 1; i < laglen - 1; i++) {
    161161    for (a = 1; a <= numelem; a++) {
    162       for (b = (1 - a); b < (sint_t)a; b++) {
    163         bt->acfout->data[i] += bt->acf->data[a * (i + 1) + b - 1]
     162      for (b = 1; b < 2 * a; b++) {
     163        bt->acfout->data[i] += bt->acf->data[i * a + b - 1]
    164164            * 1. / (2. * a - 1.);
    165165      }
     
    276276aubio_beattracking_checkstate (aubio_beattracking_t * bt)
    277277{
    278   uint_t i, j, a; sint_t b;
     278  uint_t i, j, a, b;
    279279  uint_t flagconst = 0;
    280280  sint_t counter = bt->counter;
     
    300300    for (i = 1; i < laglen - 1; i++) {
    301301      for (a = 1; a <= bt->timesig; a++) {
    302         for (b = (1 - a); b < (sint_t)a; b++) {
    303           acfout->data[i] += acf->data[a * (i + 1) + b - 1];
     302        for (b = 1; b < 2 * a; b++) {
     303          acfout->data[i] += acf->data[i * a + b - 1];
    304304        }
    305305      }
Note: See TracChangeset for help on using the changeset viewer.