#include "constants.h" /* FIXME: don't like big tables of data */ const int QR_ALIGNMENT_LOCATION[40][7] = { { 0, 0, 0, 0, 0, 0, 0 }, /* 1 */ { 6, 18, 0, 0, 0, 0, 0 }, /* 2 */ { 6, 22, 0, 0, 0, 0, 0 }, /* 3 */ { 6, 26, 0, 0, 0, 0, 0 }, /* 4 */ { 6, 30, 0, 0, 0, 0, 0 }, /* 5 */ { 6, 34, 0, 0, 0, 0, 0 }, /* 6 */ { 6, 22, 38, 0, 0, 0, 0 }, /* 7 */ { 6, 24, 42, 0, 0, 0, 0 }, /* 8 */ { 6, 26, 46, 0, 0, 0, 0 }, /* 9 */ { 6, 28, 50, 0, 0, 0, 0 }, /* 10 */ { 6, 30, 54, 0, 0, 0, 0 }, /* 11 */ { 6, 32, 58, 0, 0, 0, 0 }, /* 12 */ { 6, 34, 62, 0, 0, 0, 0 }, /* 13 */ { 6, 26, 46, 66, 0, 0, 0 }, /* 14 */ { 6, 26, 48, 70, 0, 0, 0 }, /* 15 */ { 6, 26, 50, 74, 0, 0, 0 }, /* 16 */ { 6, 30, 54, 78, 0, 0, 0 }, /* 17 */ { 6, 30, 56, 82, 0, 0, 0 }, /* 18 */ { 6, 30, 58, 86, 0, 0, 0 }, /* 19 */ { 6, 34, 62, 90, 0, 0, 0 }, /* 20 */ { 6, 28, 50, 72, 94, 0, 0 }, /* 21 */ { 6, 26, 50, 74, 98, 0, 0 }, /* 22 */ { 6, 30, 54, 78,102, 0, 0 }, /* 23 */ { 6, 28, 54, 80,106, 0, 0 }, /* 24 */ { 6, 32, 58, 84,110, 0, 0 }, /* 25 */ { 6, 30, 58, 86,114, 0, 0 }, /* 26 */ { 6, 34, 62, 90,118, 0, 0 }, /* 27 */ { 6, 26, 50, 74, 98,122, 0 }, /* 28 */ { 6, 30, 54, 78,102,126, 0 }, /* 29 */ { 6, 26, 52, 78,104,130, 0 }, /* 30 */ { 6, 30, 56, 82,108,134, 0 }, /* 31 */ { 6, 34, 60, 86,112,138, 0 }, /* 32 */ { 6, 30, 58, 86,114,142, 0 }, /* 33 */ { 6, 34, 62, 90,118,146, 0 }, /* 34 */ { 6, 30, 54, 78,102,126,150 }, /* 35 */ { 6, 24, 50, 76,102,128,154 }, /* 36 */ { 6, 28, 54, 80,106,132,158 }, /* 37 */ { 6, 32, 58, 84,110,136,162 }, /* 38 */ { 6, 26, 54, 82,110,138,166 }, /* 39 */ { 6, 30, 58, 86,114,142,170 }, /* 40 */ }; const int QR_DATA_WORD_COUNT[40][4] = { { 19, 16, 13, 9 }, { 34, 28, 22, 16 }, { 55, 44, 34, 26 }, { 80, 64, 48, 36 }, { 108, 86, 62, 46 }, { 136, 108, 76, 60 }, { 156, 124, 88, 66 }, { 194, 154, 110, 86 }, { 232, 182, 132, 100 }, { 274, 216, 154, 122 }, { 324, 254, 180, 140 }, { 370, 290, 206, 158 }, { 428, 334, 244, 180 }, { 461, 365, 261, 197 }, { 523, 415, 295, 223 }, { 589, 453, 325, 253 }, { 647, 507, 367, 283 }, { 721, 563, 397, 313 }, { 795, 627, 445, 341 }, { 861, 669, 485, 385 }, { 932, 714, 512, 406 }, { 1006, 782, 568, 442 }, { 1094, 860, 614, 464 }, { 1174, 914, 664, 514 }, { 1276, 1000, 718, 538 }, { 1370, 1062, 754, 596 }, { 1468, 1128, 808, 628 }, { 1531, 1193, 871, 661 }, { 1631, 1267, 911, 701 }, { 1735, 1373, 985, 745 }, { 1845, 1455, 1033, 793 }, { 1955, 1541, 1115, 845 }, { 2071, 1631, 1171, 901 }, { 2191, 1725, 1231, 961 }, { 2306, 1812, 1286, 986 }, { 2434, 1914, 1351, 1054 }, { 2566, 1992, 1426, 1096 }, { 2812, 2216, 1582, 1222 }, { 2956, 2334, 1666, 1276 } }; const int QR_RS_BLOCK_COUNT[40][4][2] = { { 1, 0, 1, 0, 1, 0, 1, 0 }, /* 1 */ { 1, 0, 1, 0, 1, 0, 1, 0 }, /* 2 */ { 1, 0, 1, 0, 2, 0, 2, 0 }, /* 3 */ { 1, 0, 2, 0, 2, 0, 4, 0 }, /* 4 */ { 1, 0, 2, 0, 2, 2, 2, 2 }, /* 5 */ { 2, 0, 4, 0, 4, 0, 4, 0 }, /* 6 */ { 2, 0, 4, 0, 2, 4, 4, 1 }, /* 7 */ { 2, 0, 2, 2, 4, 2, 4, 2 }, /* 8 */ { 2, 0, 3, 2, 4, 4, 4, 4 }, /* 9 */ { 2, 2, 4, 1, 6, 2, 6, 2 }, /* 10 */ { 4, 0, 1, 4, 4, 4, 3, 8 }, /* 11 */ { 2, 2, 6, 2, 4, 6, 7, 4 }, /* 12 */ { 4, 0, 8, 1, 8, 4, 12, 4 }, /* 13 */ { 3, 1, 4, 5, 11, 5, 11, 5 }, /* 14 */ { 5, 1, 5, 5, 5, 7, 11, 7 }, /* 15 */ { 5, 1, 7, 3, 15, 2, 3, 13 }, /* 16 */ { 1, 5, 10, 1, 1, 15, 2, 17 }, /* 17 */ { 5, 1, 9, 4, 17, 1, 2, 19 }, /* 18 */ { 3, 4, 3, 11, 17, 4, 9, 16 }, /* 19 */ { 3, 5, 3, 13, 15, 5, 15, 10 }, /* 20 */ { 4, 4, 17, 0, 17, 6, 19, 6 }, /* 21 */ { 2, 7, 17, 0, 7, 16, 34, 0 }, /* 22 */ { 4, 5, 4, 14, 11, 14, 16, 14 }, /* 23 */ { 6, 4, 6, 14, 11, 16, 30, 2 }, /* 24 */ { 8, 4, 8, 13, 7, 22, 22, 13 }, /* 25 */ { 10, 2, 19, 4, 28, 6, 33, 4 }, /* 26 */ { 8, 4, 22, 3, 8, 26, 12, 28 }, /* 27 */ { 3, 10, 3, 23, 4, 31, 11, 31 }, /* 28 */ { 7, 7, 21, 7, 1, 37, 19, 26 }, /* 29 */ { 5, 10, 19, 10, 15, 25, 23, 25 }, /* 30 */ { 13, 3, 2, 29, 42, 1, 23, 28 }, /* 31 */ { 17, 0, 10, 23, 10, 35, 19, 35 }, /* 32 */ { 17, 1, 14, 21, 29, 19, 11, 46 }, /* 33 */ { 13, 6, 14, 23, 44, 7, 59, 1 }, /* 34 */ { 12, 7, 12, 26, 39, 14, 22, 41 }, /* 35 */ { 6, 14, 6, 34, 46, 10, 2, 64 }, /* 36 */ { 17, 4, 29, 14, 49, 10, 24, 46 }, /* 37 */ { 4, 18, 13, 32, 48, 14, 42, 32 }, /* 38 */ { 20, 4, 40, 7, 43, 22, 10, 67 }, /* 39 */ { 19, 6, 18, 31, 34, 34, 20, 61 } /* 40 */ }; const enum qr_data_type QR_TYPE_CODES[16] = { QR_DATA_INVALID, /* 0000 */ QR_DATA_NUMERIC, /* 0001 */ QR_DATA_ALPHA, /* 0010 */ QR_DATA_MIXED, /* 0011 */ QR_DATA_8BIT, /* 0100 */ QR_DATA_FNC1, /* 0101 */ QR_DATA_INVALID, /* 0110 */ QR_DATA_ECI, /* 0111 */ QR_DATA_KANJI, /* 1000 */ QR_DATA_FNC1, /* 1001 */ QR_DATA_INVALID, /* 1010 */ QR_DATA_INVALID, /* 1011 */ QR_DATA_INVALID, /* 1100 */ QR_DATA_INVALID, /* 1101 */ QR_DATA_INVALID, /* 1110 */ QR_DATA_INVALID, /* 1111 */ };