Vous êtes sur la page 1sur 17

Wavelet Transform

Group 820
System Architecture

Haar Transform

EZW

Arithmetic Coding
Haar Wavelet Transform Haar Transform

EZW

To calculate the Haar transform of an array of samples:


Arithmetic Coding
1. Find the average of each pair of samples.
2. Find the difference between the average and the samples.
3. Fill the first half of the array with averages.
4. Normalize
5. Fill the second half of the array with differences.
6. Recurse - repeat the process on the first half of the array.
(Note: The array length should be a power of two)

1. 1+3 / 2 = 2
Signal 1 3 5 7 2. 1 - 2 = -1
1. Iteration 3. Insert
2 6 -1 -1
4. Normalize
2. Iteration 4 -2 -1 -1 5. Insert
6. Recurse
Haar Wavelet Transform Haar Transform

EZW

Arithmetic Coding
Signal 1
3
5
Signal
7
[1 3 5 7 ]

Signal recreated from 2 coefficients


2. Iteration 4
[2 2 6 6 ]
-2

-1

-1
Haar Basis Haar Transform

EZW

Arithmetic Coding

Lisa Haar Basis


System Architecture

Haar Transform

EZW

Arithmetic Coding
Encoding the Coefficients Haar Transform

EZW
• How do you encode the coefficients effectively?
Arithmetic Coding
•Various ad hoc methods
•Store 0 if coefficient is below some threshold
•Store coefficient if > threshold as (x,y,c)
•Suboptimal approach. Bad compression.
EZW – Embedded Zerotree of Wavelet Coefficients
Haar Transform
• Developed by Shapiro in 93
• Enabled wavelet compression to compete with JPEG EZW

• Builds on two observations:


Arithmetic Coding
1. Large coefficients are most important (contains most
information) and should be stored first.
2. Magnitude of coefficients decrease as one moves
from lower frequency subbands to higher frequencies.
• E: Embedded. Progressive algorithm
• Z: Zerotree. Quadtree data structure central to algorithm
• W: Wavelet. Designet specifically for wavelet compression
Why it works Haar Transform

EZW

Arithmetic Coding
How it works Haar Transform

threshold = 2^(floor(lg(max(c)))
EZW
do {
dominant pass (encode PS,NS,ZT,IZ) Arithmetic Coding

subordinate pass (refinement of PS and NS)


t /= 2
} while (PSNR < T1 && BITRATE < T2);

•Decode algorithm similar


•EBCOT used in JPEG2000 uses similar
algorithm
System Architecture

Haar Transform

EZW

Arithmetic Coding
Arithmetic Coding Haar Transform

EZW
• A symbol with the probability of 0.4 should ideally be
encoded with 1.32 bits. Arithmetic Coding

• Arithmetic Coding assigns one long code to entire stream!


Arithmetic Coding –
Encoding step Haar Transform

EZW
• Divide the interval of [0;1) into subintervals based on the
probabilities of the individual symbols
Arithmetic Coding
•Based on the symbol read from the input stream, select the
corresponding interval
•Divide this interval further into subinterval still based on
probabilities of the symbols
• Repeat the last two steps until the end of input stream
Arithmetic Coding –
Example of the encoding Haar Transform

EZW
• Input: ABAABB
Arithmetic Coding
•p(A)=0.5 and p(B) = 0.5
•A’s interval [0;0.5)
•B’s interval [0.5;1)
•Upper and lower determines current interval
•A1: lower = 0, upper = 0.5
•B1: lower = 0.25, upper = 0.5
•…..
•B3: lower = 0.34375, upper = 0.375
Arithmetic Coding –
Example of the encoding Haar Transform

EZW
•Final interval: [0.34375;0.375)
Arithmetic Coding
•We choose 0.36 and throw away 0. -> 36 is a code for the
string ABAABB
• =6 bit
Arithmetic Coding –
Decoding Haar Transform

EZW
• From the code the initial interval is determined
Arithmetic Coding
• For next symbol (Repeat until done):
• Subtract lower limit of previous
• Divide by width of subinterval
Result

13 48
5

Vous aimerez peut-être aussi