]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
factorize
authormichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sun, 25 Mar 2007 14:02:54 +0000 (14:02 +0000)
committermichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Sun, 25 Mar 2007 14:02:54 +0000 (14:02 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@8510 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/lzw.c

index cb12eb85730e9a33cb394f0e8065dbbf0cf1be1a..240ff134917335d6eff29532ed08a84b148a1a1b 100644 (file)
@@ -192,13 +192,12 @@ int ff_lzw_decode(LZWState *p, uint8_t *buf, int len){
     oc = s->oc;
     fc = s->fc;
 
-    while (sp > s->stack) {
-        *buf++ = *(--sp);
-        if ((--l) == 0)
-            goto the_end;
-    }
-
     for (;;) {
+        while (sp > s->stack) {
+            *buf++ = *(--sp);
+            if ((--l) == 0)
+                goto the_end;
+        }
         c = lzw_get_code(s);
         if (c == s->end_code) {
             s->end_code = -1;
@@ -242,11 +241,6 @@ int ff_lzw_decode(LZWState *p, uint8_t *buf, int len){
                     s->curmask = mask[++s->cursize];
                 }
             }
-            while (sp > s->stack) {
-                *buf++ = *(--sp);
-                if ((--l) == 0)
-                    goto the_end;
-            }
         }
     }
   the_end: