Wavelet Trasform CSE 49 G Itroductio to Data Compressio Witer 6 Wavelet Trasform Codig PACW Wavelet Trasform A family of atios that filters the data ito low resolutio data plus detail data high pass filter low pass filter ed detail subbads CSE 49g - ecture - Witer 6 Wavelet Trasformed Barbara (Ehaced) Wavelet Trasformed Barbara (Actual) ow resolutio subbad Detail subbads most of the details are small so they are very dark CSE 49g - ecture - Witer 6 CSE 49g - ecture - Witer 6 4 (pixels) Wavelet Trasform Compressio Ecoder Decoder decodig ed (coefficiets) ed (approx coefficiets) codig iverse bit stream distorted Wavelet coder trasmits ed i bit plae order with the most sigificat bits first CSE 49g - ecture - Witer 6 5 4 sig plae Bit Plaes of Coefficiets + - + + + Coefficiets are ormalized betwee ad CSE 49g - ecture - Witer 6 6
Why Wavelet Compressio Works Wavelet coefficiets are trasmitted i bit-plae order I most sigificat bit plaes most coefficiets are so they ca be coded efficietly Oly some of the bit plaes are trasmitted This is where fidelity is lost whe compressio is gaied Natural progressive trasmissio compressed bit plaes trucated compressed bit plaes CSE 49g - ecture - Witer 6 7 8 6 4 8 6 4 Rate-Fidelity Curve 4 bits per pixel 5 65 7 8 9 More bit plaes of the ed that is set the higher the fidelity SPIT coded Barbara CSE 49g - ecture - Witer 6 8 Wavelet Codig Methods EZW - Shapiro, 99 Embedded Zerotree codig SPIT - Said ad Pearlma, 996 Set Partitioig i ierarchical Trees codig Also uses zerotrees ECECOW - Wu, 997 Uses arithmetic codig with cotext EBCOT Taubma, Uses arithmetic codig with differet cotext JPEG ew stadard based largely o EBCOT GTW og, ader Uses group testig which is closely related to Golomb codes PACW - ader, Askew, Barey ike GTW but uses arithmetic codig CSE 49g - ecture - Witer 6 9 (pixels) Ecoder Decoder decodig Wavelet Trasform ed (coefficiets) ed (approx coefficiets) codig iverse bit stream distorted A decomposes the ito a low resolutio versio ad details The details are typically very small so they ca be coded i very few bits CSE 49g - ecture - Witer 6 Oe-Dimesioal Average Trasform () Oe-Dimesioal Average Trasform () x y average (x+y)/ ow do we represet two data poits at lower resolutio? x y detail (y-x)/ x y (x+y)/ = low pass filter high pass filter (y-x)/ = x x = - y = + y Trasform detail Iverse Trasform CSE 49g - ecture - Witer 6 CSE 49g - ecture - Witer 6
Oe-Dimesioal Average Trasform () Oe-Dimesioal Average Trasform (4) ow Resolutio Versio A B Note that the low resolutio versio ad the detail together have the same umber of values as the origial Detail B[i] = A[i] + A[i + ], i < B[/ + i] = A[i] + A[i + ], i < = B[/-] = B[/-] CSE 49g - ecture - Witer 6 CSE 49g - ecture - Witer 6 4 Oe-Dimesioal Average Iverse Trasform Two Dimesioal Trasform () low resolutio subbad horizotal vertical B A A[i] = B[i] B[/ + i], i < A[i + ] = B[i] + B[/ + i], i < Trasform each row Trasform each colum i ad detail subbads CSE 49g - ecture - Witer 6 5 CSE 49g - ecture - Witer 6 6 Two Dimesioal Trasform () Two Dimesioal Average Trasform horizotal horizotal vertical Trasform each row i Trasform each colum i ad egative value vertical levels of gives 7 subbads k levels of gives k + subbads CSE 49g - ecture - Witer 6 7 CSE 49g - ecture - Witer 6 8
Wavelet Trasformed Image levels of low resolutio subbad 6 detail subbads Wavelet Trasform Details Coversio to reals Covert gray scale to floatig poit Covert color to Y U V ad the covert each to bad to floatig poit Compress separately After several levels (-8) of we have a matrix of floatig poit umbers called the ed (coefficiets) CSE 49g - ecture - Witer 6 9 CSE 49g - ecture - Witer 6 Wavelet Trasforms Techically s are special kids of liear atios Easiest to thik of them as filters The filters deped oly o a costat umber of values (bouded support) Preserve eergy (orm of the pixels = orm of the coefficiets) Iverse filters also have bouded support Well-kow s aar like the average but orthogoal to preserve eergy Not used i practice Daubechies 9/7 biorthogoal (iverse is ot the traspose) Most commoly used i practice CSE 49g - ecture - Witer 6 8 6 4 - -4-6 -8 aar Filters low pass =, high pass =, low pass B[i] = A[i] + A[i + ], i < high pass B[/ + i] = A[i] + A[i + ], i < 8 6 4 - -4-6 -8 Wat the sum of squares of the filter coefficiets = CSE 49g - ecture - Witer 6 8 6 4 - -4-6 -8 - Daubechies 9/7 Filters low pass filter high pass filter 8 h g j 6 j 4-4 - - - 4 - - - - -4-6 -8 - low pass high pass B[i] = 4 j= 4 B[/ + i] = hja[ i + j], i < j= gja[ i + j], i < reflectio used ear boudaries CSE 49g - ecture - Witer 6 iear Time Complexity of D Wavelet Trasform et = umber of pixels ad let b be the umber of coefficiets i the filters Oe level of takes time O(b) k levels of takes time proportioal to b + b/4 + + b/4 k- < (4/)b The is liear time whe the filters have costat The poit of s is to use costat filters ulike may other s CSE 49g - ecture - Witer 6 4 4
(pixels) Ecoder Decoder decodig Wavelet Trasform ed (coefficiets) ed (approx coefficiets) codig iverse bit stream distorted Wavelet coder trasmits ed i bit plae order with the most sigificat bits first Bit-Plae Codig Normalize the coefficiets to be betwee ad Trasmit oe bit-plae at a time For each bit-plae Sigificace pass: Fid the ewly sigificat coefficiets, trasmit their sigs Refiemet pass: trasmit the bits of the kow sigificat coefficiets CSE 49g - ecture - Witer 6 5 CSE 49g - ecture - Witer 6 6 Divide ito Bit-Plaes Sigificat Coefficiets Coefficiets + - + - + + Sig Plae 9 8 7 6 5 magitude 4 coefficiets bit-plae threshold CSE 49g - ecture - Witer 6 7 CSE 49g - ecture - Witer 6 8 9 8 7 6 5 magitude 4 Sigificat Coefficiets coefficiets bit-plae threshold CSE 49g - ecture - Witer 6 9 Sigificace & Refiemet Passes Code a bit-plae i two passes Sigificace pass codes previously isigificat coefficiets also codes sig bit Refiemet pass refies values for previously sigificat coefficiets Mai idea: Sigificace-pass bits likely to be ; Refiemet-pass bit are ot Coefficiet ist # value 4 5 6 7 8 9 refiemet bits CSE 49g - ecture - Witer 6 : : Bit-plae 5
bit plae bit plaes 4 5 68 CSE 49g - ecture - Witer 6 CSE 49g - ecture - Witer 6 bit plaes bit plaes 4 7 5 88 5 : 5 CSE 49g - ecture - Witer 6 CSE 49g - ecture - Witer 6 4 bit plaes 5 bit plaes 6 5 8 ratio 9 : ratio 68 : 48 CSE 49g - ecture - Witer 6 5 CSE 49g - ecture - Witer 6 6 6
bit plaes 7 bit plaes 8 69 ratio 6 : ratio : 87 9 CSE 49g - ecture - Witer 6 7 CSE 49g - ecture - Witer 6 8 bit plaes 9 PACW 6 ratio 7 : 75 A simple coder based o Bit-plae codig Sigificace pass Refiemet pass Arithmetic codig Careful selectio of cotexts based o statistical studies Implemeted by udergraduates Amada Askew ad Dae Barey i Summer CSE 49g - ecture - Witer 6 9 CSE 49g - ecture - Witer 6 4 (pixels) bit plae decodig usig AC Ecoder Decoder PACW Block Diagram ed (coefficiets) Recombie bit-plaes subtract Avg Bitplaes Bitplaes Iterpolate Divide ito bit-plaes add Avg ed (approx coefficiets) bit plae ecodig usig AC iverse bit stream distorted Arithmetic Codig i PACW Performed o each idividual bit plae Alphabet is ={,} Sigs are coded as eeded Uses iteger implemetatio with -bit itegers (Iitialize =, R = -) Uses scalig ad adaptatio Uses cotexts based o statistical studies CSE 49g - ecture - Witer 6 4 CSE 49g - ecture - Witer 6 4 7
Ecodig the Bit-Plaes Code most sigificat bit-plaes first Sigificace pass for a bit-plae First code those coefficiets that were isigificat i the previous bit-plae Code these i a priority order If a coefficiet becomes sigificat the code its sig Refiemet pass for a bit-plae Code the refiemet bit for each coefficiet that is sigificat i a previous bit-plae Decodig Emulate the ecoder to fid the bit plaes The decoder kow which bit-plae is beig decoded Whether it is the sigificat or refiemet pass Which coefficiet is beig decoded Iterpolate to estimate the coefficiets CSE 49g - ecture - Witer 6 4 CSE 49g - ecture - Witer 6 44 Cotexts (per bit plae) Sigificace pass cotexts: Cotexts based o Subbad level Number of sigificat eighbors Sig cotext Refiemet cotexts st refiemet bit is always so o cotext eeded d refiemet bit has a cotext All other refiemet bits have a cotext Cotext Priciples Bits i a give cotext have a probability distributio Bits i differet cotexts have differet probability distributios Subbad evel Image is divided ito subbads util bad (subbad level ) is less tha 6x6 Barbara has 7 subbad levels CSE 49g - ecture - Witer 6 45 CSE 49g - ecture - Witer 6 46 Statistics for Subbad evels Sigificat Neighbor Metric Subbad evel Barbara (8) # sigificat # isigificat % sigificat Cout # of sigificat eighbors childre cout for at most,,,+ 44 64 8% 4 5 6 7 848 4 68 488 9 48 459 568 886 546 694 6% 56% 7% 97% 87% 78% Neighbors of : p paret a spatially adjacet i spatially idetical c child i p a a a a a a a a i c c c c CSE 49g - ecture - Witer 6 47 CSE 49g - ecture - Witer 6 48 8
Number of Sigificat Neighbors Sigificat eighbors 4 5 6 7 # sigificat Barbara (8) 4849 9 76 6 44 754 648 87566 # isigificat 5468 695 45 78899 5584 989 445 976 % sigificat % 59% 76% 77% 7% 4% 45% 488% Refiemet Bit Cotext Statistics d Refiemet Bits Other Refiemet Bits Sig Bits Barbara (8) s 46,9 475,94 8,45 s,5 4,98, % s 59% 5% 496% Barbara at : d Refiemet bit % s = 658% CSE 49g - ecture - Witer 6 49 CSE 49g - ecture - Witer 6 5 Cotext Details Sigificace pass cotexts per bit-plae: Max eighbors* um subbad levels cotexts For Barbara: cotexts for sig eighbor couts of - ad subbad levels of -6 = 4*7 = 8 cotexts Idex of a cotext Max eighbors * subbad level + um sig eighbors Example um sig eighbors =, subbad level =, idex = 4 * + = 4 Sig cotext cotexts Refiemet cotexts st refiemet bit is always ot trasmitted d refiemet bit has a cotext all other refiemet bits have a cotext Number of cotexts per bit-plae for Barbara = 8 + + = Priority Queue Used i sigificace pass to decide which coefficiet to code ext Goal code coefficiets most likely to become sigificat All o-empty cotexts are kept i a max heap Priority is determied by: # sig coefficiets coded / total coefficiets coded CSE 49g - ecture - Witer 6 5 CSE 49g - ecture - Witer 6 5 Recostructio of Coefficiets Origial Barbara Image Coefficiets are decoded to a certai umber of bit plaes XXXXX What should X s be? < XXXXX < is half-way adled the same as SPIT ad GTW if coefficiet is still isigificat, do o iterpolatio if ewly sigificat, add o 8 to scale if sigificat, add o 5 to scale A = k -k A +8 +5 A A A CSE 49g - ecture - Witer 6 5 CSE 49g - ecture - Witer 6 54 9
Barbara at 5 ( = 775) Barbara at 5 ( = 68) CSE 49g - ecture - Witer 6 55 CSE 49g - ecture - Witer 6 Barbara at ( = 45) 56 Results Compressio of Barbara 7 6 5 4 (db) 9 JPEG 8 UWIC 7 GTW SPIT 6 JPEG 5 4 4 5 6 7 8 9 Bit rate (bits/pixel) CSE 49g - ecture - Witer 6 57 CSE 49g - ecture - Witer 6 58 Results Results Compressio of ea Compressio of RoughWall 4 4 9 8 (db) (db) 7 6 5 4 PACW GTW SPIT JPEG JPEG 9 8 7 UWIC SPIT JPEG 4 9 4 5 6 7 8 9 Bit rate (bits/pixel) CSE 49g - ecture - Witer 6 JPEG 5 GTW 6 4 5 6 7 8 9 Bit rate (bits/pixel) 59 CSE 49g - ecture - Witer 6 6
PACW Notes PACW competitive with JPEG, SPIT- AC, ad GTW Developed i Java from scratch by two udergraduates, Dae Barey ad Amada Askew, i moths Dae s fial versio is slightly differet tha the oe describe here See his seior thesis CSE 49g - ecture - Witer 6 6