mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Alterations based on feedback from Wang Yi
This commit is contained in:
parent
eecad5e43f
commit
5402264ad9
@ -644,7 +644,8 @@ void calculate_binary(char binary[], char mode[], int source[], int length, int
|
|||||||
|
|
||||||
/* Terminator */
|
/* Terminator */
|
||||||
strcat(binary, "111111111111111");
|
strcat(binary, "111111111111111");
|
||||||
/* Terminator sequence of length 12 is assumed to be a mistake */
|
/* Terminator sequence of length 12 is a mistake
|
||||||
|
- confirmed by Wang Yi */
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -1030,7 +1031,7 @@ void make_picket_fence(unsigned char fullstream[], unsigned char picket_fence[],
|
|||||||
|
|
||||||
/* Evaluate a bitmask according to table 9 */
|
/* Evaluate a bitmask according to table 9 */
|
||||||
int hx_evaluate(unsigned char *eval, int size, int pattern) {
|
int hx_evaluate(unsigned char *eval, int size, int pattern) {
|
||||||
int x, y, i, block, weight;
|
int x, y, block, weight;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
char state;
|
char state;
|
||||||
int p;
|
int p;
|
||||||
@ -1151,47 +1152,45 @@ int hx_evaluate(unsigned char *eval, int size, int pattern) {
|
|||||||
/* In AIMD-15 section 5.8.3.2 it is stated... “In Table 9 below, i refers to the row
|
/* In AIMD-15 section 5.8.3.2 it is stated... “In Table 9 below, i refers to the row
|
||||||
* position of the module.” - however i being the length of the run of the
|
* position of the module.” - however i being the length of the run of the
|
||||||
* same colour (i.e. "block" below) in the same fashion as ISO/IEC 18004
|
* same colour (i.e. "block" below) in the same fashion as ISO/IEC 18004
|
||||||
* makes more sense. The implementation below matches AIMD-015.*/
|
* makes more sense. -- Confirmed by Wang Yi */
|
||||||
|
|
||||||
/* Vertical */
|
/* Vertical */
|
||||||
for (x = 0; x < size; x++) {
|
for (x = 0; x < size; x++) {
|
||||||
state = local[x];
|
state = local[x];
|
||||||
block = 0;
|
block = 0;
|
||||||
for (y = 0; y < size; y++) {
|
for (y = 0; y < size; y++) {
|
||||||
i = y + 1;
|
|
||||||
if (local[(y * size) + x] == state) {
|
if (local[(y * size) + x] == state) {
|
||||||
block++;
|
block++;
|
||||||
} else {
|
} else {
|
||||||
if (block > (3 + i)) {
|
if (block > 3) {
|
||||||
result += (3 + i) * 4;
|
result += (3 + block) * 4;
|
||||||
}
|
}
|
||||||
block = 0;
|
block = 0;
|
||||||
state = local[(y * size) + x];
|
state = local[(y * size) + x];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (block > (3 + i)) {
|
if (block > 3) {
|
||||||
result += (3 + i) * 4;
|
result += (3 + block) * 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Horizontal */
|
/* Horizontal */
|
||||||
for (y = 0; y < size; y++) {
|
for (y = 0; y < size; y++) {
|
||||||
i = y + 1;
|
|
||||||
state = local[y * size];
|
state = local[y * size];
|
||||||
block = 0;
|
block = 0;
|
||||||
for (x = 0; x < size; x++) {
|
for (x = 0; x < size; x++) {
|
||||||
if (local[(y * size) + x] == state) {
|
if (local[(y * size) + x] == state) {
|
||||||
block++;
|
block++;
|
||||||
} else {
|
} else {
|
||||||
if (block > (3 + i)) {
|
if (block > 3) {
|
||||||
result += (3 + i) * 4;
|
result += (3 + block) * 4;
|
||||||
}
|
}
|
||||||
block = 0;
|
block = 0;
|
||||||
state = local[(y * size) + x];
|
state = local[(y * size) + x];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (block > (3 + i)) {
|
if (block > 3) {
|
||||||
result += (3 + i) * 4;
|
result += (3 + block) * 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user