diff options
author | Vitor Sessak <vitor1001@gmail.com> | 2008-05-21 16:36:19 +0000 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2008-05-21 16:36:19 +0000 |
commit | 59ffb6e2cc0974f3090a10facdedf8da5f6bf742 (patch) | |
tree | bf3ede241aaecb4743ac9f1b39cdabd18e8c93d9 | |
parent | 432a54ef805695b9083597a987e8e92b26f7c5a7 (diff) | |
download | ffmpeg-59ffb6e2cc0974f3090a10facdedf8da5f6bf742.tar.gz |
Simplify ra144_decode_frame() by unrolling a senseless
loop.
Thanks mkhdor for suggesting this patch.
Originally committed as revision 13211 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/ra144.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/libavcodec/ra144.c b/libavcodec/ra144.c index b99ab1df3f..6d0da4db1d 100644 --- a/libavcodec/ra144.c +++ b/libavcodec/ra144.c @@ -401,25 +401,14 @@ static int ra144_decode_frame(AVCodecContext * avctx, val = decodeval[get_bits(&gb, 5) << 1]; // Useless table entries? a = t_sqrt(val*glob->oldval) >> 12; - for (c=0; c < NBLOCKS; c++) { - if (c == (NBLOCKS - 1)) { - dec1(glob, glob->swapbuf1, glob->swapbuf2, 3, val); - } else { - if (c * 2 == (NBLOCKS - 2)) { - if (glob->oldval < val) { - dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, a, glob->swapbuf2alt, c); - } else { - dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, a, glob->swapbuf2, c); - } - } else { - if (c * 2 < (NBLOCKS - 2)) { - dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, glob->oldval, glob->swapbuf2, c); - } else { - dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, val, glob->swapbuf2alt, c); - } - } - } + dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, glob->oldval, glob->swapbuf2, 0); + if (glob->oldval < val) { + dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, a, glob->swapbuf2alt, 1); + } else { + dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, a, glob->swapbuf2, 1); } + dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, val, glob->swapbuf2alt, 2); + dec1(glob, glob->swapbuf1, glob->swapbuf2, 3, val); /* do output */ for (b=0, c=0; c<4; c++) { |