mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
- PDF417/MICROPDF417: use latch not ps shift for padding when
spanning Text segments to avoid affecting 1st char of 2nd segment - PDF417/MICROPDF417: add optimized encoding, FAST_MODE for previous scheme; formatting changes - common.c/h: add `cnt_digits()`, comments in include and make more consistent, minor code fiddling - DOTCODE: replace `dc_n_digits()` with new `cnt_digits()` - test_qr: fix `test_qr_perf()` - composite: minor code fiddling - library: debug dump HIBC-processed input - BWIPP: update to latest
This commit is contained in:
parent
fbfaabf004
commit
e515f63fab
@ -20,6 +20,9 @@ Changes
|
||||
and returning error if so rather than continuing to process
|
||||
- manual: MSE typo -> MSI; adjust SVG scaling for PDF manual; pandoc 2.19.2
|
||||
- manual/man page/GUI: Code 16k -> Code 16K
|
||||
- PDF417/MICROPDF417: add optimized encoding, FAST_MODE for previous; formatting
|
||||
changes
|
||||
- common.c/h: add `cnt_digits()`, comments in include, minor fiddling
|
||||
|
||||
Bugs
|
||||
----
|
||||
@ -45,6 +48,8 @@ Bugs
|
||||
- MSVC project files: remove incorrect "CompileAsCpp" setting from libzint
|
||||
project files (ticket #272)
|
||||
- bwipp_dump.ps: fix 2/4-track processing; update to latest BWIPP
|
||||
- PDF417/MICROPDF417: use latch not ps shift for padding when spanning
|
||||
Text segments to avoid affecting 1st char of 2nd segment
|
||||
|
||||
|
||||
Version 2.11.1 (2022-08-22)
|
||||
|
@ -568,7 +568,9 @@ typedef const struct s_channel_precalc {
|
||||
long value; unsigned char B[8]; unsigned char S[8]; unsigned char bmax[7]; unsigned char smax[7];
|
||||
} channel_precalc;
|
||||
|
||||
/*#define CHANNEL_GENERATE_PRECALCS*/
|
||||
#if 0
|
||||
#define CHANNEL_GENERATE_PRECALCS
|
||||
#endif
|
||||
|
||||
#ifdef CHANNEL_GENERATE_PRECALCS
|
||||
/* To generate precalc tables uncomment CHANNEL_GENERATE_PRECALCS define and run
|
||||
|
@ -51,9 +51,8 @@ INTERNAL int ctoi(const char source) {
|
||||
INTERNAL char itoc(const int source) {
|
||||
if ((source >= 0) && (source <= 9)) {
|
||||
return ('0' + source);
|
||||
} else {
|
||||
return ('A' + (source - 10));
|
||||
}
|
||||
return ('A' - 10 + source);
|
||||
}
|
||||
|
||||
/* Converts decimal string of length <= 9 to integer value. Returns -1 if not numeric */
|
||||
@ -72,7 +71,7 @@ INTERNAL int to_int(const unsigned char source[], const int length) {
|
||||
return val;
|
||||
}
|
||||
|
||||
/* Converts lower case characters to upper case in a string source[] */
|
||||
/* Converts lower case characters to upper case in string `source` */
|
||||
INTERNAL void to_upper(unsigned char source[], const int length) {
|
||||
int i;
|
||||
|
||||
@ -83,12 +82,12 @@ INTERNAL void to_upper(unsigned char source[], const int length) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns the number of times a character occurs in a string */
|
||||
INTERNAL int chr_cnt(const unsigned char string[], const int length, const unsigned char c) {
|
||||
/* Returns the number of times a character occurs in `source` */
|
||||
INTERNAL int chr_cnt(const unsigned char source[], const int length, const unsigned char c) {
|
||||
int count = 0;
|
||||
int i;
|
||||
for (i = 0; i < length; i++) {
|
||||
if (string[i] == c) {
|
||||
if (source[i] == c) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -168,7 +167,7 @@ INTERNAL int is_sane_lookup(const char test_string[], const int test_length, con
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Returns the position of data in set_string */
|
||||
/* Returns the position of `data` in `set_string` */
|
||||
INTERNAL int posn(const char set_string[], const char data) {
|
||||
const char *s;
|
||||
|
||||
@ -180,7 +179,8 @@ INTERNAL int posn(const char set_string[], const char data) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Convert an integer value to a string representing its binary equivalent and place at a given position */
|
||||
/* Converts `arg` to a string representing its binary equivalent of length `length` and places in `binary` at
|
||||
`bin_posn`. Returns `bin_posn` + `length` */
|
||||
INTERNAL int bin_append_posn(const int arg, const int length, char *binary, const int bin_posn) {
|
||||
int i;
|
||||
int start;
|
||||
@ -198,28 +198,28 @@ INTERNAL int bin_append_posn(const int arg, const int length, char *binary, cons
|
||||
}
|
||||
|
||||
#ifndef Z_COMMON_INLINE
|
||||
/* Return true (1) if a module is dark/black, otherwise false (0) */
|
||||
/* Returns true (1) if a module is dark/black, otherwise false (0) */
|
||||
INTERNAL int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord) {
|
||||
return (symbol->encoded_data[y_coord][x_coord >> 3] >> (x_coord & 0x07)) & 1;
|
||||
}
|
||||
|
||||
/* Set a module to dark/black */
|
||||
/* Sets a module to dark/black */
|
||||
INTERNAL void set_module(struct zint_symbol *symbol, const int y_coord, const int x_coord) {
|
||||
symbol->encoded_data[y_coord][x_coord >> 3] |= 1 << (x_coord & 0x07);
|
||||
}
|
||||
|
||||
/* Return true (1-8) if a module is colour, otherwise false (0) */
|
||||
/* Returns true (1-8) if a module is colour, otherwise false (0) */
|
||||
INTERNAL int module_colour_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord) {
|
||||
return symbol->encoded_data[y_coord][x_coord];
|
||||
}
|
||||
|
||||
/* Set a module to a colour */
|
||||
/* Sets a module to a colour */
|
||||
INTERNAL void set_module_colour(struct zint_symbol *symbol, const int y_coord, const int x_coord, const int colour) {
|
||||
symbol->encoded_data[y_coord][x_coord] = colour;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set a dark/black module to white (i.e. unset) */
|
||||
/* Sets a dark/black module to white (i.e. unsets) */
|
||||
INTERNAL void unset_module(struct zint_symbol *symbol, const int y_coord, const int x_coord) {
|
||||
symbol->encoded_data[y_coord][x_coord >> 3] &= ~(1 << (x_coord & 0x07));
|
||||
}
|
||||
@ -255,7 +255,7 @@ INTERNAL void expand(struct zint_symbol *symbol, const char data[], const int le
|
||||
}
|
||||
}
|
||||
|
||||
/* Indicates which symbologies can have row binding */
|
||||
/* Whether `symbology` can have row binding */
|
||||
INTERNAL int is_stackable(const int symbology) {
|
||||
if (symbology < BARCODE_PHARMA_TWO && symbology != BARCODE_POSTNET) {
|
||||
return 1;
|
||||
@ -280,7 +280,7 @@ INTERNAL int is_stackable(const int symbology) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Indicates which symbols can have addon (EAN-2 and EAN-5) */
|
||||
/* Whether `symbology` can have addon (EAN-2 and EAN-5) */
|
||||
INTERNAL int is_extendable(const int symbology) {
|
||||
|
||||
switch (symbology) {
|
||||
@ -301,12 +301,12 @@ INTERNAL int is_extendable(const int symbology) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Indicates which symbols can have composite 2D component data */
|
||||
/* Whether `symbology` can have composite 2D component data */
|
||||
INTERNAL int is_composite(const int symbology) {
|
||||
return symbology >= BARCODE_EANX_CC && symbology <= BARCODE_DBAR_EXPSTK_CC;
|
||||
}
|
||||
|
||||
/* Returns 1 if symbology is a matrix design renderable as dots */
|
||||
/* Whether `symbology` is a matrix design renderable as dots */
|
||||
INTERNAL int is_dotty(const int symbology) {
|
||||
|
||||
switch (symbology) {
|
||||
@ -332,7 +332,7 @@ INTERNAL int is_dotty(const int symbology) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Returns 1 if symbology has fixed aspect ratio (matrix design) */
|
||||
/* Whether `symbology` has a fixed aspect ratio (matrix design) */
|
||||
INTERNAL int is_fixed_ratio(const int symbology) {
|
||||
|
||||
if (is_dotty(symbology)) {
|
||||
@ -358,6 +358,16 @@ INTERNAL int is_twodigits(const unsigned char source[], const int length, const
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Returns how many consecutive digits lie immediately ahead up to `max`, or all if `max` is -1 */
|
||||
INTERNAL int cnt_digits(const unsigned char source[], const int length, const int position, const int max) {
|
||||
int i;
|
||||
const int max_length = max == -1 || position + max > length ? length : position + max;
|
||||
|
||||
for (i = position; i < max_length && z_isdigit(source[i]); i++);
|
||||
|
||||
return i - position;
|
||||
}
|
||||
|
||||
/* State machine to decode UTF-8 to Unicode codepoints (state 0 means done, state 12 means error) */
|
||||
INTERNAL unsigned int decode_utf8(unsigned int *state, unsigned int *codep, const unsigned char byte) {
|
||||
/*
|
||||
@ -419,8 +429,8 @@ INTERNAL int is_valid_utf8(const unsigned char source[], const int length) {
|
||||
return state == 0;
|
||||
}
|
||||
|
||||
/* Convert UTF-8 to Unicode. If `disallow_4byte` unset, allow all values (UTF-32). If `disallow_4byte` set,
|
||||
* only allow codepoints <= U+FFFF (ie four-byte sequences not allowed) (UTF-16, no surrogates) */
|
||||
/* Converts UTF-8 to Unicode. If `disallow_4byte` unset, allows all values (UTF-32). If `disallow_4byte` set,
|
||||
* only allows codepoints <= U+FFFF (ie four-byte sequences not allowed) (UTF-16, no surrogates) */
|
||||
INTERNAL int utf8_to_unicode(struct zint_symbol *symbol, const unsigned char source[], unsigned int vals[],
|
||||
int *length, const int disallow_4byte) {
|
||||
int bpos;
|
||||
@ -453,7 +463,7 @@ INTERNAL int utf8_to_unicode(struct zint_symbol *symbol, const unsigned char sou
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set symbol height, returning a warning if not within minimum and/or maximum if given.
|
||||
/* Sets symbol height, returning a warning if not within minimum and/or maximum if given.
|
||||
`default_height` does not include height of fixed-height rows (i.e. separators/composite data) */
|
||||
INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height, const float default_height,
|
||||
const float max_height, const int no_errtxt) {
|
||||
@ -535,7 +545,7 @@ INTERNAL int segs_length(const struct zint_seg segs[], const int seg_count) {
|
||||
return total_len;
|
||||
}
|
||||
|
||||
/* Shallow copy segments, adjusting default ECIs */
|
||||
/* Shallow copies segments, adjusting default ECIs */
|
||||
INTERNAL void segs_cpy(const struct zint_symbol *symbol, const struct zint_seg segs[], const int seg_count,
|
||||
struct zint_seg local_segs[]) {
|
||||
const int default_eci = symbol->symbology == BARCODE_GRIDMATRIX ? 29 : symbol->symbology == BARCODE_UPNQR ? 4 : 3;
|
||||
|
167
backend/common.h
167
backend/common.h
@ -90,7 +90,7 @@ typedef unsigned __int64 uint64_t;
|
||||
/* The most commonly used set */
|
||||
#define NEON_F IS_NUM_F /* NEON "0123456789" */
|
||||
|
||||
/* Simple versions of <cctype> functions with no dependence on locale */
|
||||
/* Simple versions of <ctype.h> functions with no dependence on locale */
|
||||
#define z_isdigit(c) ((c) <= '9' && (c) >= '0')
|
||||
#define z_isupper(c) ((c) >= 'A' && (c) <= 'Z')
|
||||
#define z_islower(c) ((c) >= 'a' && (c) <= 'z')
|
||||
@ -146,75 +146,144 @@ typedef unsigned __int64 uint64_t;
|
||||
#define Z_COMMON_INLINE 1
|
||||
|
||||
#ifdef Z_COMMON_INLINE
|
||||
/* Return true (1) if a module is dark/black, otherwise false (0) */
|
||||
/* Returns true (1) if a module is dark/black, otherwise false (0) */
|
||||
# define module_is_set(s, y, x) (((s)->encoded_data[(y)][(x) >> 3] >> ((x) & 0x07)) & 1)
|
||||
|
||||
/* Set a module to dark/black */
|
||||
/* Sets a module to dark/black */
|
||||
# define set_module(s, y, x) do { (s)->encoded_data[(y)][(x) >> 3] |= 1 << ((x) & 0x07); } while (0)
|
||||
|
||||
/* Return true (1-8) if a module is colour, otherwise false (0) */
|
||||
/* Returns true (1-8) if a module is colour, otherwise false (0) */
|
||||
# define module_colour_is_set(s, y, x) ((s)->encoded_data[(y)][(x)])
|
||||
|
||||
/* Set a module to a colour */
|
||||
/* Sets a module to a colour */
|
||||
# define set_module_colour(s, y, x, c) do { (s)->encoded_data[(y)][(x)] = (c); } while (0)
|
||||
#endif
|
||||
|
||||
INTERNAL int ctoi(const char source);
|
||||
INTERNAL char itoc(const int source);
|
||||
INTERNAL int to_int(const unsigned char source[], const int length);
|
||||
INTERNAL void to_upper(unsigned char source[], const int length);
|
||||
INTERNAL int chr_cnt(const unsigned char string[], const int length, const unsigned char c);
|
||||
/* Converts a character 0-9, A-F to its equivalent integer value */
|
||||
INTERNAL int ctoi(const char source);
|
||||
|
||||
INTERNAL int is_chr(const unsigned int flg, const unsigned int c);
|
||||
INTERNAL int is_sane(const unsigned int flg, const unsigned char source[], const int length);
|
||||
INTERNAL int is_sane_lookup(const char test_string[], const int test_length, const unsigned char source[],
|
||||
const int length, int *posns);
|
||||
INTERNAL int posn(const char set_string[], const char data);
|
||||
/* Converts an integer value to its hexadecimal character */
|
||||
INTERNAL char itoc(const int source);
|
||||
|
||||
INTERNAL int bin_append_posn(const int arg, const int length, char *binary, const int bin_posn);
|
||||
/* Converts decimal string of length <= 9 to integer value. Returns -1 if not numeric */
|
||||
INTERNAL int to_int(const unsigned char source[], const int length);
|
||||
|
||||
#ifndef Z_COMMON_INLINE
|
||||
INTERNAL int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord);
|
||||
INTERNAL void set_module(struct zint_symbol *symbol, const int y_coord, const int x_coord);
|
||||
INTERNAL int module_colour_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord);
|
||||
INTERNAL void set_module_colour(struct zint_symbol *symbol, const int y_coord, const int x_coord,
|
||||
const int colour);
|
||||
#endif
|
||||
INTERNAL void unset_module(struct zint_symbol *symbol, const int y_coord, const int x_coord);
|
||||
/* Converts lower case characters to upper case in string `source` */
|
||||
INTERNAL void to_upper(unsigned char source[], const int length);
|
||||
|
||||
INTERNAL void expand(struct zint_symbol *symbol, const char data[], const int length);
|
||||
/* Returns the number of times a character occurs in `source` */
|
||||
INTERNAL int chr_cnt(const unsigned char source[], const int length, const unsigned char c);
|
||||
|
||||
INTERNAL int is_stackable(const int symbology);
|
||||
INTERNAL int is_extendable(const int symbology);
|
||||
INTERNAL int is_composite(const int symbology);
|
||||
INTERNAL int is_dotty(const int symbology);
|
||||
INTERNAL int is_fixed_ratio(const int symbology);
|
||||
|
||||
INTERNAL int is_twodigits(const unsigned char source[], const int length, const int position);
|
||||
/* Whether a character matches `flg` */
|
||||
INTERNAL int is_chr(const unsigned int flg, const unsigned int c);
|
||||
|
||||
INTERNAL unsigned int decode_utf8(unsigned int *state, unsigned int *codep, const unsigned char byte);
|
||||
INTERNAL int is_valid_utf8(const unsigned char source[], const int length);
|
||||
INTERNAL int utf8_to_unicode(struct zint_symbol *symbol, const unsigned char source[], unsigned int vals[],
|
||||
int *length, const int disallow_4byte);
|
||||
/* Verifies that a string only uses valid characters */
|
||||
INTERNAL int is_sane(const unsigned int flg, const unsigned char source[], const int length);
|
||||
|
||||
INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height, const float default_height,
|
||||
const float max_height, const int set_errtxt);
|
||||
/* Verifies that a string only uses valid characters, and returns `test_string` position of each in `posns` array */
|
||||
INTERNAL int is_sane_lookup(const char test_string[], const int test_length, const unsigned char source[],
|
||||
const int length, int *posns);
|
||||
|
||||
INTERNAL float stripf(const float arg);
|
||||
/* Returns the position of `data` in `set_string` */
|
||||
INTERNAL int posn(const char set_string[], const char data);
|
||||
|
||||
INTERNAL int segs_length(const struct zint_seg segs[], const int seg_count);
|
||||
INTERNAL void segs_cpy(const struct zint_symbol *symbol, const struct zint_seg segs[], const int seg_count,
|
||||
struct zint_seg local_segs[]);
|
||||
|
||||
INTERNAL int colour_to_red(const int colour);
|
||||
INTERNAL int colour_to_green(const int colour);
|
||||
INTERNAL int colour_to_blue(const int colour);
|
||||
/* Converts `arg` to a string representing its binary equivalent of length `length` and places in `binary` at
|
||||
`bin_posn`. Returns `bin_posn` + `length` */
|
||||
INTERNAL int bin_append_posn(const int arg, const int length, char *binary, const int bin_posn);
|
||||
|
||||
#ifdef ZINT_TEST
|
||||
INTERNAL void debug_test_codeword_dump(struct zint_symbol *symbol, const unsigned char *codewords,
|
||||
const int length);
|
||||
INTERNAL void debug_test_codeword_dump_int(struct zint_symbol *symbol, const int *codewords, const int length);
|
||||
#endif
|
||||
|
||||
#ifndef Z_COMMON_INLINE
|
||||
/* Returns true (1) if a module is dark/black, otherwise false (0) */
|
||||
INTERNAL int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord);
|
||||
|
||||
/* Sets a module to dark/black */
|
||||
INTERNAL void set_module(struct zint_symbol *symbol, const int y_coord, const int x_coord);
|
||||
|
||||
/* Returns true (1-8) if a module is colour, otherwise false (0) */
|
||||
INTERNAL int module_colour_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord);
|
||||
|
||||
/* Sets a module to a colour */
|
||||
INTERNAL void set_module_colour(struct zint_symbol *symbol, const int y_coord, const int x_coord,
|
||||
const int colour);
|
||||
#endif
|
||||
/* Sets a dark/black module to white (i.e. unsets) */
|
||||
INTERNAL void unset_module(struct zint_symbol *symbol, const int y_coord, const int x_coord);
|
||||
|
||||
/* Expands from a width pattern to a bit pattern */
|
||||
INTERNAL void expand(struct zint_symbol *symbol, const char data[], const int length);
|
||||
|
||||
|
||||
/* Whether `symbology` can have row binding */
|
||||
INTERNAL int is_stackable(const int symbology);
|
||||
|
||||
/* Whether `symbology` can have addon (EAN-2 and EAN-5) */
|
||||
INTERNAL int is_extendable(const int symbology);
|
||||
|
||||
/* Whether `symbology` can have composite 2D component data */
|
||||
INTERNAL int is_composite(const int symbology);
|
||||
|
||||
/* Whether `symbology` is a matrix design renderable as dots */
|
||||
INTERNAL int is_dotty(const int symbology);
|
||||
|
||||
/* Whether `symbology` has a fixed aspect ratio (matrix design) */
|
||||
INTERNAL int is_fixed_ratio(const int symbology);
|
||||
|
||||
|
||||
/* Whether next two characters are digits */
|
||||
INTERNAL int is_twodigits(const unsigned char source[], const int length, const int position);
|
||||
|
||||
/* Returns how many consecutive digits lie immediately ahead up to `max`, or all if `max` is -1 */
|
||||
INTERNAL int cnt_digits(const unsigned char source[], const int length, const int position, const int max);
|
||||
|
||||
|
||||
/* State machine to decode UTF-8 to Unicode codepoints (state 0 means done, state 12 means error) */
|
||||
INTERNAL unsigned int decode_utf8(unsigned int *state, unsigned int *codep, const unsigned char byte);
|
||||
|
||||
/* Is string valid UTF-8? */
|
||||
INTERNAL int is_valid_utf8(const unsigned char source[], const int length);
|
||||
|
||||
/* Converts UTF-8 to Unicode. If `disallow_4byte` unset, allows all values (UTF-32). If `disallow_4byte` set,
|
||||
* only allows codepoints <= U+FFFF (ie four-byte sequences not allowed) (UTF-16, no surrogates) */
|
||||
INTERNAL int utf8_to_unicode(struct zint_symbol *symbol, const unsigned char source[], unsigned int vals[],
|
||||
int *length, const int disallow_4byte);
|
||||
|
||||
|
||||
/* Sets symbol height, returning a warning if not within minimum and/or maximum if given.
|
||||
`default_height` does not include height of fixed-height rows (i.e. separators/composite data) */
|
||||
INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height, const float default_height,
|
||||
const float max_height, const int set_errtxt);
|
||||
|
||||
|
||||
/* Removes excess precision from floats - see https://stackoverflow.com/q/503436 */
|
||||
INTERNAL float stripf(const float arg);
|
||||
|
||||
|
||||
/* Returns total length of segments */
|
||||
INTERNAL int segs_length(const struct zint_seg segs[], const int seg_count);
|
||||
|
||||
/* Shallow copies segments, adjusting default ECIs */
|
||||
INTERNAL void segs_cpy(const struct zint_symbol *symbol, const struct zint_seg segs[], const int seg_count,
|
||||
struct zint_seg local_segs[]);
|
||||
|
||||
|
||||
/* Returns red component if any of ultra colour indexing "0CBMRYGKW" */
|
||||
INTERNAL int colour_to_red(const int colour);
|
||||
|
||||
/* Returns green component if any of ultra colour indexing "0CBMRYGKW" */
|
||||
INTERNAL int colour_to_green(const int colour);
|
||||
|
||||
/* Returns blue component if any of ultra colour indexing "0CBMRYGKW" */
|
||||
INTERNAL int colour_to_blue(const int colour);
|
||||
|
||||
|
||||
#ifdef ZINT_TEST
|
||||
/* Dumps hex-formatted codewords in symbol->errtxt (for use in testing) */
|
||||
INTERNAL void debug_test_codeword_dump(struct zint_symbol *symbol, const unsigned char *codewords, const int length);
|
||||
/* Dumps decimal-formatted codewords in symbol->errtxt (for use in testing) */
|
||||
INTERNAL void debug_test_codeword_dump_int(struct zint_symbol *symbol, const int *codewords, const int length);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w
|
||||
const int length = (int) strlen(source) / 8;
|
||||
int i;
|
||||
unsigned char *data_string = (unsigned char *) z_alloca(length + 3);
|
||||
int chainemc[180], mclength;
|
||||
int chainemc[180], mclength = 0;
|
||||
int k, j, p, longueur, mccorrection[50] = {0}, offset;
|
||||
int total;
|
||||
char pattern[580];
|
||||
@ -322,11 +322,8 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w
|
||||
}
|
||||
}
|
||||
|
||||
mclength = 0;
|
||||
|
||||
/* "the CC-B component shall have codeword 920 in the first symbol character position" (section 9a) */
|
||||
chainemc[mclength] = 920;
|
||||
mclength++;
|
||||
chainemc[mclength++] = 920;
|
||||
|
||||
pdf_byteprocess(chainemc, &mclength, data_string, 0, length, 0, debug_print);
|
||||
|
||||
@ -410,8 +407,7 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w
|
||||
|
||||
/* Binary input padded to target length so no padding should be necessary */
|
||||
while (i > 0) {
|
||||
chainemc[mclength] = 900; /* Not reached */
|
||||
mclength++;
|
||||
chainemc[mclength++] = 900; /* Not reached */
|
||||
i--;
|
||||
}
|
||||
|
||||
@ -435,8 +431,7 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w
|
||||
}
|
||||
/* we add these codes to the string */
|
||||
for (i = k - 1; i >= 0; i--) {
|
||||
chainemc[mclength] = mccorrection[i];
|
||||
mclength++;
|
||||
chainemc[mclength++] = mccorrection[i];
|
||||
}
|
||||
|
||||
/* Now get the RAP (Row Address Pattern) start values */
|
||||
@ -522,7 +517,7 @@ static void cc_c(struct zint_symbol *symbol, const char source[], const int cc_w
|
||||
const int length = (int) strlen(source) / 8;
|
||||
int i, p;
|
||||
unsigned char *data_string = (unsigned char *) z_alloca(length + 4);
|
||||
int chainemc[1000], mclength, k;
|
||||
int chainemc[1000], mclength = 0, k;
|
||||
int offset, longueur, loop, total, j, mccorrection[520] = {0};
|
||||
int c1, c2, c3, dummy[35];
|
||||
char pattern[580];
|
||||
@ -540,12 +535,8 @@ static void cc_c(struct zint_symbol *symbol, const char source[], const int cc_w
|
||||
}
|
||||
}
|
||||
|
||||
mclength = 0;
|
||||
|
||||
chainemc[mclength] = 0; /* space for length descriptor */
|
||||
mclength++;
|
||||
chainemc[mclength] = 920; /* CC-C identifier */
|
||||
mclength++;
|
||||
chainemc[mclength++] = 0; /* space for length descriptor */
|
||||
chainemc[mclength++] = 920; /* CC-C identifier */
|
||||
|
||||
pdf_byteprocess(chainemc, &mclength, data_string, 0, length, 0, debug_print);
|
||||
|
||||
@ -603,8 +594,7 @@ static void cc_c(struct zint_symbol *symbol, const char source[], const int cc_w
|
||||
}
|
||||
/* we add these codes to the string */
|
||||
for (i = k - 1; i >= 0; i--) {
|
||||
chainemc[mclength] = mccorrection[i];
|
||||
mclength++;
|
||||
chainemc[mclength++] = mccorrection[i];
|
||||
}
|
||||
|
||||
/* 818 - The CW string is finished */
|
||||
|
@ -758,7 +758,9 @@ static int dm_getEndMode(struct zint_symbol *symbol, const unsigned char *source
|
||||
return mode;
|
||||
}
|
||||
|
||||
/*#define DM_TRACE*/
|
||||
#if 0
|
||||
#define DM_TRACE
|
||||
#endif
|
||||
#include "dmatrix_trace.h"
|
||||
|
||||
/* Return number of C40/TEXT codewords needed to encode characters in full batches of 3 (or less if EOD).
|
||||
|
@ -52,6 +52,7 @@ static void DM_TRACE_VertexToString(const unsigned char *source, const int lengt
|
||||
printf("char '%c' at %d mode %s", source[position], position, dm_smodes[edge->mode]);
|
||||
}
|
||||
}
|
||||
|
||||
static void DM_TRACE_EdgeToString(char *buf, const unsigned char *source, const int length, struct dm_edge *edges,
|
||||
struct dm_edge *edge) {
|
||||
int previousMode = DM_TRACE_getPreviousMode(edges, edge);
|
||||
|
@ -409,21 +409,12 @@ static int dc_datum_c(const unsigned char source[], const int length, const int
|
||||
return is_twodigits(source, length, position);
|
||||
}
|
||||
|
||||
/* Returns how many consecutive digits lie immediately ahead (Annex F.II.A) */
|
||||
static int dc_n_digits(const unsigned char source[], const int length, const int position, const int max) {
|
||||
int i;
|
||||
|
||||
for (i = position; (i < length) && z_isdigit(source[i]) && (i < position + max); i++);
|
||||
|
||||
return i - position;
|
||||
}
|
||||
|
||||
/* Checks ahead for 10 or more digits starting "17xxxxxx10..." (Annex F.II.B) */
|
||||
static int dc_seventeen_ten(const unsigned char source[], const int length, const int position) {
|
||||
|
||||
if (position + 9 < length && source[position] == '1' && source[position + 1] == '7'
|
||||
&& source[position + 8] == '1' && source[position + 9] == '0'
|
||||
&& dc_n_digits(source, length, position + 2, 6) >= 6) {
|
||||
&& cnt_digits(source, length, position + 2, 6) >= 6) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -447,7 +438,7 @@ static int dc_ahead_c(const unsigned char source[], const int length, const int
|
||||
/* Annex F.II.F */
|
||||
static int dc_try_c(const unsigned char source[], const int length, const int position) {
|
||||
|
||||
if (position < length && z_isdigit(source[position])) { /* dc_n_digits(position) > 0 */
|
||||
if (position < length && z_isdigit(source[position])) { /* cnt_digits(position) > 0 */
|
||||
const int ahead_c_position = dc_ahead_c(source, length, position);
|
||||
if (ahead_c_position > dc_ahead_c(source, length, position + 1)) {
|
||||
return ahead_c_position;
|
||||
@ -681,7 +672,7 @@ static int dc_encode_message(struct zint_symbol *symbol, const unsigned char sou
|
||||
|
||||
/* Step C3 */
|
||||
if (dc_binary(source, length, position)) {
|
||||
/* dc_n_digits(position + 1) > 0 */
|
||||
/* cnt_digits(position + 1) > 0 */
|
||||
if (position + 1 < length && z_isdigit(source[position + 1])) {
|
||||
if ((source[position] - 128) < 32) {
|
||||
codeword_array[ap++] = 110; /* Upper Shift A */
|
||||
|
@ -336,6 +336,8 @@ static int hibc(struct zint_symbol *symbol, struct zint_seg segs[], const int se
|
||||
segs[0].source = (unsigned char *) to_process;
|
||||
segs[0].length = length;
|
||||
|
||||
if (symbol->debug & ZINT_DEBUG_PRINT) printf("HIBC processed source: %s\n", to_process);
|
||||
|
||||
switch (symbol->symbology) {
|
||||
case BARCODE_HIBC_128:
|
||||
error_number = code128(symbol, segs[0].source, segs[0].length);
|
||||
|
867
backend/pdf417.c
867
backend/pdf417.c
File diff suppressed because it is too large
Load Diff
@ -45,7 +45,7 @@ INTERNAL_DATA_EXTERN const unsigned short pdf_bitpattern[2787];
|
||||
INTERNAL_DATA_EXTERN const unsigned short pdf_Microcoeffs[344];
|
||||
|
||||
/* rows, columns, error codewords, k-offset of valid MicroPDF417 sizes from ISO/IEC 24728:2006 */
|
||||
INTERNAL_DATA_EXTERN const unsigned short pdf_MicroVariants[170];
|
||||
INTERNAL_DATA_EXTERN const unsigned short pdf_MicroVariants[136];
|
||||
|
||||
/* following is Left RAP, Centre RAP, Right RAP and Start Cluster from ISO/IEC 24728:2006 tables 10, 11 and 12 */
|
||||
INTERNAL_DATA_EXTERN const char pdf_RAPTable[136];
|
||||
@ -56,8 +56,8 @@ INTERNAL_DATA_EXTERN const unsigned short pdf_rap_side[52];
|
||||
/* Centre Row Address Pattern from Table 2 */
|
||||
INTERNAL_DATA_EXTERN const unsigned short pdf_rap_centre[52];
|
||||
|
||||
INTERNAL void pdf_byteprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length,
|
||||
const int lastmode, const int debug);
|
||||
INTERNAL void pdf_byteprocess(int *chainemc, int *p_mclength, const unsigned char chaine[], int start,
|
||||
const int length, const int lastmode, const int debug);
|
||||
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
#endif /* Z_PDF417_H */
|
||||
|
@ -42,7 +42,7 @@
|
||||
/* PDF417 error correction coefficients from Grand Zebu */
|
||||
INTERNAL_DATA const unsigned short pdf_coefrs[1022] = {
|
||||
/* k = 2 */
|
||||
27, 917,
|
||||
27, 917,
|
||||
|
||||
/* k = 4 */
|
||||
522, 568, 723, 809,
|
||||
@ -51,79 +51,79 @@ INTERNAL_DATA const unsigned short pdf_coefrs[1022] = {
|
||||
237, 308, 436, 284, 646, 653, 428, 379,
|
||||
|
||||
/* k = 16 */
|
||||
274, 562, 232, 755, 599, 524, 801, 132, 295, 116, 442, 428, 295, 42, 176, 65,
|
||||
274, 562, 232, 755, 599, 524, 801, 132, 295, 116, 442, 428, 295, 42, 176, 65,
|
||||
|
||||
/* k = 32 */
|
||||
361, 575, 922, 525, 176, 586, 640, 321, 536, 742, 677, 742, 687, 284, 193, 517,
|
||||
273, 494, 263, 147, 593, 800, 571, 320, 803, 133, 231, 390, 685, 330, 63, 410,
|
||||
273, 494, 263, 147, 593, 800, 571, 320, 803, 133, 231, 390, 685, 330, 63, 410,
|
||||
|
||||
/* k = 64 */
|
||||
539, 422, 6, 93, 862, 771, 453, 106, 610, 287, 107, 505, 733, 877, 381, 612,
|
||||
539, 422, 6, 93, 862, 771, 453, 106, 610, 287, 107, 505, 733, 877, 381, 612,
|
||||
723, 476, 462, 172, 430, 609, 858, 822, 543, 376, 511, 400, 672, 762, 283, 184,
|
||||
440, 35, 519, 31, 460, 594, 225, 535, 517, 352, 605, 158, 651, 201, 488, 502,
|
||||
648, 733, 717, 83, 404, 97, 280, 771, 840, 629, 4, 381, 843, 623, 264, 543,
|
||||
440, 35, 519, 31, 460, 594, 225, 535, 517, 352, 605, 158, 651, 201, 488, 502,
|
||||
648, 733, 717, 83, 404, 97, 280, 771, 840, 629, 4, 381, 843, 623, 264, 543,
|
||||
|
||||
/* k = 128 */
|
||||
521, 310, 864, 547, 858, 580, 296, 379, 53, 779, 897, 444, 400, 925, 749, 415,
|
||||
822, 93, 217, 208, 928, 244, 583, 620, 246, 148, 447, 631, 292, 908, 490, 704,
|
||||
516, 258, 457, 907, 594, 723, 674, 292, 272, 96, 684, 432, 686, 606, 860, 569,
|
||||
193, 219, 129, 186, 236, 287, 192, 775, 278, 173, 40, 379, 712, 463, 646, 776,
|
||||
171, 491, 297, 763, 156, 732, 95, 270, 447, 90, 507, 48, 228, 821, 808, 898,
|
||||
784, 663, 627, 378, 382, 262, 380, 602, 754, 336, 89, 614, 87, 432, 670, 616,
|
||||
157, 374, 242, 726, 600, 269, 375, 898, 845, 454, 354, 130, 814, 587, 804, 34,
|
||||
211, 330, 539, 297, 827, 865, 37, 517, 834, 315, 550, 86, 801, 4, 108, 539,
|
||||
521, 310, 864, 547, 858, 580, 296, 379, 53, 779, 897, 444, 400, 925, 749, 415,
|
||||
822, 93, 217, 208, 928, 244, 583, 620, 246, 148, 447, 631, 292, 908, 490, 704,
|
||||
516, 258, 457, 907, 594, 723, 674, 292, 272, 96, 684, 432, 686, 606, 860, 569,
|
||||
193, 219, 129, 186, 236, 287, 192, 775, 278, 173, 40, 379, 712, 463, 646, 776,
|
||||
171, 491, 297, 763, 156, 732, 95, 270, 447, 90, 507, 48, 228, 821, 808, 898,
|
||||
784, 663, 627, 378, 382, 262, 380, 602, 754, 336, 89, 614, 87, 432, 670, 616,
|
||||
157, 374, 242, 726, 600, 269, 375, 898, 845, 454, 354, 130, 814, 587, 804, 34,
|
||||
211, 330, 539, 297, 827, 865, 37, 517, 834, 315, 550, 86, 801, 4, 108, 539,
|
||||
|
||||
/* k = 256 */
|
||||
524, 894, 75, 766, 882, 857, 74, 204, 82, 586, 708, 250, 905, 786, 138, 720,
|
||||
524, 894, 75, 766, 882, 857, 74, 204, 82, 586, 708, 250, 905, 786, 138, 720,
|
||||
858, 194, 311, 913, 275, 190, 375, 850, 438, 733, 194, 280, 201, 280, 828, 757,
|
||||
710, 814, 919, 89, 68, 569, 11, 204, 796, 605, 540, 913, 801, 700, 799, 137,
|
||||
710, 814, 919, 89, 68, 569, 11, 204, 796, 605, 540, 913, 801, 700, 799, 137,
|
||||
439, 418, 592, 668, 353, 859, 370, 694, 325, 240, 216, 257, 284, 549, 209, 884,
|
||||
315, 70, 329, 793, 490, 274, 877, 162, 749, 812, 684, 461, 334, 376, 849, 521,
|
||||
307, 291, 803, 712, 19, 358, 399, 908, 103, 511, 51, 8, 517, 225, 289, 470,
|
||||
637, 731, 66, 255, 917, 269, 463, 830, 730, 433, 848, 585, 136, 538, 906, 90,
|
||||
2, 290, 743, 199, 655, 903, 329, 49, 802, 580, 355, 588, 188, 462, 10, 134,
|
||||
628, 320, 479, 130, 739, 71, 263, 318, 374, 601, 192, 605, 142, 673, 687, 234,
|
||||
722, 384, 177, 752, 607, 640, 455, 193, 689, 707, 805, 641, 48, 60, 732, 621,
|
||||
895, 544, 261, 852, 655, 309, 697, 755, 756, 60, 231, 773, 434, 421, 726, 528,
|
||||
503, 118, 49, 795, 32, 144, 500, 238, 836, 394, 280, 566, 319, 9, 647, 550,
|
||||
73, 914, 342, 126, 32, 681, 331, 792, 620, 60, 609, 441, 180, 791, 893, 754,
|
||||
605, 383, 228, 749, 760, 213, 54, 297, 134, 54, 834, 299, 922, 191, 910, 532,
|
||||
609, 829, 189, 20, 167, 29, 872, 449, 83, 402, 41, 656, 505, 579, 481, 173,
|
||||
404, 251, 688, 95, 497, 555, 642, 543, 307, 159, 924, 558, 648, 55, 497, 10,
|
||||
315, 70, 329, 793, 490, 274, 877, 162, 749, 812, 684, 461, 334, 376, 849, 521,
|
||||
307, 291, 803, 712, 19, 358, 399, 908, 103, 511, 51, 8, 517, 225, 289, 470,
|
||||
637, 731, 66, 255, 917, 269, 463, 830, 730, 433, 848, 585, 136, 538, 906, 90,
|
||||
2, 290, 743, 199, 655, 903, 329, 49, 802, 580, 355, 588, 188, 462, 10, 134,
|
||||
628, 320, 479, 130, 739, 71, 263, 318, 374, 601, 192, 605, 142, 673, 687, 234,
|
||||
722, 384, 177, 752, 607, 640, 455, 193, 689, 707, 805, 641, 48, 60, 732, 621,
|
||||
895, 544, 261, 852, 655, 309, 697, 755, 756, 60, 231, 773, 434, 421, 726, 528,
|
||||
503, 118, 49, 795, 32, 144, 500, 238, 836, 394, 280, 566, 319, 9, 647, 550,
|
||||
73, 914, 342, 126, 32, 681, 331, 792, 620, 60, 609, 441, 180, 791, 893, 754,
|
||||
605, 383, 228, 749, 760, 213, 54, 297, 134, 54, 834, 299, 922, 191, 910, 532,
|
||||
609, 829, 189, 20, 167, 29, 872, 449, 83, 402, 41, 656, 505, 579, 481, 173,
|
||||
404, 251, 688, 95, 497, 555, 642, 543, 307, 159, 924, 558, 648, 55, 497, 10,
|
||||
|
||||
/* k = 512 */
|
||||
352, 77, 373, 504, 35, 599, 428, 207, 409, 574, 118, 498, 285, 380, 350, 492,
|
||||
197, 265, 920, 155, 914, 299, 229, 643, 294, 871, 306, 88, 87, 193, 352, 781,
|
||||
846, 75, 327, 520, 435, 543, 203, 666, 249, 346, 781, 621, 640, 268, 794, 534,
|
||||
539, 781, 408, 390, 644, 102, 476, 499, 290, 632, 545, 37, 858, 916, 552, 41,
|
||||
542, 289, 122, 272, 383, 800, 485, 98, 752, 472, 761, 107, 784, 860, 658, 741,
|
||||
290, 204, 681, 407, 855, 85, 99, 62, 482, 180, 20, 297, 451, 593, 913, 142,
|
||||
808, 684, 287, 536, 561, 76, 653, 899, 729, 567, 744, 390, 513, 192, 516, 258,
|
||||
240, 518, 794, 395, 768, 848, 51, 610, 384, 168, 190, 826, 328, 596, 786, 303,
|
||||
570, 381, 415, 641, 156, 237, 151, 429, 531, 207, 676, 710, 89, 168, 304, 402,
|
||||
40, 708, 575, 162, 864, 229, 65, 861, 841, 512, 164, 477, 221, 92, 358, 785,
|
||||
288, 357, 850, 836, 827, 736, 707, 94, 8, 494, 114, 521, 2, 499, 851, 543,
|
||||
152, 729, 771, 95, 248, 361, 578, 323, 856, 797, 289, 51, 684, 466, 533, 820,
|
||||
669, 45, 902, 452, 167, 342, 244, 173, 35, 463, 651, 51, 699, 591, 452, 578,
|
||||
37, 124, 298, 332, 552, 43, 427, 119, 662, 777, 475, 850, 764, 364, 578, 911,
|
||||
283, 711, 472, 420, 245, 288, 594, 394, 511, 327, 589, 777, 699, 688, 43, 408,
|
||||
842, 383, 721, 521, 560, 644, 714, 559, 62, 145, 873, 663, 713, 159, 672, 729,
|
||||
624, 59, 193, 417, 158, 209, 563, 564, 343, 693, 109, 608, 563, 365, 181, 772,
|
||||
677, 310, 248, 353, 708, 410, 579, 870, 617, 841, 632, 860, 289, 536, 35, 777,
|
||||
618, 586, 424, 833, 77, 597, 346, 269, 757, 632, 695, 751, 331, 247, 184, 45,
|
||||
787, 680, 18, 66, 407, 369, 54, 492, 228, 613, 830, 922, 437, 519, 644, 905,
|
||||
789, 420, 305, 441, 207, 300, 892, 827, 141, 537, 381, 662, 513, 56, 252, 341,
|
||||
242, 797, 838, 837, 720, 224, 307, 631, 61, 87, 560, 310, 756, 665, 397, 808,
|
||||
851, 309, 473, 795, 378, 31, 647, 915, 459, 806, 590, 731, 425, 216, 548, 249,
|
||||
321, 881, 699, 535, 673, 782, 210, 815, 905, 303, 843, 922, 281, 73, 469, 791,
|
||||
660, 162, 498, 308, 155, 422, 907, 817, 187, 62, 16, 425, 535, 336, 286, 437,
|
||||
375, 273, 610, 296, 183, 923, 116, 667, 751, 353, 62, 366, 691, 379, 687, 842,
|
||||
37, 357, 720, 742, 330, 5, 39, 923, 311, 424, 242, 749, 321, 54, 669, 316,
|
||||
342, 299, 534, 105, 667, 488, 640, 672, 576, 540, 316, 486, 721, 610, 46, 656,
|
||||
447, 171, 616, 464, 190, 531, 297, 321, 762, 752, 533, 175, 134, 14, 381, 433,
|
||||
717, 45, 111, 20, 596, 284, 736, 138, 646, 411, 877, 669, 141, 919, 45, 780,
|
||||
352, 77, 373, 504, 35, 599, 428, 207, 409, 574, 118, 498, 285, 380, 350, 492,
|
||||
197, 265, 920, 155, 914, 299, 229, 643, 294, 871, 306, 88, 87, 193, 352, 781,
|
||||
846, 75, 327, 520, 435, 543, 203, 666, 249, 346, 781, 621, 640, 268, 794, 534,
|
||||
539, 781, 408, 390, 644, 102, 476, 499, 290, 632, 545, 37, 858, 916, 552, 41,
|
||||
542, 289, 122, 272, 383, 800, 485, 98, 752, 472, 761, 107, 784, 860, 658, 741,
|
||||
290, 204, 681, 407, 855, 85, 99, 62, 482, 180, 20, 297, 451, 593, 913, 142,
|
||||
808, 684, 287, 536, 561, 76, 653, 899, 729, 567, 744, 390, 513, 192, 516, 258,
|
||||
240, 518, 794, 395, 768, 848, 51, 610, 384, 168, 190, 826, 328, 596, 786, 303,
|
||||
570, 381, 415, 641, 156, 237, 151, 429, 531, 207, 676, 710, 89, 168, 304, 402,
|
||||
40, 708, 575, 162, 864, 229, 65, 861, 841, 512, 164, 477, 221, 92, 358, 785,
|
||||
288, 357, 850, 836, 827, 736, 707, 94, 8, 494, 114, 521, 2, 499, 851, 543,
|
||||
152, 729, 771, 95, 248, 361, 578, 323, 856, 797, 289, 51, 684, 466, 533, 820,
|
||||
669, 45, 902, 452, 167, 342, 244, 173, 35, 463, 651, 51, 699, 591, 452, 578,
|
||||
37, 124, 298, 332, 552, 43, 427, 119, 662, 777, 475, 850, 764, 364, 578, 911,
|
||||
283, 711, 472, 420, 245, 288, 594, 394, 511, 327, 589, 777, 699, 688, 43, 408,
|
||||
842, 383, 721, 521, 560, 644, 714, 559, 62, 145, 873, 663, 713, 159, 672, 729,
|
||||
624, 59, 193, 417, 158, 209, 563, 564, 343, 693, 109, 608, 563, 365, 181, 772,
|
||||
677, 310, 248, 353, 708, 410, 579, 870, 617, 841, 632, 860, 289, 536, 35, 777,
|
||||
618, 586, 424, 833, 77, 597, 346, 269, 757, 632, 695, 751, 331, 247, 184, 45,
|
||||
787, 680, 18, 66, 407, 369, 54, 492, 228, 613, 830, 922, 437, 519, 644, 905,
|
||||
789, 420, 305, 441, 207, 300, 892, 827, 141, 537, 381, 662, 513, 56, 252, 341,
|
||||
242, 797, 838, 837, 720, 224, 307, 631, 61, 87, 560, 310, 756, 665, 397, 808,
|
||||
851, 309, 473, 795, 378, 31, 647, 915, 459, 806, 590, 731, 425, 216, 548, 249,
|
||||
321, 881, 699, 535, 673, 782, 210, 815, 905, 303, 843, 922, 281, 73, 469, 791,
|
||||
660, 162, 498, 308, 155, 422, 907, 817, 187, 62, 16, 425, 535, 336, 286, 437,
|
||||
375, 273, 610, 296, 183, 923, 116, 667, 751, 353, 62, 366, 691, 379, 687, 842,
|
||||
37, 357, 720, 742, 330, 5, 39, 923, 311, 424, 242, 749, 321, 54, 669, 316,
|
||||
342, 299, 534, 105, 667, 488, 640, 672, 576, 540, 316, 486, 721, 610, 46, 656,
|
||||
447, 171, 616, 464, 190, 531, 297, 321, 762, 752, 533, 175, 134, 14, 381, 433,
|
||||
717, 45, 111, 20, 596, 284, 736, 138, 646, 411, 877, 669, 141, 919, 45, 780,
|
||||
407, 164, 332, 899, 165, 726, 600, 325, 498, 655, 357, 752, 768, 223, 849, 647,
|
||||
63, 310, 863, 251, 366, 304, 282, 738, 675, 410, 389, 244, 31, 121, 303, 263
|
||||
63, 310, 863, 251, 366, 304, 282, 738, 675, 410, 389, 244, 31, 121, 303, 263
|
||||
};
|
||||
|
||||
INTERNAL_DATA const unsigned short pdf_bitpattern[2787] = {
|
||||
@ -411,7 +411,7 @@ INTERNAL_DATA const unsigned short pdf_bitpattern[2787] = {
|
||||
/* MicroPDF417 coefficients from ISO/IEC 24728:2006 Annex F */
|
||||
INTERNAL_DATA const unsigned short pdf_Microcoeffs[344] = {
|
||||
/* k = 7 */
|
||||
76, 925, 537, 597, 784, 691, 437,
|
||||
76, 925, 537, 597, 784, 691, 437,
|
||||
|
||||
/* k = 8 */
|
||||
237, 308, 436, 284, 646, 653, 428, 379,
|
||||
@ -420,13 +420,13 @@ INTERNAL_DATA const unsigned short pdf_Microcoeffs[344] = {
|
||||
567, 527, 622, 257, 289, 362, 501, 441, 205,
|
||||
|
||||
/* k = 10 */
|
||||
377, 457, 64, 244, 826, 841, 818, 691, 266, 612,
|
||||
377, 457, 64, 244, 826, 841, 818, 691, 266, 612,
|
||||
|
||||
/* k = 11 */
|
||||
462, 45, 565, 708, 825, 213, 15, 68, 327, 602, 904,
|
||||
462, 45, 565, 708, 825, 213, 15, 68, 327, 602, 904,
|
||||
|
||||
/* k = 12 */
|
||||
597, 864, 757, 201, 646, 684, 347, 127, 388, 7, 69, 851,
|
||||
597, 864, 757, 201, 646, 684, 347, 127, 388, 7, 69, 851,
|
||||
|
||||
/* k = 13 */
|
||||
764, 713, 342, 384, 606, 583, 322, 592, 678, 204, 184, 394, 692,
|
||||
@ -435,13 +435,13 @@ INTERNAL_DATA const unsigned short pdf_Microcoeffs[344] = {
|
||||
669, 677, 154, 187, 241, 286, 274, 354, 478, 915, 691, 833, 105, 215,
|
||||
|
||||
/* k = 15 */
|
||||
460, 829, 476, 109, 904, 664, 230, 5, 80, 74, 550, 575, 147, 868, 642,
|
||||
460, 829, 476, 109, 904, 664, 230, 5, 80, 74, 550, 575, 147, 868, 642,
|
||||
|
||||
/* k = 16 */
|
||||
274, 562, 232, 755, 599, 524, 801, 132, 295, 116, 442, 428, 295, 42, 176, 65,
|
||||
274, 562, 232, 755, 599, 524, 801, 132, 295, 116, 442, 428, 295, 42, 176, 65,
|
||||
|
||||
/* k = 18 */
|
||||
279, 577, 315, 624, 37, 855, 275, 739, 120, 297, 312, 202, 560, 321, 233, 756,
|
||||
279, 577, 315, 624, 37, 855, 275, 739, 120, 297, 312, 202, 560, 321, 233, 756,
|
||||
760, 573,
|
||||
|
||||
/* k = 21 */
|
||||
@ -449,45 +449,45 @@ INTERNAL_DATA const unsigned short pdf_Microcoeffs[344] = {
|
||||
347, 165, 193, 259, 568,
|
||||
|
||||
/* k = 26 */
|
||||
443, 284, 887, 544, 788, 93, 477, 760, 331, 608, 269, 121, 159, 830, 446, 893,
|
||||
443, 284, 887, 544, 788, 93, 477, 760, 331, 608, 269, 121, 159, 830, 446, 893,
|
||||
699, 245, 441, 454, 325, 858, 131, 847, 764, 169,
|
||||
|
||||
/* k = 32 */
|
||||
361, 575, 922, 525, 176, 586, 640, 321, 536, 742, 677, 742, 687, 284, 193, 517,
|
||||
273, 494, 263, 147, 593, 800, 571, 320, 803, 133, 231, 390, 685, 330, 63, 410,
|
||||
273, 494, 263, 147, 593, 800, 571, 320, 803, 133, 231, 390, 685, 330, 63, 410,
|
||||
|
||||
/* k = 38 */
|
||||
234, 228, 438, 848, 133, 703, 529, 721, 788, 322, 280, 159, 738, 586, 388, 684,
|
||||
445, 680, 245, 595, 614, 233, 812, 32, 284, 658, 745, 229, 95, 689, 920, 771,
|
||||
445, 680, 245, 595, 614, 233, 812, 32, 284, 658, 745, 229, 95, 689, 920, 771,
|
||||
554, 289, 231, 125, 117, 518,
|
||||
|
||||
/* k = 44 */
|
||||
476, 36, 659, 848, 678, 64, 764, 840, 157, 915, 470, 876, 109, 25, 632, 405,
|
||||
417, 436, 714, 60, 376, 97, 413, 706, 446, 21, 3, 773, 569, 267, 272, 213,
|
||||
31, 560, 231, 758, 103, 271, 572, 436, 339, 730, 82, 285,
|
||||
476, 36, 659, 848, 678, 64, 764, 840, 157, 915, 470, 876, 109, 25, 632, 405,
|
||||
417, 436, 714, 60, 376, 97, 413, 706, 446, 21, 3, 773, 569, 267, 272, 213,
|
||||
31, 560, 231, 758, 103, 271, 572, 436, 339, 730, 82, 285,
|
||||
|
||||
/* k = 50 */
|
||||
923, 797, 576, 875, 156, 706, 63, 81, 257, 874, 411, 416, 778, 50, 205, 303,
|
||||
188, 535, 909, 155, 637, 230, 534, 96, 575, 102, 264, 233, 919, 593, 865, 26,
|
||||
579, 623, 766, 146, 10, 739, 246, 127, 71, 244, 211, 477, 920, 876, 427, 820,
|
||||
923, 797, 576, 875, 156, 706, 63, 81, 257, 874, 411, 416, 778, 50, 205, 303,
|
||||
188, 535, 909, 155, 637, 230, 534, 96, 575, 102, 264, 233, 919, 593, 865, 26,
|
||||
579, 623, 766, 146, 10, 739, 246, 127, 71, 244, 211, 477, 920, 876, 427, 820,
|
||||
718, 435
|
||||
};
|
||||
|
||||
/* rows, columns, error codewords, k-offset of valid MicroPDF417 sizes from ISO/IEC 24728:2006 */
|
||||
INTERNAL_DATA const unsigned short pdf_MicroVariants[170] = {
|
||||
1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
11, 14, 17, 20, 24, 28, 8, 11, 14, 17, 20, 23, 26, 6, 8, 10, 12, 15, 20, 26, 32, 38, 44, 4, 6, 8, 10, 12, 15, 20, 26, 32, 38, 44,
|
||||
7, 7, 7, 8, 8, 8, 8, 9, 9, 10, 11, 13, 15, 12, 14, 16, 18, 21, 26, 32, 38, 44, 50, 8, 12, 14, 16, 18, 21, 26, 32, 38, 44, 50,
|
||||
0, 0, 0, 7, 7, 7, 7, 15, 15, 24, 34, 57, 84, 45, 70, 99, 115, 133, 154, 180, 212, 250, 294, 7, 45, 70, 99, 115, 133, 154, 180, 212, 250, 294
|
||||
INTERNAL_DATA const unsigned short pdf_MicroVariants[136] = { /*34*4*/
|
||||
1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
11, 14, 17, 20, 24, 28, 8, 11, 14, 17, 20, 23, 26, 6, 8, 10, 12, 15, 20, 26, 32, 38, 44, 4, 6, 8, 10, 12, 15, 20, 26, 32, 38, 44,
|
||||
7, 7, 7, 8, 8, 8, 8, 9, 9, 10, 11, 13, 15, 12, 14, 16, 18, 21, 26, 32, 38, 44, 50, 8, 12, 14, 16, 18, 21, 26, 32, 38, 44, 50,
|
||||
0, 0, 0, 7, 7, 7, 7, 15, 15, 24, 34, 57, 84, 45, 70, 99, 115, 133, 154, 180, 212, 250, 294, 7, 45, 70, 99, 115, 133, 154, 180, 212, 250, 294
|
||||
};
|
||||
/* rows, columns, error codewords, k-offset */
|
||||
|
||||
/* following is Left RAP, Centre RAP, Right RAP and Start Cluster from ISO/IEC 24728:2006 tables 10, 11 and 12 */
|
||||
INTERNAL_DATA const char pdf_RAPTable[136] = {
|
||||
1, 8, 36, 19, 9, 25, 1, 1, 8, 36, 19, 9, 27, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1, 47, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25, 19, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25,
|
||||
9, 8, 36, 19, 17, 33, 1, 9, 8, 36, 19, 17, 35, 1, 7, 15, 25, 37, 33, 17, 37, 47, 49, 43, 1, 7, 15, 25, 37, 33, 17, 37, 47, 49,
|
||||
0, 3, 6, 0, 6, 0, 0, 0, 3, 6, 0, 6, 6, 0, 0, 6, 0, 0, 0, 0, 6, 6, 0, 3, 0, 0, 6, 0, 0, 0, 0, 6, 6, 0
|
||||
INTERNAL_DATA const char pdf_RAPTable[136] = { /*34*4*/
|
||||
1, 8, 36, 19, 9, 25, 1, 1, 8, 36, 19, 9, 27, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1, 47, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25, 19, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25,
|
||||
9, 8, 36, 19, 17, 33, 1, 9, 8, 36, 19, 17, 35, 1, 7, 15, 25, 37, 33, 17, 37, 47, 49, 43, 1, 7, 15, 25, 37, 33, 17, 37, 47, 49,
|
||||
0, 3, 6, 0, 6, 0, 0, 0, 3, 6, 0, 6, 6, 0, 0, 6, 0, 0, 0, 0, 6, 6, 0, 3, 0, 0, 6, 0, 0, 0, 0, 6, 6, 0
|
||||
};
|
||||
|
||||
/* Left and Right Row Address Pattern from Table 2 */
|
||||
|
136
backend/pdf417_trace.h
Normal file
136
backend/pdf417_trace.h
Normal file
@ -0,0 +1,136 @@
|
||||
/* pdf417_trace.h - Trace routines for optimal PDF417 optimization algorithm */
|
||||
/*
|
||||
libzint - the open source barcode library
|
||||
Copyright (C) 2022 Robin Stuart <rstuart114@gmail.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the project nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
*/
|
||||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
|
||||
#ifndef Z_PDF417_TRACE_H
|
||||
#define Z_PDF417_TRACE_H
|
||||
|
||||
#ifndef PDF_TRACE
|
||||
#define PDF_TRACE_Edges(px, s, l, p, v)
|
||||
#define PDF_TRACE_AddEdge(s, l, es, p, v, t, e) do { (void)(s); (void)(l); } while (0)
|
||||
#define PDF_TRACE_NotAddEdge(s, l, es, p, v, t, e) do { (void)(s); (void)(l); } while (0)
|
||||
#else
|
||||
|
||||
static int PDF_TRACE_getPreviousMode(struct pdf_edge *edges, struct pdf_edge *edge) {
|
||||
struct pdf_edge *previous = PDF_PREVIOUS(edges, edge);
|
||||
return previous == NULL ? PDF_ALP : previous->mode;
|
||||
}
|
||||
|
||||
static void PDF_TRACE_EdgeToString(char *buf, const unsigned char *source, const int length, struct pdf_edge *edges,
|
||||
struct pdf_edge *edge) {
|
||||
int previousMode = PDF_TRACE_getPreviousMode(edges, edge);
|
||||
(void)length;
|
||||
if (buf) {
|
||||
sprintf(buf, "%d_%c %c(%d,%d) %d(%d,%d,%d) -> %d_%c",
|
||||
edge->from, pdf_smodes[previousMode], pdf_smodes[edge->mode], source[edge->from], edge->len, edge->size
|
||||
+ edge->unit_size, edge->units, edge->unit_size, edge->size, edge->from + 1, pdf_smodes[edge->mode]);
|
||||
} else {
|
||||
printf("%d_%c %c(%d,%d) %d(%d,%d,%d) -> %d_%c",
|
||||
edge->from, pdf_smodes[previousMode], pdf_smodes[edge->mode], source[edge->from], edge->len, edge->size
|
||||
+ edge->unit_size, edge->units, edge->unit_size, edge->size, edge->from + 1, pdf_smodes[edge->mode]);
|
||||
}
|
||||
}
|
||||
|
||||
static void PDF_TRACE_Path(const unsigned char *source, const int length, struct pdf_edge *edges,
|
||||
struct pdf_edge *edge, char *result, const int result_size) {
|
||||
PDF_TRACE_EdgeToString(result, source, length, edges, edge);
|
||||
struct pdf_edge *current = PDF_PREVIOUS(edges, edge);
|
||||
while (current) {
|
||||
char s[256];
|
||||
char *pos;
|
||||
int len;
|
||||
PDF_TRACE_EdgeToString(s, source, length, edges, current);
|
||||
pos = strrchr(s, ' ');
|
||||
assert(pos);
|
||||
len = strlen(result);
|
||||
if ((pos - s) + 1 + len + 1 >= result_size) {
|
||||
result[result_size - 4] = '\0';
|
||||
strcat(result, "...");
|
||||
break;
|
||||
}
|
||||
memmove(result + (pos - s) + 1, result, len + 1);
|
||||
memcpy(result, s, (pos - s) + 1);
|
||||
current = PDF_PREVIOUS(edges, current);
|
||||
}
|
||||
puts(result);
|
||||
}
|
||||
|
||||
static void PDF_TRACE_Edges(const char *prefix, const unsigned char *source, const int length,
|
||||
struct pdf_edge *edges, const int vertexIndex) {
|
||||
int i, j, e_i;
|
||||
char result[1024 * 2];
|
||||
if (vertexIndex) {
|
||||
printf(prefix, vertexIndex);
|
||||
} else {
|
||||
fputs(prefix, stdout);
|
||||
}
|
||||
for (i = vertexIndex; i <= length; i++) {
|
||||
e_i = i * PDF_NUM_MODES;
|
||||
for (j = 0; j < PDF_NUM_MODES; j++) {
|
||||
if (edges[e_i + j].mode) {
|
||||
fputs(" **** ", stdout);
|
||||
PDF_TRACE_Path(source, length, edges, edges + e_i + j, result, (int) ARRAY_SIZE(result));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void PDF_TRACE_AddEdge(const unsigned char *source, const int length, struct pdf_edge *edges,
|
||||
struct pdf_edge *previous, const int vertexIndex, const int t_table, struct pdf_edge *edge) {
|
||||
const int new_size = edge->size + edge->unit_size;
|
||||
const int v_ij = vertexIndex * PDF_NUM_MODES + edge->mode - 1;
|
||||
const int v_size = edges[v_ij].size + edges[v_ij].unit_size;
|
||||
|
||||
(void)source; (void)length;
|
||||
|
||||
printf("add mode %c, t_table 0x%X, previous %d, from %d, len %d, v_ij %d, %d(%d,%d,%d) > %d(%d,%d,%d)\n",
|
||||
pdf_smodes[edge->mode], t_table, previous ? (int) (previous - edges) : 0, edge->from, edge->len, v_ij,
|
||||
v_size, edges[v_ij].units, edges[v_ij].unit_size, edges[v_ij].size,
|
||||
new_size, edge->units, edge->unit_size, edge->size);
|
||||
}
|
||||
|
||||
static void PDF_TRACE_NotAddEdge(const unsigned char *source, const int length, struct pdf_edge *edges,
|
||||
struct pdf_edge *previous, const int vertexIndex, const int t_table, struct pdf_edge *edge) {
|
||||
const int new_size = edge->size + edge->unit_size;
|
||||
const int v_ij = vertexIndex * PDF_NUM_MODES + edge->mode - 1;
|
||||
const int v_size = edges[v_ij].size + edges[v_ij].unit_size;
|
||||
|
||||
(void)source; (void)length;
|
||||
|
||||
printf("NOT mode %c, t_table %d, previous %d, from %d, len %d, v_ij %d, %d(%d,%d,%d) <= %d(%d,%d,%d)\n",
|
||||
pdf_smodes[edge->mode], t_table, previous ? (int) (previous - edges) : 0, edge->from, edge->len, v_ij,
|
||||
v_size, edges[v_ij].units, edges[v_ij].unit_size, edges[v_ij].size,
|
||||
new_size, edge->units, edge->unit_size, edge->size);
|
||||
}
|
||||
|
||||
#endif /* PDF_TRACE */
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
#endif /* Z_PDF417_TRACE_H */
|
File diff suppressed because it is too large
Load Diff
@ -4417,7 +4417,7 @@ static void test_qr_perf(const testCtx *const p_ctx) {
|
||||
struct item data[] = {
|
||||
/* 0*/ { BARCODE_QRCODE, UNICODE_MODE, -1, -1,
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 12345678901234567890123456 点点点点点点点点点点点点点点点点点点点点点点点点点点",
|
||||
0, 37, 37, "107 chars, Mixed modes" },
|
||||
ZINT_WARN_NONCOMPLIANT, 37, 37, "107 chars, Mixed modes" },
|
||||
/* 1*/ { BARCODE_QRCODE, UNICODE_MODE, -1, -1,
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 12345678901234567890123456 点点点点点点点点点点点点点点点点点点点点点点点点点点"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 12345678901234567890123456 点点点点点点点点点点点点点点点点点点点点点点点点点点"
|
||||
@ -4428,7 +4428,7 @@ static void test_qr_perf(const testCtx *const p_ctx) {
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 12345678901234567890123456 点点点点点点点点点点点点点点点点点点点点点点点点点点"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 12345678901234567890123456 点点点点点点点点点点点点点点点点点点点点点点点点点点"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 12345678901234567890123456 点点点点点点点点点点点点点点点点点点点点点点点点点点",
|
||||
0, 105, 105, "963 chars, Mixed modes" },
|
||||
ZINT_WARN_NONCOMPLIANT, 105, 105, "963 chars, Mixed modes" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
|
@ -3342,7 +3342,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
|
||||
{ "DataBarExpanded", BARCODE_DBAR_EXPSTK, 81, },
|
||||
{ "", BARCODE_PLANET, 82, },
|
||||
{ "", -1, 83, },
|
||||
{ "", BARCODE_MICROPDF417, 84, },
|
||||
{ "MicroPDF417", BARCODE_MICROPDF417, 84, },
|
||||
{ "", BARCODE_USPS_IMAIL, 85, },
|
||||
{ "", BARCODE_PLESSEY, 86, },
|
||||
{ "", BARCODE_TELEPEN_NUM, 87, },
|
||||
@ -3468,9 +3468,9 @@ int testUtilCanZXingCPP(int index, const struct zint_symbol *symbol, const char
|
||||
|
||||
int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source, const int length, char *bits,
|
||||
char *buffer, const int buffer_size, int *p_cmp_len) {
|
||||
static const char cmd_fmt[] = "zxingcppdecoder -width %d -textonly -format %s -bits '%s'";
|
||||
static const char hint_cmd_fmt[] = "zxingcppdecoder -width %d -textonly -format %s -hint '%s' -bits '%s'";
|
||||
static const char cs_cmd_fmt[] = "zxingcppdecoder -width %d -textonly -format %s -bits '%s' -charset %s";
|
||||
static const char cmd_fmt[] = "zxingcppdecoder -textonly -format %s -width %d -bits '%s'";
|
||||
static const char hint_cmd_fmt[] = "zxingcppdecoder -textonly -format %s -hint '%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;
|
||||
@ -3519,11 +3519,11 @@ int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source,
|
||||
} else {
|
||||
charset = "ISO8859_1";
|
||||
}
|
||||
sprintf(cmd, cs_cmd_fmt, width, zxingcpp_barcode, bits, charset);
|
||||
sprintf(cmd, cs_cmd_fmt, zxingcpp_barcode, charset, width, bits);
|
||||
} else if (hint) {
|
||||
sprintf(cmd, hint_cmd_fmt, width, zxingcpp_barcode, hint, bits);
|
||||
sprintf(cmd, hint_cmd_fmt, zxingcpp_barcode, hint, width, bits);
|
||||
} else {
|
||||
sprintf(cmd, cmd_fmt, width, zxingcpp_barcode, bits);
|
||||
sprintf(cmd, cmd_fmt, zxingcpp_barcode, width, bits);
|
||||
}
|
||||
|
||||
if (symbol->debug & ZINT_DEBUG_TEST_PRINT) {
|
||||
|
Binary file not shown.
@ -293,7 +293,7 @@ extern "C" {
|
||||
#define GS1NOCHECK_MODE 0x0020 /* Do not check validity of GS1 data (except that printable ASCII only) */
|
||||
#define HEIGHTPERROW_MODE 0x0040 /* Interpret `height` as per-row rather than as overall height */
|
||||
#define FAST_MODE 0x0080 /* Use faster if less optimal encodation for symbologies that support it */
|
||||
/* Note: only DATAMATRIX currently */
|
||||
/* Note: only DATAMATRIX, MICROPDF417 & PDF417 currently */
|
||||
|
||||
/* Data Matrix specific options (`symbol->option_3`) */
|
||||
#define DM_SQUARE 100 /* Only consider square versions on automatic symbol size selection */
|
||||
|
@ -56,6 +56,7 @@ HEADERS += ../backend/aztec.h \
|
||||
../backend/pcx.h \
|
||||
../backend/pdf417.h \
|
||||
../backend/pdf417_tabs.h \
|
||||
../backend/pdf417_trace.h \
|
||||
../backend/qr.h \
|
||||
../backend/reedsol.h \
|
||||
../backend/reedsol_logs.h \
|
||||
|
@ -43,6 +43,7 @@ HEADERS += ../backend/aztec.h \
|
||||
../backend/pcx.h \
|
||||
../backend/pdf417.h \
|
||||
../backend/pdf417_tabs.h \
|
||||
../backend/pdf417_trace.h \
|
||||
../backend/qr.h \
|
||||
../backend/reedsol.h \
|
||||
../backend/rss.h \
|
||||
|
@ -1,6 +1,6 @@
|
||||
% Zint Barcode Generator and Zint Barcode Studio User Manual
|
||||
% Version 2.11.1.9
|
||||
% October 2022
|
||||
% November 2022
|
||||
|
||||
# 1. Introduction
|
||||
|
||||
@ -2031,7 +2031,8 @@ Value Effect
|
||||
overall height.
|
||||
|
||||
`FAST_MODE` Use faster if less optimal encodation for symbologies that
|
||||
support it (currently `DATAMATRIX` only).
|
||||
support it (currently `DATAMATRIX`, `MICROPDF417` and
|
||||
`PDF417` only).
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Table: API `input_mode` Values {#tbl:api_input_mode tag="$ $"}
|
||||
@ -2917,6 +2918,9 @@ This symbology uses Latin-1 character encoding by default but also supports the
|
||||
ECI encoding mechanism. A separate symbology ID (`BARCODE_HIBC_PDF`) can be used
|
||||
to encode Health Industry Barcode (HIBC) data.
|
||||
|
||||
For a faster but less optimal encoding, the `--fast` option (API `input_mode |=
|
||||
FAST_MODE`) may be used.
|
||||
|
||||
PDF417 supports Structured Append of up to 99,999 symbols and an optional
|
||||
numeric ID of up to 30 digits, which can be set by using the `--structapp`
|
||||
option (see [4.16 Structured Append]) (API `structapp`). The ID consists of up
|
||||
@ -2947,7 +2951,7 @@ can be determined using the `--cols` switch (API `option_2`) as with PDF417.
|
||||
This symbology uses Latin-1 character encoding by default but also supports the
|
||||
ECI encoding mechanism. A separate symbology ID (`BARCODE_HIBC_MICPDF`) can be
|
||||
used to encode Health Industry Barcode (HIBC) data. MicroPDF417 supports
|
||||
Structured Append the same as PDF417, for which see details.
|
||||
`FAST_MODE` and Structured Append the same as PDF417, for which see details.
|
||||
|
||||
### 6.2.7 GS1 DataBar Stacked (ISO 24724)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
Zint Barcode Generator and Zint Barcode Studio User Manual
|
||||
Version 2.11.1.9
|
||||
October 2022
|
||||
November 2022
|
||||
|
||||
*******************************************************************************
|
||||
* For reference the following is a text-only version of the Zint manual, *
|
||||
@ -2051,7 +2051,8 @@ property. Valid values are shown in the table below.
|
||||
overall height.
|
||||
|
||||
FAST_MODE Use faster if less optimal encodation for symbologies that
|
||||
support it (currently DATAMATRIX only).
|
||||
support it (currently DATAMATRIX, MICROPDF417 and PDF417
|
||||
only).
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
: Table : API input_mode Values
|
||||
@ -2870,6 +2871,9 @@ This symbology uses Latin-1 character encoding by default but also supports the
|
||||
ECI encoding mechanism. A separate symbology ID (BARCODE_HIBC_PDF) can be used
|
||||
to encode Health Industry Barcode (HIBC) data.
|
||||
|
||||
For a faster but less optimal encoding, the --fast option (API
|
||||
input_mode |= FAST_MODE) may be used.
|
||||
|
||||
PDF417 supports Structured Append of up to 99,999 symbols and an optional
|
||||
numeric ID of up to 30 digits, which can be set by using the --structapp option
|
||||
(see 4.16 Structured Append) (API structapp). The ID consists of up to 10
|
||||
@ -2900,7 +2904,7 @@ can be determined using the --cols switch (API option_2) as with PDF417.
|
||||
This symbology uses Latin-1 character encoding by default but also supports the
|
||||
ECI encoding mechanism. A separate symbology ID (BARCODE_HIBC_MICPDF) can be
|
||||
used to encode Health Industry Barcode (HIBC) data. MicroPDF417 supports
|
||||
Structured Append the same as PDF417, for which see details.
|
||||
FAST_MODE and Structured Append the same as PDF417, for which see details.
|
||||
|
||||
6.2.7 GS1 DataBar Stacked (ISO 24724)
|
||||
|
||||
@ -4121,7 +4125,7 @@ defined.
|
||||
|
||||
Annex B. Man Page ZINT(1)
|
||||
|
||||
% ZINT(1) Version 2.11.1.9 % % October 2022
|
||||
% ZINT(1) Version 2.11.1.9 % % November 2022
|
||||
|
||||
NAME
|
||||
|
||||
@ -4284,7 +4288,8 @@ OPTIONS
|
||||
|
||||
--fast
|
||||
|
||||
Use faster if less optimal encodation (currently affects Data Matrix only).
|
||||
Use faster if less optimal encodation (currently affects Data Matrix,
|
||||
MicroPDF417 & PDF417 only).
|
||||
|
||||
--fg=COLOUR
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
. ftr VB CB
|
||||
. ftr VBI CBI
|
||||
.\}
|
||||
.TH "ZINT" "1" "October 2022" "Version 2.11.1.9" ""
|
||||
.TH "ZINT" "1" "November 2022" "Version 2.11.1.9" ""
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
@ -193,8 +193,8 @@ The escape sequences are:
|
||||
.RE
|
||||
.TP
|
||||
\f[V]--fast\f[R]
|
||||
Use faster if less optimal encodation (currently affects Data Matrix
|
||||
only).
|
||||
Use faster if less optimal encodation (currently affects Data Matrix,
|
||||
MicroPDF417 & PDF417 only).
|
||||
.TP
|
||||
\f[V]--fg=COLOUR\f[R]
|
||||
Specify a foreground (ink) colour where \f[I]COLOUR\f[R] is in hex
|
||||
|
@ -1,6 +1,6 @@
|
||||
% ZINT(1) Version 2.11.1.9
|
||||
%
|
||||
% October 2022
|
||||
% November 2022
|
||||
|
||||
# NAME
|
||||
|
||||
@ -144,7 +144,7 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
|
||||
|
||||
`--fast`
|
||||
|
||||
: Use faster if less optimal encodation (currently affects Data Matrix only).
|
||||
: Use faster if less optimal encodation (currently affects Data Matrix, MicroPDF417 & PDF417 only).
|
||||
|
||||
`--fg=COLOUR`
|
||||
|
||||
|
@ -231,6 +231,20 @@ the data with a slash "/"</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkMPDFFast">
|
||||
<property name="text">
|
||||
<string>&Fast encoding</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Use a faster but less optimal algorithm
|
||||
for encoding the data</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxMPDFStructApp">
|
||||
<property name="title">
|
||||
|
@ -922,6 +922,20 @@ right row indicators and shortens the stop pattern</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkPDFFast">
|
||||
<property name="text">
|
||||
<string>&Fast encoding</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Use a faster but less optimal algorithm
|
||||
for encoding the data</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxPDFStructApp">
|
||||
<property name="title">
|
||||
|
@ -1486,6 +1486,7 @@ void MainWindow::change_options()
|
||||
connect(get_widget(QSL("radPDFTruncated")), SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("radPDFStand")), SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("radPDFHIBC")), SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("chkPDFFast")), SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("spnPDFStructAppCount")), SIGNAL(valueChanged( int )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("spnPDFStructAppCount")), SIGNAL(valueChanged( int )), SLOT(structapp_ui_set()));
|
||||
connect(get_widget(QSL("spnPDFStructAppIndex")), SIGNAL(valueChanged( int )), SLOT(update_preview()));
|
||||
@ -1510,6 +1511,7 @@ void MainWindow::change_options()
|
||||
connect(m_btnHeightPerRowDisable, SIGNAL(clicked( bool )), SLOT(height_per_row_disable()));
|
||||
connect(m_btnHeightPerRowDefault, SIGNAL(clicked( bool )), SLOT(height_per_row_default()));
|
||||
connect(get_widget(QSL("radMPDFStand")), SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("chkMPDFFast")), SIGNAL(toggled( bool )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("spnMPDFStructAppCount")), SIGNAL(valueChanged( int )), SLOT(update_preview()));
|
||||
connect(get_widget(QSL("spnMPDFStructAppCount")), SIGNAL(valueChanged( int )), SLOT(structapp_ui_set()));
|
||||
connect(get_widget(QSL("spnMPDFStructAppIndex")), SIGNAL(valueChanged( int )), SLOT(update_preview()));
|
||||
@ -2437,6 +2439,10 @@ void MainWindow::update_preview()
|
||||
}
|
||||
m_bc.bc.setOption1(get_cmb_index(QSL("cmbPDFECC")) - 1);
|
||||
|
||||
if (get_chk_val(QSL("chkPDFFast"))) {
|
||||
m_bc.bc.setInputMode(FAST_MODE | m_bc.bc.inputMode());
|
||||
}
|
||||
|
||||
if ((item_val = get_spn_val(QSL("spnPDFStructAppCount"))) > 1) {
|
||||
m_bc.bc.setStructApp(item_val, get_spn_val(QSL("spnPDFStructAppIndex")),
|
||||
get_txt_val(QSL("txtPDFStructAppID")));
|
||||
@ -2451,6 +2457,10 @@ void MainWindow::update_preview()
|
||||
|
||||
m_bc.bc.setOption2(get_cmb_index(QSL("cmbMPDFCols")));
|
||||
|
||||
if (get_chk_val(QSL("chkMPDFFast"))) {
|
||||
m_bc.bc.setInputMode(FAST_MODE | m_bc.bc.inputMode());
|
||||
}
|
||||
|
||||
if ((item_val = get_spn_val(QSL("spnMPDFStructAppCount"))) > 1) {
|
||||
m_bc.bc.setStructApp(item_val, get_spn_val(QSL("spnMPDFStructAppIndex")),
|
||||
get_txt_val(QSL("txtMPDFStructAppID")));
|
||||
@ -3677,6 +3687,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
|
||||
settings.setValue(QSL("studio/bc/pdf417/ecc"), get_cmb_index(QSL("cmbPDFECC")));
|
||||
settings.setValue(QSL("studio/bc/pdf417/encoding_mode"), get_rad_grp_index(
|
||||
QStringList() << QSL("radPDFStand") << QSL("radPDFTruncated") << QSL("radPDFHIBC")));
|
||||
settings.setValue(QSL("studio/bc/pdf417/chk_fast"), get_chk_val(QSL("chkPDFFast")));
|
||||
settings.setValue(QSL("studio/bc/pdf417/structapp_count"), get_spn_val(QSL("spnPDFStructAppCount")));
|
||||
settings.setValue(QSL("studio/bc/pdf417/structapp_index"), get_spn_val(QSL("spnPDFStructAppIndex")));
|
||||
settings.setValue(QSL("studio/bc/pdf417/structapp_id"), get_txt_val(QSL("txtPDFStructAppID")));
|
||||
@ -3688,6 +3699,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
|
||||
settings.setValue(QSL("studio/bc/micropdf417/height_per_row"), get_dspn_val(QSL("spnMPDFHeightPerRow")));
|
||||
settings.setValue(QSL("studio/bc/micropdf417/encoding_mode"), get_rad_grp_index(
|
||||
QStringList() << QSL("radMPDFStand") << QSL("radMPDFHIBC")));
|
||||
settings.setValue(QSL("studio/bc/micropdf417/chk_fast"), get_chk_val(QSL("chkMPDFFast")));
|
||||
settings.setValue(QSL("studio/bc/micropdf417/structapp_count"),
|
||||
get_spn_val(QSL("spnMPDFStructAppCount")));
|
||||
settings.setValue(QSL("studio/bc/micropdf417/structapp_index"),
|
||||
@ -4059,6 +4071,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
|
||||
set_cmb_from_setting(settings, QSL("studio/bc/pdf417/ecc"), QSL("cmbPDFECC"));
|
||||
set_rad_from_setting(settings, QSL("studio/bc/pdf417/encoding_mode"),
|
||||
QStringList() << QSL("radPDFStand") << QSL("radPDFTruncated") << QSL("radPDFHIBC"));
|
||||
set_chk_from_setting(settings, QSL("studio/bc/pdf417/chk_fast"), QSL("chkPDFFast"));
|
||||
set_spn_from_setting(settings, QSL("studio/bc/pdf417/structapp_count"), QSL("spnPDFStructAppCount"), 1);
|
||||
set_spn_from_setting(settings, QSL("studio/bc/pdf417/structapp_index"), QSL("spnPDFStructAppIndex"), 0);
|
||||
set_txt_from_setting(settings, QSL("studio/bc/pdf417/structapp_id"), QSL("txtPDFStructAppID"), QSL(""));
|
||||
@ -4071,6 +4084,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
|
||||
0.0f);
|
||||
set_rad_from_setting(settings, QSL("studio/bc/micropdf417/encoding_mode"),
|
||||
QStringList() << QSL("radMPDFStand") << QSL("radMPDFHIBC"));
|
||||
set_chk_from_setting(settings, QSL("studio/bc/micropdf417/chk_fast"), QSL("chkMPDFFast"));
|
||||
set_spn_from_setting(settings, QSL("studio/bc/micropdf417/structapp_count"),
|
||||
QSL("spnMPDFStructAppCount"), 1);
|
||||
set_spn_from_setting(settings, QSL("studio/bc/micropdf417/structapp_index"),
|
||||
|
@ -201,6 +201,7 @@
|
||||
<ClInclude Include="..\backend\pcx.h" />
|
||||
<ClInclude Include="..\backend\pdf417.h" />
|
||||
<ClInclude Include="..\backend\pdf417_tabs.h" />
|
||||
<ClInclude Include="..\backend\pdf417_trace.h" />
|
||||
<ClInclude Include="..\backend\qr.h" />
|
||||
<ClInclude Include="..\backend\reedsol.h" />
|
||||
<ClInclude Include="..\backend\reedsol_logs.h" />
|
||||
|
@ -589,6 +589,10 @@
|
||||
RelativePath="..\..\backend\pdf417_tabs.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\backend\pdf417_trace.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\backend\qr.h"
|
||||
>
|
||||
|
@ -378,6 +378,7 @@
|
||||
<ClInclude Include="..\..\backend\pcx.h" />
|
||||
<ClInclude Include="..\..\backend\pdf417.h" />
|
||||
<ClInclude Include="..\..\backend\pdf417_tabs.h" />
|
||||
<ClInclude Include="..\..\backend\pdf417_trace.h" />
|
||||
<ClInclude Include="..\..\backend\qr.h" />
|
||||
<ClInclude Include="..\..\backend\reedsol.h" />
|
||||
<ClInclude Include="..\..\backend\reedsol_logs.h" />
|
||||
|
@ -149,6 +149,7 @@
|
||||
<ClInclude Include="..\..\backend\pcx.h" />
|
||||
<ClInclude Include="..\..\backend\pdf417.h" />
|
||||
<ClInclude Include="..\..\backend\pdf417_tabs.h" />
|
||||
<ClInclude Include="..\..\backend\pdf417_trace.h" />
|
||||
<ClInclude Include="..\..\backend\qr.h" />
|
||||
<ClInclude Include="..\..\backend\reedsol.h" />
|
||||
<ClInclude Include="..\..\backend\reedsol_logs.h" />
|
||||
|
@ -201,6 +201,7 @@
|
||||
<ClInclude Include="..\..\backend\pcx.h" />
|
||||
<ClInclude Include="..\..\backend\pdf417.h" />
|
||||
<ClInclude Include="..\..\backend\pdf417_tabs.h" />
|
||||
<ClInclude Include="..\..\backend\pdf417_trace.h" />
|
||||
<ClInclude Include="..\..\backend\qr.h" />
|
||||
<ClInclude Include="..\..\backend\reedsol.h" />
|
||||
<ClInclude Include="..\..\backend\reedsol_logs.h" />
|
||||
|
Loading…
Reference in New Issue
Block a user