I’ve recently written a very baseline JPEG-LS decoder (grayscale lossless only) and had to deal with some issues, some of them listed in JPEG-LS standard (ISO 14495, ITU T.87), some are not:
- Bitstream is escape-coded (after each byte 0xFF another zero-bit must be stuffed to avoid false JPEG markers detection). That requires special bitstream reader or another unescaped buffer.
- There is no definite way to reverse error-mapping of run termination symbol. Even the reference code use another technique.
- A lot of different modes (different bpps, pallettised images, two interleaving modes)
For now, lossless and near-lossless decoding is OK, plane and line interleaving are supported. With working decoder it will be simplier to write JPEG-LS encoder.
As I recently discovered, there is also ISO/IEC 14495-2 (or ITU T.870) standard – JPEG-LS extensions. For unknown reason ITU don’t send me another 3 free recs ID, yet I’ve managed to find some draft of this standard. Main changes: new mode – visual quantisation, new coding schemes – modified Golomb codes and arithmetic coding. I’m not sure if somebody support this anyway.
February: now grayscale/colour lossless/near-lossless JPEG-LS encoder and decoder are working (or simulate working well enough).