Changeset 9771488 for src/mathutils.c
- Timestamp:
- Mar 21, 2006, 7:05:23 PM (18 years ago)
- 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:
- d94f98b
- Parents:
- 1d4fc4a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mathutils.c
r1d4fc4a r9771488 331 331 } 332 332 333 smpl_t vec_quadint_min(fvec_t * x,uint_t pos, uint_t span) { 334 smpl_t step = 1./200.; 335 /* init resold to - something (in case x[pos+-span]<0)) */ 336 smpl_t res, frac, s0, s1, s2, exactpos = (smpl_t)pos, resold = 100000.; 337 if ((pos > span) && (pos < x->length-span)) { 338 s0 = x->data[0][pos-span]; 339 s1 = x->data[0][pos] ; 340 s2 = x->data[0][pos+span]; 341 /* increase frac */ 342 for (frac = 0.; frac < 2.; frac = frac + step) { 343 res = aubio_quadfrac(s0, s1, s2, frac); 344 if (res < resold) { 345 resold = res; 346 } else { 347 exactpos += (frac-step)*span - span/2.; 348 break; 349 } 350 } 351 } 352 return exactpos; 353 } 354 333 355 smpl_t aubio_quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf) { 334 356 smpl_t tmp = s0 + (pf/2.) * (pf * ( s0 - 2.*s1 + s2 ) - 3.*s0 + 4.*s1 - s2);
Note: See TracChangeset
for help on using the changeset viewer.