I used this library as a reference while writing an rMQR encoder in Kotlin and cross-checked its tables against Zint (backend/qr.h). Three things came up.
-
R13x27, level M has k=14 in rmqr_versions.py, but number_of_data_bits for the same version and level is 96, which is 12 codewords. Zint also says 12.
-
R17x43, level M has c=60, while codewords_total for that version is 61. Zint also says 61.
-
_make_final_codewords breaks out of the block loop when a block has no codeword at the current index, instead of skipping that block. The short blocks come first, so once the first one runs out, the longer blocks never contribute their last data codeword. This affects the eight level M versions whose blocks differ in length:
q = rMQR('R13x139', ErrorCorrectionLevel.M)
q.add_segment('A' * 60)
q.make()
# len(final_codewords) is 165, codewords_total is 166
Using continue instead of break fixes it.
One more data point for 1 and 2: the block layout can be derived from total codewords, data codewords and block count, with the same number of EC codewords per block and the extra data codeword going to the last blocks. That reproduces your table for 62 of the 64 version and level combinations, and the two that do not match are exactly the entries above.
Happy to send a PR if that helps.
I used this library as a reference while writing an rMQR encoder in Kotlin and cross-checked its tables against Zint (
backend/qr.h). Three things came up.R13x27, level M has
k=14inrmqr_versions.py, butnumber_of_data_bitsfor the same version and level is 96, which is 12 codewords. Zint also says 12.R17x43, level M has
c=60, whilecodewords_totalfor that version is 61. Zint also says 61._make_final_codewordsbreaks out of the block loop when a block has no codeword at the current index, instead of skipping that block. The short blocks come first, so once the first one runs out, the longer blocks never contribute their last data codeword. This affects the eight level M versions whose blocks differ in length:Using
continueinstead ofbreakfixes it.One more data point for 1 and 2: the block layout can be derived from total codewords, data codewords and block count, with the same number of EC codewords per block and the extra data codeword going to the last blocks. That reproduces your table for 62 of the 64 version and level combinations, and the two that do not match are exactly the entries above.
Happy to send a PR if that helps.