Search code examples
qr-code

How should I interpret Table 9 in the QR Code ISO IEC 18004 2015 Standard wrt number of blocks?


I have concatenated my data, added mode info and data length, terminator, etc, and now it's time to divide the data into blocks for processing by the EC. Page 37 says

Depending on the Version and Error Correction Level, the data codeword sequence shall be subdivided into one or more blocks, to each of which the error correction algorithm shall be applied separately. Table 9 lists, for each version and Error Correction Level, the total number of codewords, the total number of error correction codewords, and the structure and number of error correction blocks.

Which seems straightforward enough. However, in the Table, for symbols Version 5 and upwards, there are more rows in the "Number of error correction blocks" cell than there are in the corresponding "Error correction level" cell. How do I know which EC block partition format belongs to which EC level?

Example: Version 4 has the lines/rows "1,2,2,4" in the "Number of error correction blocks" cell, seemingly aligned to the EC levels L, M, Q, H, respectively. However, Version 5 has the lines/rows "1,2,2,2,2,2" in the "Number of error correction blocks" cell. In my humble/uninformed opinion, the implied format of the table breaks down a bit at that point. How do I know which blocks, and in what way, the data should be divided?

Some sources on the net mentions that the blocks can be further subdivided into blocks, (possibly giving rise to "groups"?). I don't really gather that from the wording in the document though. It seems that there is quite some deduction to be made form clues I haven't yet picked up in the text.

Any input greatly appreciated! (Don't be afraid to go into overly pedagogical mode...)


Solution

  • So after having looked at various sources I believe the following:

    Table 9 actually makes sense with a little bit of reverse deduction on the table format. (A few vertical lines more in the cell ""Number of error correction blocks" would not have hurt.) So for example for Version 5 symbol there are 4 EC levels, of course, but 6 corresponding lines in the "Number of EC blocks" cell. We can deduct/guess which ones belong to which EC level by looking at the "Total number of codewords" and the "Number of error correction blocks" cells. The total number (TNC) is 134, and the first line of Number of error correction blocks (NUMEC[1]) says 1. The "Error correction code per block" (ECCPB)has the corresponding line (134, 108, 13) which means the block holds 134 codewords, which is the same as TNC. So we "guess" that the first line corresponds to EC Level L.

    NUMEC[2] says 2, with ECCPB saying 67,43,12. 2x67 = 134, which corresponds to TNC. It seems thus that those blocks will suffice to fill TNC and we can only arrive at that corresponding to EC Level M.

    Now, in the next line in the ECCPB cell, we have a 2, corresponding to 33,15,9. 2x33 = 66, which does NOT amount to TNC, and so we understand (apparently) that we need more blocks. The next line in NUMEC is a 2 => 34, 12,11. 2x33 + 2x34 = 134, so it seems these two lines correspond to a whole symbol, and thus contain the info for EC Level Q.

    Next, for level H, we have 2x33 + 2x34 again (but with fewer data cws and higher error correction capacity. 33,11,11 vs the Q level 33,15,9, for example), making up a whole symbol (or at least TNC).

    So generally when looking at lines in NUMEC, we can go from the top and find the lines that sum to TNC to assign them to an EC Level, and then continue down. The error correction capacity and the "similar" number of codewords in the ECCPB cell is also a clue.

    The example for V5-H in section 7.6 also gives some clues/confirmation as to how it's done.