Changeset 9c54265
- Timestamp:
- Jul 13, 2006, 3:45:37 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:
- 470a772
- Parents:
- dde06ad
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/hist.c
rdde06ad r9c54265 79 79 { 80 80 uint_t i,j; 81 sint_t tmp = 0; 82 aubio_scale_do(s->scaler, input); 83 /* reset data */ 84 for (i=0; i < s->channels; i++) 85 for (j=0; j < s->nelems; j++) 86 s->hist[i][j] = 0; 87 /* run accum */ 88 for (i=0; i < input->channels; i++) 89 for (j=0; j < input->length; j++) 90 { 91 tmp = (sint_t)FLOOR(input->data[i][j]); 92 if ((tmp >= 0) && (tmp < (sint_t)s->nelems)) 93 s->hist[i][tmp] += 1; 94 } 95 } 96 97 void aubio_hist_do_notnull (aubio_hist_t *s, fvec_t *input) 98 { 99 uint_t i,j; 100 sint_t tmp = 0; 81 101 aubio_scale_do(s->scaler, input); 82 102 /* reset data */ … … 87 107 for (i=0; i < input->channels; i++) 88 108 for (j=0; j < input->length; j++) 89 s->hist[i][(uint_t)floor(input->data[i][j])] += 1; 90 } 91 92 void aubio_hist_do_notnull (aubio_hist_t *s, fvec_t *input) 93 { 94 uint_t i,j; 95 aubio_scale_do(s->scaler, input); 96 /* reset data */ 97 for (i=0; i < s->channels; i++) 98 for (j=0; j < s->nelems; j++) 99 s->hist[i][j] = 0; 100 /* run accum */ 101 for (i=0; i < input->channels; i++) 102 for (j=0; j < input->length; j++) 103 if (input->data[i][j]!=0.0f) //input is not 0 104 s->hist[i][(uint_t)floor(input->data[i][j])] += 1; 109 { 110 if (input->data[i][j] != 0) { 111 tmp = (sint_t)FLOOR(input->data[i][j]); 112 if ((tmp >= 0) && (tmp < (sint_t)s->nelems)) 113 s->hist[i][tmp] += 1; 114 } 115 } 105 116 } 106 117 … … 109 120 { 110 121 uint_t i,j; 122 sint_t tmp = 0; 111 123 smpl_t ilow = vec_min(input); 112 124 smpl_t ihig = vec_max(input); … … 131 143 for (i=0; i < input->channels; i++) 132 144 for (j=0; j < input->length; j++) 133 if (input->data[i][j]!=0.) //input was not 0 134 s->hist[i][(uint_t)floorf(input->data[i][j])] += 1; 145 { 146 if (input->data[i][j] != 0) { 147 tmp = (sint_t)FLOOR(input->data[i][j]); 148 if ((tmp >= 0) && (tmp < (sint_t)s->nelems)) 149 s->hist[i][tmp] += 1; 150 } 151 } 135 152 } 136 153
Note: See TracChangeset
for help on using the changeset viewer.