This is another one I'm not 100% sure is a bug, but looks suspicious. The following block of code in qr.c seems to compare bit length to codeword count:
/* Ensure maxium error correction capacity */
if (est_binlen <= qr_data_codewords_M[version - 1]) {
ecc_level = LEVEL_M;
}
if (est_binlen <= qr_data_codewords_Q[version - 1]) {
ecc_level = LEVEL_Q;
}
if (est_binlen <= qr_data_codewords_H[version - 1]) {
ecc_level = LEVEL_H;
}
Similar code elsewhere in this file multiplies the codeword counts by 8 so that we're comparing bit lengths.
The equivalent Okapi code also multiplies the codeword count by 8:
/* Ensure maximum error correction capacity */
if (est_binlen <= (QR_DATA_CODEWORDS_M[version - 1] * 8)) {
ecc_level = EccMode.M;
}
if (est_binlen <= (QR_DATA_CODEWORDS_Q[version - 1] * 8)) {
ecc_level = EccMode.Q;
}
if (est_binlen <= (QR_DATA_CODEWORDS_H[version - 1] * 8)) {
ecc_level = EccMode.H;
}
Thanks Daniel,
Well spotted! The Okapi code is correct. I have now corrected Zint.
Robin.