aboutsummaryrefslogtreecommitdiff
path: root/lpg/libqr/capacity.c
diff options
context:
space:
mode:
authorLeo Howell <leo@lwh.jp>2009-11-01 22:54:33 +0900
committerLeo Howell <leo@lwh.jp>2009-11-01 22:54:33 +0900
commit4eee8658be637fde410f429e69e86b034cd39185 (patch)
tree0de9cd32261559bad15373d7cad4026748d2f356 /lpg/libqr/capacity.c
parent0b61708d12b30ce6dc174554794d674eb9f99dad (diff)
downloadpdf-simple-sign-4eee8658be637fde410f429e69e86b034cd39185.tar.gz
pdf-simple-sign-4eee8658be637fde410f429e69e86b034cd39185.tar.xz
pdf-simple-sign-4eee8658be637fde410f429e69e86b034cd39185.zip
support for multiple ec blocks
Diffstat (limited to 'lpg/libqr/capacity.c')
-rw-r--r--lpg/libqr/capacity.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/lpg/libqr/capacity.c b/lpg/libqr/capacity.c
new file mode 100644
index 0000000..4b513af
--- /dev/null
+++ b/lpg/libqr/capacity.c
@@ -0,0 +1,88 @@
+/* FIXME: don't like big tables of data */
+
+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
+};
+
+/* I'm sure we can calculate these values */
+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, 0, 2, 0,
+ 2, 0, 4, 0, 4, 0, 4, 0,
+ 2, 0, 4, 0, 2, 4, 4, 1,
+ 2, 0, 2, 2, 4, 2, 4, 2, /* 8 */
+ 2, 0, 3, 2, 4, 4, 4, 4,
+ 2, 2, 4, 1, 6, 2, 6, 2,
+ 4, 0, 1, 4, 4, 4, 3, 8,
+ 2, 2, 6, 2, 4, 6, 7, 4,
+ 4, 0, 8, 1, 8, 4, 12, 4,
+ 3, 1, 4, 5, 11, 5, 11, 5, /* 14 */
+ 5, 1, 5, 5, 5, 7, 11, 7,
+ 5, 1, 7, 3, 15, 2, 3, 13,
+ 1, 5, 10, 1, 1, 15, 2, 17,
+ 5, 1, 9, 4, 17, 1, 2, 19,
+ 3, 4, 3, 11, 17, 4, 9, 16, /* 19 */
+ 3, 5, 3, 13, 15, 5, 15, 10,
+ 4, 4, 17, 0, 17, 6, 19, 6,
+ 2, 7, 17, 0, 7, 16, 34, 0,
+ 4, 5, 4, 14, 11, 14, 16, 14,
+ 6, 4, 6, 14, 11, 16, 30, 2,
+ 8, 4, 8, 13, 7, 22, 22, 13, /* 25 */
+ 10, 2, 19, 4, 28, 6, 33, 4,
+ 8, 4, 22, 3, 8, 26, 12, 28,
+ 3, 10, 3, 23, 4, 31, 11, 31,
+ 7, 7, 21, 7, 1, 37, 19, 26,
+ 5, 10, 19, 10, 15, 25, 23, 25, /* 30 */
+ 13, 3, 2, 29, 42, 1, 23, 28,
+ 17, 0, 10, 23, 10, 35, 19, 35,
+ 17, 1, 14, 21, 29, 19, 11, 46,
+ 13, 6, 14, 23, 44, 7, 59, 1,
+ 12, 7, 12, 26, 39, 14, 22, 41, /* 35 */
+ 6, 14, 6, 34, 46, 10, 2, 64,
+ 17, 4, 29, 14, 49, 10, 24, 46,
+ 4, 18, 13, 32, 48, 14, 42, 32,
+ 20, 4, 40, 7, 43, 22, 10, 67,
+ 19, 6, 18, 31, 34, 34, 20, 61 /* 40 */
+};
+