Fix JBIG2 decoding issue #5026

This PR fixes two issues that caused #5026:

1. There was a `0` was missing in the old template (I think Figure 8 in the [draft](http://www.jpeg.org/public/fcd14492.pdf#page=44) is slightly wrong, the leftmost zero should be in thick borders). Up to the missing zero, the old constants (almost) matched those in xpdf.
2. We are sorting the template since 7b5b5178efec7068d5c926e2c0057e2a59a670e2, and so the template bits must be reordered as well. The new constants match those in [jbig2dec](https://github.com/rillian/jbig2dec/blob/master/jbig2_generic.c).