diff options
author | Måns Rullgård <mans@mansr.com> | 2009-09-29 12:48:24 +0000 |
---|---|---|
committer | Måns Rullgård <mans@mansr.com> | 2009-09-29 12:48:24 +0000 |
commit | 0e71841b0555e54691431f6d319f2cb17e208c6a (patch) | |
tree | 23c43075e493d62444a0d84e5d3f1f881616affb /libavcodec/wmadec.c | |
parent | a7adcf29cf4674d45cbc885b1eda6c22657a224b (diff) | |
download | ffmpeg-0e71841b0555e54691431f6d319f2cb17e208c6a.tar.gz |
WMA: fix loop unrolling in decode_exp_vlc()
The count can be a non-multiple of 4 after all.
Originally committed as revision 20081 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/wmadec.c')
-rw-r--r-- | libavcodec/wmadec.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index e216de706b..5a31963520 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -330,12 +330,12 @@ static int decode_exp_vlc(WMACodecContext *s, int ch) 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(WMACodecContext *s, int ch) 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; |