JPEGLS The new standard of lossless image compression











![JPEG-LS: Re-mapping example n n If the pixel value is in range [0, 255], JPEG-LS: Re-mapping example n n If the pixel value is in range [0, 255],](https://slidetodoc.com/presentation_image/7d40be8016d5a8c5be0abe9dadae203c/image-12.jpg)
![JPEG-LS: Re-map residuals The following example assumes pixel value is in [0, 7] -3 JPEG-LS: Re-map residuals The following example assumes pixel value is in [0, 7] -3](https://slidetodoc.com/presentation_image/7d40be8016d5a8c5be0abe9dadae203c/image-13.jpg)


- Slides: 15

JPEG-LS -- The new standard of lossless image compression School of Computer Science, University of Central Florida, VLSI and M-5 Research Group May, 1999

Predictive encoding n n Q: why prediction? A: to produce a more “skewed” set of sequence for entropy encoder Original sequence Prediction errors 20 21 125 126 30 31 32 20 1 104 1 1 1 Prediction example -96

Predictive encoding n n Lossless JPEG-LS CALIC ……

What’s wrong with Lossless JPEG ? C A n B X Lossless JPEG uses “static” predictor. The prediction model is determined before the compression starts

JPEG-LS is better because… n n n “Dynamic” predictor. The predictor is determined dynamically Simple edge detection algorithm is introduced to determine the predictor. Prediction refinement

JPEG-LS: initial prediction n n c b d a X Prediction algorithm: X is the pixel being encoded a, b and c used for initial prediction If c max(a, b) X^ = min(a, b) Else { If c min(a, b) X^ = max(a, b) Else X^= a + b- c }

JPEG-LS: initial prediction example n 103 100 d 102 X X is predicted as 100 since a vertical edge is detected n 99 100 d 102 X X is predicted as 102 since a horizontal edge is detected

JPEG-LS: refine the prediction n n JPEG-LS maintains 365 contexts. it is used to describe the local “characteristics” of pixels. Context of X is computed from a, b and d Each context maintains a bias, which can be considered as an evaluation of the predictor’s performance for that particular context. The bias is used for refinement of the initial prediction n n X’’ = X’ – B[q] where X’ is the initial prediction, X’’ is the refined prediction, q is the context of X and B is the bias

JPEG-LS: prediction refinement example n n 103 100 d 102 X X’ = 100 Suppose X is in context q and B[q] = -1, then X’’ = 100 – (-1) = 101

JPEG-LS: compute the prediction error, update the bias n Compute the prediction error as: n n Prediction Error = X – X’’ Update the context-dependent bias

Ready for entropy encoding? Wait……
![JPEGLS Remapping example n n If the pixel value is in range 0 255 JPEG-LS: Re-mapping example n n If the pixel value is in range [0, 255],](https://slidetodoc.com/presentation_image/7d40be8016d5a8c5be0abe9dadae203c/image-12.jpg)
JPEG-LS: Re-mapping example n n If the pixel value is in range [0, 255], the prediction error is in range [-255, 255] A larger range means more bits to represent the prediction error We need to re-map the prediction errors to [0, 255], is it possible? Yes. Since the prediction error always in range [-x”, 255 -x’’]
![JPEGLS Remap residuals The following example assumes pixel value is in 0 7 3 JPEG-LS: Re-map residuals The following example assumes pixel value is in [0, 7] -3](https://slidetodoc.com/presentation_image/7d40be8016d5a8c5be0abe9dadae203c/image-13.jpg)
JPEG-LS: Re-map residuals The following example assumes pixel value is in [0, 7] -3 6 -2 4 -1 2 0 0 1 1 2 3 3 5 4 7 Mistake in David Salomon’s book? X’’’ = 2 x’’ if x’’>=0 X’’’ = 2|x’’|-1 otherwise -3 -2 -1 0 1 2 3 4 5 3 1 0 2 4 6 8

JPEG-LS: entropy encoding n Finally entropy encoder is applied.

Summary of the basic steps of JPEG-LS n n n Find the initial prediction X^ Refine prediction by considering the bias of the context Compute the prediction error (residual) and update the bias of that context Re-map residuals Encode residuals using Golomb-Rice coder