Wavelet-based Image Compression

Wavelets and compression
Dr Mike Spann
1
Contents




Scale and image compression
Signal (image) approximation/prediction –
simple wavelet construction
Statistical dependencies in wavelet
coefficients – why wavelet compression works
State-of-the-art wavelet compression
algorithms
2
Image at different scales
3
Correlation between features at
different scales
4
Wavelet construction – a simplified
approach



Traditional approaches to wavelets have used
a filterbank interpretation
Fourier techniques required to get synthesis
(reconstruction) filters from analysis filters
Not easy to generalize
5
Wavelet construction – lifting
3 steps

Split

Predict (P step)

Update (U step)
6
Example – the Haar wavelet

S step
Splits the signal into odd and even samples
sn
en1 even samples
on 1
odd samples
7
Example – the Haar wavelet

P step
Predict the odd samples from the even samples
s n ,l
l
For the Haar wavelet, the prediction for the
odd sample is the previous even sample :
sˆn , 2l 1  sn , 2l
8
Example – the Haar wavelet
Detail signal : d n 1,l  s n , 2l 1  s n, 2l
s n ,l
d n 1,l
l
l
9
Example – the Haar wavelet

U step
Update the even samples to produce the next
coarser scale approximation
s n 1,l  s n , 2l  d n 1,l / 2
The signal average is maintained :
2 n1 1
s
l 0
2 n 1
n 1,l
 1 / 2  s n ,l
l 0
10
Summary of the Haar wavelet
decomposition
d n 1,l  s n , 2l 1  s n , 2l
s n 1,l  s n , 2l  d n 1,l / 2
Can be computed ‘in place’ :
….. sn , 2l 1
sn , 2 l
-1
sn , 2l 1 …..
-1
d n 1,l 1
sn , 2 l
1/2
P step
d n 1,l
1/2
d n 1,l 1
sn 1,l
d n 1,l
U step
11
Inverse Haar wavelet transform

Simply run the forward Haar wavelet transform
backwards!
sn , 2l  sn 1,l  d n 1,l / 2
sn , 2l 1  sn , 2l  d n 1,l
Then merge even and odd samples
sn , 2 l
sn , 2l 1
Merge
s n ,l
12
General lifting stage of wavelet
decomposition
e j 1
+
sj
P
Split
-
o j 1
s j 1
U
d j 1
13
Multi-level wavelet decomposition

We can produce a multi-level decomposition by
cascading lifting stages
sn
lift
sn1
…
lift
d n 1
d n2
lift
s0
d0
14
General lifting stage of inverse
wavelet synthesis
s j 1
e j 1
-
U
d j 1
P
Merge
sj
+
o j 1
15
Multi-level inverse wavelet synthesis

We can produce a multi-level inverse wavelet
synthesis by cascading lifting stages
s0
lift
s1
lift
s2
…...
sn1
lift
sn
d0
d1
d2
d n 1
16
Advantages of the lifting
implementation

Inverse transform
 Inverse transform is trivial – just run the code
backwards
 No need for Fourier techniques
 Generality
 The design of the transform is performed without
reference to particular forms for the predict and
update operators
 Can even include non-linearities (for integer wavelets)
17
Example 2 – the linear spline wavelet


A more sophisticated wavelet – uses slightly
more complex P and U operators
Uses linear prediction to determine odd samples
from even samples
18
The linear spline wavelet

P-step – linear prediction
Original signal
Linear prediction at
odd samples
Detail signal (prediction error
at odd samples)
19
The linear spline wavelet

The prediction for the odd samples is based
on the two even samples either side :
sˆn , 2l 1  1 / 2sn, 2l  sn , 2l  2 
d n 1,l  sn , 2l 1  1 / 2sn , 2l  sn , 2l  2 
20
The linear spline wavelet

The U step – use current and previous detail
signal sample
sn 1,l  sn , 2l  1 / 4(d n 1,l 1  d n 1,l )
21
The linear spline wavelet

Preserves signal average and first-order
moment (signal position) :
2 n1 1
s
l 0
2 n 1
n 1,l
2 n 1 1
 ls
l 0
 1 / 2  s n ,l
l 0
2 n 1
n 1,l
 1 / 2  ls n,l
l 0
22
The linear spline wavelet

