gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

table.go (27806B)


      1 // generated by "go run gen.go". DO NOT EDIT.
      2 
      3 package ccitt
      4 
      5 // Each decodeTable is represented by an array of [2]int16's: a binary tree.
      6 // Each array element (other than element 0, which means invalid) is a branch
      7 // node in that tree. The root node is always element 1 (the second element).
      8 //
      9 // To walk the tree, look at the next bit in the bit stream, using it to select
     10 // the first or second element of the [2]int16. If that int16 is 0, we have an
     11 // invalid code. If it is positive, go to that branch node. If it is negative,
     12 // then we have a leaf node, whose value is the bitwise complement (the ^
     13 // operator) of that int16.
     14 //
     15 // Comments above each decodeTable also show the same structure visually. The
     16 // "b123" lines show the 123'rd branch node. The "=XXXXX" lines show an invalid
     17 // code. The "=v1234" lines show a leaf node with value 1234. When reading the
     18 // bit stream, a 0 or 1 bit means to go up or down, as you move left to right.
     19 //
     20 // For example, in modeDecodeTable, branch node b005 is three steps up from the
     21 // root node, meaning that we have already seen "000". If the next bit is "0"
     22 // then we move to branch node b006. Otherwise, the next bit is "1", and we
     23 // move to the leaf node v0000 (also known as the modePass constant). Indeed,
     24 // the bits that encode modePass are "0001".
     25 //
     26 // Tables 1, 2 and 3 come from the "ITU-T Recommendation T.6: FACSIMILE CODING
     27 // SCHEMES AND CODING CONTROL FUNCTIONS FOR GROUP 4 FACSIMILE APPARATUS"
     28 // specification:
     29 //
     30 // https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-T.6-198811-I!!PDF-E&type=items
     31 
     32 // modeDecodeTable represents Table 1 and the End-of-Line code.
     33 //
     34 //	                   +=XXXXX
     35 //	b009             +-+
     36 //	                 | +=v0009
     37 //	b007           +-+
     38 //	               | | +=v0008
     39 //	b010           | +-+
     40 //	               |   +=v0005
     41 //	b006         +-+
     42 //	             | | +=v0007
     43 //	b008         | +-+
     44 //	             |   +=v0004
     45 //	b005       +-+
     46 //	           | +=v0000
     47 //	b003     +-+
     48 //	         | +=v0001
     49 //	b002   +-+
     50 //	       | | +=v0006
     51 //	b004   | +-+
     52 //	       |   +=v0003
     53 //	b001 +-+
     54 //	       +=v0002
     55 var modeDecodeTable = [...][2]int16{
     56 	0:  {0, 0},
     57 	1:  {2, ^2},
     58 	2:  {3, 4},
     59 	3:  {5, ^1},
     60 	4:  {^6, ^3},
     61 	5:  {6, ^0},
     62 	6:  {7, 8},
     63 	7:  {9, 10},
     64 	8:  {^7, ^4},
     65 	9:  {0, ^9},
     66 	10: {^8, ^5},
     67 }
     68 
     69 // whiteDecodeTable represents Tables 2 and 3 for a white run.
     70 //
     71 //	                     +=XXXXX
     72 //	b059               +-+
     73 //	                   | |     +=v1792
     74 //	b096               | |   +-+
     75 //	                   | |   | | +=v1984
     76 //	b100               | |   | +-+
     77 //	                   | |   |   +=v2048
     78 //	b094               | | +-+
     79 //	                   | | | |   +=v2112
     80 //	b101               | | | | +-+
     81 //	                   | | | | | +=v2176
     82 //	b097               | | | +-+
     83 //	                   | | |   | +=v2240
     84 //	b102               | | |   +-+
     85 //	                   | | |     +=v2304
     86 //	b085               | +-+
     87 //	                   |   |   +=v1856
     88 //	b098               |   | +-+
     89 //	                   |   | | +=v1920
     90 //	b095               |   +-+
     91 //	                   |     |   +=v2368
     92 //	b103               |     | +-+
     93 //	                   |     | | +=v2432
     94 //	b099               |     +-+
     95 //	                   |       | +=v2496
     96 //	b104               |       +-+
     97 //	                   |         +=v2560
     98 //	b040             +-+
     99 //	                 | | +=v0029
    100 //	b060             | +-+
    101 //	                 |   +=v0030
    102 //	b026           +-+
    103 //	               | |   +=v0045
    104 //	b061           | | +-+
    105 //	               | | | +=v0046
    106 //	b041           | +-+
    107 //	               |   +=v0022
    108 //	b016         +-+
    109 //	             | |   +=v0023
    110 //	b042         | | +-+
    111 //	             | | | | +=v0047
    112 //	b062         | | | +-+
    113 //	             | | |   +=v0048
    114 //	b027         | +-+
    115 //	             |   +=v0013
    116 //	b008       +-+
    117 //	           | |     +=v0020
    118 //	b043       | |   +-+
    119 //	           | |   | | +=v0033
    120 //	b063       | |   | +-+
    121 //	           | |   |   +=v0034
    122 //	b028       | | +-+
    123 //	           | | | |   +=v0035
    124 //	b064       | | | | +-+
    125 //	           | | | | | +=v0036
    126 //	b044       | | | +-+
    127 //	           | | |   | +=v0037
    128 //	b065       | | |   +-+
    129 //	           | | |     +=v0038
    130 //	b017       | +-+
    131 //	           |   |   +=v0019
    132 //	b045       |   | +-+
    133 //	           |   | | | +=v0031
    134 //	b066       |   | | +-+
    135 //	           |   | |   +=v0032
    136 //	b029       |   +-+
    137 //	           |     +=v0001
    138 //	b004     +-+
    139 //	         | |     +=v0012
    140 //	b030     | |   +-+
    141 //	         | |   | |   +=v0053
    142 //	b067     | |   | | +-+
    143 //	         | |   | | | +=v0054
    144 //	b046     | |   | +-+
    145 //	         | |   |   +=v0026
    146 //	b018     | | +-+
    147 //	         | | | |     +=v0039
    148 //	b068     | | | |   +-+
    149 //	         | | | |   | +=v0040
    150 //	b047     | | | | +-+
    151 //	         | | | | | | +=v0041
    152 //	b069     | | | | | +-+
    153 //	         | | | | |   +=v0042
    154 //	b031     | | | +-+
    155 //	         | | |   |   +=v0043
    156 //	b070     | | |   | +-+
    157 //	         | | |   | | +=v0044
    158 //	b048     | | |   +-+
    159 //	         | | |     +=v0021
    160 //	b009     | +-+
    161 //	         |   |     +=v0028
    162 //	b049     |   |   +-+
    163 //	         |   |   | | +=v0061
    164 //	b071     |   |   | +-+
    165 //	         |   |   |   +=v0062
    166 //	b032     |   | +-+
    167 //	         |   | | |   +=v0063
    168 //	b072     |   | | | +-+
    169 //	         |   | | | | +=v0000
    170 //	b050     |   | | +-+
    171 //	         |   | |   | +=v0320
    172 //	b073     |   | |   +-+
    173 //	         |   | |     +=v0384
    174 //	b019     |   +-+
    175 //	         |     +=v0010
    176 //	b002   +-+
    177 //	       | |     +=v0011
    178 //	b020   | |   +-+
    179 //	       | |   | |   +=v0027
    180 //	b051   | |   | | +-+
    181 //	       | |   | | | | +=v0059
    182 //	b074   | |   | | | +-+
    183 //	       | |   | | |   +=v0060
    184 //	b033   | |   | +-+
    185 //	       | |   |   |     +=v1472
    186 //	b086   | |   |   |   +-+
    187 //	       | |   |   |   | +=v1536
    188 //	b075   | |   |   | +-+
    189 //	       | |   |   | | | +=v1600
    190 //	b087   | |   |   | | +-+
    191 //	       | |   |   | |   +=v1728
    192 //	b052   | |   |   +-+
    193 //	       | |   |     +=v0018
    194 //	b010   | | +-+
    195 //	       | | | |     +=v0024
    196 //	b053   | | | |   +-+
    197 //	       | | | |   | | +=v0049
    198 //	b076   | | | |   | +-+
    199 //	       | | | |   |   +=v0050
    200 //	b034   | | | | +-+
    201 //	       | | | | | |   +=v0051
    202 //	b077   | | | | | | +-+
    203 //	       | | | | | | | +=v0052
    204 //	b054   | | | | | +-+
    205 //	       | | | | |   +=v0025
    206 //	b021   | | | +-+
    207 //	       | | |   |     +=v0055
    208 //	b078   | | |   |   +-+
    209 //	       | | |   |   | +=v0056
    210 //	b055   | | |   | +-+
    211 //	       | | |   | | | +=v0057
    212 //	b079   | | |   | | +-+
    213 //	       | | |   | |   +=v0058
    214 //	b035   | | |   +-+
    215 //	       | | |     +=v0192
    216 //	b005   | +-+
    217 //	       |   |     +=v1664
    218 //	b036   |   |   +-+
    219 //	       |   |   | |   +=v0448
    220 //	b080   |   |   | | +-+
    221 //	       |   |   | | | +=v0512
    222 //	b056   |   |   | +-+
    223 //	       |   |   |   |   +=v0704
    224 //	b088   |   |   |   | +-+
    225 //	       |   |   |   | | +=v0768
    226 //	b081   |   |   |   +-+
    227 //	       |   |   |     +=v0640
    228 //	b022   |   | +-+
    229 //	       |   | | |     +=v0576
    230 //	b082   |   | | |   +-+
    231 //	       |   | | |   | | +=v0832
    232 //	b089   |   | | |   | +-+
    233 //	       |   | | |   |   +=v0896
    234 //	b057   |   | | | +-+
    235 //	       |   | | | | |   +=v0960
    236 //	b090   |   | | | | | +-+
    237 //	       |   | | | | | | +=v1024
    238 //	b083   |   | | | | +-+
    239 //	       |   | | | |   | +=v1088
    240 //	b091   |   | | | |   +-+
    241 //	       |   | | | |     +=v1152
    242 //	b037   |   | | +-+
    243 //	       |   | |   |     +=v1216
    244 //	b092   |   | |   |   +-+
    245 //	       |   | |   |   | +=v1280
    246 //	b084   |   | |   | +-+
    247 //	       |   | |   | | | +=v1344
    248 //	b093   |   | |   | | +-+
    249 //	       |   | |   | |   +=v1408
    250 //	b058   |   | |   +-+
    251 //	       |   | |     +=v0256
    252 //	b011   |   +-+
    253 //	       |     +=v0002
    254 //	b001 +-+
    255 //	       |     +=v0003
    256 //	b012   |   +-+
    257 //	       |   | | +=v0128
    258 //	b023   |   | +-+
    259 //	       |   |   +=v0008
    260 //	b006   | +-+
    261 //	       | | |   +=v0009
    262 //	b024   | | | +-+
    263 //	       | | | | | +=v0016
    264 //	b038   | | | | +-+
    265 //	       | | | |   +=v0017
    266 //	b013   | | +-+
    267 //	       | |   +=v0004
    268 //	b003   +-+
    269 //	         |   +=v0005
    270 //	b014     | +-+
    271 //	         | | |   +=v0014
    272 //	b039     | | | +-+
    273 //	         | | | | +=v0015
    274 //	b025     | | +-+
    275 //	         | |   +=v0064
    276 //	b007     +-+
    277 //	           | +=v0006
    278 //	b015       +-+
    279 //	             +=v0007
    280 var whiteDecodeTable = [...][2]int16{
    281 	0:   {0, 0},
    282 	1:   {2, 3},
    283 	2:   {4, 5},
    284 	3:   {6, 7},
    285 	4:   {8, 9},
    286 	5:   {10, 11},
    287 	6:   {12, 13},
    288 	7:   {14, 15},
    289 	8:   {16, 17},
    290 	9:   {18, 19},
    291 	10:  {20, 21},
    292 	11:  {22, ^2},
    293 	12:  {^3, 23},
    294 	13:  {24, ^4},
    295 	14:  {^5, 25},
    296 	15:  {^6, ^7},
    297 	16:  {26, 27},
    298 	17:  {28, 29},
    299 	18:  {30, 31},
    300 	19:  {32, ^10},
    301 	20:  {^11, 33},
    302 	21:  {34, 35},
    303 	22:  {36, 37},
    304 	23:  {^128, ^8},
    305 	24:  {^9, 38},
    306 	25:  {39, ^64},
    307 	26:  {40, 41},
    308 	27:  {42, ^13},
    309 	28:  {43, 44},
    310 	29:  {45, ^1},
    311 	30:  {^12, 46},
    312 	31:  {47, 48},
    313 	32:  {49, 50},
    314 	33:  {51, 52},
    315 	34:  {53, 54},
    316 	35:  {55, ^192},
    317 	36:  {^1664, 56},
    318 	37:  {57, 58},
    319 	38:  {^16, ^17},
    320 	39:  {^14, ^15},
    321 	40:  {59, 60},
    322 	41:  {61, ^22},
    323 	42:  {^23, 62},
    324 	43:  {^20, 63},
    325 	44:  {64, 65},
    326 	45:  {^19, 66},
    327 	46:  {67, ^26},
    328 	47:  {68, 69},
    329 	48:  {70, ^21},
    330 	49:  {^28, 71},
    331 	50:  {72, 73},
    332 	51:  {^27, 74},
    333 	52:  {75, ^18},
    334 	53:  {^24, 76},
    335 	54:  {77, ^25},
    336 	55:  {78, 79},
    337 	56:  {80, 81},
    338 	57:  {82, 83},
    339 	58:  {84, ^256},
    340 	59:  {0, 85},
    341 	60:  {^29, ^30},
    342 	61:  {^45, ^46},
    343 	62:  {^47, ^48},
    344 	63:  {^33, ^34},
    345 	64:  {^35, ^36},
    346 	65:  {^37, ^38},
    347 	66:  {^31, ^32},
    348 	67:  {^53, ^54},
    349 	68:  {^39, ^40},
    350 	69:  {^41, ^42},
    351 	70:  {^43, ^44},
    352 	71:  {^61, ^62},
    353 	72:  {^63, ^0},
    354 	73:  {^320, ^384},
    355 	74:  {^59, ^60},
    356 	75:  {86, 87},
    357 	76:  {^49, ^50},
    358 	77:  {^51, ^52},
    359 	78:  {^55, ^56},
    360 	79:  {^57, ^58},
    361 	80:  {^448, ^512},
    362 	81:  {88, ^640},
    363 	82:  {^576, 89},
    364 	83:  {90, 91},
    365 	84:  {92, 93},
    366 	85:  {94, 95},
    367 	86:  {^1472, ^1536},
    368 	87:  {^1600, ^1728},
    369 	88:  {^704, ^768},
    370 	89:  {^832, ^896},
    371 	90:  {^960, ^1024},
    372 	91:  {^1088, ^1152},
    373 	92:  {^1216, ^1280},
    374 	93:  {^1344, ^1408},
    375 	94:  {96, 97},
    376 	95:  {98, 99},
    377 	96:  {^1792, 100},
    378 	97:  {101, 102},
    379 	98:  {^1856, ^1920},
    380 	99:  {103, 104},
    381 	100: {^1984, ^2048},
    382 	101: {^2112, ^2176},
    383 	102: {^2240, ^2304},
    384 	103: {^2368, ^2432},
    385 	104: {^2496, ^2560},
    386 }
    387 
    388 // blackDecodeTable represents Tables 2 and 3 for a black run.
    389 //
    390 //	                     +=XXXXX
    391 //	b017               +-+
    392 //	                   | |     +=v1792
    393 //	b042               | |   +-+
    394 //	                   | |   | | +=v1984
    395 //	b063               | |   | +-+
    396 //	                   | |   |   +=v2048
    397 //	b029               | | +-+
    398 //	                   | | | |   +=v2112
    399 //	b064               | | | | +-+
    400 //	                   | | | | | +=v2176
    401 //	b043               | | | +-+
    402 //	                   | | |   | +=v2240
    403 //	b065               | | |   +-+
    404 //	                   | | |     +=v2304
    405 //	b022               | +-+
    406 //	                   |   |   +=v1856
    407 //	b044               |   | +-+
    408 //	                   |   | | +=v1920
    409 //	b030               |   +-+
    410 //	                   |     |   +=v2368
    411 //	b066               |     | +-+
    412 //	                   |     | | +=v2432
    413 //	b045               |     +-+
    414 //	                   |       | +=v2496
    415 //	b067               |       +-+
    416 //	                   |         +=v2560
    417 //	b013             +-+
    418 //	                 | |     +=v0018
    419 //	b031             | |   +-+
    420 //	                 | |   | |   +=v0052
    421 //	b068             | |   | | +-+
    422 //	                 | |   | | | | +=v0640
    423 //	b095             | |   | | | +-+
    424 //	                 | |   | | |   +=v0704
    425 //	b046             | |   | +-+
    426 //	                 | |   |   |   +=v0768
    427 //	b096             | |   |   | +-+
    428 //	                 | |   |   | | +=v0832
    429 //	b069             | |   |   +-+
    430 //	                 | |   |     +=v0055
    431 //	b023             | | +-+
    432 //	                 | | | |     +=v0056
    433 //	b070             | | | |   +-+
    434 //	                 | | | |   | | +=v1280
    435 //	b097             | | | |   | +-+
    436 //	                 | | | |   |   +=v1344
    437 //	b047             | | | | +-+
    438 //	                 | | | | | |   +=v1408
    439 //	b098             | | | | | | +-+
    440 //	                 | | | | | | | +=v1472
    441 //	b071             | | | | | +-+
    442 //	                 | | | | |   +=v0059
    443 //	b032             | | | +-+
    444 //	                 | | |   |   +=v0060
    445 //	b072             | | |   | +-+
    446 //	                 | | |   | | | +=v1536
    447 //	b099             | | |   | | +-+
    448 //	                 | | |   | |   +=v1600
    449 //	b048             | | |   +-+
    450 //	                 | | |     +=v0024
    451 //	b018             | +-+
    452 //	                 |   |     +=v0025
    453 //	b049             |   |   +-+
    454 //	                 |   |   | |   +=v1664
    455 //	b100             |   |   | | +-+
    456 //	                 |   |   | | | +=v1728
    457 //	b073             |   |   | +-+
    458 //	                 |   |   |   +=v0320
    459 //	b033             |   | +-+
    460 //	                 |   | | |   +=v0384
    461 //	b074             |   | | | +-+
    462 //	                 |   | | | | +=v0448
    463 //	b050             |   | | +-+
    464 //	                 |   | |   |   +=v0512
    465 //	b101             |   | |   | +-+
    466 //	                 |   | |   | | +=v0576
    467 //	b075             |   | |   +-+
    468 //	                 |   | |     +=v0053
    469 //	b024             |   +-+
    470 //	                 |     |     +=v0054
    471 //	b076             |     |   +-+
    472 //	                 |     |   | | +=v0896
    473 //	b102             |     |   | +-+
    474 //	                 |     |   |   +=v0960
    475 //	b051             |     | +-+
    476 //	                 |     | | |   +=v1024
    477 //	b103             |     | | | +-+
    478 //	                 |     | | | | +=v1088
    479 //	b077             |     | | +-+
    480 //	                 |     | |   | +=v1152
    481 //	b104             |     | |   +-+
    482 //	                 |     | |     +=v1216
    483 //	b034             |     +-+
    484 //	                 |       +=v0064
    485 //	b010           +-+
    486 //	               | |   +=v0013
    487 //	b019           | | +-+
    488 //	               | | | |     +=v0023
    489 //	b052           | | | |   +-+
    490 //	               | | | |   | | +=v0050
    491 //	b078           | | | |   | +-+
    492 //	               | | | |   |   +=v0051
    493 //	b035           | | | | +-+
    494 //	               | | | | | |   +=v0044
    495 //	b079           | | | | | | +-+
    496 //	               | | | | | | | +=v0045
    497 //	b053           | | | | | +-+
    498 //	               | | | | |   | +=v0046
    499 //	b080           | | | | |   +-+
    500 //	               | | | | |     +=v0047
    501 //	b025           | | | +-+
    502 //	               | | |   |     +=v0057
    503 //	b081           | | |   |   +-+
    504 //	               | | |   |   | +=v0058
    505 //	b054           | | |   | +-+
    506 //	               | | |   | | | +=v0061
    507 //	b082           | | |   | | +-+
    508 //	               | | |   | |   +=v0256
    509 //	b036           | | |   +-+
    510 //	               | | |     +=v0016
    511 //	b014           | +-+
    512 //	               |   |     +=v0017
    513 //	b037           |   |   +-+
    514 //	               |   |   | |   +=v0048
    515 //	b083           |   |   | | +-+
    516 //	               |   |   | | | +=v0049
    517 //	b055           |   |   | +-+
    518 //	               |   |   |   | +=v0062
    519 //	b084           |   |   |   +-+
    520 //	               |   |   |     +=v0063
    521 //	b026           |   | +-+
    522 //	               |   | | |     +=v0030
    523 //	b085           |   | | |   +-+
    524 //	               |   | | |   | +=v0031
    525 //	b056           |   | | | +-+
    526 //	               |   | | | | | +=v0032
    527 //	b086           |   | | | | +-+
    528 //	               |   | | | |   +=v0033
    529 //	b038           |   | | +-+
    530 //	               |   | |   |   +=v0040
    531 //	b087           |   | |   | +-+
    532 //	               |   | |   | | +=v0041
    533 //	b057           |   | |   +-+
    534 //	               |   | |     +=v0022
    535 //	b020           |   +-+
    536 //	               |     +=v0014
    537 //	b008         +-+
    538 //	             | |   +=v0010
    539 //	b015         | | +-+
    540 //	             | | | +=v0011
    541 //	b011         | +-+
    542 //	             |   |     +=v0015
    543 //	b027         |   |   +-+
    544 //	             |   |   | |     +=v0128
    545 //	b088         |   |   | |   +-+
    546 //	             |   |   | |   | +=v0192
    547 //	b058         |   |   | | +-+
    548 //	             |   |   | | | | +=v0026
    549 //	b089         |   |   | | | +-+
    550 //	             |   |   | | |   +=v0027
    551 //	b039         |   |   | +-+
    552 //	             |   |   |   |   +=v0028
    553 //	b090         |   |   |   | +-+
    554 //	             |   |   |   | | +=v0029
    555 //	b059         |   |   |   +-+
    556 //	             |   |   |     +=v0019
    557 //	b021         |   | +-+
    558 //	             |   | | |     +=v0020
    559 //	b060         |   | | |   +-+
    560 //	             |   | | |   | | +=v0034
    561 //	b091         |   | | |   | +-+
    562 //	             |   | | |   |   +=v0035
    563 //	b040         |   | | | +-+
    564 //	             |   | | | | |   +=v0036
    565 //	b092         |   | | | | | +-+
    566 //	             |   | | | | | | +=v0037
    567 //	b061         |   | | | | +-+
    568 //	             |   | | | |   | +=v0038
    569 //	b093         |   | | | |   +-+
    570 //	             |   | | | |     +=v0039
    571 //	b028         |   | | +-+
    572 //	             |   | |   |   +=v0021
    573 //	b062         |   | |   | +-+
    574 //	             |   | |   | | | +=v0042
    575 //	b094         |   | |   | | +-+
    576 //	             |   | |   | |   +=v0043
    577 //	b041         |   | |   +-+
    578 //	             |   | |     +=v0000
    579 //	b016         |   +-+
    580 //	             |     +=v0012
    581 //	b006       +-+
    582 //	           | |   +=v0009
    583 //	b012       | | +-+
    584 //	           | | | +=v0008
    585 //	b009       | +-+
    586 //	           |   +=v0007
    587 //	b004     +-+
    588 //	         | | +=v0006
    589 //	b007     | +-+
    590 //	         |   +=v0005
    591 //	b002   +-+
    592 //	       | | +=v0001
    593 //	b005   | +-+
    594 //	       |   +=v0004
    595 //	b001 +-+
    596 //	       | +=v0003
    597 //	b003   +-+
    598 //	         +=v0002
    599 var blackDecodeTable = [...][2]int16{
    600 	0:   {0, 0},
    601 	1:   {2, 3},
    602 	2:   {4, 5},
    603 	3:   {^3, ^2},
    604 	4:   {6, 7},
    605 	5:   {^1, ^4},
    606 	6:   {8, 9},
    607 	7:   {^6, ^5},
    608 	8:   {10, 11},
    609 	9:   {12, ^7},
    610 	10:  {13, 14},
    611 	11:  {15, 16},
    612 	12:  {^9, ^8},
    613 	13:  {17, 18},
    614 	14:  {19, 20},
    615 	15:  {^10, ^11},
    616 	16:  {21, ^12},
    617 	17:  {0, 22},
    618 	18:  {23, 24},
    619 	19:  {^13, 25},
    620 	20:  {26, ^14},
    621 	21:  {27, 28},
    622 	22:  {29, 30},
    623 	23:  {31, 32},
    624 	24:  {33, 34},
    625 	25:  {35, 36},
    626 	26:  {37, 38},
    627 	27:  {^15, 39},
    628 	28:  {40, 41},
    629 	29:  {42, 43},
    630 	30:  {44, 45},
    631 	31:  {^18, 46},
    632 	32:  {47, 48},
    633 	33:  {49, 50},
    634 	34:  {51, ^64},
    635 	35:  {52, 53},
    636 	36:  {54, ^16},
    637 	37:  {^17, 55},
    638 	38:  {56, 57},
    639 	39:  {58, 59},
    640 	40:  {60, 61},
    641 	41:  {62, ^0},
    642 	42:  {^1792, 63},
    643 	43:  {64, 65},
    644 	44:  {^1856, ^1920},
    645 	45:  {66, 67},
    646 	46:  {68, 69},
    647 	47:  {70, 71},
    648 	48:  {72, ^24},
    649 	49:  {^25, 73},
    650 	50:  {74, 75},
    651 	51:  {76, 77},
    652 	52:  {^23, 78},
    653 	53:  {79, 80},
    654 	54:  {81, 82},
    655 	55:  {83, 84},
    656 	56:  {85, 86},
    657 	57:  {87, ^22},
    658 	58:  {88, 89},
    659 	59:  {90, ^19},
    660 	60:  {^20, 91},
    661 	61:  {92, 93},
    662 	62:  {^21, 94},
    663 	63:  {^1984, ^2048},
    664 	64:  {^2112, ^2176},
    665 	65:  {^2240, ^2304},
    666 	66:  {^2368, ^2432},
    667 	67:  {^2496, ^2560},
    668 	68:  {^52, 95},
    669 	69:  {96, ^55},
    670 	70:  {^56, 97},
    671 	71:  {98, ^59},
    672 	72:  {^60, 99},
    673 	73:  {100, ^320},
    674 	74:  {^384, ^448},
    675 	75:  {101, ^53},
    676 	76:  {^54, 102},
    677 	77:  {103, 104},
    678 	78:  {^50, ^51},
    679 	79:  {^44, ^45},
    680 	80:  {^46, ^47},
    681 	81:  {^57, ^58},
    682 	82:  {^61, ^256},
    683 	83:  {^48, ^49},
    684 	84:  {^62, ^63},
    685 	85:  {^30, ^31},
    686 	86:  {^32, ^33},
    687 	87:  {^40, ^41},
    688 	88:  {^128, ^192},
    689 	89:  {^26, ^27},
    690 	90:  {^28, ^29},
    691 	91:  {^34, ^35},
    692 	92:  {^36, ^37},
    693 	93:  {^38, ^39},
    694 	94:  {^42, ^43},
    695 	95:  {^640, ^704},
    696 	96:  {^768, ^832},
    697 	97:  {^1280, ^1344},
    698 	98:  {^1408, ^1472},
    699 	99:  {^1536, ^1600},
    700 	100: {^1664, ^1728},
    701 	101: {^512, ^576},
    702 	102: {^896, ^960},
    703 	103: {^1024, ^1088},
    704 	104: {^1152, ^1216},
    705 }
    706 
    707 const maxCodeLength = 13
    708 
    709 // Each encodeTable is represented by an array of bitStrings.
    710 
    711 // bitString is a pair of uint32 values representing a bit code.
    712 // The nBits low bits of bits make up the actual bit code.
    713 // Eg. bitString{0x0004, 8} represents the bitcode "00000100".
    714 type bitString struct {
    715 	bits  uint32
    716 	nBits uint32
    717 }
    718 
    719 // modeEncodeTable represents Table 1 and the End-of-Line code.
    720 var modeEncodeTable = [...]bitString{
    721 	0: {0x0001, 4}, // "0001"
    722 	1: {0x0001, 3}, // "001"
    723 	2: {0x0001, 1}, // "1"
    724 	3: {0x0003, 3}, // "011"
    725 	4: {0x0003, 6}, // "000011"
    726 	5: {0x0003, 7}, // "0000011"
    727 	6: {0x0002, 3}, // "010"
    728 	7: {0x0002, 6}, // "000010"
    729 	8: {0x0002, 7}, // "0000010"
    730 	9: {0x0001, 7}, // "0000001"
    731 }
    732 
    733 // whiteEncodeTable2 represents Table 2 for a white run.
    734 var whiteEncodeTable2 = [...]bitString{
    735 	0:  {0x0035, 8}, // "00110101"
    736 	1:  {0x0007, 6}, // "000111"
    737 	2:  {0x0007, 4}, // "0111"
    738 	3:  {0x0008, 4}, // "1000"
    739 	4:  {0x000b, 4}, // "1011"
    740 	5:  {0x000c, 4}, // "1100"
    741 	6:  {0x000e, 4}, // "1110"
    742 	7:  {0x000f, 4}, // "1111"
    743 	8:  {0x0013, 5}, // "10011"
    744 	9:  {0x0014, 5}, // "10100"
    745 	10: {0x0007, 5}, // "00111"
    746 	11: {0x0008, 5}, // "01000"
    747 	12: {0x0008, 6}, // "001000"
    748 	13: {0x0003, 6}, // "000011"
    749 	14: {0x0034, 6}, // "110100"
    750 	15: {0x0035, 6}, // "110101"
    751 	16: {0x002a, 6}, // "101010"
    752 	17: {0x002b, 6}, // "101011"
    753 	18: {0x0027, 7}, // "0100111"
    754 	19: {0x000c, 7}, // "0001100"
    755 	20: {0x0008, 7}, // "0001000"
    756 	21: {0x0017, 7}, // "0010111"
    757 	22: {0x0003, 7}, // "0000011"
    758 	23: {0x0004, 7}, // "0000100"
    759 	24: {0x0028, 7}, // "0101000"
    760 	25: {0x002b, 7}, // "0101011"
    761 	26: {0x0013, 7}, // "0010011"
    762 	27: {0x0024, 7}, // "0100100"
    763 	28: {0x0018, 7}, // "0011000"
    764 	29: {0x0002, 8}, // "00000010"
    765 	30: {0x0003, 8}, // "00000011"
    766 	31: {0x001a, 8}, // "00011010"
    767 	32: {0x001b, 8}, // "00011011"
    768 	33: {0x0012, 8}, // "00010010"
    769 	34: {0x0013, 8}, // "00010011"
    770 	35: {0x0014, 8}, // "00010100"
    771 	36: {0x0015, 8}, // "00010101"
    772 	37: {0x0016, 8}, // "00010110"
    773 	38: {0x0017, 8}, // "00010111"
    774 	39: {0x0028, 8}, // "00101000"
    775 	40: {0x0029, 8}, // "00101001"
    776 	41: {0x002a, 8}, // "00101010"
    777 	42: {0x002b, 8}, // "00101011"
    778 	43: {0x002c, 8}, // "00101100"
    779 	44: {0x002d, 8}, // "00101101"
    780 	45: {0x0004, 8}, // "00000100"
    781 	46: {0x0005, 8}, // "00000101"
    782 	47: {0x000a, 8}, // "00001010"
    783 	48: {0x000b, 8}, // "00001011"
    784 	49: {0x0052, 8}, // "01010010"
    785 	50: {0x0053, 8}, // "01010011"
    786 	51: {0x0054, 8}, // "01010100"
    787 	52: {0x0055, 8}, // "01010101"
    788 	53: {0x0024, 8}, // "00100100"
    789 	54: {0x0025, 8}, // "00100101"
    790 	55: {0x0058, 8}, // "01011000"
    791 	56: {0x0059, 8}, // "01011001"
    792 	57: {0x005a, 8}, // "01011010"
    793 	58: {0x005b, 8}, // "01011011"
    794 	59: {0x004a, 8}, // "01001010"
    795 	60: {0x004b, 8}, // "01001011"
    796 	61: {0x0032, 8}, // "00110010"
    797 	62: {0x0033, 8}, // "00110011"
    798 	63: {0x0034, 8}, // "00110100"
    799 }
    800 
    801 // whiteEncodeTable3 represents Table 3 for a white run.
    802 var whiteEncodeTable3 = [...]bitString{
    803 	0:  {0x001b, 5},  // "11011"
    804 	1:  {0x0012, 5},  // "10010"
    805 	2:  {0x0017, 6},  // "010111"
    806 	3:  {0x0037, 7},  // "0110111"
    807 	4:  {0x0036, 8},  // "00110110"
    808 	5:  {0x0037, 8},  // "00110111"
    809 	6:  {0x0064, 8},  // "01100100"
    810 	7:  {0x0065, 8},  // "01100101"
    811 	8:  {0x0068, 8},  // "01101000"
    812 	9:  {0x0067, 8},  // "01100111"
    813 	10: {0x00cc, 9},  // "011001100"
    814 	11: {0x00cd, 9},  // "011001101"
    815 	12: {0x00d2, 9},  // "011010010"
    816 	13: {0x00d3, 9},  // "011010011"
    817 	14: {0x00d4, 9},  // "011010100"
    818 	15: {0x00d5, 9},  // "011010101"
    819 	16: {0x00d6, 9},  // "011010110"
    820 	17: {0x00d7, 9},  // "011010111"
    821 	18: {0x00d8, 9},  // "011011000"
    822 	19: {0x00d9, 9},  // "011011001"
    823 	20: {0x00da, 9},  // "011011010"
    824 	21: {0x00db, 9},  // "011011011"
    825 	22: {0x0098, 9},  // "010011000"
    826 	23: {0x0099, 9},  // "010011001"
    827 	24: {0x009a, 9},  // "010011010"
    828 	25: {0x0018, 6},  // "011000"
    829 	26: {0x009b, 9},  // "010011011"
    830 	27: {0x0008, 11}, // "00000001000"
    831 	28: {0x000c, 11}, // "00000001100"
    832 	29: {0x000d, 11}, // "00000001101"
    833 	30: {0x0012, 12}, // "000000010010"
    834 	31: {0x0013, 12}, // "000000010011"
    835 	32: {0x0014, 12}, // "000000010100"
    836 	33: {0x0015, 12}, // "000000010101"
    837 	34: {0x0016, 12}, // "000000010110"
    838 	35: {0x0017, 12}, // "000000010111"
    839 	36: {0x001c, 12}, // "000000011100"
    840 	37: {0x001d, 12}, // "000000011101"
    841 	38: {0x001e, 12}, // "000000011110"
    842 	39: {0x001f, 12}, // "000000011111"
    843 }
    844 
    845 // blackEncodeTable2 represents Table 2 for a black run.
    846 var blackEncodeTable2 = [...]bitString{
    847 	0:  {0x0037, 10}, // "0000110111"
    848 	1:  {0x0002, 3},  // "010"
    849 	2:  {0x0003, 2},  // "11"
    850 	3:  {0x0002, 2},  // "10"
    851 	4:  {0x0003, 3},  // "011"
    852 	5:  {0x0003, 4},  // "0011"
    853 	6:  {0x0002, 4},  // "0010"
    854 	7:  {0x0003, 5},  // "00011"
    855 	8:  {0x0005, 6},  // "000101"
    856 	9:  {0x0004, 6},  // "000100"
    857 	10: {0x0004, 7},  // "0000100"
    858 	11: {0x0005, 7},  // "0000101"
    859 	12: {0x0007, 7},  // "0000111"
    860 	13: {0x0004, 8},  // "00000100"
    861 	14: {0x0007, 8},  // "00000111"
    862 	15: {0x0018, 9},  // "000011000"
    863 	16: {0x0017, 10}, // "0000010111"
    864 	17: {0x0018, 10}, // "0000011000"
    865 	18: {0x0008, 10}, // "0000001000"
    866 	19: {0x0067, 11}, // "00001100111"
    867 	20: {0x0068, 11}, // "00001101000"
    868 	21: {0x006c, 11}, // "00001101100"
    869 	22: {0x0037, 11}, // "00000110111"
    870 	23: {0x0028, 11}, // "00000101000"
    871 	24: {0x0017, 11}, // "00000010111"
    872 	25: {0x0018, 11}, // "00000011000"
    873 	26: {0x00ca, 12}, // "000011001010"
    874 	27: {0x00cb, 12}, // "000011001011"
    875 	28: {0x00cc, 12}, // "000011001100"
    876 	29: {0x00cd, 12}, // "000011001101"
    877 	30: {0x0068, 12}, // "000001101000"
    878 	31: {0x0069, 12}, // "000001101001"
    879 	32: {0x006a, 12}, // "000001101010"
    880 	33: {0x006b, 12}, // "000001101011"
    881 	34: {0x00d2, 12}, // "000011010010"
    882 	35: {0x00d3, 12}, // "000011010011"
    883 	36: {0x00d4, 12}, // "000011010100"
    884 	37: {0x00d5, 12}, // "000011010101"
    885 	38: {0x00d6, 12}, // "000011010110"
    886 	39: {0x00d7, 12}, // "000011010111"
    887 	40: {0x006c, 12}, // "000001101100"
    888 	41: {0x006d, 12}, // "000001101101"
    889 	42: {0x00da, 12}, // "000011011010"
    890 	43: {0x00db, 12}, // "000011011011"
    891 	44: {0x0054, 12}, // "000001010100"
    892 	45: {0x0055, 12}, // "000001010101"
    893 	46: {0x0056, 12}, // "000001010110"
    894 	47: {0x0057, 12}, // "000001010111"
    895 	48: {0x0064, 12}, // "000001100100"
    896 	49: {0x0065, 12}, // "000001100101"
    897 	50: {0x0052, 12}, // "000001010010"
    898 	51: {0x0053, 12}, // "000001010011"
    899 	52: {0x0024, 12}, // "000000100100"
    900 	53: {0x0037, 12}, // "000000110111"
    901 	54: {0x0038, 12}, // "000000111000"
    902 	55: {0x0027, 12}, // "000000100111"
    903 	56: {0x0028, 12}, // "000000101000"
    904 	57: {0x0058, 12}, // "000001011000"
    905 	58: {0x0059, 12}, // "000001011001"
    906 	59: {0x002b, 12}, // "000000101011"
    907 	60: {0x002c, 12}, // "000000101100"
    908 	61: {0x005a, 12}, // "000001011010"
    909 	62: {0x0066, 12}, // "000001100110"
    910 	63: {0x0067, 12}, // "000001100111"
    911 }
    912 
    913 // blackEncodeTable3 represents Table 3 for a black run.
    914 var blackEncodeTable3 = [...]bitString{
    915 	0:  {0x000f, 10}, // "0000001111"
    916 	1:  {0x00c8, 12}, // "000011001000"
    917 	2:  {0x00c9, 12}, // "000011001001"
    918 	3:  {0x005b, 12}, // "000001011011"
    919 	4:  {0x0033, 12}, // "000000110011"
    920 	5:  {0x0034, 12}, // "000000110100"
    921 	6:  {0x0035, 12}, // "000000110101"
    922 	7:  {0x006c, 13}, // "0000001101100"
    923 	8:  {0x006d, 13}, // "0000001101101"
    924 	9:  {0x004a, 13}, // "0000001001010"
    925 	10: {0x004b, 13}, // "0000001001011"
    926 	11: {0x004c, 13}, // "0000001001100"
    927 	12: {0x004d, 13}, // "0000001001101"
    928 	13: {0x0072, 13}, // "0000001110010"
    929 	14: {0x0073, 13}, // "0000001110011"
    930 	15: {0x0074, 13}, // "0000001110100"
    931 	16: {0x0075, 13}, // "0000001110101"
    932 	17: {0x0076, 13}, // "0000001110110"
    933 	18: {0x0077, 13}, // "0000001110111"
    934 	19: {0x0052, 13}, // "0000001010010"
    935 	20: {0x0053, 13}, // "0000001010011"
    936 	21: {0x0054, 13}, // "0000001010100"
    937 	22: {0x0055, 13}, // "0000001010101"
    938 	23: {0x005a, 13}, // "0000001011010"
    939 	24: {0x005b, 13}, // "0000001011011"
    940 	25: {0x0064, 13}, // "0000001100100"
    941 	26: {0x0065, 13}, // "0000001100101"
    942 	27: {0x0008, 11}, // "00000001000"
    943 	28: {0x000c, 11}, // "00000001100"
    944 	29: {0x000d, 11}, // "00000001101"
    945 	30: {0x0012, 12}, // "000000010010"
    946 	31: {0x0013, 12}, // "000000010011"
    947 	32: {0x0014, 12}, // "000000010100"
    948 	33: {0x0015, 12}, // "000000010101"
    949 	34: {0x0016, 12}, // "000000010110"
    950 	35: {0x0017, 12}, // "000000010111"
    951 	36: {0x001c, 12}, // "000000011100"
    952 	37: {0x001d, 12}, // "000000011101"
    953 	38: {0x001e, 12}, // "000000011110"
    954 	39: {0x001f, 12}, // "000000011111"
    955 }
    956 
    957 // COPY PASTE table.go BEGIN
    958 
    959 const (
    960 	modePass = iota // Pass
    961 	modeH           // Horizontal
    962 	modeV0          // Vertical-0
    963 	modeVR1         // Vertical-Right-1
    964 	modeVR2         // Vertical-Right-2
    965 	modeVR3         // Vertical-Right-3
    966 	modeVL1         // Vertical-Left-1
    967 	modeVL2         // Vertical-Left-2
    968 	modeVL3         // Vertical-Left-3
    969 	modeExt         // Extension
    970 )
    971 
    972 // COPY PASTE table.go END