CHAPTER 15 /JPEG-LS LOSSLESS AND NEAR LOSSLESS IMAGE COMPRESSION
309
indicate this hit. At this point the value of
RUNidx
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
RUNidx
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
rk
bits are transmitted to indicate the
length of the run (this must be <
2 rk
- 1). The value of
RUNidx
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
Ra
that started the run or its neighbor
Rb
as the prediction without further
correction.
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.
15.3 SUMMARY
Figure 15.10 illustrates near lossless coding for the
sensin
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
sensin
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
sensin
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 books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.