shithub: jbig2

Download patch

ref: b28d531ea50bf15cc80cb068192b47b57a8916ce
parent: 2ff386d420a62438df630a8b0ba3a022469cd3f8
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Wed Jun 8 10:20:45 EDT 2005

Implement remaining standard huffman tables.


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

--- a/jbig2_huffman.h
+++ b/jbig2_huffman.h
@@ -85,7 +85,7 @@
 extern const Jbig2HuffmanParams jbig2_huffman_params_K; /* Table B.11 */
 extern const Jbig2HuffmanParams jbig2_huffman_params_L; /* Table B.12 */
 extern const Jbig2HuffmanParams jbig2_huffman_params_M; /* Table B.13 */
-extern const Jbig2HuffmanParams jbig2_huffman_params_J; /* Table B.14 */
+extern const Jbig2HuffmanParams jbig2_huffman_params_N; /* Table B.14 */
 extern const Jbig2HuffmanParams jbig2_huffman_params_O; /* Table B.15 */
 
 
--- a/jbig2_hufftab.h
+++ b/jbig2_hufftab.h
@@ -1,7 +1,7 @@
 /*
     jbig2dec
     
-    Copyright (c) 2001 artofcode LLC.
+    Copyright (c) 2001-2005 artofcode LLC.
     
     This software is distributed under license and may not
     be copied, modified or distributed except as expressly
@@ -95,13 +95,210 @@
 	{3, 0, 3},
 	{4, 3, 4},
 	{5, 6, 12},
-	{7, 32, -256},
-	{6, 32, 76}
+	{7, 32, -256}, /* low */
+	{6, 32, 76}    /* high */
 };
 
 const Jbig2HuffmanParams
 jbig2_huffman_params_E = { FALSE, 8, jbig2_huffman_lines_E };
 
