mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
ULTRA: include secondary vertical clock track in DCC; ECC count, maxsize adjustment
This commit is contained in:
parent
9e2b6716f4
commit
bd654647c0
@ -138,32 +138,32 @@ static void test_encode(void)
|
|||||||
"7777777777777777777777"
|
"7777777777777777777777"
|
||||||
"7057065353533131551057"
|
"7057065353533131551057"
|
||||||
"7767053515611616136717"
|
"7767053515611616136717"
|
||||||
"7017036661565555363057"
|
"7037036661565555363057"
|
||||||
"7767055333616336135717"
|
"7717055333616336135717"
|
||||||
"7037036515535515366057"
|
"7037036515535515366057"
|
||||||
"7707070707070707070707"
|
"7707070707070707070707"
|
||||||
"7067016561133113551017"
|
"7067016561133113551017"
|
||||||
"7737035155311665165737"
|
"7737035155311665165737"
|
||||||
"7057066561155551653057"
|
"7067066561155551653057"
|
||||||
"7767033315616663515717"
|
"7737033315616663515717"
|
||||||
"7017051653331136333057"
|
"7017051653331136333057"
|
||||||
"7777777777777777777777"
|
"7777777777777777777777"
|
||||||
},
|
},
|
||||||
/* 1*/ { UNICODE_MODE, 0, -1, -1, "ULTRACODE_123456789!", 0, 13, 24, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** no compression; verified against bwipp",
|
/* 1*/ { UNICODE_MODE, 0, -1, -1, "ULTRACODE_123456789!", 0, 13, 24, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** no compression; verified against bwipp",
|
||||||
"777777777777777777777777"
|
"777777777777777777777777"
|
||||||
"705706533153313111101157"
|
"705706533153313111101157"
|
||||||
"776703361661161666676617"
|
"776703361661161666676617"
|
||||||
"703706115156555511303357"
|
"703706115156555511303357"
|
||||||
"775705556561633656175517"
|
"776705556561633656175517"
|
||||||
"703701311653551535501657"
|
"703701311653551535501657"
|
||||||
"770707070707070707070707"
|
"770707070707070707070707"
|
||||||
"706701656113311311101117"
|
"706701656113311311101117"
|
||||||
"775703333531166566676537"
|
"775703333531166566676537"
|
||||||
"701706651315555113303357"
|
"701706651315555113303357"
|
||||||
"773705515161666351175517"
|
"776705515161666351175517"
|
||||||
"701706166533113663603357"
|
"701706166533113663603357"
|
||||||
"777777777777777777777777"
|
"777777777777777777777777"
|
||||||
},
|
},
|
||||||
/* 2*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, 19, 23, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** different compression",
|
/* 2*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, 19, 23, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** different compression",
|
||||||
"77777777777777777777777"
|
"77777777777777777777777"
|
||||||
"70070663151561555150557"
|
"70070663151561555150557"
|
||||||
@ -172,19 +172,19 @@ static void test_encode(void)
|
|||||||
"77570535365656556367117"
|
"77570535365656556367117"
|
||||||
"70370153656135163550357"
|
"70370153656135163550357"
|
||||||
"77170707070707070707077"
|
"77170707070707070707077"
|
||||||
"70570156315513136160357"
|
"70670156315513136160357"
|
||||||
"77370533531631615537117"
|
"77370533531631615537117"
|
||||||
"70070361155313351360657"
|
"70070361155313351360657"
|
||||||
"77670515613665166537117"
|
"77670515613665166537117"
|
||||||
"70170651131551335150357"
|
"70170651131551335150357"
|
||||||
"77570707070707070707077"
|
"77670707070707070707077"
|
||||||
"70670535163551333630617"
|
"70370535163551333630617"
|
||||||
"77170111531613611567137"
|
"77170111531613611567137"
|
||||||
"70070566665531335610357"
|
"70070566665531335610357"
|
||||||
"77070151331365561537137"
|
"77070151331365561537137"
|
||||||
"70070333656153153360617"
|
"70070333656153153360617"
|
||||||
"77777777777777777777777"
|
"77777777777777777777777"
|
||||||
},
|
},
|
||||||
/* 3*/ { DATA_MODE, 0, -1, -1, "\110\105\111\115\101\123\315\320\101\040\113\105\116\116\101\122\101\110\301\123\113\323\114\101\040\315\123\114\101\116\104\123", 0, 19, 23, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** no compression; verified against bwipp",
|
/* 3*/ { DATA_MODE, 0, -1, -1, "\110\105\111\115\101\123\315\320\101\040\113\105\116\116\101\122\101\110\301\123\113\323\114\101\040\315\123\114\101\116\104\123", 0, 19, 23, "AIMD/TSC15032-43 Figure G.2 **NOT SAME** no compression; verified against bwipp",
|
||||||
"77777777777777777777777"
|
"77777777777777777777777"
|
||||||
"70070633151153313350137"
|
"70070633151153313350137"
|
||||||
@ -193,19 +193,19 @@ static void test_encode(void)
|
|||||||
"77570531366336136167367"
|
"77570531366336136167367"
|
||||||
"70370155555515653350537"
|
"70370155555515653350537"
|
||||||
"77170707070707070707077"
|
"77170707070707070707077"
|
||||||
"70570135513311133130357"
|
"70670135513311133130357"
|
||||||
"77370513331166611617117"
|
"77370513331166611617117"
|
||||||
"70070351153555533550557"
|
"70070351153555533550557"
|
||||||
"77670613615636356367117"
|
"77670613615636356367117"
|
||||||
"70170156336355515530657"
|
"70170156336355515530657"
|
||||||
"77570707070707070707077"
|
"77670707070707070707077"
|
||||||
"70670615133513355130117"
|
"70370615133513355130117"
|
||||||
"77170136511651166517637"
|
"77170136511651166517637"
|
||||||
"70070365635335515350557"
|
"70070365635335515350557"
|
||||||
"77070613551651656517637"
|
"77070613551651656517637"
|
||||||
"70070361115516163130317"
|
"70070361115516163130317"
|
||||||
"77777777777777777777777"
|
"77777777777777777777777"
|
||||||
},
|
},
|
||||||
/* 4*/ { UNICODE_MODE, 10, -1, ULTRA_COMPRESSION, "אולטרה-קוד1234", 0, 13, 19, "AIMD/TSC15032-43 Figure G.3 Same except DCC correct whereas DCC in Figure G.3 is incorrent",
|
/* 4*/ { UNICODE_MODE, 10, -1, ULTRA_COMPRESSION, "אולטרה-קוד1234", 0, 13, 19, "AIMD/TSC15032-43 Figure G.3 Same except DCC correct whereas DCC in Figure G.3 is incorrent",
|
||||||
"7777777777777777777"
|
"7777777777777777777"
|
||||||
"7057065565566616657"
|
"7057065565566616657"
|
||||||
@ -220,7 +220,7 @@ static void test_encode(void)
|
|||||||
"7767016565663636117"
|
"7767016565663636117"
|
||||||
"7017051316355311357"
|
"7017051316355311357"
|
||||||
"7777777777777777777"
|
"7777777777777777777"
|
||||||
},
|
},
|
||||||
/* 5*/ { DATA_MODE, 0, -1, -1, "\340\345\354\350\370\344\055\367\345\343\061\062\063\064", 0, 13, 20, "AIMD/TSC15032-43 Figure G.3 **NOT SAME** no compression; verified against bwipp",
|
/* 5*/ { DATA_MODE, 0, -1, -1, "\340\345\354\350\370\344\055\367\345\343\061\062\063\064", 0, 13, 20, "AIMD/TSC15032-43 Figure G.3 **NOT SAME** no compression; verified against bwipp",
|
||||||
"77777777777777777777"
|
"77777777777777777777"
|
||||||
"70570611115666161157"
|
"70570611115666161157"
|
||||||
@ -235,22 +235,22 @@ static void test_encode(void)
|
|||||||
"77370166136636365117"
|
"77370166136636365117"
|
||||||
"70170613653553116357"
|
"70170613653553116357"
|
||||||
"77777777777777777777"
|
"77777777777777777777"
|
||||||
},
|
},
|
||||||
/* 6*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "https://aimglobal.org/jcrv3tX", 0, 13, 22, "AIMD/TSC15032-43 Figure G.4a **NOT SAME** different compression",
|
/* 6*/ { UNICODE_MODE, 0, -1, ULTRA_COMPRESSION, "https://aimglobal.org/jcrv3tX", 0, 13, 22, "AIMD/TSC15032-43 Figure G.4a **NOT SAME** different compression",
|
||||||
"7777777777777777777777"
|
"7777777777777777777777"
|
||||||
"7057065133563156313037"
|
"7057065133563156313037"
|
||||||
"7767051556651331566757"
|
"7767051556651331566757"
|
||||||
"7017066611513613331017"
|
"7037066611513613331017"
|
||||||
"7767053165666351655767"
|
"7717053165666351655767"
|
||||||
"7037035651531533133057"
|
"7037035651531533133057"
|
||||||
"7707070707070707070707"
|
"7707070707070707070707"
|
||||||
"7067015511111161565017"
|
"7067015511111161565017"
|
||||||
"7737036635335356151737"
|
"7737036635335356151737"
|
||||||
"7057063111116533366057"
|
"7067063111116533366057"
|
||||||
"7767031536633116511717"
|
"7737031536633116511717"
|
||||||
"7017063363361363356057"
|
"7017063363361363356057"
|
||||||
"7777777777777777777777"
|
"7777777777777777777777"
|
||||||
},
|
},
|
||||||
/* 7*/ { UNICODE_MODE, 0, -1, -1, "A", 0, 13, 13, "Verified against bwipp",
|
/* 7*/ { UNICODE_MODE, 0, -1, -1, "A", 0, 13, 13, "Verified against bwipp",
|
||||||
"7777777777777"
|
"7777777777777"
|
||||||
"7057063335517"
|
"7057063335517"
|
||||||
@ -265,7 +265,133 @@ static void test_encode(void)
|
|||||||
"7737065163617"
|
"7737065163617"
|
||||||
"7017033536357"
|
"7017033536357"
|
||||||
"7777777777777"
|
"7777777777777"
|
||||||
},
|
},
|
||||||
|
/* 8*/ { UNICODE_MODE, 0, 2, -1, "12345678901234567890123", 0, 13, 25, "Length 23 == 26 MCC (C) with EC1 so 7 ECC by Table 12",
|
||||||
|
"7777777777777777777777777"
|
||||||
|
"7057063655511111111011117"
|
||||||
|
"7767031563666666666766667"
|
||||||
|
"7057063315511333113033117"
|
||||||
|
"7717055133656155561755567"
|
||||||
|
"7037011366535516355016357"
|
||||||
|
"7707070707070707070707077"
|
||||||
|
"7067013331111111111011117"
|
||||||
|
"7757051515366666666766637"
|
||||||
|
"7037016363113331133031157"
|
||||||
|
"7757051535651153511753517"
|
||||||
|
"7017035653363636636036657"
|
||||||
|
"7777777777777777777777777"
|
||||||
|
},
|
||||||
|
/* 9*/ { UNICODE_MODE, 0, 1, -1, "1", 0, 13, 11, "Figure 3a min 2-row, EC0; verified against bwipp",
|
||||||
|
"77777777777"
|
||||||
|
"70570661517"
|
||||||
|
"77170355667"
|
||||||
|
"70370666517"
|
||||||
|
"77670551657"
|
||||||
|
"70370135537"
|
||||||
|
"77070707077"
|
||||||
|
"70670151117"
|
||||||
|
"77170333337"
|
||||||
|
"70370115117"
|
||||||
|
"77570631357"
|
||||||
|
"70170365567"
|
||||||
|
"77777777777"
|
||||||
|
},
|
||||||
|
/* 10*/ { UNICODE_MODE, 0, 6, -1, "123456789012345678901", 0, 13, 27, "Figure 3a max 2-row, EC5",
|
||||||
|
"777777777777777777777777777"
|
||||||
|
"705706316551651111101111117"
|
||||||
|
"771703535313166666676666667"
|
||||||
|
"703706166556351133301133317"
|
||||||
|
"771705311313665615575615557"
|
||||||
|
"706701655165353551603551637"
|
||||||
|
"770707070707070707070707077"
|
||||||
|
"703701165561111111101111117"
|
||||||
|
"771705336136536666676666637"
|
||||||
|
"703701113655351333101333157"
|
||||||
|
"775703635331635115375115367"
|
||||||
|
"701705553563556363606363637"
|
||||||
|
"777777777777777777777777777"
|
||||||
|
},
|
||||||
|
/* 11*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012345678901234567890123456789012", 0, 19, 36, "Figure 3b max 3-row, EC5",
|
||||||
|
"777777777777777777777777777777777777"
|
||||||
|
"700706363653513111101111111111111117"
|
||||||
|
"770703511165156356676666666666666667"
|
||||||
|
"700706155316333511303133133113313317"
|
||||||
|
"775705516633156156175515515361551557"
|
||||||
|
"701701335356661335606653331656665337"
|
||||||
|
"773707070707070707070707070707070707"
|
||||||
|
"705701313116156311101111111111111117"
|
||||||
|
"776706665563633166676666666666666667"
|
||||||
|
"700703316155566513301133133133113317"
|
||||||
|
"773705165316651651573615515515361557"
|
||||||
|
"701701556535515533106566653331656667"
|
||||||
|
"773707070707070707070707070707070707"
|
||||||
|
"706701333331113511101111111111111117"
|
||||||
|
"771705161113336666676666666666666657"
|
||||||
|
"700703313565163513301331133133133137"
|
||||||
|
"770705661613551651575153615515515317"
|
||||||
|
"700703155555336565303316566653331637"
|
||||||
|
"777777777777777777777777777777777777"
|
||||||
|
},
|
||||||
|
/* 12*/ { UNICODE_MODE, 0, 6, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", 0, 25, 49, "Figure 3c max 4-row, EC5",
|
||||||
|
"7777777777777777777777777777777777777777777777777"
|
||||||
|
"7007061565635135151011111111111111101111111111117"
|
||||||
|
"7707035151513316566766666666666666676666666666667"
|
||||||
|
"7007061536666531351031331313313133103133131331317"
|
||||||
|
"7707056653153315566755156551565515675515655156557"
|
||||||
|
"7007013366335656655013565135651356501356513565137"
|
||||||
|
"7707070707070707070707070707070707070707070707077"
|
||||||
|
"7057036636366363311011111111111111101111111111117"
|
||||||
|
"7737055565651635656766666666666666676666666666667"
|
||||||
|
"7017061653316513563031313313133131303131331313317"
|
||||||
|
"7757056561153165131755131551315513175513155131557"
|
||||||
|
"7067063135615536653036663366633666303666336663367"
|
||||||
|
"7707070707070707070707070707070707070707070707077"
|
||||||
|
"7037056156651155111011111111111111101111111111117"
|
||||||
|
"7717015565563561566766666666666666676666666666667"
|
||||||
|
"7067066631136356613031313313133131303131331313317"
|
||||||
|
"7737031365663161551756551565515655175655156551567"
|
||||||
|
"7017065156355516135065135651356513506513565135657"
|
||||||
|
"7707070707070707070707070707070707070707070707077"
|
||||||
|
"7007053555355533511011111111111111101111111111117"
|
||||||
|
"7707035616631351166766666666666666676666666666657"
|
||||||
|
"7007063363316563613013313133131331301331313313167"
|
||||||
|
"7707031111653311551731551315513155173155131551357"
|
||||||
|
"7007016565561165166063366633666336606336663366637"
|
||||||
|
"7777777777777777777777777777777777777777777777777"
|
||||||
|
},
|
||||||
|
/* 13*/ { UNICODE_MODE, 0, 6, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 0, 31, 66, "Figure 3d max 5-row, EC5 **NOT SAME** Max columns due to 282 limit is 60 not 61 as shown",
|
||||||
|
"777777777777777777777777777777777777777777777777777777777777777777"
|
||||||
|
"700706655166656555306351111111111110111111111111111011111111111117"
|
||||||
|
"770703331611363336575566666666666667666666666666666766666666666667"
|
||||||
|
"700706555153116611103153333333333330333333333333333033333333333337"
|
||||||
|
"770705361635661566576361515151515157151515151515151751515151515157"
|
||||||
|
"700701513513555315303653636363636360363636363636363063636363636367"
|
||||||
|
"770707070707070707070707070707070707070707070707070707070707070707"
|
||||||
|
"700705316656355536606131111111111110111111111111111011111111111157"
|
||||||
|
"770706653365566155373316666666666667666666666666666766666666666617"
|
||||||
|
"700703361516133633605633131313131310313131313131313013131313131357"
|
||||||
|
"775705513161356156176361313131313137131313131313131731313131313117"
|
||||||
|
"706706166533165615303615656565656560565656565656565065656565656557"
|
||||||
|
"775707070707070707070707070707070707070707070707070707070707070707"
|
||||||
|
"701703651151633136506611111111111110111111111111111011111111111157"
|
||||||
|
"776706533613515615373566666666666667666666666666666766666666666617"
|
||||||
|
"700701365531653133101613131313131310313131313131313013131313131357"
|
||||||
|
"773703113156366615576151515151515157151515151515151751515151515117"
|
||||||
|
"706706351535111563305536363636363630636363636363636036363636363657"
|
||||||
|
"773707070707070707070707070707070707070707070707070707070707070707"
|
||||||
|
"705705611111515333605311111111111110111111111111111011111111111157"
|
||||||
|
"771703336366133651571166666666666667666666666666666766666666666617"
|
||||||
|
"700706513535351316103313131313131310313131313131313013131313131357"
|
||||||
|
"770703131151115535575555555555555557555555555555555755555555555517"
|
||||||
|
"700705665366536111306661616161616160161616161616161061616161616157"
|
||||||
|
"770707070707070707070707070707070707070707070707070707070707070707"
|
||||||
|
"700706355163151355603611111111111110111111111111111011111111111137"
|
||||||
|
"770703563615515136176566666666666667666666666666666766666666666617"
|
||||||
|
"700705655136333561505613131313131310313131313131313013131313131357"
|
||||||
|
"770701136561611613373365656565656567565656565656565765656565656517"
|
||||||
|
"700703663313553565506153535353535350353535353535353053535353535357"
|
||||||
|
"777777777777777777777777777777777777777777777777777777777777777777"
|
||||||
|
},
|
||||||
};
|
};
|
||||||
int data_size = sizeof(data) / sizeof(struct item);
|
int data_size = sizeof(data) / sizeof(struct item);
|
||||||
|
|
||||||
@ -297,7 +423,7 @@ static void test_encode(void)
|
|||||||
i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, testUtilOption3Name(data[i].option_3),
|
i, testUtilInputModeName(data[i].input_mode), data[i].eci, data[i].option_1, testUtilOption3Name(data[i].option_3),
|
||||||
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
|
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
|
||||||
testUtilModulesDump(symbol, " ", "\n");
|
testUtilModulesDump(symbol, " ", "\n");
|
||||||
printf(" },\n");
|
printf(" },\n");
|
||||||
#else
|
#else
|
||||||
if (ret < 5) {
|
if (ret < 5) {
|
||||||
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
|
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
|
||||||
|
@ -59,8 +59,7 @@ static const char ultra_digit[] = "0123456789,/";
|
|||||||
static const char ultra_colour[] = "WCBMRYGK";
|
static const char ultra_colour[] = "WCBMRYGK";
|
||||||
|
|
||||||
//static const int ultra_maxsize[] = {34, 78, 158, 282}; // According to Table 1
|
//static const int ultra_maxsize[] = {34, 78, 158, 282}; // According to Table 1
|
||||||
//static const int ultra_maxsize[] = {34, 82, 158, 282}; // Adjusted to allow 79-82 codeword range in 3-row symbols
|
static const int ultra_maxsize[] = {34, 81, 158, 282}; // Adjusted to allow 79-81 codeword range in 3-row symbols (only 1 secondary vertical clock track, not 2, so 3 extra)
|
||||||
static const int ultra_maxsize[] = {38, 91, 158, 282}; // Adjusted again to ensure DCC is never negative
|
|
||||||
|
|
||||||
static const int ultra_mincols[] = {5, 13, 23, 30}; // # Total Tile Columns from Table 1
|
static const int ultra_mincols[] = {5, 13, 23, 30}; // # Total Tile Columns from Table 1
|
||||||
|
|
||||||
@ -131,7 +130,7 @@ static const int tiles[] = {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Generate divisor polynomial gQ(x) for GF283() given the required ECC size, 3 to 101 */
|
/* Generate divisor polynomial gQ(x) for GF283() given the required ECC size, 3 to 101 */
|
||||||
void ultra_genPoly(short EccSize, unsigned short gPoly[], unsigned short gfPwr[], unsigned short gfLog[]) {
|
static void ultra_genPoly(short EccSize, unsigned short gPoly[], unsigned short gfPwr[], unsigned short gfLog[]) {
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
gPoly[0] = 1;
|
gPoly[0] = 1;
|
||||||
@ -148,7 +147,7 @@ void ultra_genPoly(short EccSize, unsigned short gPoly[], unsigned short gfPwr[]
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Generate the log and antilog tables for GF283() multiplication & division */
|
/* Generate the log and antilog tables for GF283() multiplication & division */
|
||||||
void ultra_initLogTables(unsigned short gfPwr[], unsigned short gfLog[]) {
|
static void ultra_initLogTables(unsigned short gfPwr[], unsigned short gfLog[]) {
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (j = 0; j < 283; j++) gfLog[j] = 0;
|
for (j = 0; j < 283; j++) gfLog[j] = 0;
|
||||||
@ -161,7 +160,7 @@ void ultra_initLogTables(unsigned short gfPwr[], unsigned short gfLog[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ultra_gf283(short DataSize, short EccSize, int Message[]) {
|
static void ultra_gf283(short DataSize, short EccSize, int Message[]) {
|
||||||
/* Input is complete message codewords in array Message[282]
|
/* Input is complete message codewords in array Message[282]
|
||||||
* DataSize is number of message codewords
|
* DataSize is number of message codewords
|
||||||
* EccSize is number of Reed-Solomon GF(283) check codewords to generate
|
* EccSize is number of Reed-Solomon GF(283) check codewords to generate
|
||||||
@ -204,7 +203,7 @@ void ultra_gf283(short DataSize, short EccSize, int Message[]) {
|
|||||||
|
|
||||||
/* End of Ted Williams code */
|
/* End of Ted Williams code */
|
||||||
|
|
||||||
int ultra_find_fragment(unsigned char source[], int source_length, int position) {
|
static int ultra_find_fragment(const unsigned char source[], int source_length, int position) {
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
int j, k, latch;
|
int j, k, latch;
|
||||||
|
|
||||||
@ -228,7 +227,7 @@ int ultra_find_fragment(unsigned char source[], int source_length, int position)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Encode characters in 8-bit mode */
|
/* Encode characters in 8-bit mode */
|
||||||
float look_ahead_eightbit(unsigned char source[], int in_length, int in_locn, char current_mode, int end_char, int cw[], int* cw_len, int gs1)
|
static float look_ahead_eightbit(unsigned char source[], int in_length, int in_locn, char current_mode, int end_char, int cw[], int* cw_len, int gs1)
|
||||||
{
|
{
|
||||||
int codeword_count = 0;
|
int codeword_count = 0;
|
||||||
int i;
|
int i;
|
||||||
@ -262,7 +261,7 @@ float look_ahead_eightbit(unsigned char source[], int in_length, int in_locn, ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Encode character in the ASCII mode/submode (including numeric compression) */
|
/* Encode character in the ASCII mode/submode (including numeric compression) */
|
||||||
float look_ahead_ascii(unsigned char source[], int in_length, int in_locn, char current_mode, int symbol_mode, int end_char, int cw[], int* cw_len, int* encoded, int gs1) {
|
static float look_ahead_ascii(unsigned char source[], int in_length, int in_locn, char current_mode, int symbol_mode, int end_char, int cw[], int* cw_len, int* encoded, int gs1) {
|
||||||
int codeword_count = 0;
|
int codeword_count = 0;
|
||||||
int i;
|
int i;
|
||||||
int first_digit, second_digit, done;
|
int first_digit, second_digit, done;
|
||||||
@ -350,7 +349,7 @@ float look_ahead_ascii(unsigned char source[], int in_length, int in_locn, char
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_subset(unsigned char source[], int in_length, int in_locn) {
|
static int get_subset(unsigned char source[], int in_length, int in_locn) {
|
||||||
int fragno;
|
int fragno;
|
||||||
int subset = 0;
|
int subset = 0;
|
||||||
|
|
||||||
@ -375,7 +374,7 @@ int get_subset(unsigned char source[], int in_length, int in_locn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Encode characters in the C43 compaction submode */
|
/* Encode characters in the C43 compaction submode */
|
||||||
float look_ahead_c43(unsigned char source[], int in_length, int in_locn, char current_mode, int end_char, int cw[], int* cw_len, int* encoded, int gs1) {
|
static float look_ahead_c43(unsigned char source[], int in_length, int in_locn, char current_mode, int end_char, int cw[], int* cw_len, int* encoded, int gs1) {
|
||||||
int codeword_count = 0;
|
int codeword_count = 0;
|
||||||
int subcodeword_count = 0;
|
int subcodeword_count = 0;
|
||||||
int i;
|
int i;
|
||||||
@ -567,7 +566,7 @@ float look_ahead_c43(unsigned char source[], int in_length, int in_locn, char cu
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Produces a set of codewords which are "somewhat" optimised - this could be improved on */
|
/* Produces a set of codewords which are "somewhat" optimised - this could be improved on */
|
||||||
int ultra_generate_codewords(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length, int codewords[]) {
|
static int ultra_generate_codewords(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length, int codewords[]) {
|
||||||
int i;
|
int i;
|
||||||
int crop_length;
|
int crop_length;
|
||||||
int codeword_count = 0;
|
int codeword_count = 0;
|
||||||
@ -762,7 +761,7 @@ int ultra_generate_codewords(struct zint_symbol *symbol, const unsigned char sou
|
|||||||
mode[input_locn] = '8';
|
mode[input_locn] = '8';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mode[input_locn] = '\0';
|
mode[crop_length] = '\0';
|
||||||
|
|
||||||
if (symbol->debug & ZINT_DEBUG_PRINT) {
|
if (symbol->debug & ZINT_DEBUG_PRINT) {
|
||||||
printf("Mode: %s (%zu)\n", mode, strlen(mode));
|
printf("Mode: %s (%zu)\n", mode, strlen(mode));
|
||||||
@ -824,7 +823,7 @@ INTERNAL int ultracode(struct zint_symbol *symbol, const unsigned char source[],
|
|||||||
int total_cws;
|
int total_cws;
|
||||||
int pads;
|
int pads;
|
||||||
int cw_memalloc;
|
int cw_memalloc;
|
||||||
int codeword[282 + 4];
|
int codeword[282 + 3]; // Allow for 3 pads in final 57th (60th incl. clock tracks) column of 5-row symbol (57 * 5 == 285)
|
||||||
int i, j, locn;
|
int i, j, locn;
|
||||||
int total_height, total_width;
|
int total_height, total_width;
|
||||||
char tilepat[6];
|
char tilepat[6];
|
||||||
@ -856,11 +855,14 @@ INTERNAL int ultracode(struct zint_symbol *symbol, const unsigned char source[],
|
|||||||
if (symbol->debug & ZINT_DEBUG_PRINT) {
|
if (symbol->debug & ZINT_DEBUG_PRINT) {
|
||||||
printf("Codewords returned = %d\n", data_cw_count);
|
printf("Codewords returned = %d\n", data_cw_count);
|
||||||
}
|
}
|
||||||
#ifdef ZINT_TEST
|
#ifdef ZINT_TEST
|
||||||
if (symbol->debug & ZINT_DEBUG_TEST) {
|
if (symbol->debug & ZINT_DEBUG_TEST) {
|
||||||
debug_test_codeword_dump_int(symbol, data_codewords, data_cw_count);
|
debug_test_codeword_dump_int(symbol, data_codewords, data_cw_count);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
data_cw_count += 2; // 2 == MCC + ACC (data codeword count includes start char)
|
||||||
|
|
||||||
/* Default ECC level is EC2 */
|
/* Default ECC level is EC2 */
|
||||||
if ((symbol->option_1 <= 0) || (symbol->option_1 > 6)) {
|
if ((symbol->option_1 <= 0) || (symbol->option_1 > 6)) {
|
||||||
ecc_level = 2;
|
ecc_level = 2;
|
||||||
@ -886,7 +888,7 @@ INTERNAL int ultracode(struct zint_symbol *symbol, const unsigned char source[],
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Maximum capacity is 282 codewords */
|
/* Maximum capacity is 282 codewords */
|
||||||
total_cws = data_cw_count + qcc + 5;
|
total_cws = data_cw_count + qcc + 3; // 3 == TCC pattern + RSEC pattern + QCC pattern
|
||||||
if (total_cws > 282) {
|
if (total_cws > 282) {
|
||||||
strcpy(symbol->errtxt, "591: Data too long for selected error correction capacity");
|
strcpy(symbol->errtxt, "591: Data too long for selected error correction capacity");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
@ -894,7 +896,7 @@ INTERNAL int ultracode(struct zint_symbol *symbol, const unsigned char source[],
|
|||||||
|
|
||||||
rows = 5;
|
rows = 5;
|
||||||
for (i = 2; i >= 0; i--) {
|
for (i = 2; i >= 0; i--) {
|
||||||
if (total_cws < ultra_maxsize[i]) {
|
if (total_cws - 6 <= ultra_maxsize[i]) { // Total codewords less 6 overhead (Start + MCC + ACC + 3 TCC/RSEC/QCC patterns)
|
||||||
rows--;
|
rows--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -906,6 +908,7 @@ INTERNAL int ultracode(struct zint_symbol *symbol, const unsigned char source[],
|
|||||||
pads = rows - (total_cws % rows);
|
pads = rows - (total_cws % rows);
|
||||||
columns = (total_cws / rows) + 1;
|
columns = (total_cws / rows) + 1;
|
||||||
}
|
}
|
||||||
|
columns += columns / 15; // Secondary vertical clock tracks
|
||||||
|
|
||||||
if (symbol->debug & ZINT_DEBUG_PRINT) {
|
if (symbol->debug & ZINT_DEBUG_PRINT) {
|
||||||
printf("Calculated size is %d rows by %d columns\n", rows, columns);
|
printf("Calculated size is %d rows by %d columns\n", rows, columns);
|
||||||
@ -915,7 +918,7 @@ INTERNAL int ultracode(struct zint_symbol *symbol, const unsigned char source[],
|
|||||||
for (i = 282; i > 2; i--) {
|
for (i = 282; i > 2; i--) {
|
||||||
data_codewords[i] = data_codewords[i - 2];
|
data_codewords[i] = data_codewords[i - 2];
|
||||||
}
|
}
|
||||||
data_codewords[1] = data_cw_count += 2; // MCC
|
data_codewords[1] = data_cw_count; // MCC
|
||||||
data_codewords[2] = acc; // ACC
|
data_codewords[2] = acc; // ACC
|
||||||
|
|
||||||
locn = 0;
|
locn = 0;
|
||||||
@ -948,7 +951,7 @@ INTERNAL int ultracode(struct zint_symbol *symbol, const unsigned char source[],
|
|||||||
}
|
}
|
||||||
|
|
||||||
total_height = (rows * 6) + 1;
|
total_height = (rows * 6) + 1;
|
||||||
total_width = columns + 6 + (columns / 15);
|
total_width = columns + 6;
|
||||||
|
|
||||||
/* Build symbol */
|
/* Build symbol */
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
|
Loading…
Reference in New Issue
Block a user