Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /*
  2.     jbig2dec
  3.  
  4.     Copyright (C) 2001-2005 Artifex Software, Inc.
  5.  
  6.     This software is distributed under license and may not
  7.     be copied, modified or distributed except as expressly
  8.     authorized under the terms of the license contained in
  9.     the file LICENSE in this distribution.
  10.  
  11.     For further licensing information refer to http://artifex.com/ or
  12.     contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
  13.     San Rafael, CA  94903, U.S.A., +1(415)492-9861.
  14. */
  15.  
  16. /* predefined Huffman table definitions
  17.     -- See Annex B of the JBIG2 specification */
  18.  
  19. #ifndef JBIG2_HUFFTAB_H
  20. #define JBIG2_HUFFTAB_H
  21.  
  22. /* types are in jbig2_huffman.h, you must include that first */
  23.  
  24.  
  25. /* Table B.1 */
  26. const Jbig2HuffmanLine
  27. jbig2_huffman_lines_A[] = {
  28.   { 1, 4, 0 },
  29.   { 2, 8, 16 },
  30.   { 3, 16, 272 },
  31.   { 0, 32, -1 },   /* low */
  32.   { 3, 32, 65808 } /* high */
  33. };
  34.  
  35. const Jbig2HuffmanParams
  36. jbig2_huffman_params_A = { FALSE, 5, jbig2_huffman_lines_A };
  37.  
  38. /* Table B.2 */
  39. const Jbig2HuffmanLine
  40. jbig2_huffman_lines_B[] = {
  41.   { 1, 0, 0 },
  42.   { 2, 0, 1 },
  43.   { 3, 0, 2 },
  44.   { 4, 3, 3 },
  45.   { 5, 6, 11 },
  46.   { 0, 32, -1 }, /* low */
  47.   { 6, 32, 75 }, /* high */
  48.   { 6, 0, 0 }
  49. };
  50.  
  51. const Jbig2HuffmanParams
  52. jbig2_huffman_params_B = { TRUE, 8, jbig2_huffman_lines_B };
  53.  
  54. /* Table B.3 */
  55. const Jbig2HuffmanLine
  56. jbig2_huffman_lines_C[] = {
  57.   { 8, 8, -256 },
  58.   { 1, 0, 0 },
  59.   { 2, 0, 1 },
  60.   { 3, 0, 2 },
  61.   { 4, 3, 3 },
  62.   { 5, 6, 11 },
  63.   { 8, 32, -257 }, /* low */
  64.   { 7, 32, 75 },   /* high */
  65.   { 6, 0, 0 } /* OOB */
  66. };
  67.  
  68. const Jbig2HuffmanParams
  69. jbig2_huffman_params_C = { TRUE, 9, jbig2_huffman_lines_C };
  70.  
  71. /* Table B.4 */
  72. const Jbig2HuffmanLine
  73. jbig2_huffman_lines_D[] = {
  74.   { 1, 0, 1 },
  75.   { 2, 0, 2 },
  76.   { 3, 0, 3 },
  77.   { 4, 3, 4 },
  78.   { 5, 6, 12 },
  79.   { 0, 32, -1 }, /* low */
  80.   { 5, 32, 76 }, /* high */
  81. };
  82.  
  83. const Jbig2HuffmanParams
  84. jbig2_huffman_params_D = { FALSE, 7, jbig2_huffman_lines_D };
  85.  
  86. /* Table B.5 */
  87. const Jbig2HuffmanLine
  88. jbig2_huffman_lines_E[] = {
  89.         {7, 8, -255},
  90.         {1, 0, 1},
  91.         {2, 0, 2},
  92.         {3, 0, 3},
  93.         {4, 3, 4},
  94.         {5, 6, 12},
  95.         {7, 32, -256}, /* low */
  96.         {6, 32, 76}    /* high */
  97. };
  98.  
  99. const Jbig2HuffmanParams
  100. jbig2_huffman_params_E = { FALSE, 8, jbig2_huffman_lines_E };
  101.  
  102. /* Table B.6 */
  103. const Jbig2HuffmanLine
  104. jbig2_huffman_lines_F[] = {
  105.         {5, 10, -2048},
  106.         {4, 9, -1024},
  107.         {4, 8, -512},
  108.         {4, 7, -256},
  109.         {5, 6, -128},
  110.         {5, 5, -64},
  111.         {4, 5, -32},
  112.         {2, 7, 0},
  113.         {3, 7, 128},
  114.         {3, 8, 256},
  115.         {4, 9, 512},
  116.         {4, 10, 1024},
  117.         {6, 32, -2049}, /* low */
  118.         {6, 32, 2048}   /* high */
  119. };
  120.  
  121. const Jbig2HuffmanParams
  122. jbig2_huffman_params_F = { FALSE, 14, jbig2_huffman_lines_F };
  123.  
  124. /* Table B.7 */
  125. const Jbig2HuffmanLine
  126. jbig2_huffman_lines_G[] = {
  127.         {4, 9, -1024},
  128.         {3, 8, -512},
  129.         {4, 7, -256},
  130.         {5, 6, -128},
  131.         {5, 5, -64},
  132.         {4, 5, -32},
  133.         {4, 5, 0},
  134.         {5, 5, 32},
  135.         {5, 6, 64},
  136.         {4, 7, 128},
  137.         {3, 8, 256},
  138.         {3, 9, 512},
  139.         {3, 10, 1024},
  140.         {5, 32, -1025}, /* low */
  141.         {5, 32, 2048}  /* high */
  142. };
  143.  
  144. const Jbig2HuffmanParams
  145. jbig2_huffman_params_G = { FALSE, 15, jbig2_huffman_lines_G };
  146.  
  147. /* Table B.8 */
  148. const Jbig2HuffmanLine
  149. jbig2_huffman_lines_H[] = {
  150.         {8, 3, -15},
  151.         {9, 1, -7},
  152.         {8, 1, -5},
  153.         {9, 0, -3},
  154.         {7, 0, -2},
  155.         {4, 0, -1},
  156.         {2, 1, 0},
  157.         {5, 0, 2},
  158.         {6, 0, 3},
  159.         {3, 4, 4},
  160.         {6, 1, 20},
  161.         {4, 4, 22},
  162.         {4, 5, 38},
  163.         {5, 6, 70},
  164.         {5, 7, 134},
  165.         {6, 7, 262},
  166.         {7, 8, 390},
  167.         {6, 10, 646},
  168.         {9, 32, -16}, /* low */
  169.         {9, 32, 1670}, /* high */
  170.         {2, 0, 0}  /* OOB */
  171. };
  172.  
  173. const Jbig2HuffmanParams
  174. jbig2_huffman_params_H = { TRUE, 21, jbig2_huffman_lines_H };
  175.  
  176. /* Table B.9 */
  177. const Jbig2HuffmanLine
  178. jbig2_huffman_lines_I[] = {
  179.         {8, 4, -31},
  180.         {9, 2, -15},
  181.         {8, 2, -11},
  182.         {9, 1, -7},
  183.         {7, 1, -5},
  184.         {4, 1, -3},
  185.         {3, 1, -1},
  186.         {3, 1, 1},
  187.         {5, 1, 3},
  188.         {6, 1, 5},
  189.         {3, 5, 7},
  190.         {6, 2, 39},
  191.         {4, 5, 43},
  192.         {4, 6, 75},
  193.         {5, 7, 139},
  194.         {5, 8, 267},
  195.         {6, 8, 523},
  196.         {7, 9, 779},
  197.         {6, 11, 1291},
  198.         {9, 32, -32},  /* low */
  199.         {9, 32, 3339}, /* high */
  200.         {2, 0, 0}      /* OOB */
  201. };
  202.  
  203. const Jbig2HuffmanParams
  204. jbig2_huffman_params_I = { TRUE, 22, jbig2_huffman_lines_I };
  205.  
  206. /* Table B.10 */
  207. const Jbig2HuffmanLine
  208. jbig2_huffman_lines_J[] = {
  209.         {7, 4, -21},
  210.         {8, 0, -5},
  211.         {7, 0, -4},
  212.         {5, 0, -3},
  213.         {2, 2, -2},
  214.         {5, 0, 2},
  215.         {6, 0, 3},
  216.         {7, 0, 4},
  217.         {8, 0, 5},
  218.         {2, 6, 6},
  219.         {5, 5, 70},
  220.         {6, 5, 102},
  221.         {6, 6, 134},
  222.         {6, 7, 198},
  223.         {6, 8, 326},
  224.         {6, 9, 582},
  225.         {6, 10, 1094},
  226.         {7, 11, 2118},
  227.         {8, 32, -22},  /* low */
  228.         {8, 32, 4166}, /* high */
  229.         {2, 0, 0}      /* OOB */
  230. };
  231.  
  232. const Jbig2HuffmanParams
  233. jbig2_huffman_params_J = { TRUE, 21, jbig2_huffman_lines_J };
  234.  
  235. /* Table B.11 */
  236. const Jbig2HuffmanLine
  237. jbig2_huffman_lines_K[] = {
  238.         {1, 0, 1},
  239.         {2, 1, 2},
  240.         {4, 0, 3},
  241.         {4, 1, 5},
  242.         {5, 1, 7},
  243.         {5, 2, 9},
  244.         {6, 2, 13},
  245.         {7, 2, 17},
  246.         {7, 3, 21},
  247.         {7, 4, 29},
  248.         {7, 5, 45},
  249.         {7, 6, 77},
  250.         {7, 32, 141} /* high */
  251. };
  252.  
  253. const Jbig2HuffmanParams
  254. jbig2_huffman_params_K = { FALSE, 13, jbig2_huffman_lines_K };
  255.  
  256. /* Table B.12 */
  257. const Jbig2HuffmanLine
  258. jbig2_huffman_lines_L[] = {
  259.         {1, 0, 1},
  260.         {2, 0, 2},
  261.         {3, 1, 3},
  262.         {5, 0, 5},
  263.         {5, 1, 6},
  264.         {6, 1, 8},
  265.         {7, 0, 10},
  266.         {7, 1, 11},
  267.         {7, 2, 13},
  268.         {7, 3, 17},
  269.         {7, 4, 25},
  270.         {8, 5, 41},
  271.         {8, 32, 73}
  272. };
  273.  
  274. const Jbig2HuffmanParams
  275. jbig2_huffman_params_L = { FALSE, 13, jbig2_huffman_lines_L };
  276.  
  277.  
  278. /* Table B.13 */
  279. const Jbig2HuffmanLine
  280. jbig2_huffman_lines_M[] = {
  281.         {1, 0, 1},
  282.         {3, 0, 2},
  283.         {4, 0, 3},
  284.         {5, 0, 4},
  285.         {4, 1, 5},
  286.         {3, 3, 7},
  287.         {6, 1, 15},
  288.         {6, 2, 17},
  289.         {6, 3, 21},
  290.         {6, 4, 29},
  291.         {6, 5, 45},
  292.         {7, 6, 77},
  293.         {7, 32, 141} /* high */
  294. };
  295.  
  296. const Jbig2HuffmanParams
  297. jbig2_huffman_params_M = { FALSE, 13, jbig2_huffman_lines_M };
  298.  
  299. /* Table B.14 */
  300. const Jbig2HuffmanLine
  301. jbig2_huffman_lines_N[] = {
  302.   { 3, 0, -2 },
  303.   { 3, 0, -1 },
  304.   { 1, 0, 0 },
  305.   { 3, 3, 1 },
  306.   { 3, 6, 2 },
  307.   { 0, 32, -1 }, /* low */
  308.   { 0, 32, 3 }, /* high */
  309. };
  310.  
  311. const Jbig2HuffmanParams
  312. jbig2_huffman_params_N = { FALSE, 7, jbig2_huffman_lines_N };
  313.  
  314. /* Table B.15 */
  315. const Jbig2HuffmanLine
  316. jbig2_huffman_lines_O[] = {
  317.         {7, 4, -24},
  318.         {6, 2, -8},
  319.         {5, 1, -4},
  320.         {4, 0, -2},
  321.         {3, 0, -1},
  322.         {1, 0, 0},
  323.         {3, 0, 1},
  324.         {4, 0, 2},
  325.         {5, 1, 3},
  326.         {6, 2, 5},
  327.         {7, 4, 9},
  328.         {7, 32, -25}, /* low */
  329.         {7, 32, 25}   /* high */
  330. };
  331.  
  332. const Jbig2HuffmanParams
  333. jbig2_huffman_params_O = { FALSE, 13, jbig2_huffman_lines_O };
  334.  
  335. #endif /* JBIG2_HUFFTAB_H */
  336.