Upload
amit-garg
View
21
Download
0
Embed Size (px)
DESCRIPTION
wavelet transform description
Citation preview
Wavelet TransformWavelet TransformGroup 820Group 820
System ArchitectureSystem Architecture
Haar Transform
EZW
Arithmetic Coding
Haar Wavelet TransformHaar Wavelet Transform
To calculate the Haar transform of an array of samples: 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)
11 33 55 77
1. Iteration
2. Iteration
1. 1+3 / 2 = 22. 1 - 2 = -13. Insert4. Normalize5. Insert6. Recurse
Signal
-1
-1-1
-1
6
-2
2
4
Haar Transform
EZW
Arithmetic Coding
Haar Wavelet TransformHaar Wavelet Transform
Signal 1
3
5
7
4
-2
-1
-1
2. Iteration
Signal
[ 1 3 5 7 ]
Signal recreated from 2 coefficients
[ 2 2 6 6 ]
Haar Transform
EZW
Arithmetic Coding
Haar BasisHaar Basis
Lisa Haar Basis
Haar Transform
EZW
Arithmetic Coding
System ArchitectureSystem Architecture
Haar Transform
EZW
Arithmetic Coding
Encoding the CoefficientsEncoding the CoefficientsHaar Transform
EZW
Arithmetic Coding
• How do you encode the coefficients effectively?
•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 CoefficientsEZW – Embedded Zerotree of Wavelet Coefficients
Haar Transform
EZW
Arithmetic Coding
• Developed by Shapiro in 93
• Enabled wavelet compression to compete with JPEG
• Builds on two observations:
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 worksWhy it worksHaar Transform
EZW
Arithmetic Coding
How it worksHow it worksHaar Transform
EZW
Arithmetic Coding
threshold = 2^(floor(lg(max(c)))
do {
dominant pass (encode PS,NS,ZT,IZ)
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 ArchitectureSystem Architecture
Haar Transform
EZW
Arithmetic Coding
Arithmetic CodingArithmetic CodingHaar Transform
EZW
Arithmetic Coding
• A symbol with the probability of 0.4 should ideally be encoded with 1.32 bits.
• Arithmetic Coding assigns one long code to entire stream!
Arithmetic Coding – Arithmetic Coding – Encoding stepEncoding step Haar Transform
EZW
Arithmetic Coding
• Divide the interval of [0;1) into subintervals based on the probabilities of the individual symbols
•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 – Arithmetic Coding – Example of the encodingExample of the encoding Haar Transform
EZW
Arithmetic Coding
• Input: ABAABB
•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 – Arithmetic Coding – Example of the encodingExample of the encoding Haar Transform
EZW
Arithmetic Coding
•Final interval: [0.34375;0.375)
•We choose 0.36 and throw away 0. -> 36 is a code for the string ABAABB
• =6 bit
Arithmetic Coding – Arithmetic Coding – DecodingDecoding Haar Transform
EZW
Arithmetic Coding
• From the code the initial interval is determined
• For next symbol (Repeat until done):
• Subtract lower limit of previous
• Divide by width of subinterval
ResultResult
5 13 48