JPEG标准中推荐的缺省huffman编码表

/* created(bruin, 2002.11.26) */
  
typedef unsigned char BYTE;
  
/* entry in huffman table: the entry index is the symbol value */
typedef struct{
         BYTE  size;  /* number of bits of the huffman code. <= 16 */
         WORD  code;  /* huffman code in the least signficant bits */
}HUFF_ENTRY;
  
  
/* JPEG DHT format of 4 typical huffman tables given in "ISO/IEC 10918-1, 1993(e), Annex K":  
  
    + luminance DC coefficient difference,
    + luminance AC coefficient,  
    + chrominance DC coefficient difference, and
    + chrominance AC coeeficient
  
    this block of data can be obtained by simply dumping a typical jpeg file.

*/

注意:霍夫曼表一般包括四个部分,直流亮度霍夫曼值(DC Luminance)、交流亮度霍夫曼值(AC Luminance)、直流色度霍夫曼值(DC Chrominance)、交流色度霍夫曼值(AC Chrominance),但是在具体应用中,这四部分的顺序是可以调整的,比如在mjpg-Streamer中的顺序是:直流亮度直流色度交流亮度交流色度

static BYTE s_default_dht[] = {
  
         0xff,0xc4, /* DHT (Define Huffman Table) identifier */
         0x01,0xa2, /* section size: 0x01a2, from this two bytes to the end, inclusive */  
  
         0x00,                                                                                                                                  /* DC Luminance */
         0x00,0x01,0x05,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* BITS         */
         0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,                                   /* HUFFVALS     */
  
         0x10,                                                                                                                                  /* AC Luminance */
         0x00,0x02,0x01,0x03,0x03,0x02,0x04,0x03,0x05,0x05,0x04,0x04,0x00,0x00,0x01,0x7d, /* BITS         */
         0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, /* HUFFVALS     */
         0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08,0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0,
         0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16,0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28,
         0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,
         0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,
         0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89,
         0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,
         0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,
         0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2,
         0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,
         0xf9,0xfa,
  
         0x01,                                                                                                                                  /* DC Chrominance */
         0x00,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, /* BITS           */
         0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,                                   /* HUFFVALS       */
  
         0x11,                                                                                                                                  /* AC Chrominance */
         0x00,0x02,0x01,0x02,0x04,0x04,0x03,0x04,0x07,0x05,0x04,0x04,0x00,0x01,0x02,0x77, /* BITS           */
         0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21,0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, /* HUFFVALS       */
         0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91,0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0,
         0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34,0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26,
         0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,
         0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68,
         0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87,
         0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,
         0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3,
         0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,
         0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,
         0xf9,0xfa
};
  
/* the following are huffman tables derived from above DHT data by using algorithms  
    given in "ISO/IEC 10918-1, 1993(e), Annex C".
  
    given: BITS (a 16 byte list giving the nr of codes for each code length from 1 to 16 )
           HUFFVAL (a list of 8-bit symbol values, each of which is assigned a huffman
           code, the symbol values are placed in the list in the order of increasing
           code length. code lengths greater then 16 are not allowed.)
    to create:
           HUFFSIZE (a list of code lengths, the list size is the sum of 16 byte in BITS)
           HUFFCODE (the huffman codes corresponding to those lengths in HUFFSIZE)
  
   the following code fragment could be used to create HUFFSIZE table:
          
         k = 0;
         for(i = 0; i < 16; i ++)
                 for(j = 0; j < BITS[i]; j ++){
                         HUFFSIZE[k++] = i + 1;
                 }
         huffsize_table_size = k;
  
   the following code fragment could be used to create HUFFCODE table:
  
         code = 0x00;
         for(i = 0; i < huffsize_table_size; i ++){
                 if(i == 0 || (HUFFCODE[i] == HUFFCODE[i - 1])){
                         HUFFCODE[i] = code;
                         code ++;
                 }
                 else{
                         code <<= (HUFFSIZE[i] - HUFFSIZE[i - 1]);
                         HUFFCODE[i] = code;
                         code ++;
                 }
         }
  
   the following code fragment coould be used to check validity of the given BITS,
   in case one need to check a given BITS:
    
         bool check_bits(unsigned char bits[16]){
         int i;
         int c = 0xffff;
         for(i = 0; i < 16; i ++){
                 printf("i=%d, c=%d\n", i, c);
                 if((c = c - bits[i] * pow(2, (15 - i))) < 0){
                         printf("error at %d, bits[%d]=%d\n", i, i, bits[i]);
                         return false;
                 }
         }
         return true;
         }
  
   in the following 4 generated huffman tables, the array index is symbol values (HUFFVAL),  
   while each element contains the code length (HUFFSIZE) and the code (HUFFCODE) for  
   the corresponding symbol value (also the "code word" is illustrated in the comments
   for each element).  
  
   be noted that in AC tables, for those symbol values do not included the huffman table,  
   it's HUFFSIZE and HUFFCODE been set to 0.
  
*/
static HUFF_ENTRY s_lumin_dc[12] = {
         { 2, 0x0000}, /*               00 */
         { 3, 0x0002}, /*              010 */
         { 3, 0x0003}, /*              011 */
         { 3, 0x0004}, /*              100 */
         { 3, 0x0005}, /*              101 */
         { 3, 0x0006}, /*              110 */
         { 4, 0x000e}, /*             1110 */
         { 5, 0x001e}, /*            11110 */
         { 6, 0x003e}, /*           111110 */
         { 7, 0x007e}, /*          1111110 */
         { 8, 0x00fe}, /*         11111110 */
         { 9, 0x01fe}  /*        111111110 */
};
  
