pdf-association / pdf-issues

Industry-based resolutions for issues and errata reported against any PDF-related specification
https://pdf-issues.pdfa.org/
64 stars 2 forks source link

Rule for issuing LZW clear codes is unclear/confusing #255

Open pesco opened 1 year ago

pesco commented 1 year ago

Describe the bug 7.4.4.2, last Paragraph states:

[The encoder] shall issue a clear-table code when the table becomes full;

Reading this literally, it seems that the rule says that a clear code must be issued immediately after code number 4095 is assigned in step d) of the encoding cycle given in Paragraph 4. That would mean, however, that code 4095 can never actually be used, raising the question whether the intended meaning was to issue the clear code when the table would otherwise overflow, i.e. one output cycle later.

This is, of course, analogous to the meaning/issue of EarlyChange. Note, though, that Table 8 which describes that parameter does not mention clear codes. It only talks specifically about code length.

One way to clarify the rule would be to refer explicitly to the encoding sequence as defined in Paragraph 4. For example: "If the table is already full in step d) of the encoding sequence, the next code emitted shall be a clear code".

petervwyatt commented 1 year ago

@lrosenthol - would you care to comment?