Transform Codng Prncple of block-wse transform codng Propertes of orthonormal transforms Dscrete cosne transform (DCT) Bt allocaton for transform coeffcents Entropy codng of transform coeffcents Typcal codng artfacts Fast mplementaton of the DCT Thomas Wegand: Dgtal Image Communcaton Transform Codng - Transform Codng Prncple Structure u Τ U Quantzer V Τ v Transform coder (Τα) / decoder (βτ ) structure u U V Τ α β Τ v Insert entropy codng (γ) and transmsson channel u Τ U b b V α γ channel γ β Τ v Thomas Wegand: Dgtal Image Communcaton Transform Codng -
Transform Codng and Quantzaton u U V v u Τ U V Q U V Τ u v v Transformaton of vector u=(u,u,,u )ntou=(u,u,,u ) Quantzer Q maybe appled to coeffcents U separately (scalar quantzaton: low complexty) jontly (vector quantzaton, may requre hgh complexty, explotng of redundancy between U ) Inverse transformaton of vector V=(V,V,,V )ntov=(v,v,,v ) Why should we use a transform? Thomas Wegand: Dgtal Image Communcaton Transform Codng - 3 Geometrcal Interpretaton A lnear transform can decorrelate random varables An orthonormal transform s a rotaton of the sgnal vector around the orgn Parseval s Theorem holds for orthonormal transforms DC bass functon U u U u u u = = T = u AC bass functon U U 3 Tu U = = = = Thomas Wegand: Dgtal Image Communcaton Transform Codng -
Propertes of Orthonormal Transforms Forward transform transform coeffcents U=Tu Transform matrx of sze x nput sgnal block of sze Orthonormal transform property: nverse transform u=t U=TT U Lnearty: u s represented as lnear combnaton of bass functons Thomas Wegand: Dgtal Image Communcaton Transform Codng - 5 Transform Codng of Images Explot horzontal and vertcal dependences by processng blocks orgnal mage reconstructed mage Orgnal mage block Reconstructed mage block Transform T Transform coeffcents Quantzaton Entropy Codng Transmsson Inverse transform T - Quantzed transform coeffcents Thomas Wegand: Dgtal Image Communcaton Transform Codng -
Separable Orthonormal Transforms, I Problem: sze of vectors * (typcal value of : 8) An orthonormal transform s separable, f the transform of a sgnal block of sze *-can be expressed by U=TuT * transform coeffcents Orthonormal transform matrx of sze * * block of nput sgnal The nverse transform s u= TT UT Great practcal mportance: transform requres matrx multplcatons of sze * nstead one multplcaton of a vector of sze* wthamatrxofsze * Reducton of the complexty from O( )too( 3 ) Thomas Wegand: Dgtal Image Communcaton Transform Codng - 7 Separable Orthonormal Transforms, II Separable -D transform s realzed by two -D transforms along rows and columns of the sgnal block u column-wse Tu row-wse TuTT -transform -transform * block of pxels * block of transform coeffcents Thomas Wegand: Dgtal Image Communcaton Transform Codng - 8
Crtera for the Selecton of a Partcular Transform Decorrelaton, energy concentraton KLT, DCT, Transform should provde energy compacton Vsually pleasant bass functons pseudo-random-nose, m-sequences, lapped transforms, Quantzaton errors make bass functons vsble Low complexty of computaton Separablty n -D Smple quantzaton of transform coeffcents Thomas Wegand: Dgtal Image Communcaton Transform Codng - 9 Karhunen Loève Transform (KLT) Decorrelate elements of vector u R u =E{uu T }, U=Tu, R U =E{UU T }=TE{uu T }T T = TR u T T =dag{α } Bass functons are egenvectors of the covarance matrx of the nput sgnal. KLT acheves optmum energy concentraton. Dsadvantages: - KLT dependent on sgnal statstcs - KLT not separable for mage blocks - Transform matrx cannot be factored nto sparse matrces. Thomas Wegand: Dgtal Image Communcaton Transform Codng -
Comparson of Varous Transforms, I Comparson of D bass functons for block sze =8 () Karhunen Loève transform (98/9) () Haar transform (9) (3) Walsh-Hadamard transform (93) () Slant transform (Enomoto, Shbata, 97) () () (3) () (5) (5) Dscrete CosneTransform (DCT) (Ahmet, atarajan, Rao, 97) Thomas Wegand: Dgtal Image Communcaton Transform Codng - Comparson of Varous Transforms, II Energy concentraton measured for typcal natural mages, block sze x3 (Lohscheller) KLT s optmum DCT performs only slghtly worse than KLT Thomas Wegand: Dgtal Image Communcaton Transform Codng -
DCT - Type II-DCT of blocksze M x M - D bass functons of the DCT: s defned by transform matrx A contanng elements π (k + ) ak = α cos M k, =...( M ) wth α = M α = M Thomas Wegand: Dgtal Image Communcaton Transform Codng - 3 Dscrete Cosne Transform and Dscrete Fourer Transform Transform codng of mages usng the Dscrete Fourer Transform (DFT): edge For statonary mage statstcs, the energy folded concentraton propertes of the DFT converge aganst those of the KLT for large block szes. Problem of blockwse DFT codng: blockng effects DFT of larger symmetrc block -> DCT due to crcular topology of the DFT and Gbbs phenomena. pxel folded Remedy: reflect mage at block boundares Thomas Wegand: Dgtal Image Communcaton Transform Codng -
Hstograms of DCT Coeffcents: Image: Lena, 5x5 pxel DCT: 8x8 pxels DCT coeffcents are approxmately dstrbuted lke Laplacan pdf Thomas Wegand: Dgtal Image Communcaton Transform Codng - 5 Dstrbuton of the DCT Coeffcents Central Lmt Theorem requests DCT coeffcents to be Gaussan dstrbuted Model varance of Gaussan DCT coeffcents dstrbuton as random varable (Lam & Goodmann ) u pu ( σ ) = exp πσ σ Usng condtonal probablty pu ( ) = pu ( σ ) p( σ ) dσ Thomas Wegand: Dgtal Image Communcaton Transform Codng -
Dstrbuton of the Varance Exponental Dstrbuton { } p( σ ) = µ exp µσ Thomas Wegand: Dgtal Image Communcaton Transform Codng - 7 Dstrbuton of the DCT Coeffcents pu ( ) = pu ( σ ) p( σ ) dσ u = exp µ exp{ µσ } dσ πσ σ u = µ exp µσ dσ π σ π µ u = µ exp π µ µ = exp { µ u } Laplacan Dstrbuton Thomas Wegand: Dgtal Image Communcaton Transform Codng - 8
Bt Allocaton for Transform Coeffcents I Problem: dvde bt-rate R among transform coeffcents such that resultng dstorton D s mnmzed. DR ( ) = D ( R ), s.t. R R = = Average Average dstorton rate Dstorton contrbuted by coeffcent Rate for coeffcent Approach: mnmze Lagrangan cost functon d dd ( )! R D( R) + λ R = + λ= dr dr = = Soluton: Pareto condton dd( R) = λ dr Move bts from coeffcent wth small dstorton reducton per bt to coeffcent wth larger dstorton reducton per bt Thomas Wegand: Dgtal Image Communcaton Transform Codng - 9 Bt Allocaton for Transform Coeffcents II Assumpton: hgh rate approxmatons are vald dd ( R ) D R aσ a σ = λ R R ( ), ln dr aln R σ logσ + log R logσ logσ R log R λ + = σ + ( σ ) = = aln ln logσ + log = log a R R + log = = λ = λ log σ σ Operatonal Dstorton Rate functon for transform codng: DR ( ) = D( R) = = a σ σ σ σ log a R R a R σ = = = = Thomas Wegand: Dgtal Image Communcaton Transform Codng - Geometrc mean: σ = ( σ )
Entropy Codng of Transform Coeffcents Prevous dervaton assumes: AC coeffcents are very lkely to be zero Orderng of the transform coeffcents by zg-zag-scan Desgn Huffman code for event: # of zeros and coeffcent value Arthmetc code maybe smpler Probablty that coeffcent s not zero when quantzng wth: V =*round(u /).5 R 3 σ max[(log ),] = D 5 7 8 bt DC coeffcent 8 7 5 3 Thomas Wegand: Dgtal Image Communcaton Transform Codng - Entropy Codng of Transform Coeffcents II Encoder 95 88 93 9 57 9 9 93 88 87 95 93 3 93 8 9 8 95 8 5 99 93 7 7 79 79 5 8 98 83 9 95 9 7 59 85 8 75 3 5 7 73 85 5 7 5 7 8 8 7 73 98 3 5 8 9 9 59 3 Orgnal 8x8 block DCT 8 9 33-5 - 33-38 -5-7 -3-9 3 - - - 9 8 7 7-3 -5-3 - 3-8 -3-3 -5-9 3 3 3-7 - - -9 8-7 -5-8 -7 α 85 3-3 - - - - - - - zg-zag-scan (85 3 - -3 - - - - - - EOB) run-level codng Mean of block: 85 (,3) (,) (,) (,) (,) (,-) (,) (,) (,) (,-3) (,) (,-) (,) (,-) (,-) (,-) (,) (9,-) (,-) (EOB) entropy codng & transmsson Thomas Wegand: Dgtal Image Communcaton Transform Codng -
3 - - -3 3 - - -3 3 - - -3 3 - - -3 3 - - -3 3 - - -3 Entropy Codng of Transform Coeffcents III Decoder transmsson Mean of block: 85 (,3) (,) (,) (,) (,) (,- ) (,) (,) (,) (,-3) (,) (,-) (,) (,-) (,-) (,-) (,) (9,-) (,-) (EOB) Inverse zg-zagscan run-leveldecodng (85 3 - -3 - - - - - - EOB) 85 3-3 - - - - - - - Scalng and nverse DCT: β 9 93 87 9 79 7 9 89 98 88 8 98 9 9 8 85 89 9 97 7 59 8 89 7 8 8 77 5 53 87 89 99 78 5 3 85 79 7 93 7 5 79 97 7 9 98 95 93 9 5 8 79 9 9 9 85 9 57 Reconstructed 8x8 block Thomas Wegand: Dgtal Image Communcaton Transform Codng - 3 Detal n a Block vs. DCT Coeffcents Transmtted mage block DCT coeffcents quantzed DCT block of block coeffcents reconstructed of block from quantzed coeffcents Thomas Wegand: Dgtal Image Communcaton Transform Codng -
Typcal DCT Codng Artfacts DCT codng wth ncreasngly coarse quantzaton, block sze 8x8 quantzer step sze quantzer step sze quantzer step sze for AC coeffcents: 5 for AC coeffcents: for AC coeffcents: Thomas Wegand: Dgtal Image Communcaton Transform Codng - 5 Influence of DCT Block Sze Effcency as a functon of blocksze x, measured for 8 bt Quantzaton n the orgnal doman and equvalent quantzaton n the transform doman. = Memoryless entropy of orgnal sgnal mean entropy of transform coeffcents Block sze 8x8 s a good compromse. Thomas Wegand: Dgtal Image Communcaton Transform Codng -
Fast DCT Algorthm I DCT matrx factored nto sparse matrces (Ara, Agu, and akajma; 988): y = M x = S P M M M 3 M M 5 M x S = s s s s3 s s5 s s7 P = M = - - M = - - M = 3 C -C C -C -C C M = - M = 5 - - - - M = - - - - Thomas Wegand: Dgtal Image Communcaton Transform Codng - 7 Fast DCT Algorthm II Sgnal flow graph for fast (scaled) 8-DCT accordng to Ara, Agu, akajma: x s y scalng x s y x x 3 x x 5 a a a 3 s s s 5 s y y y 5 y only 5 + 8 Multplcatons (drect matrx multplcaton: multplcatons) x a x 7 a 5 s 7 s 3 y 7 y 3 Multplcaton: u m m u Addton: u v u v u+v u-v a= C a = C C a3 = C a = C+ C a5 = C s = sk = ; k =... 7 CK CK = cos(ks ) Thomas Wegand: Dgtal Image Communcaton Transform Codng - 8
Transform Codng: Summary Orthonormal transform: rotaton of coordnate system n sgnal space Purpose of transform: decorrelaton, energy concentraton KLT s optmum, but sgnal dependent and, hence, wthout a fast algorthm DCT shows reduced blockng artfacts compared to DFT Bt allocaton proportonal to logarthm of varance Threshold codng + zg-zag-scan + 8x8 block sze s wdely used today (e.g. JPEG, MPEG, ITU-T H.3) Fast algorthm for scaled 8-DCT: 5 multplcatons, 9 addtons Thomas Wegand: Dgtal Image Communcaton Transform Codng - 9