Connexions

You are here: Home » Content » Use of Laplacian PDFs in Image Compression
Content Actions

Use of Laplacian PDFs in Image Compression

Module by: Nick Kingsbury

Summary: This module introduces the use of Laplacian PDFs in image compression.

It is found to be appropriate and convenient to model the distribution of many types of transformed image coefficients by Laplacian distributions. It is appropriate because much real data is approximately modeled by the Laplacian probability density function (PDF), and it is convenient because the mathematical form of the Laplacian PDF is simple enough to allow some useful analytical results to be derived.
A Laplacian PDF is a back-to-back pair of exponential decays and is given by:
px=12x0-|x|x0 p x 1 2 x0 x x0 (1)
where x0 x0 is the equivalent of a time constant which defines the width of the PDF from the centre to the 1 1 points. The initial scaling factor ensures that the area under px p x is unity, so that it is a valid PDF. Figure 1 shows the shape of px p x .
figure14.png
Figure 1: Laplacian PDF, px p x , and typical quantiser decision thresholds, shown for the case when the quantiser step size Q=2x0 Q 2 x0
The mean of this PDF is zero and the variance is given by:
vx0=-x2pxdx=2x22x0-xx0dx=2x02 v x0 x x 2 p x 2 x x 2 2 x0 x x0 2 x0 2 (2)
(using integration by parts twice).
Hence the standard deviation is:
σx0=vx0=2x0 σ x0 v x0 2 x0 (3)
Given the variance (power) of a subimage of transformed pels, we may calculate x0 x0 and hence determine the PDF of the subimage, assuming a Laplacian shape. We now show that, if we quantise the subimage using a uniform quantiser with step size QQ, we can calculate the entropy of the quantised samples and thus estimate the bit rate needed to encode the subimage in bits/pel. This is a powerful analytical tool as it shows how the compressed bit rate relates directly to the energy of a subimage. The vertical dashed lines in Figure 1 show the decision thresholds for a typical quantiser for the case when Q=2x0 Q 2 x0 .
First we analyse the probability of a pel being quantised to each step of the quantiser. This is given by the area under px p x between each adjacent pair of quantiser thresholds.
  • Probability of being at step 0, p0=Pr-12Q<x<12Q=2Pr0<x<12Q p0 1 2 Q x 1 2 Q 2 0 x 1 2 Q
  • Probability of being at step kk, pk=Prk-12Q<x<k+12Q pk k 1 2 Q x k 1 2 Q
