|
|
|
|
@@ -65,11 +65,11 @@ http://www.codeproject.com/KB/cs/qrcode.aspx
|
|
|
|
|
http://sourceforge.jp/projects/reedsolomon
|
|
|
|
|
http://twit88.com/home/
|
|
|
|
|
http://qrcode.sourceforge.jp/
|
|
|
|
|
http://zxing.org/w/decode.jspx Online decoder
|
|
|
|
|
http://zxing.org/w/decode.jspx Online decoder
|
|
|
|
|
http://blog.qr4.nl/Online-QR-Code_Decoder.aspx Online decoder (not all codes are decoded)
|
|
|
|
|
http://www.thonky.com/qr-code-tutorial/ Tutorial
|
|
|
|
|
http://code.google.com/p/zxing/ Java library
|
|
|
|
|
http://goqr.me/ Online encode
|
|
|
|
|
http://goqr.me/ Online encode
|
|
|
|
|
http://www.pclviewer.com/rs2/calculator.html Reed-solomon ECC calculator
|
|
|
|
|
http://raidenii.net/files/datasheets/misc/qr_code.pdf
|
|
|
|
|
|
|
|
|
|
@@ -98,7 +98,7 @@ typedef struct
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
unsigned int uiTotal; /* total number of codewords */
|
|
|
|
|
QRLEVEL level[ 4 ];
|
|
|
|
|
QRLEVEL level[ 4 ];
|
|
|
|
|
} QRVERSION, * PQRVERSION;
|
|
|
|
|
|
|
|
|
|
static const QRVERSION s_version[] =
|
|
|
|
|
@@ -110,163 +110,163 @@ static const QRVERSION s_version[] =
|
|
|
|
|
{ 44, {{ 10, {{ 1, 34, 10}, { 0, 0, 0}}}, /* 2 4 * 2 */
|
|
|
|
|
{ 16, {{ 1, 28, 16}, { 0, 0, 0}}},
|
|
|
|
|
{ 22, {{ 1, 22, 22}, { 0, 0, 0}}},
|
|
|
|
|
{ 28, {{ 1, 16, 28}, { 0, 0, 0}}}}},
|
|
|
|
|
{ 28, {{ 1, 16, 28}, { 0, 0, 0}}}}},
|
|
|
|
|
{ 70, {{ 15, {{ 1, 55, 15}, { 0, 0, 0}}}, /* 3 7 * 2 */
|
|
|
|
|
{ 26, {{ 1, 44, 26}, { 0, 0, 0}}},
|
|
|
|
|
{ 36, {{ 2, 17, 18}, { 0, 0, 0}}},
|
|
|
|
|
{ 26, {{ 1, 44, 26}, { 0, 0, 0}}},
|
|
|
|
|
{ 36, {{ 2, 17, 18}, { 0, 0, 0}}},
|
|
|
|
|
{ 44, {{ 2, 13, 22}, { 0, 0, 0}}}}},
|
|
|
|
|
{ 100, {{ 20, {{ 1, 80, 20}, { 0, 0, 0}}}, /* 4 */
|
|
|
|
|
{ 36, {{ 2, 32, 18}, { 0, 0, 0}}},
|
|
|
|
|
{ 52, {{ 2, 24, 26}, { 0, 0, 0}}},
|
|
|
|
|
{ 36, {{ 2, 32, 18}, { 0, 0, 0}}},
|
|
|
|
|
{ 52, {{ 2, 24, 26}, { 0, 0, 0}}},
|
|
|
|
|
{ 64, {{ 4, 9, 16}, { 0, 0, 0}}}}},
|
|
|
|
|
{ 134, {{ 26, {{ 1, 108, 26}, { 0, 0, 0}}}, /* 5 */
|
|
|
|
|
{ 48, {{ 2, 43, 24}, { 0, 0, 0}}},
|
|
|
|
|
{ 72, {{ 2, 15, 18}, { 2, 16, 18}}},
|
|
|
|
|
{ 48, {{ 2, 43, 24}, { 0, 0, 0}}},
|
|
|
|
|
{ 72, {{ 2, 15, 18}, { 2, 16, 18}}},
|
|
|
|
|
{ 88, {{ 2, 11, 22}, { 2, 12, 22}}}}},
|
|
|
|
|
{ 172, {{ 36, {{ 2, 68, 18}, { 0, 0, 0}}}, /* 6 */
|
|
|
|
|
{ 64, {{ 4, 27, 16}, { 0, 0, 0}}},
|
|
|
|
|
{ 96, {{ 4, 19, 24}, { 0, 0, 0}}},
|
|
|
|
|
{ 64, {{ 4, 27, 16}, { 0, 0, 0}}},
|
|
|
|
|
{ 96, {{ 4, 19, 24}, { 0, 0, 0}}},
|
|
|
|
|
{ 112, {{ 4, 15, 28}, { 0, 0, 0}}}}},
|
|
|
|
|
{ 196, {{ 40, {{ 2, 78, 20}, { 0, 0, 0}}}, /* 7 */
|
|
|
|
|
{ 72, {{ 4, 31, 18}, { 0, 0, 0}}},
|
|
|
|
|
{ 108, {{ 2, 14, 18}, { 4, 15, 18}}},
|
|
|
|
|
{ 72, {{ 4, 31, 18}, { 0, 0, 0}}},
|
|
|
|
|
{ 108, {{ 2, 14, 18}, { 4, 15, 18}}},
|
|
|
|
|
{ 130, {{ 4, 13, 26}, { 1, 14, 26}}}}},
|
|
|
|
|
{ 242, {{ 48, {{ 2, 97, 24}, { 0, 0, 0}}}, /* 8 */
|
|
|
|
|
{ 88, {{ 2, 38, 22}, { 2, 39, 22}}},
|
|
|
|
|
{ 132, {{ 4, 18, 22}, { 2, 19, 22}}},
|
|
|
|
|
{ 156, {{ 4, 14, 26}, { 2, 15, 26}}}}},
|
|
|
|
|
{ 88, {{ 2, 38, 22}, { 2, 39, 22}}},
|
|
|
|
|
{ 132, {{ 4, 18, 22}, { 2, 19, 22}}},
|
|
|
|
|
{ 156, {{ 4, 14, 26}, { 2, 15, 26}}}}},
|
|
|
|
|
{ 292, {{ 60, {{ 2, 116, 30}, { 0, 0, 0}}}, /* 9 */
|
|
|
|
|
{ 110, {{ 3, 36, 22}, { 2, 37, 22}}},
|
|
|
|
|
{ 160, {{ 4, 16, 20}, { 4, 17, 20}}},
|
|
|
|
|
{ 192, {{ 4, 12, 24}, { 4, 13, 24}}}}},
|
|
|
|
|
{ 110, {{ 3, 36, 22}, { 2, 37, 22}}},
|
|
|
|
|
{ 160, {{ 4, 16, 20}, { 4, 17, 20}}},
|
|
|
|
|
{ 192, {{ 4, 12, 24}, { 4, 13, 24}}}}},
|
|
|
|
|
{ 346, {{ 72, {{ 2, 68, 18}, { 2, 69, 18}}}, /* 10 */
|
|
|
|
|
{ 130, {{ 4, 43, 26}, { 1, 44, 26}}},
|
|
|
|
|
{ 192, {{ 6, 19, 24}, { 2, 20, 24}}},
|
|
|
|
|
{ 224, {{ 6, 15, 28}, { 2, 16, 28}}}}},
|
|
|
|
|
{ 130, {{ 4, 43, 26}, { 1, 44, 26}}},
|
|
|
|
|
{ 192, {{ 6, 19, 24}, { 2, 20, 24}}},
|
|
|
|
|
{ 224, {{ 6, 15, 28}, { 2, 16, 28}}}}},
|
|
|
|
|
{ 404, {{ 80, {{ 4, 81, 20}, { 0, 0, 0}}}, /* 11 */
|
|
|
|
|
{ 150, {{ 1, 50, 30}, { 4, 51, 30}}},
|
|
|
|
|
{ 224, {{ 4, 22, 28}, { 4, 23, 28}}},
|
|
|
|
|
{ 264, {{ 3, 12, 24}, { 8, 13, 24}}}}},
|
|
|
|
|
{ 150, {{ 1, 50, 30}, { 4, 51, 30}}},
|
|
|
|
|
{ 224, {{ 4, 22, 28}, { 4, 23, 28}}},
|
|
|
|
|
{ 264, {{ 3, 12, 24}, { 8, 13, 24}}}}},
|
|
|
|
|
{ 466, {{ 96, {{ 2, 92, 24}, { 2, 93, 24}}}, /* 12 */
|
|
|
|
|
{ 176, {{ 6, 36, 22}, { 2, 37, 22}}},
|
|
|
|
|
{ 260, {{ 4, 20, 26}, { 6, 21, 26}}},
|
|
|
|
|
{ 308, {{ 7, 14, 28}, { 4, 15, 28}}}}},
|
|
|
|
|
{ 176, {{ 6, 36, 22}, { 2, 37, 22}}},
|
|
|
|
|
{ 260, {{ 4, 20, 26}, { 6, 21, 26}}},
|
|
|
|
|
{ 308, {{ 7, 14, 28}, { 4, 15, 28}}}}},
|
|
|
|
|
{ 532, {{ 104, {{ 4, 107, 26}, { 0, 0, 0}}}, /* 13 */
|
|
|
|
|
{ 198, {{ 8, 37, 22}, { 1, 38, 22}}},
|
|
|
|
|
{ 288, {{ 8, 20, 24}, { 4, 21, 24}}},
|
|
|
|
|
{ 352, {{12, 11, 22}, { 4, 12, 22}}}}},
|
|
|
|
|
{ 198, {{ 8, 37, 22}, { 1, 38, 22}}},
|
|
|
|
|
{ 288, {{ 8, 20, 24}, { 4, 21, 24}}},
|
|
|
|
|
{ 352, {{12, 11, 22}, { 4, 12, 22}}}}},
|
|
|
|
|
{ 581, {{ 120, {{ 3, 115, 30}, { 1, 116, 30}}}, /* 14 */
|
|
|
|
|
{ 216, {{ 4, 40, 24}, { 5, 41, 24}}},
|
|
|
|
|
{ 320, {{11, 16, 20}, { 5, 17, 20}}},
|
|
|
|
|
{ 384, {{11, 12, 24}, { 5, 13, 24}}}}},
|
|
|
|
|
{ 216, {{ 4, 40, 24}, { 5, 41, 24}}},
|
|
|
|
|
{ 320, {{11, 16, 20}, { 5, 17, 20}}},
|
|
|
|
|
{ 384, {{11, 12, 24}, { 5, 13, 24}}}}},
|
|
|
|
|
{ 655, {{ 132, {{ 5, 87, 22}, { 1, 88, 22}}}, /* 15 */
|
|
|
|
|
{ 240, {{ 5, 41, 24}, { 5, 42, 24}}},
|
|
|
|
|
{ 360, {{ 5, 24, 30}, { 7, 25, 30}}},
|
|
|
|
|
{ 432, {{11, 12, 24}, { 7, 13, 24}}}}},
|
|
|
|
|
{ 240, {{ 5, 41, 24}, { 5, 42, 24}}},
|
|
|
|
|
{ 360, {{ 5, 24, 30}, { 7, 25, 30}}},
|
|
|
|
|
{ 432, {{11, 12, 24}, { 7, 13, 24}}}}},
|
|
|
|
|
{ 733, {{ 144, {{ 5, 98, 24}, { 1, 99, 24}}}, /* 16 */
|
|
|
|
|
{ 280, {{ 7, 45, 28}, { 3, 46, 28}}},
|
|
|
|
|
{ 408, {{15, 19, 24}, { 2, 20, 24}}},
|
|
|
|
|
{ 480, {{ 3, 15, 30}, {13, 16, 30}}}}},
|
|
|
|
|
{ 280, {{ 7, 45, 28}, { 3, 46, 28}}},
|
|
|
|
|
{ 408, {{15, 19, 24}, { 2, 20, 24}}},
|
|
|
|
|
{ 480, {{ 3, 15, 30}, {13, 16, 30}}}}},
|
|
|
|
|
{ 815, {{ 168, {{ 1, 107, 28}, { 5, 108, 28}}}, /* 17 */
|
|
|
|
|
{ 308, {{10, 46, 28}, { 1, 47, 28}}},
|
|
|
|
|
{ 448, {{ 1, 22, 28}, {15, 23, 28}}},
|
|
|
|
|
{ 532, {{ 2, 14, 28}, {17, 15, 28}}}}},
|
|
|
|
|
{ 308, {{10, 46, 28}, { 1, 47, 28}}},
|
|
|
|
|
{ 448, {{ 1, 22, 28}, {15, 23, 28}}},
|
|
|
|
|
{ 532, {{ 2, 14, 28}, {17, 15, 28}}}}},
|
|
|
|
|
{ 901, {{ 180, {{ 5, 120, 30}, { 1, 121, 30}}}, /* 18 */
|
|
|
|
|
{ 338, {{ 9, 43, 26}, { 4, 44, 26}}},
|
|
|
|
|
{ 504, {{17, 22, 28}, { 1, 23, 28}}},
|
|
|
|
|
{ 588, {{ 2, 14, 28}, {19, 15, 28}}}}},
|
|
|
|
|
{ 338, {{ 9, 43, 26}, { 4, 44, 26}}},
|
|
|
|
|
{ 504, {{17, 22, 28}, { 1, 23, 28}}},
|
|
|
|
|
{ 588, {{ 2, 14, 28}, {19, 15, 28}}}}},
|
|
|
|
|
{ 991, {{ 196, {{ 3, 113, 28}, { 4, 114, 28}}}, /* 19 */
|
|
|
|
|
{ 364, {{ 3, 44, 26}, {11, 45, 26}}},
|
|
|
|
|
{ 546, {{17, 21, 26}, { 4, 22, 26}}},
|
|
|
|
|
{ 650, {{ 9, 13, 26}, {16, 14, 26}}}}},
|
|
|
|
|
{ 364, {{ 3, 44, 26}, {11, 45, 26}}},
|
|
|
|
|
{ 546, {{17, 21, 26}, { 4, 22, 26}}},
|
|
|
|
|
{ 650, {{ 9, 13, 26}, {16, 14, 26}}}}},
|
|
|
|
|
{1085, {{ 224, {{ 3, 107, 28}, { 5, 108, 28}}}, /* 20 */
|
|
|
|
|
{ 416, {{ 3, 41, 26}, {13, 42, 26}}},
|
|
|
|
|
{ 600, {{15, 24, 30}, { 5, 25, 30}}},
|
|
|
|
|
{ 700, {{15, 15, 28}, {10, 16, 28}}}}},
|
|
|
|
|
{ 416, {{ 3, 41, 26}, {13, 42, 26}}},
|
|
|
|
|
{ 600, {{15, 24, 30}, { 5, 25, 30}}},
|
|
|
|
|
{ 700, {{15, 15, 28}, {10, 16, 28}}}}},
|
|
|
|
|
{1156, {{ 224, {{ 4, 116, 28}, { 4, 117, 28}}}, /* 21 */
|
|
|
|
|
{ 442, {{17, 42, 26}, { 0, 0, 0}}},
|
|
|
|
|
{ 644, {{17, 22, 28}, { 6, 23, 28}}},
|
|
|
|
|
{ 750, {{19, 16, 30}, { 6, 17, 30}}}}},
|
|
|
|
|
{ 442, {{17, 42, 26}, { 0, 0, 0}}},
|
|
|
|
|
{ 644, {{17, 22, 28}, { 6, 23, 28}}},
|
|
|
|
|
{ 750, {{19, 16, 30}, { 6, 17, 30}}}}},
|
|
|
|
|
{1258, {{ 252, {{ 2, 111, 28}, { 7, 112, 28}}}, /* 22 */
|
|
|
|
|
{ 476, {{17, 46, 28}, { 0, 0, 0}}},
|
|
|
|
|
{ 690, {{ 7, 24, 30}, {16, 25, 30}}},
|
|
|
|
|
{ 816, {{34, 13, 24}, { 0, 0, 0}}}}},
|
|
|
|
|
{ 476, {{17, 46, 28}, { 0, 0, 0}}},
|
|
|
|
|
{ 690, {{ 7, 24, 30}, {16, 25, 30}}},
|
|
|
|
|
{ 816, {{34, 13, 24}, { 0, 0, 0}}}}},
|
|
|
|
|
{1364, {{ 270, {{ 4, 121, 30}, { 5, 122, 30}}}, /* 23 */
|
|
|
|
|
{ 504, {{ 4, 47, 28}, {14, 48, 28}}},
|
|
|
|
|
{ 750, {{11, 24, 30}, {14, 25, 30}}},
|
|
|
|
|
{ 900, {{16, 15, 30}, {14, 16, 30}}}}},
|
|
|
|
|
{ 504, {{ 4, 47, 28}, {14, 48, 28}}},
|
|
|
|
|
{ 750, {{11, 24, 30}, {14, 25, 30}}},
|
|
|
|
|
{ 900, {{16, 15, 30}, {14, 16, 30}}}}},
|
|
|
|
|
{1474, {{ 300, {{ 6, 117, 30}, { 4, 118, 30}}}, /* 24 */
|
|
|
|
|
{ 560, {{ 6, 45, 28}, {14, 46, 28}}},
|
|
|
|
|
{ 810, {{11, 24, 30}, {16, 25, 30}}},
|
|
|
|
|
{ 960, {{30, 16, 30}, { 2, 17, 30}}}}},
|
|
|
|
|
{ 560, {{ 6, 45, 28}, {14, 46, 28}}},
|
|
|
|
|
{ 810, {{11, 24, 30}, {16, 25, 30}}},
|
|
|
|
|
{ 960, {{30, 16, 30}, { 2, 17, 30}}}}},
|
|
|
|
|
{1588, {{ 312, {{ 8, 106, 26}, { 4, 107, 26}}}, /* 25 */
|
|
|
|
|
{ 588, {{ 8, 47, 28}, {13, 48, 28}}},
|
|
|
|
|
{ 870, {{ 7, 24, 30}, {22, 25, 30}}},
|
|
|
|
|
{1050, {{22, 15, 30}, {13, 16, 30}}}}},
|
|
|
|
|
{ 588, {{ 8, 47, 28}, {13, 48, 28}}},
|
|
|
|
|
{ 870, {{ 7, 24, 30}, {22, 25, 30}}},
|
|
|
|
|
{1050, {{22, 15, 30}, {13, 16, 30}}}}},
|
|
|
|
|
{1706, {{ 336, {{10, 114, 28}, { 2, 115, 28}}}, /* 26 */
|
|
|
|
|
{ 644, {{19, 46, 28}, { 4, 47, 28}}},
|
|
|
|
|
{ 952, {{28, 22, 28}, { 6, 23, 28}}},
|
|
|
|
|
{1110, {{33, 16, 30}, { 4, 17, 30}}}}},
|
|
|
|
|
{ 644, {{19, 46, 28}, { 4, 47, 28}}},
|
|
|
|
|
{ 952, {{28, 22, 28}, { 6, 23, 28}}},
|
|
|
|
|
{1110, {{33, 16, 30}, { 4, 17, 30}}}}},
|
|
|
|
|
{1828, {{ 360, {{ 8, 122, 30}, { 4, 123, 30}}}, /* 27 */
|
|
|
|
|
{ 700, {{22, 45, 28}, { 3, 46, 28}}},
|
|
|
|
|
{1020, {{ 8, 23, 30}, {26, 24, 30}}},
|
|
|
|
|
{1200, {{12, 15, 30}, {28, 16, 30}}}}},
|
|
|
|
|
{ 700, {{22, 45, 28}, { 3, 46, 28}}},
|
|
|
|
|
{1020, {{ 8, 23, 30}, {26, 24, 30}}},
|
|
|
|
|
{1200, {{12, 15, 30}, {28, 16, 30}}}}},
|
|
|
|
|
{1921, {{ 390, {{ 3, 117, 30}, {10, 118, 30}}}, /* 28 */
|
|
|
|
|
{ 728, {{ 3, 45, 28}, {23, 46, 28}}},
|
|
|
|
|
{1050, {{ 4, 24, 30}, {31, 25, 30}}},
|
|
|
|
|
{1260, {{11, 15, 30}, {31, 16, 30}}}}},
|
|
|
|
|
{ 728, {{ 3, 45, 28}, {23, 46, 28}}},
|
|
|
|
|
{1050, {{ 4, 24, 30}, {31, 25, 30}}},
|
|
|
|
|
{1260, {{11, 15, 30}, {31, 16, 30}}}}},
|
|
|
|
|
{2051, {{ 420, {{ 7, 116, 30}, { 7, 117, 30}}}, /* 29 */
|
|
|
|
|
{ 784, {{21, 45, 28}, { 7, 46, 28}}},
|
|
|
|
|
{1140, {{ 1, 23, 30}, {37, 24, 30}}},
|
|
|
|
|
{1350, {{19, 15, 30}, {26, 16, 30}}}}},
|
|
|
|
|
{ 784, {{21, 45, 28}, { 7, 46, 28}}},
|
|
|
|
|
{1140, {{ 1, 23, 30}, {37, 24, 30}}},
|
|
|
|
|
{1350, {{19, 15, 30}, {26, 16, 30}}}}},
|
|
|
|
|
{2185, {{ 450, {{ 5, 115, 30}, {10, 116, 30}}}, /* 30 */
|
|
|
|
|
{ 812, {{19, 47, 28}, {10, 48, 28}}},
|
|
|
|
|
{1200, {{15, 24, 30}, {25, 25, 30}}},
|
|
|
|
|
{1440, {{23, 15, 30}, {25, 16, 30}}}}},
|
|
|
|
|
{ 812, {{19, 47, 28}, {10, 48, 28}}},
|
|
|
|
|
{1200, {{15, 24, 30}, {25, 25, 30}}},
|
|
|
|
|
{1440, {{23, 15, 30}, {25, 16, 30}}}}},
|
|
|
|
|
{2323, {{ 480, {{13, 115, 30}, { 3, 116, 30}}}, /* 31 */
|
|
|
|
|
{ 868, {{ 2, 46, 28}, {29, 47, 28}}},
|
|
|
|
|
{1290, {{42, 24, 30}, { 1, 25, 30}}},
|
|
|
|
|
{1530, {{23, 15, 30}, {28, 16, 30}}}}},
|
|
|
|
|
{ 868, {{ 2, 46, 28}, {29, 47, 28}}},
|
|
|
|
|
{1290, {{42, 24, 30}, { 1, 25, 30}}},
|
|
|
|
|
{1530, {{23, 15, 30}, {28, 16, 30}}}}},
|
|
|
|
|
{2465, {{ 510, {{17, 115, 30}, { 0, 0, 0}}}, /* 32 */
|
|
|
|
|
{ 924, {{10, 46, 28}, {23, 47, 28}}},
|
|
|
|
|
{1350, {{10, 24, 30}, {35, 25, 30}}},
|
|
|
|
|
{1620, {{19, 15, 30}, {35, 16, 30}}}}},
|
|
|
|
|
{ 924, {{10, 46, 28}, {23, 47, 28}}},
|
|
|
|
|
{1350, {{10, 24, 30}, {35, 25, 30}}},
|
|
|
|
|
{1620, {{19, 15, 30}, {35, 16, 30}}}}},
|
|
|
|
|
{2611, {{ 540, {{17, 115, 30}, { 1, 116, 30}}}, /* 33 */
|
|
|
|
|
{ 980, {{14, 46, 28}, {21, 47, 28}}},
|
|
|
|
|
{1440, {{29, 24, 30}, {19, 25, 30}}},
|
|
|
|
|
{1710, {{11, 15, 30}, {46, 16, 30}}}}},
|
|
|
|
|
{ 980, {{14, 46, 28}, {21, 47, 28}}},
|
|
|
|
|
{1440, {{29, 24, 30}, {19, 25, 30}}},
|
|
|
|
|
{1710, {{11, 15, 30}, {46, 16, 30}}}}},
|
|
|
|
|
{2761, {{ 570, {{13, 115, 30}, { 6, 116, 30}}}, /* 34 */
|
|
|
|
|
{1036, {{14, 46, 28}, {23, 47, 28}}},
|
|
|
|
|
{1530, {{44, 24, 30}, { 7, 25, 30}}},
|
|
|
|
|
{1800, {{59, 16, 30}, { 1, 17, 30}}}}},
|
|
|
|
|
{1036, {{14, 46, 28}, {23, 47, 28}}},
|
|
|
|
|
{1530, {{44, 24, 30}, { 7, 25, 30}}},
|
|
|
|
|
{1800, {{59, 16, 30}, { 1, 17, 30}}}}},
|
|
|
|
|
{2876, {{ 570, {{12, 121, 30}, { 7, 122, 30}}}, /* 35 */
|
|
|
|
|
{1064, {{12, 47, 28}, {26, 48, 28}}},
|
|
|
|
|
{1590, {{39, 24, 30}, {14, 25, 30}}},
|
|
|
|
|
{1890, {{22, 15, 30}, {41, 16, 30}}}}},
|
|
|
|
|
{1064, {{12, 47, 28}, {26, 48, 28}}},
|
|
|
|
|
{1590, {{39, 24, 30}, {14, 25, 30}}},
|
|
|
|
|
{1890, {{22, 15, 30}, {41, 16, 30}}}}},
|
|
|
|
|
{3034, {{ 600, {{ 6, 121, 30}, {14, 122, 30}}}, /* 36 */
|
|
|
|
|
{1120, {{ 6, 47, 28}, {34, 48, 28}}},
|
|
|
|
|
{1680, {{46, 24, 30}, {10, 25, 30}}},
|
|
|
|
|
{1980, {{ 2, 15, 30}, {64, 16, 30}}}}},
|
|
|
|
|
{1120, {{ 6, 47, 28}, {34, 48, 28}}},
|
|
|
|
|
{1680, {{46, 24, 30}, {10, 25, 30}}},
|
|
|
|
|
{1980, {{ 2, 15, 30}, {64, 16, 30}}}}},
|
|
|
|
|
{3196, {{ 630, {{17, 122, 30}, { 4, 123, 30}}}, /* 37 */
|
|
|
|
|
{1204, {{29, 46, 28}, {14, 47, 28}}},
|
|
|
|
|
{1770, {{49, 24, 30}, {10, 25, 30}}},
|
|
|
|
|
{2100, {{24, 15, 30}, {46, 16, 30}}}}},
|
|
|
|
|
{1204, {{29, 46, 28}, {14, 47, 28}}},
|
|
|
|
|
{1770, {{49, 24, 30}, {10, 25, 30}}},
|
|
|
|
|
{2100, {{24, 15, 30}, {46, 16, 30}}}}},
|
|
|
|
|
{3362, {{ 660, {{ 4, 122, 30}, {18, 123, 30}}}, /* 38 */
|
|
|
|
|
{1260, {{13, 46, 28}, {32, 47, 28}}},
|
|
|
|
|
{1860, {{48, 24, 30}, {14, 25, 30}}},
|
|
|
|
|
{2220, {{42, 15, 30}, {32, 16, 30}}}}},
|
|
|
|
|
{1260, {{13, 46, 28}, {32, 47, 28}}},
|
|
|
|
|
{1860, {{48, 24, 30}, {14, 25, 30}}},
|
|
|
|
|
{2220, {{42, 15, 30}, {32, 16, 30}}}}},
|
|
|
|
|
{3532, {{ 720, {{20, 117, 30}, { 4, 118, 30}}}, /* 39 */
|
|
|
|
|
{1316, {{40, 47, 28}, { 7, 48, 28}}},
|
|
|
|
|
{1950, {{43, 24, 30}, {22, 25, 30}}},
|
|
|
|
|
{2310, {{10, 15, 30}, {67, 16, 30}}}}},
|
|
|
|
|
{1316, {{40, 47, 28}, { 7, 48, 28}}},
|
|
|
|
|
{1950, {{43, 24, 30}, {22, 25, 30}}},
|
|
|
|
|
{2310, {{10, 15, 30}, {67, 16, 30}}}}},
|
|
|
|
|
{3706, {{ 750, {{19, 118, 30}, { 6, 119, 30}}}, /* 40 */
|
|
|
|
|
{1372, {{18, 47, 28}, {31, 48, 28}}},
|
|
|
|
|
{2040, {{34, 24, 30}, {34, 25, 30}}},
|
|
|
|
|
{1372, {{18, 47, 28}, {31, 48, 28}}},
|
|
|
|
|
{2040, {{34, 24, 30}, {34, 25, 30}}},
|
|
|
|
|
{2430, {{20, 15, 30}, {61, 16, 30}}}}}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const unsigned char s_rev[256] =
|
|
|
|
|
static const unsigned char s_rev[256] =
|
|
|
|
|
{
|
|
|
|
|
#define R2(n) n, n + 2*64, n + 1*64, n + 3*64
|
|
|
|
|
#define R4(n) R2(n), R2(n + 2*16), R2(n + 1*16), R2(n + 3*16)
|
|
|
|
|
@@ -276,7 +276,7 @@ static const unsigned char s_rev[256] =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* zero terminated align patterns positions */
|
|
|
|
|
static unsigned char s_align01[] = { 0 };
|
|
|
|
|
static unsigned char s_align01[] = { 0 };
|
|
|
|
|
static unsigned char s_align02[] = { 6, 18, 0 };
|
|
|
|
|
static unsigned char s_align03[] = { 6, 22, 0 };
|
|
|
|
|
static unsigned char s_align04[] = { 6, 26, 0 };
|
|
|
|
|
@@ -317,7 +317,7 @@ static unsigned char s_align38[] = { 6, 32, 58, 84, 110, 136, 162, 0 };
|
|
|
|
|
static unsigned char s_align39[] = { 6, 26, 54, 82, 110, 138, 166, 0 };
|
|
|
|
|
static unsigned char s_align40[] = { 6, 30, 58, 86, 114, 142, 170, 0 };
|
|
|
|
|
|
|
|
|
|
static unsigned char * s_align[ 40 ] = {
|
|
|
|
|
static unsigned char * s_align[ 40 ] = {
|
|
|
|
|
s_align01,
|
|
|
|
|
s_align02,
|
|
|
|
|
s_align03,
|
|
|
|
|
@@ -366,18 +366,18 @@ static int _qr_check_version_table( void )
|
|
|
|
|
const QRVERSION * pQRVersion;
|
|
|
|
|
int iV, iL;
|
|
|
|
|
unsigned int uiSumD, uiSumE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( iV = 1; iV <= 40; iV++ )
|
|
|
|
|
{
|
|
|
|
|
pQRVersion = & s_version[ iV - 1 ];
|
|
|
|
|
for( iL = 0; iL < 4; iL++ )
|
|
|
|
|
{
|
|
|
|
|
uiSumE = ( unsigned int ) ( pQRVersion->level[ iL ].block[ 0 ].uiCount ) * ( pQRVersion->level[ iL ].block[ 0 ].uiECC ) +
|
|
|
|
|
uiSumE = ( unsigned int ) ( pQRVersion->level[ iL ].block[ 0 ].uiCount ) * ( pQRVersion->level[ iL ].block[ 0 ].uiECC ) +
|
|
|
|
|
( unsigned int ) ( pQRVersion->level[ iL ].block[ 1 ].uiCount ) * ( pQRVersion->level[ iL ].block[ 1 ].uiECC );
|
|
|
|
|
if( uiSumE != pQRVersion->level[ iL ].uiECC )
|
|
|
|
|
return iV + 10000 + (iL + 1) * 1000;
|
|
|
|
|
|
|
|
|
|
uiSumD = ( unsigned int ) ( pQRVersion->level[ iL ].block[ 0 ].uiCount ) * ( pQRVersion->level[ iL ].block[ 0 ].uiData ) +
|
|
|
|
|
uiSumD = ( unsigned int ) ( pQRVersion->level[ iL ].block[ 0 ].uiCount ) * ( pQRVersion->level[ iL ].block[ 0 ].uiData ) +
|
|
|
|
|
( unsigned int ) ( pQRVersion->level[ iL ].block[ 1 ].uiCount ) * ( pQRVersion->level[ iL ].block[ 1 ].uiData );
|
|
|
|
|
if( uiSumD + uiSumE != pQRVersion->uiTotal )
|
|
|
|
|
return iV + 20000 + (iL + 1) * 1000;
|
|
|
|
|
@@ -405,7 +405,7 @@ HB_FUNC( _QR_CHECK_VERSION_TABLE )
|
|
|
|
|
static int _qr_version_crc( int iVersion )
|
|
|
|
|
{
|
|
|
|
|
int i, iValue, iVersionRev;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iVersionRev = 0;
|
|
|
|
|
for( i = 0; i < 6; i++ )
|
|
|
|
|
{
|
|
|
|
|
@@ -431,7 +431,7 @@ static int _qr_version_crc( int iVersion )
|
|
|
|
|
static int _qr_format_crc( int iLevel, int iMask )
|
|
|
|
|
{
|
|
|
|
|
int i, iValue, iRev;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iRev = ( ( iLevel & 1 ) ? 0 : 2 ) | ( ( iLevel & 2 ) ? 1 : 0 ); /* 0->1, 1->0, 2->3, 3->2 + reverse bits */
|
|
|
|
|
iRev |= ( ( iMask & 1 ) ? 16 : 0 ) | ( ( iMask & 2 ) ? 8 : 0 ) | ( ( iMask & 4 ) ? 4 : 0 ); /* reverse bits */
|
|
|
|
|
|
|
|
|
|
@@ -474,11 +474,11 @@ static int _qr_fixed( int iVersion, int iRow, int iCol )
|
|
|
|
|
unsigned char * pi, *pj;
|
|
|
|
|
|
|
|
|
|
/* position detection markers and versino info */
|
|
|
|
|
if( iRow < 9 && iCol < 9 )
|
|
|
|
|
if( iRow < 9 && iCol < 9 )
|
|
|
|
|
return 1;
|
|
|
|
|
if( iRow < 9 && iCol >= iLength - 8 )
|
|
|
|
|
if( iRow < 9 && iCol >= iLength - 8 )
|
|
|
|
|
return 1;
|
|
|
|
|
if( iRow >= iLength - 8 && iCol < 9 )
|
|
|
|
|
if( iRow >= iLength - 8 && iCol < 9 )
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
/* timing patterns */
|
|
|
|
|
@@ -643,7 +643,7 @@ static int _qr_dataencode( const char * szCode, HB_SIZE nSize, PHB_BITBUFFER pDa
|
|
|
|
|
if( '0' <= ch && ch <= '9' )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
else if( ( 'A' <= ch && ch <= 'Z' ) ||
|
|
|
|
|
else if( ( 'A' <= ch && ch <= 'Z' ) ||
|
|
|
|
|
ch == ' ' || ch == '$' || ch == '%' || ch == '*' || ch == '+' || ch == '-' || ch == '.' || ch == '/' || ch == ':' )
|
|
|
|
|
iMode = 2;
|
|
|
|
|
else
|
|
|
|
|
@@ -689,14 +689,14 @@ static int _qr_dataencode( const char * szCode, HB_SIZE nSize, PHB_BITBUFFER pDa
|
|
|
|
|
{
|
|
|
|
|
for( n = 0; n + 2 < nSize; n += 3 )
|
|
|
|
|
{
|
|
|
|
|
hb_bitbuffer_cat_int_rev( pData, 100 * ( int )( unsigned char ) ( szCode[ n ] - '0' ) +
|
|
|
|
|
10 * ( int )( unsigned char ) ( szCode[ n + 1 ] - '0' ) +
|
|
|
|
|
hb_bitbuffer_cat_int_rev( pData, 100 * ( int )( unsigned char ) ( szCode[ n ] - '0' ) +
|
|
|
|
|
10 * ( int )( unsigned char ) ( szCode[ n + 1 ] - '0' ) +
|
|
|
|
|
( int )( unsigned char ) ( szCode[ n + 2 ] - '0' ), 10 );
|
|
|
|
|
}
|
|
|
|
|
if( n + 1 == nSize )
|
|
|
|
|
hb_bitbuffer_cat_int_rev( pData, ( int )( unsigned char ) ( szCode[ n ] - '0' ), 4 );
|
|
|
|
|
else
|
|
|
|
|
hb_bitbuffer_cat_int_rev( pData, 10 * ( int )( unsigned char ) ( szCode[ n ] - '0' ) +
|
|
|
|
|
hb_bitbuffer_cat_int_rev( pData, 10 * ( int )( unsigned char ) ( szCode[ n ] - '0' ) +
|
|
|
|
|
( int )( unsigned char ) ( szCode[ n + 1 ] - '0' ), 7 );
|
|
|
|
|
}
|
|
|
|
|
else if( iMode == 2 )
|
|
|
|
|
@@ -918,8 +918,8 @@ static void _qr_draw( PHB_BITBUFFER pBits, PHB_BITBUFFER pCWBits, int iVersion )
|
|
|
|
|
pj = s_align[ iVersion - 1 ];
|
|
|
|
|
for( ; *pj; pj++ )
|
|
|
|
|
{
|
|
|
|
|
if( ( *pi > 10 && *pi < iLength - 10 ) ||
|
|
|
|
|
( *pj > 10 && *pj < iLength - 10 ) ||
|
|
|
|
|
if( ( *pi > 10 && *pi < iLength - 10 ) ||
|
|
|
|
|
( *pj > 10 && *pj < iLength - 10 ) ||
|
|
|
|
|
( *pi > 10 && *pj > 10 ))
|
|
|
|
|
{
|
|
|
|
|
hb_bitbuffer_set( pBits, iLength * *pi + *pj - 1, 0 );
|
|
|
|
|
@@ -953,7 +953,7 @@ static void _qr_draw( PHB_BITBUFFER pBits, PHB_BITBUFFER pCWBits, int iVersion )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Draw data. Note: pCWBits == NULL is used only for debugging */
|
|
|
|
|
if( pCWBits )
|
|
|
|
|
if( pCWBits )
|
|
|
|
|
{
|
|
|
|
|
i = j = iLength - 1;
|
|
|
|
|
right = 1;
|
|
|
|
|
@@ -963,7 +963,7 @@ static void _qr_draw( PHB_BITBUFFER pBits, PHB_BITBUFFER pCWBits, int iVersion )
|
|
|
|
|
{
|
|
|
|
|
if( ! _qr_fixed( iVersion, i, j ) )
|
|
|
|
|
hb_bitbuffer_set( pBits, i * iLength + j, hb_bitbuffer_get( pCWBits, no++ ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( right )
|
|
|
|
|
{
|
|
|
|
|
j--;
|
|
|
|
|
@@ -1062,8 +1062,8 @@ static int _qr_penalty( PHB_BITBUFFER pBits, int iVersion )
|
|
|
|
|
for( j = 0; j < iLen - 1; j++ )
|
|
|
|
|
{
|
|
|
|
|
bBit = hb_bitbuffer_get( pBits, i * iLen + j );
|
|
|
|
|
if( hb_bitbuffer_get( pBits, i * iLen + j + 1 ) == bBit &&
|
|
|
|
|
hb_bitbuffer_get( pBits, ( i + 1 ) * iLen + j ) == bBit &&
|
|
|
|
|
if( hb_bitbuffer_get( pBits, i * iLen + j + 1 ) == bBit &&
|
|
|
|
|
hb_bitbuffer_get( pBits, ( i + 1 ) * iLen + j ) == bBit &&
|
|
|
|
|
hb_bitbuffer_get( pBits, ( i + 1 ) * iLen + j + 1 ) == bBit )
|
|
|
|
|
iPenalty += 3;
|
|
|
|
|
}
|
|
|
|
|
@@ -1074,22 +1074,22 @@ static int _qr_penalty( PHB_BITBUFFER pBits, int iVersion )
|
|
|
|
|
{
|
|
|
|
|
for( j = 0; j < iLen - 6; j++ )
|
|
|
|
|
{
|
|
|
|
|
if( hb_bitbuffer_get( pBits, i * iLen + j ) == HB_TRUE &&
|
|
|
|
|
hb_bitbuffer_get( pBits, i * iLen + j + 1 ) == HB_FALSE &&
|
|
|
|
|
hb_bitbuffer_get( pBits, i * iLen + j + 2 ) == HB_TRUE &&
|
|
|
|
|
hb_bitbuffer_get( pBits, i * iLen + j + 3 ) == HB_TRUE &&
|
|
|
|
|
hb_bitbuffer_get( pBits, i * iLen + j + 4 ) == HB_TRUE &&
|
|
|
|
|
hb_bitbuffer_get( pBits, i * iLen + j + 5 ) == HB_FALSE &&
|
|
|
|
|
hb_bitbuffer_get( pBits, i * iLen + j + 6 ) == HB_TRUE )
|
|
|
|
|
if( hb_bitbuffer_get( pBits, i * iLen + j ) &&
|
|
|
|
|
! hb_bitbuffer_get( pBits, i * iLen + j + 1 ) &&
|
|
|
|
|
hb_bitbuffer_get( pBits, i * iLen + j + 2 ) &&
|
|
|
|
|
hb_bitbuffer_get( pBits, i * iLen + j + 3 ) &&
|
|
|
|
|
hb_bitbuffer_get( pBits, i * iLen + j + 4 ) &&
|
|
|
|
|
! hb_bitbuffer_get( pBits, i * iLen + j + 5 ) &&
|
|
|
|
|
hb_bitbuffer_get( pBits, i * iLen + j + 6 ) )
|
|
|
|
|
iPenalty += 40;
|
|
|
|
|
|
|
|
|
|
if( hb_bitbuffer_get( pBits, i * iLen + j ) == HB_TRUE &&
|
|
|
|
|
hb_bitbuffer_get( pBits, ( i + 1 ) * iLen + j ) == HB_FALSE &&
|
|
|
|
|
hb_bitbuffer_get( pBits, ( i + 2 ) * iLen + j ) == HB_TRUE &&
|
|
|
|
|
hb_bitbuffer_get( pBits, ( i + 3 ) * iLen + j ) == HB_TRUE &&
|
|
|
|
|
hb_bitbuffer_get( pBits, ( i + 4 ) * iLen + j ) == HB_TRUE &&
|
|
|
|
|
hb_bitbuffer_get( pBits, ( i + 5 ) * iLen + j ) == HB_FALSE &&
|
|
|
|
|
hb_bitbuffer_get( pBits, ( i + 6 ) * iLen + j ) == HB_TRUE )
|
|
|
|
|
if( hb_bitbuffer_get( pBits, i * iLen + j ) &&
|
|
|
|
|
! hb_bitbuffer_get( pBits, ( i + 1 ) * iLen + j ) &&
|
|
|
|
|
hb_bitbuffer_get( pBits, ( i + 2 ) * iLen + j ) &&
|
|
|
|
|
hb_bitbuffer_get( pBits, ( i + 3 ) * iLen + j ) &&
|
|
|
|
|
hb_bitbuffer_get( pBits, ( i + 4 ) * iLen + j ) &&
|
|
|
|
|
! hb_bitbuffer_get( pBits, ( i + 5 ) * iLen + j ) &&
|
|
|
|
|
hb_bitbuffer_get( pBits, ( i + 6 ) * iLen + j ) )
|
|
|
|
|
iPenalty += 40;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1146,7 +1146,7 @@ static void _qr_mask_pattern( PHB_BITBUFFER pBits, int iVersion, int iMask )
|
|
|
|
|
k = ( ( i * j ) % 3 + ( i + j ) % 2 ) % 2 == 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if( k )
|
|
|
|
|
if( k )
|
|
|
|
|
hb_bitbuffer_not( pBits, i * iLen + j );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|