aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-01-31 10:34:13 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-01-31 10:34:13 +0000
commitbf47272f3cb9fb8a60e734a70c7d1085adc64724 (patch)
treee66453f56a86b7f61b80d0b24b6f323bb5b1bc86
parent5fe9c42cebbac9e4875f8ff30eb84ea9f8f5b407 (diff)
downloadffmpeg-bf47272f3cb9fb8a60e734a70c7d1085adc64724.tar.gz
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 Originally committed as revision 7778 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/lzo.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libavcodec/lzo.c b/libavcodec/lzo.c
index 5fd1f4cc06..d4c19aad5a 100644
--- a/libavcodec/lzo.c
+++ b/libavcodec/lzo.c
@@ -168,7 +168,7 @@ static inline void copy_backptr(LZOContext *c, int back, int cnt) {
* 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 @@ int lzo1x_decode(void *out, int *outlen, void *in, int *inlen) {
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 @@ int lzo1x_decode(void *out, int *outlen, void *in, int *inlen) {
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);