Changeset 39a7b26 for src/cvec.c
- Timestamp:
- Nov 26, 2013, 8:09:06 PM (11 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:
- 88fee8f
- Parents:
- 923a7a8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/cvec.c
r923a7a8 r39a7b26 71 71 } 72 72 73 void cvec_set(cvec_t *s, smpl_t val) { 73 void cvec_copy(cvec_t *s, cvec_t *t) { 74 if (s->length != t->length) { 75 AUBIO_ERR("trying to copy %d elements to %d elements \n", 76 s->length, t->length); 77 return; 78 } 79 #if HAVE_MEMCPY_HACKS 80 memcpy(t->norm, s->norm, t->length * sizeof(smpl_t)); 81 memcpy(t->phas, s->phas, t->length * sizeof(smpl_t)); 82 #else 83 uint_t j; 84 for (j=0; j< t->length; j++) { 85 t->norm[j] = s->norm[j]; 86 t->phas[j] = s->phas[j]; 87 } 88 #endif 89 } 90 91 void cvec_set_all_norm(cvec_t *s, smpl_t val) { 74 92 uint_t j; 75 93 for (j=0; j< s->length; j++) { … … 78 96 } 79 97 80 void cvec_zeros(cvec_t *s) { 81 cvec_set(s, 0.); 98 void cvec_zeros_norm(cvec_t *s) { 99 #if HAVE_MEMCPY_HACKS 100 memset(s->norm, 0, s->length * sizeof(smpl_t)); 101 #else 102 cvec_set_all_norm(s, 0.); 103 #endif 82 104 } 83 105 84 void cvec_ones (cvec_t *s) {85 cvec_set (s, 1.);106 void cvec_ones_norm(cvec_t *s) { 107 cvec_set_all_norm(s, 1.); 86 108 } 87 109 110 void cvec_set_all_phas(cvec_t *s, smpl_t val) { 111 uint_t j; 112 for (j=0; j< s->length; j++) { 113 s->phas[j] = val; 114 } 115 } 116 117 void cvec_zeros_phas(cvec_t *s) { 118 #if HAVE_MEMCPY_HACKS 119 memset(s->phas, 0, s->length * sizeof(smpl_t)); 120 #else 121 cvec_set_all_phas(s, 0.); 122 #endif 123 } 124 125 void cvec_ones_phas(cvec_t *s) { 126 cvec_set_all_phas(s, 1.); 127 } 128 129 void cvec_zeros(cvec_t *s) { 130 cvec_zeros_norm(s); 131 cvec_zeros_phas(s); 132 }
Note: See TracChangeset
for help on using the changeset viewer.