[FFmpeg-devel] [PATCH] audio conversion clipping/overflows

Måns Rullgård mans
Tue Mar 16 15:49:45 CET 2010


"Ronald S. Bultje" <rsbultje at gmail.com> writes:

>>> Index: ffmpeg-svn/libavcodec/wmaprodec.c
>>> ===================================================================
>>> --- ffmpeg-svn.orig/libavcodec/wmaprodec.c ? ?2010-03-15 14:30:19.000000000 -0400
>>> +++ ffmpeg-svn/libavcodec/wmaprodec.c 2010-03-15 18:13:44.000000000 -0400
>>> @@ -1351,7 +1351,7 @@
>>> ? ? ? ? ?ptr = s->samples + i;
>>>
>>> ? ? ? ? ?for (x = 0; x < s->samples_per_frame; x++) {
>>> - ? ? ? ? ? ?*ptr = av_clipf(*iptr++, -1.0, 32767.0 / 32768.0);
>>> + ? ? ? ? ? ?*ptr = *iptr++;
>>> ? ? ? ? ? ? ?ptr += incr;
>>> ? ? ? ? ?}
>>
>> same
>
> this isn't a memcpy(), it's an interpolation (incr is not 1, incr =
> n_channels, so it goes from [chan0, samp0][chan0, samp1][chan0,
> ..][chan0, sampN][chan1,samp0][...] to
> [chan0,samp0][chan1,samp0][...]. See also the second block of changes
> to atrac1.c.

That would be what we call interleaving.  It is a good candidate for
SIMD, usually best combined with some other operation to avoid
multiple reads/writes.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list