For JPX decoding only read next packet after checking for byte aligning.

This patch makes the image from #5349 appear correctly, however artefacts
for the last packet seem to still be there.
This patch also optimizes some "in-checks" and adds a few header parsings.
If it's incomplete sentence, you can move it line above (e.g. `case 16: // sRGB colorspace'). This way you can group the cases 16, 17 and 18, and add single break.