shithub: jbig2

Download patch

ref: b588b1a9e9599c5041db8279d953bb3aee57371c
parent: ccd602286a7f176ffb0fffc68be453d443f0644e
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Wed Nov 24 14:35:47 EST 2004

Implement an unoptimized version of refinement region template 0.
We now decode ubc test stream 042_21.jb2.


git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@338 ded80894-8fb9-0310-811b-c03f3676ab4d

--- a/jbig2_refinement.c
+++ b/jbig2_refinement.c
@@ -78,10 +78,13 @@
       CONTEXT |= jbig2_image_get_pixel(image, x - 1, y - 1) << 3; 
       CONTEXT |= jbig2_image_get_pixel(ref, x-dx+1, y-dy+1) << 4;
       CONTEXT |= jbig2_image_get_pixel(ref, x-dx+0, y-dy+1) << 5;
-      CONTEXT |= jbig2_image_get_pixel(ref, x-dx+1, y-dy+0) << 6;
-      CONTEXT |= jbig2_image_get_pixel(ref, x-dx+0, y-dy+0) << 7;
-      CONTEXT |= jbig2_image_get_pixel(ref, x-dx-1, y-dy+0) << 8;
-      CONTEXT |= jbig2_image_get_pixel(ref, x-dx+0, y-dy-1) << 9;
+      CONTEXT |= jbig2_image_get_pixel(ref, x-dx-1, y-dy+1) << 6;
+      CONTEXT |= jbig2_image_get_pixel(ref, x-dx+1, y-dy+0) << 7;
+      CONTEXT |= jbig2_image_get_pixel(ref, x-dx+0, y-dy+0) << 8;
+      CONTEXT |= jbig2_image_get_pixel(ref, x-dx-1, y-dy+0) << 9;
+      CONTEXT |= jbig2_image_get_pixel(ref, x-dx+1, y-dy-1) << 10;
+      CONTEXT |= jbig2_image_get_pixel(ref, x-dx+0, y-dy-1) << 11;
+      CONTEXT |= jbig2_image_get_pixel(ref, x-dx-1, y-dy-1) << 12;
       bit = jbig2_arith_decode(as, &GB_stats[CONTEXT]);
       jbig2_image_set_pixel(image, x, y, bit);
     }
@@ -271,7 +274,7 @@
     return jbig2_decode_refinement_template1_unopt(ctx, segment, params, 
                                              as, image, GB_stats);
   else
-    return jbig2_decode_refinement_template0(ctx, segment, params,
+    return jbig2_decode_refinement_template0_unopt(ctx, segment, params,
                                              as, image, GB_stats);
 }