levigo / jbig2-imageio

A Java ImageIO plugin for the JBIG2 bi-level image format
Apache License 2.0
31 stars 19 forks source link

Lower range lines in standard Huffman tables #29

Closed janpe2 closed 7 years ago

janpe2 commented 7 years ago

Fixes #27. There is a problem in lower range lines of standard Huffman tables. The JBIG2 standard lists the predefined tables in Annex B. For example, table B.3 specifies the range of values -infinity...-257 (VAL column) for the lower range line of this table. In StandardTables.java, the value Integer.MIN_VALUE has been used as the rangeLow (to represent -infinity). This is incorrect. Instead, the value -257 should be used as rangeLow. Lower range lines are special, so the upper end of the VAL range is used as rangeLow.

This problem appears 8 times in StandardTables.java because there are 8 lower range lines in total.

janpe2 commented 7 years ago

There seems to be a Travis CI error caused by the image from issue #21. Indeed, the decoding results of that image will change if you apply my pull request. Some additional text appears at the bottom of the image: "Contract No. OPP 0000373" and "Hard Copy Not Controlled...". Earlier they were not shown. Thus my pull request is needed also to decode the image of issue #21 successfully.

hennejg commented 7 years ago

Sorry for the delay in dealing with this pull request. We are currently in talks with the Apache PDFBox with the goal of donating this component the the ASF. Please see #31.

hennejg commented 7 years ago

Ping @janpe2

hennejg commented 7 years ago

Superseded by #36