r7778 - trunk/libavcodec/lzo.c
Author: michael Date: Wed Jan 31 11:34:13 2007 New Revision: 7778 Modified: trunk/libavcodec/lzo.c Log: simpify state and make code 2% faster reimar, dont hesitate to flame me for not sending patches and feel free to revert any or all of my changes to lzo.c if you dont like them Modified: trunk/libavcodec/lzo.c ============================================================================== --- trunk/libavcodec/lzo.c (original) +++ trunk/libavcodec/lzo.c Wed Jan 31 11:34:13 2007 @@ -168,7 +168,7 @@ * LZO_INPUT_PADDING, out must provide LZO_OUTPUT_PADDING additional bytes */ int lzo1x_decode(void *out, int *outlen, void *in, int *inlen) { - enum {COPY, BACKPTR} state = COPY; + int state= 0; int x; LZOContext c; c.in = in; @@ -205,9 +205,7 @@ break; } } - } else - switch (state) { - case COPY: + } else if(!state){ cnt = get_len(&c, x, 15); copy(&c, cnt + 3); x = GETB(c); @@ -219,15 +217,13 @@ continue; cnt = 1; back = (1 << 11) + (GETB(c) << 2) + (x >> 2) + 1; - break; - case BACKPTR: + } else { cnt = 0; back = (GETB(c) << 2) + (x >> 2) + 1; - break; } copy_backptr(&c, back, cnt + 2); + state= cnt = x & 3; - state = cnt ? BACKPTR : COPY; if (cnt) copy(&c, cnt); x = GETB(c);
Hello, On Wed, Jan 31, 2007 at 11:34:13AM +0100, michael wrote:
Author: michael Date: Wed Jan 31 11:34:13 2007 New Revision: 7778
Modified: trunk/libavcodec/lzo.c
Log: simpify state and make code 2% faster reimar, dont hesitate to flame me for not sending patches and feel free to revert any or all of my changes to lzo.c if you dont like them
Fine for me, I did it like this because it was a bit more readable but mostly because I hoped the compiler would be bright enough to "fix" it.. Btw. there is no reason why x has to be signed, if you think that helps the compiler... Greetings, Reimar Doeffinger
participants (2)
-
Reimar.Doeffinger@stud.uni-karlsruhe.de -
subversion@mplayerhq.hu