Changeset 5c4ec3c for src/mathutils.c
- Timestamp:
- Oct 2, 2009, 1:19:10 AM (14 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:
- 38e9732
- Parents:
- 2f64b0e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mathutils.c
r2f64b0e r5c4ec3c 93 93 } 94 94 95 smpl_t vec_sum(fvec_t *s) {95 smpl_t fvec_sum(fvec_t *s) { 96 96 uint_t i,j; 97 97 smpl_t tmp = 0.0f; … … 142 142 } 143 143 144 void vec_shift(fvec_t *s) {144 void fvec_shift(fvec_t *s) { 145 145 uint_t i,j; 146 146 //smpl_t tmp = 0.0f; … … 154 154 } 155 155 156 smpl_t vec_local_energy(fvec_t * f) {156 smpl_t fvec_local_energy(fvec_t * f) { 157 157 smpl_t locE = 0.; 158 158 uint_t i,j; … … 163 163 } 164 164 165 smpl_t vec_local_hfc(fvec_t * f) {165 smpl_t fvec_local_hfc(fvec_t * f) { 166 166 smpl_t locE = 0.; 167 167 uint_t i,j; … … 172 172 } 173 173 174 smpl_t vec_alpha_norm(fvec_t * DF, smpl_t alpha) {174 smpl_t fvec_alpha_norm(fvec_t * DF, smpl_t alpha) { 175 175 smpl_t tmp = 0.; 176 176 uint_t i,j; … … 181 181 } 182 182 183 void vec_dc_removal(fvec_t * mag) {183 void fvec_dc_removal(fvec_t * mag) { 184 184 smpl_t mini = 0.; 185 185 uint_t length = mag->length, i=0, j; … … 190 190 } 191 191 192 void vec_alpha_normalise(fvec_t * mag, uint_t alpha) {192 void fvec_alpha_normalise(fvec_t * mag, uint_t alpha) { 193 193 smpl_t alphan = 1.; 194 194 uint_t length = mag->length, i=0, j; 195 alphan = vec_alpha_norm(mag,alpha);195 alphan = fvec_alpha_norm(mag,alpha); 196 196 for (j=0;j<length;j++){ 197 197 mag->data[i][j] /= alphan; … … 199 199 } 200 200 201 void vec_add(fvec_t * mag, smpl_t threshold) {201 void fvec_add(fvec_t * mag, smpl_t threshold) { 202 202 uint_t length = mag->length, i=0, j; 203 203 for (j=0;j<length;j++) { … … 206 206 } 207 207 208 void vec_adapt_thres(fvec_t * vec, fvec_t * tmp,208 void fvec_adapt_thres(fvec_t * vec, fvec_t * tmp, 209 209 uint_t post, uint_t pre) { 210 210 uint_t length = vec->length, i=0, j; 211 211 for (j=0;j<length;j++) { 212 vec->data[i][j] -= vec_moving_thres(vec, tmp, post, pre, j);213 } 214 } 215 216 smpl_t vec_moving_thres(fvec_t * vec, fvec_t * tmpvec,212 vec->data[i][j] -= fvec_moving_thres(vec, tmp, post, pre, j); 213 } 214 } 215 216 smpl_t fvec_moving_thres(fvec_t * vec, fvec_t * tmpvec, 217 217 uint_t post, uint_t pre, uint_t pos) { 218 218 smpl_t * medar = (smpl_t *)tmpvec->data[0]; … … 237 237 medar[k] = 0.; /* 0-padding at the end */ 238 238 } 239 return vec_median(tmpvec);240 } 241 242 smpl_t vec_median(fvec_t * input) {239 return fvec_median(tmpvec); 240 } 241 242 smpl_t fvec_median(fvec_t * input) { 243 243 uint_t n = input->length; 244 244 smpl_t * arr = (smpl_t *) input->data[0]; … … 291 291 } 292 292 293 smpl_t vec_quadint(fvec_t * x,uint_t pos, uint_t span) {293 smpl_t fvec_quadint(fvec_t * x,uint_t pos, uint_t span) { 294 294 smpl_t s0, s1, s2; 295 295 uint_t x0 = (pos < span) ? pos : pos - span; … … 308 308 } 309 309 310 uint_t vec_peakpick(fvec_t * onset, uint_t pos) {310 uint_t fvec_peakpick(fvec_t * onset, uint_t pos) { 311 311 uint_t i=0, tmp=0; 312 312 /*for (i=0;i<onset->channels;i++)*/
Note: See TracChangeset
for help on using the changeset viewer.