static HUFF_ENTRY s_chrom_dc[12] = {
         { 2, 0x0000}, /*               00 */
         { 2, 0x0001}, /*               01 */
         { 2, 0x0002}, /*               10 */
         { 3, 0x0006}, /*              110 */
         { 4, 0x000e}, /*             1110 */
         { 5, 0x001e}, /*            11110 */
         { 6, 0x003e}, /*           111110 */
         { 7, 0x007e}, /*          1111110 */
         { 8, 0x00fe}, /*         11111110 */
         { 9, 0x01fe}, /*        111111110 */
         {10, 0x03fe}, /*       1111111110 */
         {11, 0x07fe}  /*      11111111110 */
};
  
/* 162 valid entries */
static HUFF_ENTRY s_lumin_ac[256] = {
  
         { 4, 0x000a}, /* 0x00:              1010 */
         { 2, 0x0000}, /* 0x01:                00 */
         { 2, 0x0001}, /* 0x02:                01 */
         { 3, 0x0004}, /* 0x03:               100 */
         { 4, 0x000b}, /* 0x04:              1011 */
         { 5, 0x001a}, /* 0x05:             11010 */
         { 7, 0x0078}, /* 0x06:           1111000 */
         { 8, 0x00f8}, /* 0x07:          11111000 */
         {10, 0x03f6}, /* 0x08:        1111110110 */
         {16, 0xff82}, /* 0x09:  1111111110000010 */
         {16, 0xff83}, /* 0x0a:  1111111110000011 */
         { 0, 0x0000}, /* 0x0b:                   */
         { 0, 0x0000}, /* 0x0c:                   */
         { 0, 0x0000}, /* 0x0d:                   */
         { 0, 0x0000}, /* 0x0e:                   */
         { 0, 0x0000}, /* 0x0f:                   */
         { 0, 0x0000}, /* 0x10:                   */
         { 4, 0x000c}, /* 0x11:              1100 */
         { 5, 0x001b}, /* 0x12:             11011 */
         { 7, 0x0079}, /* 0x13:           1111001 */
         { 9, 0x01f6}, /* 0x14:         111110110 */
         {11, 0x07f6}, /* 0x15:       11111110110 */
         {16, 0xff84}, /* 0x16:  1111111110000100 */
         {16, 0xff85}, /* 0x17:  1111111110000101 */
         {16, 0xff86}, /* 0x18:  1111111110000110 */
         {16, 0xff87}, /* 0x19:  1111111110000111 */
         {16, 0xff88}, /* 0x1a:  1111111110001000 */
         { 0, 0x0000}, /* 0x1b:                   */
         { 0, 0x0000}, /* 0x1c:                   */
         { 0, 0x0000}, /* 0x1d:                   */
         { 0, 0x0000}, /* 0x1e:                   */
         { 0, 0x0000}, /* 0x1f:                   */
         { 0, 0x0000}, /* 0x20:                   */
         { 5, 0x001c}, /* 0x21:             11100 */
         { 8, 0x00f9}, /* 0x22:          11111001 */
         {10, 0x03f7}, /* 0x23:        1111110111 */
         {12, 0x0ff4}, /* 0x24:      111111110100 */
         {16, 0xff89}, /* 0x25:  1111111110001001 */
         {16, 0xff8a}, /* 0x26:  1111111110001010 */
         {16, 0xff8b}, /* 0x27:  1111111110001011 */
         {16, 0xff8c}, /* 0x28:  1111111110001100 */
         {16, 0xff8d}, /* 0x29:  1111111110001101 */
         {16, 0xff8e}, /* 0x2a:  1111111110001110 */
         { 0, 0x0000}, /* 0x2b:                   */
         { 0, 0x0000}, /* 0x2c:                   */
         { 0, 0x0000}, /* 0x2d:                   */
         { 0, 0x0000}, /* 0x2e:                   */
         { 0, 0x0000}, /* 0x2f:                   */
         { 0, 0x0000}, /* 0x30:                   */
         { 6, 0x003a}, /* 0x31:            111010 */
         { 9, 0x01f7}, /* 0x32:         111110111 */
         {12, 0x0ff5}, /* 0x33:      111111110101 */
         {16, 0xff8f}, /* 0x34:  1111111110001111 */
         {16, 0xff90}, /* 0x35:  1111111110010000 */
         {16, 0xff91}, /* 0x36:  1111111110010001 */
         {16, 0xff92}, /* 0x37:  1111111110010010 */
         {16, 0xff93}, /* 0x38:  1111111110010011 */
         {16, 0xff94}, /* 0x39:  1111111110010100 */
         {16, 0xff95}, /* 0x3a:  1111111110010101 */
         { 0, 0x0000}, /* 0x3b:                   */
         { 0, 0x0000}, /* 0x3c:                   */
         { 0, 0x0000}, /* 0x3d:                   */
         { 0, 0x0000}, /* 0x3e:                   */
         { 0, 0x0000}, /* 0x3f:                   */
         { 0, 0x0000}, /* 0x40:                   */
         { 6, 0x003b}, /* 0x41:            111011 */
         {10, 0x03f8}, /* 0x42:        1111111000 */
         {16, 0xff96}, /* 0x43:  1111111110010110 */
         {16, 0xff97}, /* 0x44:  1111111110010111 */
         {16, 0xff98}, /* 0x45:  1111111110011000 */
         {16, 0xff99}, /* 0x46:  1111111110011001 */
         {16, 0xff9a}, /* 0x47:  1111111110011010 */
         {16, 0xff9b}, /* 0x48:  1111111110011011 */
         {16, 0xff9c}, /* 0x49:  1111111110011100 */
         {16, 0xff9d}, /* 0x4a:  1111111110011101 */
         { 0, 0x0000}, /* 0x4b:                   */
         { 0, 0x0000}, /* 0x4c:                   */
         { 0, 0x0000}, /* 0x4d:                   */
         { 0, 0x0000}, /* 0x4e:                   */
         { 0, 0x0000}, /* 0x4f:                   */
         { 0, 0x0000}, /* 0x50:                   */
         { 7, 0x007a}, /* 0x51:           1111010 */
         {11, 0x07f7}, /* 0x52:       11111110111 */
         {16, 0xff9e}, /* 0x53:  1111111110011110 */
         {16, 0xff9f}, /* 0x54:  1111111110011111 */
         {16, 0xffa0}, /* 0x55:  1111111110100000 */
         {16, 0xffa1}, /* 0x56:  1111111110100001 */
         {16, 0xffa2}, /* 0x57:  1111111110100010 */
         {16, 0xffa3}, /* 0x58:  1111111110100011 */
         {16, 0xffa4}, /* 0x59:  1111111110100100 */
         {16, 0xffa5}, /* 0x5a:  1111111110100101 */
         { 0, 0x0000}, /* 0x5b:                   */
         { 0, 0x0000}, /* 0x5c:                   */
         { 0, 0x0000}, /* 0x5d:                   */
         { 0, 0x0000}, /* 0x5e:                   */
         { 0, 0x0000}, /* 0x5f:                   */
         { 0, 0x0000}, /* 0x60:                   */
         { 7, 0x007b}, /* 0x61:           1111011 */
         {12, 0x0ff6}, /* 0x62:      111111110110 */
         {16, 0xffa6}, /* 0x63:  1111111110100110 */
         {16, 0xffa7}, /* 0x64:  1111111110100111 */
         {16, 0xffa8}, /* 0x65:  1111111110101000 */
         {16, 0xffa9}, /* 0x66:  1111111110101001 */
         {16, 0xffaa}, /* 0x67:  1111111110101010 */
         {16, 0xffab}, /* 0x68:  1111111110101011 */
         {16, 0xffac}, /* 0x69:  1111111110101100 */
         {16, 0xffad}, /* 0x6a:  1111111110101101 */
         { 0, 0x0000}, /* 0x6b:                   */
         { 0, 0x0000}, /* 0x6c:                   */
         { 0, 0x0000}, /* 0x6d:                   */
         { 0, 0x0000}, /* 0x6e:                   */
         { 0, 0x0000}, /* 0x6f:                   */
         { 0, 0x0000}, /* 0x70:                   */
         { 8, 0x00fa}, /* 0x71:          11111010 */
         {12, 0x0ff7}, /* 0x72:      111111110111 */
         {16, 0xffae}, /* 0x73:  1111111110101110 */
         {16, 0xffaf}, /* 0x74:  1111111110101111 */
         {16, 0xffb0}, /* 0x75:  1111111110110000 */
         {16, 0xffb1}, /* 0x76:  1111111110110001 */
         {16, 0xffb2}, /* 0x77:  1111111110110010 */
         {16, 0xffb3}, /* 0x78:  1111111110110011 */
         {16, 0xffb4}, /* 0x79:  1111111110110100 */
         {16, 0xffb5}, /* 0x7a:  1111111110110101 */
         { 0, 0x0000}, /* 0x7b:                   */
         { 0, 0x0000}, /* 0x7c:                   */
         { 0, 0x0000}, /* 0x7d:                   */
         { 0, 0x0000}, /* 0x7e:                   */
         { 0, 0x0000}, /* 0x7f:                   */
         { 0, 0x0000}, /* 0x80:                   */
         { 9, 0x01f8}, /* 0x81:         111111000 */
         {15, 0x7fc0}, /* 0x82:   111111111000000 */
         {16, 0xffb6}, /* 0x83:  1111111110110110 */
         {16, 0xffb7}, /* 0x84:  1111111110110111 */
         {16, 0xffb8}, /* 0x85:  1111111110111000 */
         {16, 0xffb9}, /* 0x86:  1111111110111001 */
         {16, 0xffba}, /* 0x87:  1111111110111010 */
         {16, 0xffbb}, /* 0x88:  1111111110111011 */
         {16, 0xffbc}, /* 0x89:  1111111110111100 */
         {16, 0xffbd}, /* 0x8a:  1111111110111101 */
         { 0, 0x0000}, /* 0x8b:                   */
         { 0, 0x0000}, /* 0x8c:                   */
         { 0, 0x0000}, /* 0x8d:                   */
         { 0, 0x0000}, /* 0x8e:                   */
         { 0, 0x0000}, /* 0x8f:                   */
         { 0, 0x0000}, /* 0x90:                   */
         { 9, 0x01f9}, /* 0x91:         111111001 */
         {16, 0xffbe}, /* 0x92:  1111111110111110 */
         {16, 0xffbf}, /* 0x93:  1111111110111111 */
         {16, 0xffc0}, /* 0x94:  1111111111000000 */
         {16, 0xffc1}, /* 0x95:  1111111111000001 */
         {16, 0xffc2}, /* 0x96:  1111111111000010 */
         {16, 0xffc3}, /* 0x97:  1111111111000011 */
         {16, 0xffc4}, /* 0x98:  1111111111000100 */
         {16, 0xffc5}, /* 0x99:  1111111111000101 */
         {16, 0xffc6}, /* 0x9a:  1111111111000110 */
         { 0, 0x0000}, /* 0x9b:                   */
         { 0, 0x0000}, /* 0x9c:                   */
         { 0, 0x0000}, /* 0x9d:                   */
         { 0, 0x0000}, /* 0x9e:                   */
         { 0, 0x0000}, /* 0x9f:                   */
         { 0, 0x0000}, /* 0xa0:                   */
         { 9, 0x01fa}, /* 0xa1:         111111010 */
         {16, 0xffc7}, /* 0xa2:  1111111111000111 */
         {16, 0xffc8}, /* 0xa3:  1111111111001000 */
         {16, 0xffc9}, /* 0xa4:  1111111111001001 */
         {16, 0xffca}, /* 0xa5:  1111111111001010 */
         {16, 0xffcb}, /* 0xa6:  1111111111001011 */
         {16, 0xffcc}, /* 0xa7:  1111111111001100 */
         {16, 0xffcd}, /* 0xa8:  1111111111001101 */
         {16, 0xffce}, /* 0xa9:  1111111111001110 */
         {16, 0xffcf}, /* 0xaa:  1111111111001111 */
         { 0, 0x0000}, /* 0xab:                   */
         { 0, 0x0000}, /* 0xac:                   */
         { 0, 0x0000}, /* 0xad:                   */
         { 0, 0x0000}, /* 0xae:                   */
         { 0, 0x0000}, /* 0xaf:                   */
         { 0, 0x0000}, /* 0xb0:                   */
         {10, 0x03f9}, /* 0xb1:        1111111001 */
         {16, 0xffd0}, /* 0xb2:  1111111111010000 */
         {16, 0xffd1}, /* 0xb3:  1111111111010001 */
         {16, 0xffd2}, /* 0xb4:  1111111111010010 */
         {16, 0xffd3}, /* 0xb5:  1111111111010011 */
         {16, 0xffd4}, /* 0xb6:  1111111111010100 */
         {16, 0xffd5}, /* 0xb7:  1111111111010101 */
         {16, 0xffd6}, /* 0xb8:  1111111111010110 */
         {16, 0xffd7}, /* 0xb9:  1111111111010111 */
         {16, 0xffd8}, /* 0xba:  1111111111011000 */
         { 0, 0x0000}, /* 0xbb:                   */
         { 0, 0x0000}, /* 0xbc:                   */
         { 0, 0x0000}, /* 0xbd:                   */
         { 0, 0x0000}, /* 0xbe:                   */
         { 0, 0x0000}, /* 0xbf:                   */
         { 0, 0x0000}, /* 0xc0:                   */
         {10, 0x03fa}, /* 0xc1:        1111111010 */
         {16, 0xffd9}, /* 0xc2:  1111111111011001 */
         {16, 0xffda}, /* 0xc3:  1111111111011010 */
         {16, 0xffdb}, /* 0xc4:  1111111111011011 */
         {16, 0xffdc}, /* 0xc5:  1111111111011100 */
         {16, 0xffdd}, /* 0xc6:  1111111111011101 */
         {16, 0xffde}, /* 0xc7:  1111111111011110 */
         {16, 0xffdf}, /* 0xc8:  1111111111011111 */
         {16, 0xffe0}, /* 0xc9:  1111111111100000 */
         {16, 0xffe1}, /* 0xca:  1111111111100001 */
         { 0, 0x0000}, /* 0xcb:                   */
         { 0, 0x0000}, /* 0xcc:                   */
         { 0, 0x0000}, /* 0xcd:                   */
         { 0, 0x0000}, /* 0xce:                   */
         { 0, 0x0000}, /* 0xcf:                   */
         { 0, 0x0000}, /* 0xd0:                   */
         {11, 0x07f8}, /* 0xd1:       11111111000 */
         {16, 0xffe2}, /* 0xd2:  1111111111100010 */
         {16, 0xffe3}, /* 0xd3:  1111111111100011 */
         {16, 0xffe4}, /* 0xd4:  1111111111100100 */
         {16, 0xffe5}, /* 0xd5:  1111111111100101 */
         {16, 0xffe6}, /* 0xd6:  1111111111100110 */
         {16, 0xffe7}, /* 0xd7:  1111111111100111 */
         {16, 0xffe8}, /* 0xd8:  1111111111101000 */
         {16, 0xffe9}, /* 0xd9:  1111111111101001 */
         {16, 0xffea}, /* 0xda:  1111111111101010 */
         { 0, 0x0000}, /* 0xdb:                   */
         { 0, 0x0000}, /* 0xdc:                   */
         { 0, 0x0000}, /* 0xdd:                   */
         { 0, 0x0000}, /* 0xde:                   */
         { 0, 0x0000}, /* 0xdf:                   */
         { 0, 0x0000}, /* 0xe0:                   */
         {16, 0xffeb}, /* 0xe1:  1111111111101011 */
         {16, 0xffec}, /* 0xe2:  1111111111101100 */
         {16, 0xffed}, /* 0xe3:  1111111111101101 */
         {16, 0xffee}, /* 0xe4:  1111111111101110 */
         {16, 0xffef}, /* 0xe5:  1111111111101111 */
         {16, 0xfff0}, /* 0xe6:  1111111111110000 */
         {16, 0xfff1}, /* 0xe7:  1111111111110001 */
         {16, 0xfff2}, /* 0xe8:  1111111111110010 */
         {16, 0xfff3}, /* 0xe9:  1111111111110011 */
         {16, 0xfff4}, /* 0xea:  1111111111110100 */
         { 0, 0x0000}, /* 0xeb:                   */
         { 0, 0x0000}, /* 0xec:                   */
         { 0, 0x0000}, /* 0xed:                   */
         { 0, 0x0000}, /* 0xee:                   */
         { 0, 0x0000}, /* 0xef:                   */
         {11, 0x07f9}, /* 0xf0:       11111111001 */
         {16, 0xfff5}, /* 0xf1:  1111111111110101 */
         {16, 0xfff6}, /* 0xf2:  1111111111110110 */
         {16, 0xfff7}, /* 0xf3:  1111111111110111 */
         {16, 0xfff8}, /* 0xf4:  1111111111111000 */
         {16, 0xfff9}, /* 0xf5:  1111111111111001 */
         {16, 0xfffa}, /* 0xf6:  1111111111111010 */
         {16, 0xfffb}, /* 0xf7:  1111111111111011 */
         {16, 0xfffc}, /* 0xf8:  1111111111111100 */
         {16, 0xfffd}, /* 0xf9:  1111111111111101 */
         {16, 0xfffe}, /* 0xfa:  1111111111111110 */
         { 0, 0x0000}, /* 0xfb:                   */
         { 0, 0x0000}, /* 0xfc:                   */
         { 0, 0x0000}, /* 0xfd:                   */
         { 0, 0x0000}, /* 0xfe:                   */
         { 0, 0x0000}, /* 0xff:                   */
};
  
