1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-06-09 23:23:36 +00:00

AZTEC: use algorithm adapted from ZXing for optimized encodation

(ticket #347), props Frank Yellin and Rustam Abdullaev;
   also improve performance of `FAST_MODE`
DATAMATRIX: assert max size on `edges` will fit in unsigned short;
   use MASK for DMRE/SQUARE `option_3` setting
PDF417: assert max size on `edges` will fit in unsigned short
GUI: fix setting AZTEC size and ECC combos if not previously set
manual: fix not mentioning AZTEC re `FAST_MODE`;
  gs1 mode footnote: mention 3940's length; pandoc -> 3.9
test suite: DOTCODE: account for new BWIPP input length guard
This commit is contained in:
gitlost
2026-03-11 15:48:24 +00:00
parent ee71a5cc56
commit b3a3c0d3b4
19 changed files with 3668 additions and 1558 deletions
+2659 -749
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -52,7 +52,7 @@ static void test_large(const testCtx *const p_ctx) {
/* 3*/ { 200, '0', 2974, ZINT_ERROR_INVALID_OPTION, "Error 735: Resulting symbol height '203' is too large (maximum 200)", 1, 1, "" }, /* Width > 200 also */
/* 4*/ { 200, 'A', 1470, 0, "", 1, 1, "" },
/* 5*/ { 200, 'A', 1471, ZINT_ERROR_INVALID_OPTION, "Error 735: Resulting symbol height '201' is too large (maximum 200)", 1, 1, "" },
/* 6*/ { 200, '\240', 1225, 0, "", 1, 899, "" },
/* 6*/ { 200, '\240', 1225, 0, "", 0, 899, "BWIPP limit now 4000 (== 1000 with caret escaping) TODO: suggest change to BWIPP" },
/* 7*/ { 200, '\240', 1226, ZINT_ERROR_INVALID_OPTION, "Error 735: Resulting symbol height '201' is too large (maximum 200)", 1, 899, "" },
/* 8*/ { 200, '0', 1, 0, "", 1, 1, "" }, /* Padding codewords 35 - probably max */
/* 9*/ { 200, '0', 2, 0, "", 1, 1, "" }, /* Padding codewords 35 */
+35 -1
View File
@@ -642,6 +642,40 @@ static void test_2d_encode(const testCtx *const p_ctx) {
"10111101100000001010110001010110"
"11111111111111111111111111111111"
},
/* 6*/ { 10, "JGB 010100000700009001B707RH1A 0SN35XX é", 0, 32, 32, 1, "",
"10101010101010101010101010101010"
"11000001010001111001101100001111"
"10100101110000101011111110000000"
"10101000010110011001101011000101"
"10001100111000101111000111011110"
"10011100011000011100101000100101"
"11001111001000101010010010011110"
"10100101011000111100001100101111"
"10101111010111101100111100110100"
"11001001100100111001110000010111"
"11001000001001001101001111011110"
"11010000001111111011011101101101"
"11001000010000101001101010011010"
"11010111000101011111111101111111"
"10111101100011101110001100110100"
"11111111111111111111111111111111"
"10101010101010101010101010101010"
"11011101100000011000000001110001"
"11110000111100101000011000101010"
"11001011110010011000011101110001"
"11011111000101001011100101011100"
"10010101101100011100010000011101"
"10011001101011101110100111101000"
"11101010110010111001111100100101"
"10011011111101001000101111110100"
"10011101010101111111111000111101"
"11100001010010101011001010000000"
"10011010101011111000011010001001"
"11101001100100001101010001011000"
"10001001100100011011110101100101"
"11001011100001001010111101010100"
"11111111111111111111111111111111"
},
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
@@ -714,7 +748,7 @@ static void test_2d_encode(const testCtx *const p_ctx) {
char modules_dump[144 * 144 + 1];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
"i:%d testUtilModulesDump == -1\n", i);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf,
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 3 /*zxingcpp_cmp*/, cmp_buf,
sizeof(cmp_buf), &cmp_len);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
i, testUtilBarcodeName(symbol->symbology), ret);
+3 -3
View File
@@ -4118,9 +4118,9 @@ static const char *testUtilZXingCPPCharSet(int eci) {
/* Run "zxingcppdecoder", returning result in `buffer` */
int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source, const int length, const char *bits,
const int zxingcpp_cmp, char *buffer, const int buffer_size, int *p_cmp_len) {
static const char cmd_fmt[] = "zxingcppdecoder -textonly -format %s -width %d -bits '%s'";
static const char opts_cmd_fmt[] = "zxingcppdecoder -textonly -format %s -opts '%s' -width %d -bits '%s'";
static const char cs_cmd_fmt[] = "zxingcppdecoder -textonly -format %s -charset %s -width %d -bits '%s'";
static const char cmd_fmt[] = "zxingcppdecoder -textonly -format %s -width %d -bits %s";
static const char opts_cmd_fmt[] = "zxingcppdecoder -textonly -format %s -opts '%s' -width %d -bits %s";
static const char cs_cmd_fmt[] = "zxingcppdecoder -textonly -format %s -charset %s -width %d -bits %s";
const int bits_len = (int) strlen(bits);
const int width = symbol->width;
+1
View File
@@ -48,6 +48,7 @@ extern "C" {
#define ZINT_DEBUG_TEST_PERFORMANCE 256
#define ZINT_DEBUG_TEST_ZXINGCPP 512
#define ZINT_DEBUG_TEST_BWIPP_ZXINGCPP 1024
#define ZINT_DEBUG_TEST_AZTEC_SKIP_ALL 2048
#ifdef ZINT_SANITIZEM /* Suppress clang -fsanitize=memory false positives */
#define ZINT_TESTUTIL_SANITIZEM_INIT = {0}
Binary file not shown.
@@ -16,6 +16,8 @@ function run_zxingcpp_test() {
run_zxingcpp_test "test_2of5" "encode"
run_zxingcpp_test "test_aztec" "large"
run_zxingcpp_test "test_aztec" "bs"
run_zxingcpp_test "test_aztec" "many_states"
run_zxingcpp_test "test_aztec" "encode"
run_zxingcpp_test "test_aztec" "encode_segs"
run_zxingcpp_test "test_aztec" "fuzz"