Changeset 2395:9923da8efe75 in roaraudio
- Timestamp:
- 08/17/09 02:32:14 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroardsp/remove.c
r2394 r2395 159 159 } 160 160 161 int roar_remove_so8 (int8_t * subout, int8_t * in, int samples, struct roar_remove_state * state) { 162 int i; 163 register int_least16_t s; 164 register int_least16_t peak; 165 166 if ( state == NULL ) { 167 for (i = 0; i < samples; i++) { 168 s = -subout[i]; 169 s += in[i]; 170 subout[i] = s; 171 } 172 } else { 173 peak = 127; 174 for (i = 0; i < samples; i++) { 175 s = -subout[i]; 176 s += in[i]; 177 s = s < 0 ? -s : s; // we true 32 bit, not int operation here 178 if ( s > peak ) 179 peak = s; 180 } 181 182 for (i = 0; i < samples; i++) { 183 s = -subout[i]; 184 s *= 127; 185 s /= peak; 186 s += in[i]; 187 subout[i] = s; 188 } 189 } 190 191 return 0; 192 } 193 161 194 int roar_remove_so16 (int16_t * subout, int16_t * in, int samples, struct roar_remove_state * state) { 162 195 int i;
Note: See TracChangeset
for help on using the changeset viewer.