Mercurial > libavcodec.hg
changeset 10317:88e1eb862abd libavcodec
WMA: fix loop unrolling in decode_exp_vlc()
The count can be a non-multiple of 4 after all.
author | mru |
---|---|
date | Tue, 29 Sep 2009 12:48:24 +0000 |
parents | 7bfcc66f807d |
children | 6a21c6ca346f |
files | wmadec.c |
diffstat | 1 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/wmadec.c Tue Sep 29 11:43:58 2009 +0000 +++ b/wmadec.c Tue Sep 29 12:48:24 2009 +0000 @@ -330,12 +330,12 @@ 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 @@ 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;