Mercurial > libavcodec.hg
comparison atrac1.c @ 11652:8b6f3d3b55cb libavcodec
Move clipping of audio samples (for those codecs outputting float) from decoder
to the audio conversion routines.
author | rbultje |
---|---|
date | Wed, 21 Apr 2010 17:57:48 +0000 |
parents | 7dd2a45249a9 |
children |
comparison
equal
deleted
inserted
replaced
11651:926ad89ae57a | 11652:8b6f3d3b55cb |
---|---|
303 if (ret < 0) | 303 if (ret < 0) |
304 return ret; | 304 return ret; |
305 at1_subband_synthesis(q, su, q->out_samples[ch]); | 305 at1_subband_synthesis(q, su, q->out_samples[ch]); |
306 } | 306 } |
307 | 307 |
308 /* round, convert to 16bit and interleave */ | 308 /* interleave; FIXME, should create/use a DSP function */ |
309 if (q->channels == 1) { | 309 if (q->channels == 1) { |
310 /* mono */ | 310 /* mono */ |
311 q->dsp.vector_clipf(samples, q->out_samples[0], -32700.0 / (1 << 15), | 311 memcpy(samples, q->out_samples[0], AT1_SU_SAMPLES * 4); |
312 32700.0 / (1 << 15), AT1_SU_SAMPLES); | |
313 } else { | 312 } else { |
314 /* stereo */ | 313 /* stereo */ |
315 for (i = 0; i < AT1_SU_SAMPLES; i++) { | 314 for (i = 0; i < AT1_SU_SAMPLES; i++) { |
316 samples[i * 2] = av_clipf(q->out_samples[0][i], | 315 samples[i * 2] = q->out_samples[0][i]; |
317 -32700.0 / (1 << 15), | 316 samples[i * 2 + 1] = q->out_samples[1][i]; |
318 32700.0 / (1 << 15)); | |
319 samples[i * 2 + 1] = av_clipf(q->out_samples[1][i], | |
320 -32700.0 / (1 << 15), | |
321 32700.0 / (1 << 15)); | |
322 } | 317 } |
323 } | 318 } |
324 | 319 |
325 *data_size = q->channels * AT1_SU_SAMPLES * sizeof(*samples); | 320 *data_size = q->channels * AT1_SU_SAMPLES * sizeof(*samples); |
326 return avctx->block_align; | 321 return avctx->block_align; |