[FFmpeg-cvslog] r20081 - trunk/libavcodec/wmadec.c
mru
subversion
Tue Sep 29 14:48:24 CEST 2009
Author: mru
Date: Tue Sep 29 14:48:24 2009
New Revision: 20081
Log:
WMA: fix loop unrolling in decode_exp_vlc()
The count can be a non-multiple of 4 after all.
Modified:
trunk/libavcodec/wmadec.c
Modified: trunk/libavcodec/wmadec.c
==============================================================================
--- trunk/libavcodec/wmadec.c Tue Sep 29 13:43:58 2009 (r20080)
+++ trunk/libavcodec/wmadec.c Tue Sep 29 14:48:24 2009 (r20081)
@@ -330,12 +330,12 @@ static int decode_exp_vlc(WMACodecContex
iv = iptab[last_exp];
max_scale = v;
n = *ptr++;
- do {
- *q++ = iv;
- *q++ = iv;
- *q++ = iv;
- *q++ = iv;
- } while (n -= 4);
+ switch (n & 3) do {
+ case 0: *q++ = iv;
+ case 3: *q++ = iv;
+ case 2: *q++ = iv;
+ case 1: *q++ = iv;
+ } while ((n -= 4) > 0);
}else
last_exp = 36;
@@ -352,12 +352,12 @@ static int decode_exp_vlc(WMACodecContex
if (v > max_scale)
max_scale = v;
n = *ptr++;
- do {
- *q++ = iv;
- *q++ = iv;
- *q++ = iv;
- *q++ = iv;
- } while (n -= 4);
+ switch (n & 3) do {
+ case 0: *q++ = iv;
+ case 3: *q++ = iv;
+ case 2: *q++ = iv;
+ case 1: *q++ = iv;
+ } while ((n -= 4) > 0);
}
s->max_exponent[ch] = max_scale;
return 0;
More information about the ffmpeg-cvslog
mailing list