mirror of
https://git.code.sf.net/p/zint/code
synced 2026-01-25 12:55:59 +00:00
QRCODE: implement pre-calculated QR/MICROQR masks ala BWIPP for a
slight performance gain (2-3%), see https://sourceforge.net/p/zint/mailman/message/59278637/ - generated by "backend/tools/gen_qr_masks.php" test suite: update BWIPP to latest
This commit is contained in:
39
backend/qr.h
39
backend/qr.h
@@ -1,7 +1,7 @@
|
||||
/* qr.h Data for QR Code, Micro QR Code and rMQR */
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2008-2026 Robin Stuart <rstuart114@gmail.com>
|
||||
Copyright (C) 2006 Kentaro Fukuchi <fukuchi@megaui.net>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -335,5 +335,42 @@ static const unsigned int rmqr_format_info_right[64] = {
|
||||
0x1CFB4, 0x1D091, 0x1EEDB, 0x1F1FE
|
||||
};
|
||||
|
||||
/* Pre-calculated QR and MicroQR mask tables, generated by "backend/tools/gen_qr_masks.php",
|
||||
based on lowest common periodicy of the masks (6x12):
|
||||
QR: 000: 2x2, 001: 1x2, 010: 3x1, 011: 3x3, 100: 6x4, 101: 6x6, 110: 6x6, 111: 6x6
|
||||
MicroQR: 00 (001), 01 (100), 10 (110), 11 (111)
|
||||
Taken from Barcode Writer in Pure PostScript (BWIPP)
|
||||
Copyright (c) 2004-2026 Terry Burton */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
static const unsigned char qr_masks[12][6] = {
|
||||
{ 0xFF, 0x72, 0xF3, 0x6E, 0xE3, 0x62 },
|
||||
{ 0x74, 0x51, 0x58, 0x85, 0x80, 0x89 },
|
||||
{ 0xE7, 0x4A, 0x03, 0x76, 0xDB, 0x92 },
|
||||
{ 0x6C, 0x81, 0x60, 0x9D, 0x70, 0x91 },
|
||||
{ 0xF7, 0x92, 0xDB, 0x66, 0x03, 0x4A },
|
||||
{ 0x74, 0x99, 0x90, 0x85, 0x48, 0x41 },
|
||||
{ 0xEF, 0x62, 0xE3, 0x7E, 0xF3, 0x72 },
|
||||
{ 0x64, 0x41, 0x48, 0x95, 0x90, 0x99 },
|
||||
{ 0xF7, 0x5A, 0x13, 0x66, 0xCB, 0x82 },
|
||||
{ 0x7C, 0x91, 0x70, 0x8D, 0x60, 0x81 },
|
||||
{ 0xE7, 0x82, 0xCB, 0x76, 0x13, 0x5A },
|
||||
{ 0x64, 0x89, 0x80, 0x95, 0x58, 0x51 }
|
||||
};
|
||||
|
||||
static const unsigned char microqr_masks[12][6] = {
|
||||
{ 0x0F, 0x07, 0x0F, 0x05, 0x0D, 0x05 },
|
||||
{ 0x06, 0x06, 0x06, 0x08, 0x08, 0x08 },
|
||||
{ 0x0D, 0x05, 0x01, 0x07, 0x0F, 0x0B },
|
||||
{ 0x04, 0x08, 0x04, 0x0A, 0x06, 0x0A },
|
||||
{ 0x0F, 0x0B, 0x0F, 0x05, 0x01, 0x05 },
|
||||
{ 0x06, 0x0A, 0x0A, 0x08, 0x04, 0x04 },
|
||||
{ 0x0D, 0x05, 0x0D, 0x07, 0x0F, 0x07 },
|
||||
{ 0x04, 0x04, 0x04, 0x0A, 0x0A, 0x0A },
|
||||
{ 0x0F, 0x07, 0x03, 0x05, 0x0D, 0x09 },
|
||||
{ 0x06, 0x0A, 0x06, 0x08, 0x04, 0x08 },
|
||||
{ 0x0D, 0x09, 0x0D, 0x07, 0x03, 0x07 },
|
||||
{ 0x04, 0x08, 0x08, 0x0A, 0x06, 0x06 }
|
||||
};
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
#endif /* Z_QR_H */
|
||||
|
||||
Reference in New Issue
Block a user