DCT——Page 1- Chow CS525—DCT——Page 2
Total Page:16
File Type:pdf, Size:1020Kb
Why needs Compression? Video Compression Applications z Typical NTSC video z Cable TV distribution 460x340=148000 pels/frame, 30 frames/sec, 16 bits/pel (YIQ) z Interactive communications—videophone, videoconferencing, videotex. =71 Mbps z Digital storage media—CD-ROM, CD-V, digital VTR. z Bandwidth are limited resource and expensive z Network database services video library, video information provider. z Storage—enormous for uncompressed video z Video-on-demand z Compression processing—relative cheap z Broadcasting z Video Camera, VCR, TV Receiver z Video surveillance z Comparison of NTSC and HDTV Reference: “Discrete Cosine Transform Algorithms, Advantages, Application”, Rao and Yip, Academic Press, 1990. chow CS525—DCT——Page 1- chow CS525—DCT——Page 2- Applications vs. Bit Rates Why can video data be compressed? Application Standard Bit Rate Range Fax CCITT G3/G4/JBIG 4.8-14.4 kbps Redundancy Still Image JPEG 56/64 kbps z Intraframe Videophone (analog) 9.6-19.2 kbps z Interframe Videophone (digital) CCITT H.261 px64 64-128 kbps Videoconferencing CCITT H.261 px64 320-1920 kbps Entertainment video MPEG 1-3 Mbps Broadcast video MPEG II 4-10 Mbps Intraframe JPEG JPEG 10-20 Mbps Digital VCR MPEG II 8-20 Mbps NTSC (very high quality) CCIR/ANSI 34/45 Mbps HDTV (broadcasting) FCC(US only) 20-25 Mbps HDTV (studio) 30-45 Mbps chow CS525—DCT——Page 3- chow CS525—DCT——Page 4- Compression Techniques Transform Coding Concept z Spatial domain—DPCM, Transform, Subband, Vector quantization z Why can data be compressed?—Redundancy z Temporal domain—frame difference, motion compensation z Orthogonal transform: —decorrelate data into a more compact form so that redundancy can be discarded more easily. Y Y’ X’ X chow CS525—DCT——Page 5- chow CS525—DCT——Page 6- Orthogonal Transforms A typical Transform Coder/Decoder z There are many of them: Which is better? Input Blocking FDCT Thresholder Karhunen-Loeve Transform (KLT) Image optimal, complete decorrelates the random functions in its transform domain. Discrete Fourier Transform (DFT) Binary bit stream ZigZag Scan Discrete Slant Transform Entropy Quantizer Discrete Cosine Transform (DCT) 1974 Coder 1-D sequencing Discrete Sine Transform (DST) Coder Discrete Hadamard/Walsh Transform (DHT) Discrete Harr Transform Entropy Inverse z DCT emerges as the choice of transform for Dequantizer —fast algorithms Decoder ZigZag Scan —performance (quality) Reconstructed —data-independent Output Image Thresholder Block IDCT Integration Compensator Decoder chow CS525—DCT——Page 7- chow CS525—DCT——Page 8- 2D-Discrete Cosine Transform (DCT) Example of 2D-DCT f(x,y) F(u,v) z 8x8 FDCT/IDCT formula 7 7 f(0,0) f(1,0) f(2,0) f(3,0) f(4,0) f(5,0) f(6,0) f(7,0) F(0,0) F(1,0) F(2,0) F(3,0) F(4,0) F(5,0) F(6,0) F(7,0) 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 1 ()2x + 1 uπ ()2y + 1 vπ 10000000 Fuv(), = ---Cu()Cv() fxy(), cos---------------------------cos -------------------------- 4 ∑ ∑ 16 16 f(0,1) f(1,1) f(2,1) f(3,1) f(4,1) f(5,1) f(6,1) f(7,1)f F(0,1) F(1,1) F(2,1) F(3,1) F(4,1) F(5,1) F(6,1) F(7,1) 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 00000000 7 7 x = 0y = 0 F(0,2) F(1,2) F(2,2) F(3,2) F(4,2) F(5,2) F(6,2) F(7,2) 1 ()2x + 1 uπ ()2y + 1 vπ f(0,2) f(1,2) f(2,2) f(3,2) f(4,2) f(5,2) f(6,2) f(7,2)f fxy(), = --- Cu()Cv()Fuv(), cos---------------------------cos -------------------------- 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 00000000 4 ∑ ∑ 16 16 F(0,3) F(1,3) F(2,3) F(3,3) F(4,3) F(5,3) F(6,3) F(7,3) f(0,3) f(1,3) f(2,3) f(3,3) f(4,3) f(5,3) f(6,3) f(7,3)f x = 0 y = 0 00000000 () 1 () 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 where Ck = ------- if k = 0 , otherwise Ck = 1 F(0,4) F(1,4) F(2,4) F(3,4) F(4,4) F(5,4) F(6,4) F(7,4) 2 f(0,4) f(1,4) f(2,4) f(3,4) f(4,4) f(5,4) f(6,4) f(7,4)f 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 00000000 z Separability property F(0,5) F(1,5) F(2,5) F(3,5) F(4,5) F(5,5) F(6,5) F(7,5) 7 7 f(0,5) f(1,5) f(2,5) f(3,5) f(4,5) f(5,5) f(6,5) f(7,5)f 00000000 1 1 ()2x + 1 uπ ()2y + 1 vπ 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 Fuv(), = ---Cu()∑ ---Cv()∑ fxy(), cos--------------------------- cos -------------------------- F(0,6) F(1,6) F(2,6) F(3,6) F(4,6) F(5,6) F(6,6) F(7,6) 2 2 16 16 f(0,6) f(1,6) f(2,6) f(3,6) f(4,6) f(5,6) f(6,6) f(7,6)f 00000000 x = 0y = 0 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 The 2-D FDCT can be implemented by 1-D 8-point FDCT along the rows of F(0,7) F(1,7) F(2,7) F(3,7) F(4,7) F(5,7) F(6,7) F(7,7) f(0,7) f(1,7) f(2,7) f(3,7) f(4,7) f(5,7) f(6,7) f(7,7)f 00000000 fxy(), followed by 1-D 8-point FDCT along the columns of the matrix obtained 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125 after the row transformation. 7 7 1 ()2x + 1 0π ()2y + 1 0π F()00, = ---C()0 C()0 fxy(), cos--------------------------- cos--------------------------- 4 ∑ ∑ 16 16 x = 0y = 0 F(0,0)=1/4*1/2*(64*0.125)=1 C()0 = 1 ⁄ 2 chow CS525—DCT——Page 9- chow CS525—DCT——Page 10- 1D-DCT Properties of 1D-DCTs 7 -1 1 ()2x + 1 uπ z Only DCT-I and DCT-IV are involutary (F=F ) z 8-point DCT definition Fu()= ---Cu()∑ fx()cos --------------------------- 2 16 z Inverse DCT-II≠DCT-II x = 0 z Consider f as a vector of n point data and F as a vector of transformed values z Since Matrix multiplication is a linear operation, all four DCTs retain linearity the above transformation can be represent by matrix operations F=cAf properties. F[ax + by] = aFx + bFy. z There are four different 1D-DCTs, the DCT-II was the first to be studied. z For properties related to scaling in time, shift in time, differentiation in time, and the convolution, see [DCT9x] by Rao and Yip. chow CS525—DCT——Page 11- chow CS525—DCT——Page 12- A Fast 1D-DCT Algorithm Fast 1D-DCT based on Sparse Matrix Factorization based on Sparse Matrix Factorization This matrix operation needs only 2 additions and 2 subtractions. C()2 2 12/ ---- The 1D-DCT can be represented as X = AN x 1 1 1 1 N ------- ------- 00 x ------- ------- 00 x + x Here we show how A4 can be decomposed into three sparser matrices. 1000 2 2 10 0 1 1 1000 2 2 1 x x + x Ci = cos[]iπ ⁄ k 0001 1 3 01 1 0 2 0001 1 3 2 k x ==C4 C4 00 C4 C4 00 1 1 1 1 0100 01Ð0 1 x 0100 x Ð x ------- ------- ------- ------- 00ÐC1 C3 3 00ÐC1 C3 2 1000 2 2 2 2 0010 8 8 10 0Ð 1 x 0010 8 8 x Ð x 3 1 4 3 1 1 0001 1 3 3 1 00C8 C8 00C8 C8 C4 C4 C4 C4 0100 C3 ÐC1 C1 ÐC3 1 1 1 1 0010 8 8 8 8 This matrix operation needs 8 multiplications, 3 additions, and 1 subtraction. ------- ------- ------- ------- C1 C3 ÐC3 ÐC1 2 2 2 2 matrix 8 8 8 8 1 1 1 1 1 3 5 7 A = -------()x + x + -------()x + x -------()x + x + -------()x + x A = C C C C 4 1 4 2 3 1 4 2 3 4 8 8 8 8 factorization 1000 2 2 2 2 2 6 6 2 1 1 0001 1()3() 3()1() C8 C8 C8 C8 ------- ------- 00 A x ==C4 x1 + x4 + C4 x2 + x3 C8 x2 Ð x3 + C8 x1 Ð x4 1000 2 2 10 0 1 4 3 7 1 5 0100 1()3() 1()3() C8 C8 C8 C8 0001 1 3 01 1 0 ÐC8 x2 Ð x3 + C8 x1 Ð x4 C4 x1 + x4 + C4 x2 + x3 C4 C4 00 0010 0100 01Ð0 1 3()1() 1()3() 1 3 C8 x2 Ð x3 + C8 x1 Ð x4 ÐC8 x2 Ð x3 + C8 x1 Ð x4 00ÐC8 C8 [A ]x requires 16 multiply 0010 10 0Ð 1 4 00C3 C1 This matrix operation involves only the shuffling (moving) of data and 12 add 8 8 Here [A4]x requires only 8 multiply and 8 add In total, there are only 8 multiplications, 5 additions, and 3 subtractions.