Can still implement ‘in place’
s n , 2l
-1/2
sn , 2l 1
-1/2
s n , 2l
1/4
-1/2
d n 1,l
1/4
sn 1,l
sn , 2 l  2
P step
1/4
U step
sn , 2 l  2
1/4
d n 1,l
-1/2
sn 1,l 1
23
Summary of linear spline wavelet
decomposition
d n 1,l  sn , 2l 1  1 / 2sn , 2l  sn , 2l  2 
sn 1,l  sn , 2l  1 / 4(d n 1,l 1  d n 1,l )
Computing the inverse is trivial :
sn , 2l  sn 1,l  1 / 4(d n 1,l 1  d n 1,l )
sn , 2l 1  d n 1,l  1 / 2sn , 2l  sn , 2l  2 
The even and odd samples are then merged as before
24
Wavelet decomposition applied to a
2D image
approx
lift
.
.
.
.
lift.
detail
approx
detail
25
Wavelet decomposition applied to a
2D image
approx
lift
detail
i n 1,n 1
lift
approx
lift
detail
d n11,n1
approx
lift
detail
detail
d n21,n1
approx
d n31,n1
26
Why is wavelet-based compression
effective?


Allows for intra-scale prediction (like many
other compression methods) – equivalently
the wavelet transform is a decorrelating
transform just like the DCT as used by JPEG
Allows for inter-scale (coarse-fine scale)
prediction
27
Why is wavelet-based compression
effective?
Original
1 level Haar
1 level linear spline
2 level Haar
28
Why is wavelet-based compression
effective?

Wavelet coefficient histogram
25000
20000
15000
Original
Haar wavelet
10000
5000
0
-255
-205
-155
-105
-55
-5
45
95
145
195
245
29
Why is wavelet-based compression
effective?

Coefficient entropies
Entropy
Original image
7.22
1-level Haar wavelet
5.96
1-level linear spline wavelet
5.53
2-level Haar wavelet
5.02
2-level linear spline wavelet
4.57
30
Why is wavelet-based compression
effective?

Wavelet coefficient dependencies
P( X )
X
31
Why is wavelet-based compression
effective?


Lets define sets S (small) and L (large)
wavelet coefficients
The following two probabilities
describe interscale dependancies
P( X  S | P( X )  S )
P ( X  L | P ( X )  L)
32
Why is wavelet-based compression
effective?

Without interscale dependancies
#S
P( X  S | P( X )  S )  2
N
#L
P ( X  L | P ( X )  L)  2
N
33
Why is wavelet-based compression
effective?

Measured dependancies from Lena
P( X  S | P( X )  S )
0.886
P ( X  L | P ( X )  L)
0.529
#S
N2
0.781
#L
N2
0.219
34
Why is wavelet-based compression
effective?

Intra-scale dependencies
X1
X
X8
1 8
c   c( X n )
8 n 1
X n  S
X n  L
if c  T
if c  T
35
Why is wavelet-based compression
effective?

Measured dependancies from Lena
P( X  S | X n  S ) P( X  L | X n  L)
0.912
0.623
#S
N2
0.781
#L
N2
0.219
36
Why is wavelet-based compression
effective?

Have to use a causal neighbourhood for
spatial prediction
37
Example image compression
algorithms

We will look at 3 state of the art
algorithms

Set partitioning in hierarchical sets (SPIHT)

Significance linked connected components
analysis (SLCCA)

Embedded block coding with optimal
truncation (EBCOT) which is the basis of
JPEG2000
38
The SPIHT algorithm

Coefficients transmitted in partial order
11 12 13 14…….
Coeff. number
1
2
3
4
5
6
7
8
9
10
msb 5
1
1
0
0
0
0
0
0
0
0
0
0
0
0
…
4
x
x
1
1
0
0
0
0
0
0
0
0
0
0
…
3
x
x
x
x
1
1
1
0
0
0
0
0
0
0
…
2
x
x
x
x
x
x
x
1
1
1
1
1
1
0
…
1
x
x
x
x
x
x
x
x
x
x
x
x
x
1
…
lsb 0
x
x
x
x
x
x
x
x
x
x
x
x
x
x
…
39
The SPIHT algorithm

2 components to the algorithm



Sorting pass
Sorting information is transmitted on the basis of
the most significant bit-plane
Refinement pass

Bits in bit-planes lower than the most significant
bit plane are transmitted
40
The SPIHT algorithm
N= msb of (max(abs(wavelet coefficient)))
for (bit-plane-counter)=N downto 1
transmit significance/insignificance wrt bit-plane
counter
transmit refinement bits of all coefficients that
are already significant
41
The SPIHT algorithm

Insignificant coefficients (with respect to
current bitplane counter) organised into
zerotrees
42
The SPIHT algorithm

Groups of coefficients made into zerotrees
by set paritioning
43
The SPIHT algorithm

SPIHT produces an embedded bitstream
bitstream
….1100101011100101100011………01011100010111011011101101….
44
The SLCCA algorithm
Wavelet
transform
Quantise
coefficients
Cluster and
transmit
significance
map
Bit-plane
encode
significant
coefficients
45
The SLCCA algorithm

The significance map is grouped into
clusters
46
The SLCCA algorithm

