shithub: jbig2

ref: a0531af83d6d29abe2fccb488fa7b741d68cb3fd
dir: /jbig2_hufftab.h/

View raw version
/*
    jbig2dec
    
    Copyright (c) 2001-2005 artofcode LLC.
    
    This software is distributed under license and may not
    be copied, modified or distributed except as expressly
    authorized under the terms of the license contained in
    the file LICENSE in this distribution.
                                                                                
    For information on commercial licensing, go to
    http://www.artifex.com/licensing/ or contact
    Artifex Software, Inc.,  101 Lucas Valley Road #110,
    San Rafael, CA  94903, U.S.A., +1(415)492-9861.
    
    $Id$
*/

/* predefined Huffman table definitions 
    -- See Annex B of the JBIG2 specification */

#ifndef JBIG2_HUFFTAB_H
#define JBIG2_HUFFTAB_H

/* types are in jbig2_huffman.h, you must include that first */


/* Table B.1 */
const Jbig2HuffmanLine
jbig2_huffman_lines_A[] = {
  { 1, 4, 0 },
  { 2, 8, 16 },
  { 3, 16, 272 },
  { 0, 32, -1 },   /* low */
  { 3, 32, 65808 } /* high */
};

const Jbig2HuffmanParams
jbig2_huffman_params_A = { FALSE, 5, jbig2_huffman_lines_A };

/* Table B.2 */
const Jbig2HuffmanLine
jbig2_huffman_lines_B[] = {
  { 1, 0, 0 },
  { 2, 0, 1 },
  { 3, 0, 2 },
  { 4, 3, 3 },
  { 5, 6, 11 },
  { 0, 32, -1 }, /* low */
  { 6, 32, 75 }, /* high */
  { 6, 0, 0 }
};

const Jbig2HuffmanParams
jbig2_huffman_params_B = { TRUE, 8, jbig2_huffman_lines_B };

/* Table B.3 */
const Jbig2HuffmanLine
jbig2_huffman_lines_C[] = {
  { 8, 8, -256 },
  { 1, 0, 0 },
  { 2, 0, 1 },
  { 3, 0, 2 },
  { 4, 3, 3 },
  { 5, 6, 11 },
  { 8, 32, -257 }, /* low */
  { 7, 32, 75 },   /* high */
  { 6, 0, 0 } /* OOB */
};

const Jbig2HuffmanParams
jbig2_huffman_params_C = { TRUE, 9, jbig2_huffman_lines_C };

/* Table B.4 */
const Jbig2HuffmanLine
jbig2_huffman_lines_D[] = {
  { 1, 0, 1 },
  { 2, 0, 2 },
  { 3, 0, 3 },
  { 4, 3, 4 },
  { 5, 6, 12 },
  { 0, 32, -1 }, /* low */
  { 5, 32, 76 }, /* high */
};

const Jbig2HuffmanParams
jbig2_huffman_params_D = { FALSE, 7, jbig2_huffman_lines_D };

/* Table B.5 */
const Jbig2HuffmanLine
jbig2_huffman_lines_E[] = {
	{7, 8, -255},
	{1, 0, 1},
	{2, 0, 2},
	{3, 0, 3},
	{4, 3, 4},
	{5, 6, 12},
	{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[] = {
  { 3, 0, -2 },
  { 3, 0, -1 },
  { 1, 0, 0 },
  { 3, 3, 1 },
  { 3, 6, 2 },
  { 0, 32, -1 }, /* low */
  { 0, 32, 3 }, /* high */
};

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 */