extract code to own method for faster JPX decoding