[FFmpeg-soc] [soc]: r972 - jpeg2000/j2kdec.c

k.nowosad subversion at mplayerhq.hu
Sat Aug 18 20:54:07 CEST 2007


Author: k.nowosad
Date: Sat Aug 18 20:54:07 2007
New Revision: 972

Log:
corrected and simplified tag_tree_decode()


Modified:
   jpeg2000/j2kdec.c

Modified: jpeg2000/j2kdec.c
==============================================================================
--- jpeg2000/j2kdec.c	(original)
+++ jpeg2000/j2kdec.c	Sat Aug 18 20:54:07 2007
@@ -242,24 +242,22 @@ static int tag_tree_decode(J2kDecoderCon
         node = node->parent;
     }
 
-    if (stack[sp]->val >= threshold)
-        return threshold;
-
     if (node)
         curval = node->val;
     else
         curval = stack[sp]->val;
 
-    while(sp >= 0){
-        while (!get_bits(s, 1)){
-            curval++;
-            if (curval == threshold)
+    while(curval < threshold && sp >= 0){
+        if (curval < stack[sp]->val)
+            curval = stack[sp]->val;
+        while (curval < threshold){
+            if (get_bits(s, 1)){
+                stack[sp]->vis++;
                 break;
+            } else
+                curval++;
         }
         stack[sp]->val = curval;
-        if (curval == threshold)
-            break;
-        stack[sp]->vis++;
         sp--;
     }
     return curval;



More information about the FFmpeg-soc mailing list