Clusters grown out from a seed
Seed
Significant coeff
Insignificant coeff
47
The SLCCA algorithm

Significance link symbol
Significance
link
48
Image compression results

Evaluation

Mean squared error

Human visual-based metrics

Subjective evaluation
49
Image compression results

Mean-squared error
1
mse  2
N
ˆ

(
I
(
r
,
c
)

I
(r , c) 

2
N 1
r ,c  0
Usually expressed as peak-signal-to-noise (in dB)
PSNR(dB)  10 log 10
2
255
mse
50
Image compression results
43
PSNR(dB)
41
39
37
35
SPIHT
33
SLCCA
31
JPEG
29
27
25
0.2
0.4
0.6
0.8
1
1.2
bit-rate (bits/pixel)
51
Image compression results
43
PSNR(dB)
41
39
37
35
Haar
33
Linear spline
31
Daubechies 9-7
29
27
25
0.2
0.4
0.6
0.8
1
1.2
bit-rate (bits/pixel)
52
Image compression results
SPIHT 0.2 bits/pixel
JPEG 0.2 bits/pixel
53
Image compression results
SPIHT
JPEG
54
EBCOT, JPEG2000




JPEG2000, based on embedded block coding
and optimal truncation is the state-of-the-art
compression standard
Wavelet-based
It addresses the key issue of scalability
 SPIHT is distortion scalable as we have
already seen
 JPEG2000 introduces both resolution and
spatial scalability also
An excellent reference to JPEG2000 and
compression in general is “JPEG2000” by
D.Taubman and M. Marcellin
55
EBCOT, JPEG2000

Resolution scalability is the ability to extract
from the bitstream the sub-bands
representing any resolution level
bitstream
….1100101011100101100011………01011100010111011011101101….
56
EBCOT, JPEG2000

Spatial scalability is the ability to extract from
the bitstream the sub-bands representing
specific regions in the image

bitstream
Very useful if we want to selectively decompress
certain regions of massive images
….1100101011100101100011………01011100010111011011101101….
57
Introduction to EBCOT



JPEG2000 is able to implement this general
scalability by implementing the EBCOT
paradigm
In EBCOT, the unit of compression is the
codeblock which is a partition of a wavelet
sub-band
Typically, following the wavelet
transform,each sub-band is partitioned into
small blocks (typically 32x32)
58
Introduction to EBCOT

Codeblocks – partitions of wavelet subbands
codeblock
59
Introduction to EBCOT

L0
A simple bit stream organisation could
comprise concatenated code block bit
streams
CB0
L1
Length of next
code-block stream
CB1
L2 CB2
……
60
Introduction to EBCOT


This simple bit stream structure is resolution
and spatially scalable but not distortion
scalable
Complete scalability is obtained by
introducing quality layers


Each code block bitstream is individually
(optimally) truncated in each quality layer
Loss of parent-child redundancy more than
compensated by ability to individually optimise
separate code block bitstreams
61
Introduction to EBCOT

Each code block bit stream partitioned
into a set of quality layers
LQ0
L00
CB00
L10
Q0
CB10
L10
LQ1
L02 CB20
CB01
L11
Q1
…
…
CB11
L12 CB21
…
62
EBCOT advantages

Multiple scalability


Efficient compression


Distortion, spatial and resolution scalability
This results from independent optimal truncation
of each code block bit stream
Local processing

Independent processing of each code block allows
for efficient parallel implementations as well as
hardware implementations
63
EBCOT advantages

Error resilience

Again this results from independent code
block processing which limits the influence
of errors
64
Performance comparison

A performance comparison with other
wavelet-based coders is not straightforward
as it would depend on the target bit rates
which the bit streams were truncated for



With SPIHT, we simply truncate the bit stream
when the target bit rate has been reached
However, we only have distortion scalability with
SPIHT
Even so, we still get favourable PSNR (dB)
results when comparing EBCOT (JPEG200)
with SPIHT
65
Performance comparison

We can understand this more fully by
looking at graphs of distortion (D)
against rate (R) (bitstream length)
D
Truncation
points
R-D curve for
continuously modulated
quantisation step size
R
66
Performance comparison

Truncating the bit stream to some
arbitrary rate will yield sub-optimal
performance
D
R
67
Performance comparison
43
PSNR(dB)
41
39
37
35
Spiht
33
31
EBCOT/JPEG2000
29
27
25
0.0625
0.125
0.25
0.5
1
bit-rate (bits/pixel)
68
Performance comparison

Comparable PSNR (dB) results between
EBCOT and SPIHT even though:



Results for EBCOT are for 5 quality layers
(5 optimal bit rates)
Intermediate bit rates sub-optimal
We have resolution, spatial, distortion
scalability in EBCOT but only distortion
scalability in SPIHT
69