comparison libvorbis.c @ 5525:bc4791868c52 libavcodec

various simplifications around recent av_clip_int16() usage
author aurel
date Sat, 11 Aug 2007 23:17:03 +0000
parents c2ab2ac31edb
children 5a61e8e2f65c
comparison
equal deleted inserted replaced
5524:f47bc5359101 5525:bc4791868c52
293 return 0 ; 293 return 0 ;
294 } 294 }
295 295
296 296
297 static inline int conv(int samples, float **pcm, char *buf, int channels) { 297 static inline int conv(int samples, float **pcm, char *buf, int channels) {
298 int i, j, val ; 298 int i, j;
299 ogg_int16_t *ptr, *data = (ogg_int16_t*)buf ; 299 ogg_int16_t *ptr, *data = (ogg_int16_t*)buf ;
300 float *mono ; 300 float *mono ;
301 301
302 for(i = 0 ; i < channels ; i++){ 302 for(i = 0 ; i < channels ; i++){
303 ptr = &data[i]; 303 ptr = &data[i];
304 mono = pcm[i] ; 304 mono = pcm[i] ;
305 305
306 for(j = 0 ; j < samples ; j++) { 306 for(j = 0 ; j < samples ; j++) {
307 307 *ptr = av_clip_int16(mono[j] * 32767.f);
308 val = mono[j] * 32767.f;
309
310 val = av_clip_int16(val);
311
312 *ptr = val ;
313 ptr += channels; 308 ptr += channels;
314 } 309 }
315 } 310 }
316 311
317 return 0 ; 312 return 0 ;