indicate this hit. At this point the value of
is incremented by 1 and the process continues.
If an end of line is reached during a run that has not reached rm in length, a 1 is also transmitted;
however, the variable
is not changed. If the run ends in a length less than rm, then a miss
is indicated by the transmission of a 0 bit. After this bit
bits are transmitted to indicate the
length of the run (this must be <
2 rk
- 1). The value of
after a miss is decreased by 1. The
coding of the run interruption sample is similar to regular mode coding except that two separate
contexts are reserved for determining the coding used on this sample. In addition, the prediction
uses either the pixel
that started the run or its neighbor
as the prediction without further
15.2.3 JPEG-LS Decoding
Since the JPEG-LS encoding algorithm uses information available to the decoder, the decoding
process recapitulates many of the basic encoder functions. After decoding the entropy data, the
decoder either completes the run replication (in run mode) or reconstructs the error values (in
regular mode) and adds these to the predicted values (with the same corrections provided at the
encoder) to generate the image. Note that the context definitions and updates in the decoder are
also identical to those produced in the encoder.
Figure 15.10 illustrates near lossless coding for the
test image (8-bit grayscale). The
original image is shown on the top left (NEAR = 0). The reconstructed images for NEAR =
3, 7, and 15 are shown on the top fight, bottom left, and bottom fight, respectively. Note the
degradation in image qualitymparticularly in fiat regions such as the blackboardmas the value
of NEAR becomes larger.
The compression attained on the
image for varying values of NEAR is illustrated in
Table 15.1. By removing the restriction of lossless compression and replacing it with a near
lossless constraint that the maximum difference allowed in defining a run is 1, the compressed
file size drops nearly 40%, a savings of about 1.4 bits per pixel. By increasing NEAR to 3, an
additional 0.75 bits per pixel of compression are obtained. As was seen in Fig. 15.10, for larger
values of NEAR the additional compression probably is not worth the artifacts introduced by the
lossy codingmi.e., it is not near lossless compression, rather it is lossy compression. At these
lower rates, better image compression strategies exist [4].
Table 15.1 Compression in Bits per Pixel and Percentage of Original as NEAR Is Varied
from 0 (Lossless) to 15 for the 8-Bit Grayscale Image
NEAR Bits/Pixel % of Original
0 3.704 46.3%
1 2.281 28.5%
3 1.528 19.1%
7 1.093 13.7%
15 0.741 9.3%

Get Lossless Compression Handbook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.