[FFmpeg-devel] [PATCH] wmaprodec rewrite interleaving
Ronald S. Bultje
rsbultje
Mon Mar 29 04:30:46 CEST 2010
Hi Sascha,
On Sat, Mar 27, 2010 at 5:20 PM, Sascha Sommer <saschasommer at freenet.de> wrote:
> Am Samstag 27 M?rz 2010 17:17:53 schrieb Ronald S. Bultje:
>> the interleaving code right now is plain ugly, this is an attempt to
>> make it slightly less ugly. But honestly someone should write a DSP
>> function for this (and that's not me), because other decoders (e.g.
>> atrac1) do similar silly stuff and I'm sure that can be optimized.
>
> The for -> while loop change is ok but please split the variable
> initialization into multiple instructions.
OK, see attached for a better patch then. Let me know if this is OK.
(I can commit the merge variable declaration + initial value in a
separate commit if you want.)
Ronald
-------------- next part --------------
Index: ffmpeg-svn/libavcodec/wmaprodec.c
===================================================================
--- ffmpeg-svn.orig/libavcodec/wmaprodec.c 2010-03-27 12:30:21.000000000 -0400
+++ ffmpeg-svn/libavcodec/wmaprodec.c 2010-03-28 22:06:15.000000000 -0400
@@ -1343,14 +1343,12 @@
/** interleave samples and write them to the output buffer */
for (i = 0; i < s->num_channels; i++) {
- float* ptr;
+ float* ptr = s->samples + i;
int incr = s->num_channels;
float* iptr = s->channel[i].out;
- int x;
+ float* iend = iptr + s->samples_per_frame;
- ptr = s->samples + i;
-
- for (x = 0; x < s->samples_per_frame; x++) {
+ while (iptr < iend) {
*ptr = av_clipf(*iptr++, -1.0, 32767.0 / 32768.0);
ptr += incr;
}
More information about the ffmpeg-devel
mailing list