shithub: jbig2

Download patch

ref: b8fc23e4731a172600282a65e9602ff1963bfead
parent: 42c0312cc2855d2cc0d83954968c65a8e5e6107d
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Fri Dec 3 21:29:17 EST 2004

Implement non-standard AT positions in the unoptimized version 
of the refinement region template. We now properly decode ubc
test stream 042_23.


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

--- a/CHANGES
+++ b/CHANGES
@@ -2,7 +2,7 @@
 
  * properly initialize page buffers
  * refinement region handling
- * successfully decodes ubc test streams 042_21 and 042_22
+ * successfully decodes ubc test streams 042_21, 042_22 and 042_23
  
 Version 0.6 (2003 December 31)
 
--- a/jbig2_refinement.c
+++ b/jbig2_refinement.c
@@ -75,7 +75,8 @@
       CONTEXT |= jbig2_image_get_pixel(image, x - 1, y + 0) << 0; 
       CONTEXT |= jbig2_image_get_pixel(image, x + 1, y - 1) << 1; 
       CONTEXT |= jbig2_image_get_pixel(image, x + 0, y - 1) << 2; 
-      CONTEXT |= jbig2_image_get_pixel(image, x - 1, y - 1) << 3; 
+      CONTEXT |= jbig2_image_get_pixel(image, x + params->grat[0], 
+	y + params->grat[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+1) << 6;
@@ -84,7 +85,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;
+      CONTEXT |= jbig2_image_get_pixel(ref, x-dx+params->grat[2], 
+	y-dy+params->grat[3]) << 12;
       bit = jbig2_arith_decode(as, &GB_stats[CONTEXT]);
       jbig2_image_set_pixel(image, x, y, bit);
     }