+/* Table B.6 */
+const Jbig2HuffmanLine
+jbig2_huffman_lines_F[] = {
+	{5, 10, -2048},
+	{4, 9, -1024},
+	{4, 8, -512},
+	{4, 7, -256},
+	{5, 6, -128},
+	{5, 5, -64},
+	{4, 5, -32},
+	{2, 7, 0},
+	{3, 7, 128},
+	{3, 8, 256},
+	{4, 9, 512},
+	{4, 10, 1024},
+	{6, 32, -2049}, /* low */
+	{6, 32, 2048}   /* high */
+};
+
+const Jbig2HuffmanParams
+jbig2_huffman_params_F = { FALSE, 14, jbig2_huffman_lines_F };
+
+/* Table B.7 */
+const Jbig2HuffmanLine
+jbig2_huffman_lines_G[] = {
+	{4, 9, -1024},
+	{3, 8, -512},
+	{4, 7, -256},
+	{5, 6, -128},
+	{5, 5, -64},
+	{4, 5, -32},
+	{4, 5, 0},
+	{5, 5, 32},
+	{5, 6, 64},
+	{4, 7, 128},
+	{3, 8, 256},
+	{3, 9, 512},
+	{3, 10, 1024},
+	{5, 32, -1025}, /* low */
+	{5, 32, 2048}  /* high */
+};
+
+const Jbig2HuffmanParams
+jbig2_huffman_params_G = { FALSE, 15, jbig2_huffman_lines_G };
+
+/* Table B.8 */
+const Jbig2HuffmanLine
+jbig2_huffman_lines_H[] = {
+	{8, 3, -15},
+	{9, 1, -7},
+	{8, 1, -5},
+	{9, 0, -3},
+	{7, 0, -2},
+	{4, 0, -1},
+	{2, 1, 0},
+	{5, 0, 2},
+	{6, 0, 3},
+	{3, 4, 4},
+	{6, 1, 20},
+	{4, 4, 22},
+	{4, 5, 38},
+	{5, 6, 70},
+	{5, 7, 134},
+	{6, 7, 262},
+	{7, 8, 390},
+	{6, 10, 646},
+	{9, 32, -16}, /* low */
+	{9, 32, 1670}, /* high */
+	{2, 0, 0}  /* OOB */
+};
+
+const Jbig2HuffmanParams
+jbig2_huffman_params_H = { TRUE, 21, jbig2_huffman_lines_H };
+
+/* Table B.9 */
+const Jbig2HuffmanLine
+jbig2_huffman_lines_I[] = {
+	{8, 4, -31},
+	{9, 2, -15},
+	{8, 2, -11},
+	{9, 1, -7},
+	{7, 1, -5},
+	{4, 1, -3},
+	{3, 1, -1},
+	{3, 1, 1},
+	{5, 1, 3},
+	{6, 1, 5},
+	{3, 5, 7},
+	{6, 2, 39},
+	{4, 5, 43},
+	{4, 6, 75},
+	{5, 7, 139},
+	{5, 8, 267},
+	{6, 8, 523},
+	{7, 9, 779},
+	{6, 11, 1291},
+	{9, 32, -32},  /* low */
+	{9, 32, 3339}, /* high */
+	{2, 0, 0}      /* OOB */
+};
+
+const Jbig2HuffmanParams
+jbig2_huffman_params_I = { TRUE, 22, jbig2_huffman_lines_I };
+
+/* Table B.10 */
+const Jbig2HuffmanLine
+jbig2_huffman_lines_J[] = {
+	{7, 4, -21},
+	{8, 0, -5},
+	{7, 0, -4},
+	{5, 0, -3},
+	{2, 2, -2},
+	{5, 0, 2},
+	{6, 0, 3},
+	{7, 0, 4},
+	{8, 0, 5},
+	{2, 6, 6},
+	{5, 5, 70},
+	{6, 5, 102},
+	{6, 6, 134},
+	{6, 7, 198},
+	{6, 8, 326},
+	{6, 9, 582},
+	{6, 10, 1094},
+	{7, 11, 2118},
+	{8, 32, -22},  /* low */
+	{8, 32, 4166}, /* high */
+	{2, 0, 0}      /* OOB */
+};
+
+const Jbig2HuffmanParams
+jbig2_huffman_params_J = { TRUE, 21, jbig2_huffman_lines_J };
+
+/* Table B.11 */
+const Jbig2HuffmanLine
+jbig2_huffman_lines_K[] = {
+	{1, 0, 1},
+	{2, 1, 2},
+	{4, 0, 3},
+	{4, 1, 5},
+	{5, 1, 7},
+	{5, 2, 9},
+	{6, 2, 13},
+	{7, 2, 17},
+	{7, 3, 21},
+	{7, 4, 29},
+	{7, 5, 45},
+	{7, 6, 77},
+	{7, 32, 141} /* high */
+};
+
+const Jbig2HuffmanParams
+jbig2_huffman_params_K = { FALSE, 13, jbig2_huffman_lines_K };
+
+/* Table B.12 */
+const Jbig2HuffmanLine
+jbig2_huffman_lines_L[] = {
+	{1, 0, 1},
+	{3, 0, 2},
+	{4, 0, 3},
+	{5, 0, 4},
+	{4, 1, 5},
+	{3, 3, 7},
+	{6, 1, 15},
+	{6, 2, 17},
+	{6, 3, 21},
+	{6, 4, 29},
+	{6, 5, 45},
+	{7, 6, 77},
+	{7, 32, 141}
+};
+
+const Jbig2HuffmanParams
+jbig2_huffman_params_L = { FALSE, 13, jbig2_huffman_lines_L };
+
+
+/* Table B.13 */
+const Jbig2HuffmanLine
+jbig2_huffman_lines_M[] = {
+	{1, 0, 1},
+	{3, 0, 2},
+	{4, 0, 3},
+	{5, 0, 4},
+	{4, 1, 5},
+	{3, 3, 7},
+	{6, 1, 15},
+	{6, 2, 17},
+	{6, 3, 21},
+	{6, 4, 29},
+	{6, 5, 45},
+	{7, 6, 77},
+	{7, 32, 141} /* high */
+};
+
+const Jbig2HuffmanParams
+jbig2_huffman_params_M = { FALSE, 13, jbig2_huffman_lines_M };
+
 /* Table B.14 */
 const Jbig2HuffmanLine
 jbig2_huffman_lines_N[] = {
@@ -117,5 +314,25 @@
 const Jbig2HuffmanParams
 jbig2_huffman_params_N = { FALSE, 7, jbig2_huffman_lines_N };
 
+/* Table B.15 */
+const Jbig2HuffmanLine
+jbig2_huffman_lines_O[] = {
+	{7, 4, -24},
+	{6, 2, -8},
+	{5, 1, -4},
+	{4, 0, -2},
+	{3, 0, -1},
+	{1, 0, 0},
+	{3, 0, 1},
+	{4, 0, 2},
+	{5, 1, 3},
+	{6, 2, 5},
+	{7, 4, 9},
+	{7, 32, -25}, /* low */
+	{7, 32, 25}   /* high */
+};
+
+const Jbig2HuffmanParams
+jbig2_huffman_params_O = { FALSE, 13, jbig2_huffman_lines_O };
 
 #endif /* JBIG2_HUFFTAB_H */