First, for x2x10 x2 x1 0 , we calculate: Prx1<x<x2=x1x2pxdx=-12-xx0|x1x2=12-x1x0--x2x0 x1 x x2 x x1 x2 p x x1 x2 1 2 x x0 1 2 x1 x0 x2 x0 Therefore,
p0=1--Q2x0 p0 1 Q 2 x0 (4)
and, for k1 k 1 ,
pk=12-k-12Qx0--k+12Qx0=sinhQ2x0-kQx0 pk 1 2 k 1 2 Q x0 k 1 2 Q x0 Q 2 x0 k Q x0 (5)
By symmetry, if kk is nonzero, p - k =pk=sinhQ2x0-|k|Qx0 p - k pk Q 2 x0 k Q x0
Now we can calculate the entropy of the subimage:
H=-k=-pklog2pk=-p0log2p0-2k=1pklog2pk H k pk 2 pk p0 2 p0 2 k 1 pk 2 pk (6)
To make the evaluation of the summation easier when we substitute for pk pk , we let pk=αrk pk α r k where α=sinhQ2x0 α Q 2 x0 and r=-Qx0 r Q x0 . Therefore,
k=1pklog2pk=k=1αrklog2αrk=k=1αrklog2α+klog2r=αlog2αk=1rk+αlog2rk=1krk k 1 pk 2 pk k 1 α r k 2 α r k k 1 α r k 2 α k 2 r α 2 α k 1 r k α 2 r k 1 k r k (7)
Now k=1rk=r1-r k 1 r k r 1 r and, differentiating by rr: k=1krk-1=11-r2 k 1 k r k 1 1 1 r 2 . Therefore,
k=1pklog2pk=αlog2αr1-r+αlog2rr1-r2=αr1-rlog2α+log2r1-r k 1 pk 2 pk α 2 α r 1 r α 2 r r 1 r 2 α r 1 r 2 α 2 r 1 r (8)
and
p0log2p0=1-rlog21-r p0 2 p0 1 r 2 1 r (9)
Hence the entropy is given by:
H=-1-rlog21-r-2αr1-rlog2α+log2r1-r H 1 r 2 1 r 2 α r 1 r 2 α 2 r 1 r (10)
Because both αα and rr are functions of Qx0 Q x0 , then HH is a function of just Qx0 Q x0 too. We expect that, for constant QQ, as the energy of the subimage increases, the entropy will also increase approximately logarithmically, so we plot HH against x0Q x0 Q in dB in Figure 2. This shows that our expectations are born out.
figure15.png
Figure 2: Entropy HH and approximate entropy Ha Ha of a quantised subimage with Laplacian PDF, as a function of x0Q x0 Q in dB.
We can show this in theory by considering the case when x0Q1 x0 Q 1 , when we find that: αQ2x0 α Q 2 x0 r1-Qx01-2α r 1 Q x0 1 2 α r1-α r 1 α Using the approximation log21-ε-εln2 2 1 ε ε 2 for small εε, it is then fairly straightforward to show that H-log2α+1ln2log22x0Q H 2 α 1 2 2 2 x0 Q We denote this approximation as Ha Ha in Figure 2, which shows how close to HH the approximation is, for x0>Q x0 Q (i.e. for x0Q>0 x0 Q 0 dB).
We can compare the entropies calculated using Equation 10 with those that were calculated from the bandpass subimage histograms, as given in these figures describing Haar transform energies and entropies; level 1 energies, level 2 energies, level 3 energies, and level 4 energies. (The Lo-Lo subimages have PDFs which are more uniform and do not fit the Laplacian model well.) The values of x0 x0 are calculated from: x0=std.  dev.2=subimage  energy2  (no  of  pels  in  subimage) x0 std.  dev. 2 subimage  energy 2  (no  of  pels  in  subimage) The following table shows this comparison:
Transform level Subimage type Energy (× 106 10 6 ) No of pels x0 x0 Laplacian entropy Measured entropy
1 Hi-Lo 4.56 16384 11.80 2.16 1.71
1 Lo-Hi 1.89 16384 7.59 1.58 1.15
1 Hi-Hi 0.82 16384 5.09 1.08 0.80
2 Hi-Lo 7.64 4096 30.54 3.48 3.00
2 Lo-Hi 2.95 4096 18.98 2.81 2.22
2 Hi-Hi 1.42 4096 13.17 2.31 1.75
3 Hi-Lo 13.17 1024 80.19 4.86 4.52
3 Lo-Hi 3.90 1024 43.64 3.99 3.55
3 Hi-Hi 2.49 1024 34.87 3.67 3.05
4 Hi-Lo 15.49 256 173.9 5.98 5.65
4 Lo-Hi 6.46 256 112.3 5.35 4.75
4 Hi-Hi 3.29 256 80.2 4.86 4.38
We see that the entropies calculated from the energy via the Laplacian PDF method (second column from the right) are approximately 0.5 bit/pel greater than the entropies measured from the Lenna subimage histograms. This is due to the heavier tails of the actual PDFs compared with the Laplacian exponentially decreasing tails. More accurate entropies can be obtained if x0 x0 is obtained from the mean absolute values of the pels in each subimage. For a Laplacian PDF we can show that
Mean  absolute  value=-|x|pxdx=20x2x0-xx0dx=x0 Mean  absolute  value x x p x 2 x 0 x 2 x0 x x0 x0 (11)
This gives values of x0 x0 that are about 20% lower than those calculated from the energies and the calculated entropies are then within approximately 0.2 bit/pel of the measured entropies.

Comments, questions, feedback, criticisms?

Send feedback