Changeset 274839f
- Timestamp:
- Nov 4, 2007, 4:14:31 PM (17 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:
- 812b376
- Parents:
- 2b3280a
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/hist.c
r2b3280a r274839f 28 28 29 29 struct _aubio_hist_t { 30 /*bug: move to a fvec */ 31 smpl_t ** hist; 30 fvec_t * hist; 32 31 uint_t nelems; 33 32 uint_t channels; … … 46 45 s->channels = channels; 47 46 s->nelems = nelems; 48 s->hist = AUBIO_ARRAY(smpl_t*, channels); 49 for (i=0; i< s->channels; i++) { 50 s->hist[i] = AUBIO_ARRAY(smpl_t, nelems); 51 } 47 s->hist = new_fvec(nelems, channels); 52 48 s->cent = AUBIO_ARRAY(smpl_t, nelems); 53 49 … … 63 59 64 60 void del_aubio_hist(aubio_hist_t *s) { 65 uint_t i; 66 for (i=0; i< s->channels; i++) { 67 AUBIO_FREE(s->hist[i]); 68 } 69 AUBIO_FREE(s->hist); 61 del_fvec(s->hist); 70 62 AUBIO_FREE(s->cent); 71 63 del_aubio_scale(s->scaler); … … 84 76 for (i=0; i < s->channels; i++) 85 77 for (j=0; j < s->nelems; j++) 86 s->hist [i][j] = 0;78 s->hist->data[i][j] = 0; 87 79 /* run accum */ 88 80 for (i=0; i < input->channels; i++) … … 91 83 tmp = (sint_t)FLOOR(input->data[i][j]); 92 84 if ((tmp >= 0) && (tmp < (sint_t)s->nelems)) 93 s->hist [i][tmp] += 1;85 s->hist->data[i][tmp] += 1; 94 86 } 95 87 } … … 103 95 for (i=0; i < s->channels; i++) 104 96 for (j=0; j < s->nelems; j++) 105 s->hist [i][j] = 0;97 s->hist->data[i][j] = 0; 106 98 /* run accum */ 107 99 for (i=0; i < input->channels; i++) … … 111 103 tmp = (sint_t)FLOOR(input->data[i][j]); 112 104 if ((tmp >= 0) && (tmp < (sint_t)s->nelems)) 113 s->hist [i][tmp] += 1;105 s->hist->data[i][tmp] += 1; 114 106 } 115 107 } … … 139 131 for (i=0; i < s->channels; i++) 140 132 for (j=0; j < s->nelems; j++) 141 s->hist [i][j] = 0;133 s->hist->data[i][j] = 0; 142 134 /* run accum */ 143 135 for (i=0; i < input->channels; i++) … … 147 139 tmp = (sint_t)FLOOR(input->data[i][j]); 148 140 if ((tmp >= 0) && (tmp < (sint_t)s->nelems)) 149 s->hist [i][tmp] += 1;141 s->hist->data[i][tmp] += 1; 150 142 } 151 143 } 152 144 } 153 145 154 void aubio_hist_weig th(aubio_hist_t *s)146 void aubio_hist_weight (aubio_hist_t *s) 155 147 { 156 148 uint_t i,j; 157 149 for (i=0; i < s->channels; i++) 158 150 for (j=0; j < s->nelems; j++) { 159 s->hist [i][j] *= s->cent[j];151 s->hist->data[i][j] *= s->cent[j]; 160 152 } 161 153 } … … 167 159 for (i=0; i < s->channels; i++) 168 160 for (j=0; j < s->nelems; j++) 169 tmp += s->hist [i][j];161 tmp += s->hist->data[i][j]; 170 162 return tmp/(smpl_t)(s->nelems); 171 163 } -
src/hist.h
r2b3280a r274839f 50 50 smpl_t aubio_hist_mean(aubio_hist_t *s); 51 51 /** weight the histogram */ 52 void aubio_hist_weig th(aubio_hist_t *s);52 void aubio_hist_weight(aubio_hist_t *s); 53 53 /** compute dynamic histogram for non-null elements */ 54 54 void aubio_hist_dyn_notnull (aubio_hist_t *s, fvec_t *input); -
src/onsetdetection.c
r2b3280a r274839f 129 129 aubio_hist_dyn_notnull(o->histog,o->dev1); 130 130 /* weight it */ 131 aubio_hist_weig th(o->histog);131 aubio_hist_weight(o->histog); 132 132 /* its mean is the result */ 133 133 onset->data[i][0] = aubio_hist_mean(o->histog); … … 158 158 aubio_hist_dyn_notnull(o->histog,o->dev1); 159 159 /* weight it */ 160 aubio_hist_weig th(o->histog);160 aubio_hist_weight(o->histog); 161 161 /* its mean is the result */ 162 162 onset->data[i][0] = aubio_hist_mean(o->histog);
Note: See TracChangeset
for help on using the changeset viewer.