/* 162 valid entries */
static HUFF_ENTRY s_chrom_ac[256] = {
  
         { 2, 0x0000}, /* 0x00:                00 */
         { 2, 0x0001}, /* 0x01:                01 */
         { 3, 0x0004}, /* 0x02:               100 */
         { 4, 0x000a}, /* 0x03:              1010 */
         { 5, 0x0018}, /* 0x04:             11000 */
         { 5, 0x0019}, /* 0x05:             11001 */
         { 6, 0x0038}, /* 0x06:            111000 */
         { 7, 0x0078}, /* 0x07:           1111000 */
         { 9, 0x01f4}, /* 0x08:         111110100 */
         {10, 0x03f6}, /* 0x09:        1111110110 */
         {12, 0x0ff4}, /* 0x0a:      111111110100 */
         { 0, 0x0000}, /* 0x0b:                   */
         { 0, 0x0000}, /* 0x0c:                   */
         { 0, 0x0000}, /* 0x0d:                   */
         { 0, 0x0000}, /* 0x0e:                   */
         { 0, 0x0000}, /* 0x0f:                   */
         { 0, 0x0000}, /* 0x10:                   */
         { 4, 0x000b}, /* 0x11:              1011 */
         { 6, 0x0039}, /* 0x12:            111001 */
         { 8, 0x00f6}, /* 0x13:          11110110 */
         { 9, 0x01f5}, /* 0x14:         111110101 */
         {11, 0x07f6}, /* 0x15:       11111110110 */
         {12, 0x0ff5}, /* 0x16:      111111110101 */
         {16, 0xff88}, /* 0x17:  1111111110001000 */
         {16, 0xff89}, /* 0x18:  1111111110001001 */
         {16, 0xff8a}, /* 0x19:  1111111110001010 */
         {16, 0xff8b}, /* 0x1a:  1111111110001011 */
         { 0, 0x0000}, /* 0x1b:                   */
         { 0, 0x0000}, /* 0x1c:                   */
         { 0, 0x0000}, /* 0x1d:                   */
         { 0, 0x0000}, /* 0x1e:                   */
         { 0, 0x0000}, /* 0x1f:                   */
         { 0, 0x0000}, /* 0x20:                   */
         { 5, 0x001a}, /* 0x21:             11010 */
         { 8, 0x00f7}, /* 0x22:          11110111 */
         {10, 0x03f7}, /* 0x23:        1111110111 */
         {12, 0x0ff6}, /* 0x24:      111111110110 */
         {15, 0x7fc2}, /* 0x25:   111111111000010 */
         {16, 0xff8c}, /* 0x26:  1111111110001100 */
         {16, 0xff8d}, /* 0x27:  1111111110001101 */
         {16, 0xff8e}, /* 0x28:  1111111110001110 */
         {16, 0xff8f}, /* 0x29:  1111111110001111 */
         {16, 0xff90}, /* 0x2a:  1111111110010000 */
         { 0, 0x0000}, /* 0x2b:                   */
         { 0, 0x0000}, /* 0x2c:                   */
         { 0, 0x0000}, /* 0x2d:                   */
         { 0, 0x0000}, /* 0x2e:                   */
         { 0, 0x0000}, /* 0x2f:                   */
         { 0, 0x0000}, /* 0x30:                   */
         { 5, 0x001b}, /* 0x31:             11011 */
         { 8, 0x00f8}, /* 0x32:          11111000 */
         {10, 0x03f8}, /* 0x33:        1111111000 */
         {12, 0x0ff7}, /* 0x34:      111111110111 */
         {16, 0xff91}, /* 0x35:  1111111110010001 */
         {16, 0xff92}, /* 0x36:  1111111110010010 */
         {16, 0xff93}, /* 0x37:  1111111110010011 */
         {16, 0xff94}, /* 0x38:  1111111110010100 */
         {16, 0xff95}, /* 0x39:  1111111110010101 */
         {16, 0xff96}, /* 0x3a:  1111111110010110 */
         { 0, 0x0000}, /* 0x3b:                   */
         { 0, 0x0000}, /* 0x3c:                   */
         { 0, 0x0000}, /* 0x3d:                   */
         { 0, 0x0000}, /* 0x3e:                   */
         { 0, 0x0000}, /* 0x3f:                   */
         { 0, 0x0000}, /* 0x40:                   */
         { 6, 0x003a}, /* 0x41:            111010 */
         { 9, 0x01f6}, /* 0x42:         111110110 */
         {16, 0xff97}, /* 0x43:  1111111110010111 */
         {16, 0xff98}, /* 0x44:  1111111110011000 */
         {16, 0xff99}, /* 0x45:  1111111110011001 */
         {16, 0xff9a}, /* 0x46:  1111111110011010 */
         {16, 0xff9b}, /* 0x47:  1111111110011011 */
         {16, 0xff9c}, /* 0x48:  1111111110011100 */
         {16, 0xff9d}, /* 0x49:  1111111110011101 */
         {16, 0xff9e}, /* 0x4a:  1111111110011110 */
         { 0, 0x0000}, /* 0x4b:                   */
         { 0, 0x0000}, /* 0x4c:                   */
         { 0, 0x0000}, /* 0x4d:                   */
         { 0, 0x0000}, /* 0x4e:                   */
         { 0, 0x0000}, /* 0x4f:                   */
         { 0, 0x0000}, /* 0x50:                   */
         { 6, 0x003b}, /* 0x51:            111011 */
         {10, 0x03f9}, /* 0x52:        1111111001 */
         {16, 0xff9f}, /* 0x53:  1111111110011111 */
         {16, 0xffa0}, /* 0x54:  1111111110100000 */
         {16, 0xffa1}, /* 0x55:  1111111110100001 */
         {16, 0xffa2}, /* 0x56:  1111111110100010 */
         {16, 0xffa3}, /* 0x57:  1111111110100011 */
         {16, 0xffa4}, /* 0x58:  1111111110100100 */
         {16, 0xffa5}, /* 0x59:  1111111110100101 */
         {16, 0xffa6}, /* 0x5a:  1111111110100110 */
         { 0, 0x0000}, /* 0x5b:                   */
         { 0, 0x0000}, /* 0x5c:                   */
         { 0, 0x0000}, /* 0x5d:                   */
         { 0, 0x0000}, /* 0x5e:                   */
         { 0, 0x0000}, /* 0x5f:                   */
         { 0, 0x0000}, /* 0x60:                   */
         { 7, 0x0079}, /* 0x61:           1111001 */
         {11, 0x07f7}, /* 0x62:       11111110111 */
         {16, 0xffa7}, /* 0x63:  1111111110100111 */
         {16, 0xffa8}, /* 0x64:  1111111110101000 */
         {16, 0xffa9}, /* 0x65:  1111111110101001 */
         {16, 0xffaa}, /* 0x66:  1111111110101010 */
         {16, 0xffab}, /* 0x67:  1111111110101011 */
         {16, 0xffac}, /* 0x68:  1111111110101100 */
         {16, 0xffad}, /* 0x69:  1111111110101101 */
         {16, 0xffae}, /* 0x6a:  1111111110101110 */
         { 0, 0x0000}, /* 0x6b:                   */
         { 0, 0x0000}, /* 0x6c:                   */
         { 0, 0x0000}, /* 0x6d:                   */
         { 0, 0x0000}, /* 0x6e:                   */
         { 0, 0x0000}, /* 0x6f:                   */
         { 0, 0x0000}, /* 0x70:                   */
         { 7, 0x007a}, /* 0x71:           1111010 */
         {11, 0x07f8}, /* 0x72:       11111111000 */
         {16, 0xffaf}, /* 0x73:  1111111110101111 */
         {16, 0xffb0}, /* 0x74:  1111111110110000 */
         {16, 0xffb1}, /* 0x75:  1111111110110001 */
         {16, 0xffb2}, /* 0x76:  1111111110110010 */
         {16, 0xffb3}, /* 0x77:  1111111110110011 */
         {16, 0xffb4}, /* 0x78:  1111111110110100 */
         {16, 0xffb5}, /* 0x79:  1111111110110101 */
         {16, 0xffb6}, /* 0x7a:  1111111110110110 */
         { 0, 0x0000}, /* 0x7b:                   */
         { 0, 0x0000}, /* 0x7c:                   */
         { 0, 0x0000}, /* 0x7d:                   */
         { 0, 0x0000}, /* 0x7e:                   */
         { 0, 0x0000}, /* 0x7f:                   */
         { 0, 0x0000}, /* 0x80:                   */
         { 8, 0x00f9}, /* 0x81:          11111001 */
         {16, 0xffb7}, /* 0x82:  1111111110110111 */
         {16, 0xffb8}, /* 0x83:  1111111110111000 */
         {16, 0xffb9}, /* 0x84:  1111111110111001 */
         {16, 0xffba}, /* 0x85:  1111111110111010 */
         {16, 0xffbb}, /* 0x86:  1111111110111011 */
         {16, 0xffbc}, /* 0x87:  1111111110111100 */
         {16, 0xffbd}, /* 0x88:  1111111110111101 */
         {16, 0xffbe}, /* 0x89:  1111111110111110 */
         {16, 0xffbf}, /* 0x8a:  1111111110111111 */
         { 0, 0x0000}, /* 0x8b:                   */
         { 0, 0x0000}, /* 0x8c:                   */
         { 0, 0x0000}, /* 0x8d:                   */
         { 0, 0x0000}, /* 0x8e:                   */
         { 0, 0x0000}, /* 0x8f:                   */
         { 0, 0x0000}, /* 0x90:                   */
         { 9, 0x01f7}, /* 0x91:         111110111 */
         {16, 0xffc0}, /* 0x92:  1111111111000000 */
         {16, 0xffc1}, /* 0x93:  1111111111000001 */
         {16, 0xffc2}, /* 0x94:  1111111111000010 */
         {16, 0xffc3}, /* 0x95:  1111111111000011 */
         {16, 0xffc4}, /* 0x96:  1111111111000100 */
         {16, 0xffc5}, /* 0x97:  1111111111000101 */
         {16, 0xffc6}, /* 0x98:  1111111111000110 */
         {16, 0xffc7}, /* 0x99:  1111111111000111 */
         {16, 0xffc8}, /* 0x9a:  1111111111001000 */
         { 0, 0x0000}, /* 0x9b:                   */
         { 0, 0x0000}, /* 0x9c:                   */
         { 0, 0x0000}, /* 0x9d:                   */
         { 0, 0x0000}, /* 0x9e:                   */
         { 0, 0x0000}, /* 0x9f:                   */
         { 0, 0x0000}, /* 0xa0:                   */
         { 9, 0x01f8}, /* 0xa1:         111111000 */
         {16, 0xffc9}, /* 0xa2:  1111111111001001 */
         {16, 0xffca}, /* 0xa3:  1111111111001010 */
         {16, 0xffcb}, /* 0xa4:  1111111111001011 */
         {16, 0xffcc}, /* 0xa5:  1111111111001100 */
         {16, 0xffcd}, /* 0xa6:  1111111111001101 */
         {16, 0xffce}, /* 0xa7:  1111111111001110 */
         {16, 0xffcf}, /* 0xa8:  1111111111001111 */
         {16, 0xffd0}, /* 0xa9:  1111111111010000 */
         {16, 0xffd1}, /* 0xaa:  1111111111010001 */
         { 0, 0x0000}, /* 0xab:                   */
         { 0, 0x0000}, /* 0xac:                   */
         { 0, 0x0000}, /* 0xad:                   */
         { 0, 0x0000}, /* 0xae:                   */
         { 0, 0x0000}, /* 0xaf:                   */
         { 0, 0x0000}, /* 0xb0:                   */
         { 9, 0x01f9}, /* 0xb1:         111111001 */
         {16, 0xffd2}, /* 0xb2:  1111111111010010 */
         {16, 0xffd3}, /* 0xb3:  1111111111010011 */
         {16, 0xffd4}, /* 0xb4:  1111111111010100 */
         {16, 0xffd5}, /* 0xb5:  1111111111010101 */
         {16, 0xffd6}, /* 0xb6:  1111111111010110 */
         {16, 0xffd7}, /* 0xb7:  1111111111010111 */
         {16, 0xffd8}, /* 0xb8:  1111111111011000 */
         {16, 0xffd9}, /* 0xb9:  1111111111011001 */
         {16, 0xffda}, /* 0xba:  1111111111011010 */
         { 0, 0x0000}, /* 0xbb:                   */
         { 0, 0x0000}, /* 0xbc:                   */
         { 0, 0x0000}, /* 0xbd:                   */
         { 0, 0x0000}, /* 0xbe:                   */
         { 0, 0x0000}, /* 0xbf:                   */
         { 0, 0x0000}, /* 0xc0:                   */
         { 9, 0x01fa}, /* 0xc1:         111111010 */
         {16, 0xffdb}, /* 0xc2:  1111111111011011 */
         {16, 0xffdc}, /* 0xc3:  1111111111011100 */
         {16, 0xffdd}, /* 0xc4:  1111111111011101 */
         {16, 0xffde}, /* 0xc5:  1111111111011110 */
         {16, 0xffdf}, /* 0xc6:  1111111111011111 */
         {16, 0xffe0}, /* 0xc7:  1111111111100000 */
         {16, 0xffe1}, /* 0xc8:  1111111111100001 */
         {16, 0xffe2}, /* 0xc9:  1111111111100010 */
         {16, 0xffe3}, /* 0xca:  1111111111100011 */
         { 0, 0x0000}, /* 0xcb:                   */
         { 0, 0x0000}, /* 0xcc:                   */
         { 0, 0x0000}, /* 0xcd:                   */
         { 0, 0x0000}, /* 0xce:                   */
         { 0, 0x0000}, /* 0xcf:                   */
         { 0, 0x0000}, /* 0xd0:                   */
         {11, 0x07f9}, /* 0xd1:       11111111001 */
         {16, 0xffe4}, /* 0xd2:  1111111111100100 */
         {16, 0xffe5}, /* 0xd3:  1111111111100101 */
         {16, 0xffe6}, /* 0xd4:  1111111111100110 */
         {16, 0xffe7}, /* 0xd5:  1111111111100111 */
         {16, 0xffe8}, /* 0xd6:  1111111111101000 */
         {16, 0xffe9}, /* 0xd7:  1111111111101001 */
         {16, 0xffea}, /* 0xd8:  1111111111101010 */
         {16, 0xffeb}, /* 0xd9:  1111111111101011 */
         {16, 0xffec}, /* 0xda:  1111111111101100 */
         { 0, 0x0000}, /* 0xdb:                   */
         { 0, 0x0000}, /* 0xdc:                   */
         { 0, 0x0000}, /* 0xdd:                   */
         { 0, 0x0000}, /* 0xde:                   */
         { 0, 0x0000}, /* 0xdf:                   */
         { 0, 0x0000}, /* 0xe0:                   */
         {14, 0x3fe0}, /* 0xe1:    11111111100000 */
         {16, 0xffed}, /* 0xe2:  1111111111101101 */
         {16, 0xffee}, /* 0xe3:  1111111111101110 */
         {16, 0xffef}, /* 0xe4:  1111111111101111 */
         {16, 0xfff0}, /* 0xe5:  1111111111110000 */
         {16, 0xfff1}, /* 0xe6:  1111111111110001 */
         {16, 0xfff2}, /* 0xe7:  1111111111110010 */
         {16, 0xfff3}, /* 0xe8:  1111111111110011 */
         {16, 0xfff4}, /* 0xe9:  1111111111110100 */
         {16, 0xfff5}, /* 0xea:  1111111111110101 */
         { 0, 0x0000}, /* 0xeb:                   */
         { 0, 0x0000}, /* 0xec:                   */
         { 0, 0x0000}, /* 0xed:                   */
         { 0, 0x0000}, /* 0xee:                   */
         { 0, 0x0000}, /* 0xef:                   */
         {10, 0x03fa}, /* 0xf0:        1111111010 */
         {15, 0x7fc3}, /* 0xf1:   111111111000011 */
         {16, 0xfff6}, /* 0xf2:  1111111111110110 */
         {16, 0xfff7}, /* 0xf3:  1111111111110111 */
         {16, 0xfff8}, /* 0xf4:  1111111111111000 */
         {16, 0xfff9}, /* 0xf5:  1111111111111001 */
         {16, 0xfffa}, /* 0xf6:  1111111111111010 */
         {16, 0xfffb}, /* 0xf7:  1111111111111011 */
         {16, 0xfffc}, /* 0xf8:  1111111111111100 */
         {16, 0xfffd}, /* 0xf9:  1111111111111101 */
         {16, 0xfffe}, /* 0xfa:  1111111111111110 */
         { 0, 0x0000}, /* 0xfb:                   */
         { 0, 0x0000}, /* 0xfc:                   */
         { 0, 0x0000}, /* 0xfd:                   */
         { 0, 0x0000}, /* 0xfe:                   */
         { 0, 0x0000}  /* 0xff:                   */
};
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值