MPEG1 and MPEG2 Digital Video Coding Standards N

  • Slides: 86
Download presentation
MPEG-1 and MPEG-2 Digital Video Coding Standards 資管系碩專班一年級 學生姓名: 楊朝程 學號: N 9356004 1

MPEG-1 and MPEG-2 Digital Video Coding Standards 資管系碩專班一年級 學生姓名: 楊朝程 學號: N 9356004 1

壓縮方法 DCT MPEG-1 MPEG-2 3

壓縮方法 DCT MPEG-1 MPEG-2 3

壓縮方法 DCT MPEG-1 MPEG-2 4

壓縮方法 DCT MPEG-1 MPEG-2 4

INTRA-ELEMENT CORRELATION Spatial inter-element correlation of "typical" images as calculated using a AR(1) Gauss

INTRA-ELEMENT CORRELATION Spatial inter-element correlation of "typical" images as calculated using a AR(1) Gauss Markov image model with high pel-pel correlation. Variables x and y describe the distance between pels in horizontal and vertical image dimensions respectively. 7

(B)-續1 Y U M Y=0. 299 R+0. 587 G+0. 144 B Cb=-0. 169 R-0.

(B)-續1 Y U M Y=0. 299 R+0. 587 G+0. 144 B Cb=-0. 169 R-0. 331 G+0. 500 B Cr=0. 500 R-0. 419 G-0. 081 B 原本完整的訊息 Y: U: M = 4: 4: 4 13

壓縮方法 DCT MPEG-1 MPEG-2 18

壓縮方法 DCT MPEG-1 MPEG-2 18

矩陣運算 轉置矩陣 --Transpose 矩陣相乘 1 3 1 2 A= 3 2 B= 2 -1

矩陣運算 轉置矩陣 --Transpose 矩陣相乘 1 3 1 2 A= 3 2 B= 2 -1 -3 4 2 4 1 2 (A 11*B 11) AB= + (A 12*B 21) (A 21*B 11) + (A 22*B 21) 3 4 A=[aij] AT=[aji] (A 11*B 12) + (A 12*B 22) (A 21*B 12) + (A 22*B 22) 2 -6 -1+8 6 -6 -3+8 -4 0 7 5 20

DCT-cosine P=(x, y)=(cos , sin ) P是在單位圓 上的點 (1, 0)=0 cos =cos( +2 n

DCT-cosine P=(x, y)=(cos , sin ) P是在單位圓 上的點 (1, 0)=0 cos =cos( +2 n ) 0< <2 , n= 1, 2, … - - /2 0 /2 3/2 2 27

DCT-cosine Tij= 1/ N If i = 0 2/N cos (2 j+i)i 2 N

DCT-cosine Tij= 1/ N If i = 0 2/N cos (2 j+i)i 2 N If i >0 N=8 28

DCT-轉換參考矩陣T 1/ 8 =1/2. 8284 2712 =0. 353553390 . 3536 . 4904 . 4157

DCT-轉換參考矩陣T 1/ 8 =1/2. 8284 2712 =0. 353553390 . 3536 . 4904 . 4157 . 2778 . 0975 -. 2778 -. 4157 -. 4904 . 4619 . 1913 -. 4619 -. 1913 . 4619 . 4157 -. 0975 -. 4904 -. 2778 . 4904 . 0975 -. 4157 . 3536 -. 3536 . 2778 -. 4904 . 0975 . 4157 -. 0975 . 4904 -. 2778 . 1913 -. 4619 -. 1913 . 4619 -. 4619 . 1913 . 0975 -. 2778 . 4157 -. 4904 -. 4157 . 2778 -. 0975 29

DCT-轉換參考矩陣T’. 3536 . 4904 . 4619 . 4157 . 3536 . 2778 . 1913

DCT-轉換參考矩陣T’. 3536 . 4904 . 4619 . 4157 . 3536 . 2778 . 1913 . 0975 . 3536 . 4157 . 1913 -. 0975 -. 3536 -. 4904 -. 4619 -. 2778 . 3536 . 2778 -. 1913 -. 4904 -. 3536 . 0975 . 4619 . 4157 . 3536 . 0975 -. 4619 -. 2778 . 3536 . 4157 -. 1913 -. 4904 . 3536 -. 0975 -. 4619 . 2778 . 3536 -. 4157 -. 1913 . 4904 . 3536 -. 2778 -. 1913 . 4904 -. 3536 -. 0975 . 4619 -. 4157 . 3536 -. 4157 . 1913 . 0975 -. 3536 . 4904 -. 4619 . 2778 . 3536 -. 4904 . 4619 -. 4157 . 3536 -. 2778 . 1913 -. 0975 30

原本影像plxel 值 Original 值域 0 -254 192 254 239 180 128 123 110 123

原本影像plxel 值 Original 值域 0 -254 192 254 239 180 128 123 110 123 180 198 180 154 136 105 136 123 136 154 136 123 110 123 154 180 167 136 149 123 154 180 166 154 136 123 154 166 149 180 136 123 136 198 180 154 136 110 123 136 154 166 136 31

Level-off • -1<cos <1, 為符合DCT所以要將pixel值-128 M 26 -5 -5 -5 8 64 52 8

Level-off • -1<cos <1, 為符合DCT所以要將pixel值-128 M 26 -5 -5 -5 8 64 52 8 26 26 26 8 -18 126 70 26 26 52 26 -5 -5 111 52 8 52 52 38 -5 -5 52 26 8 39 38 21 8 8 0 8 -5 8 26 52 70 26 -5 -23 -18 21 8 8 52 38 -18 8 -5 -5 -5 8 26 8 32

D頻率矩陣 D= 162. 3 40. 6 20. 0 72. 3 30. 3 12. 5

D頻率矩陣 D= 162. 3 40. 6 20. 0 72. 3 30. 3 12. 5 -19. 7 -11. 5 30. 5 108. 4 10. 5 32. 3 27. 7 -15. 5 18. 4 -2. 0 -94. 1 -60 12. 3 -43. 3 -31. 3 6. 1 -3. 3 7. 1 -38. 6 -83. 4 -5. 4 -22. 2 -13. 5 15. 5 -1. 3 3. 5 -31. 3 17. 9 -5. 5 -12. 4 14. 3 -6. 0 11. 5 -6. 0 -0. 9 -11. 8 12. 8 0. 2 28. 1 12. 6 8. 4 2. 9 4. 6 -2. 4 12. 2 6. 6 -18. 7 -12. 8 7. 7 12. 0 -10. 0 11. 2 7. 8 -16. 3 21. 5 0. 0 5. 9 10. 7 34

壓縮方法 DCT MPEG-1 MPEG-2 35

壓縮方法 DCT MPEG-1 MPEG-2 35

MPEG-1發展 • 依ISO的JPEG規模來發展MPEG I, IV影音壓 縮標準。 • 1991年完成MPEG-1制定五大部份: • 系統架構(System configuration) • 視訊編碼(Video coding)

MPEG-1發展 • 依ISO的JPEG規模來發展MPEG I, IV影音壓 縮標準。 • 1991年完成MPEG-1制定五大部份: • 系統架構(System configuration) • 視訊編碼(Video coding) • 聲訊編碼(Audiio coding) • 承諾測試(Complicance TEST) • MPEG-1軟體編碼(Software for MPEG-1 coding) 36

(D)-續7 -DCT VAR(u, v) (0, 0) 0 7 39

(D)-續7 -DCT VAR(u, v) (0, 0) 0 7 39

MPEG-1 • (Motion Picture Expert Group)標準規範: 參數 至少有支援TV的畫面大小 decodor 最少有720 pixels/line Line Picuture 572

MPEG-1 • (Motion Picture Expert Group)標準規範: 參數 至少有支援TV的畫面大小 decodor 最少有720 pixels/line Line Picuture 572 lines/picture 傳輸率 1. 86 Mbits/s 畫面 標準為非交錯式畫面 但是並沒有規定實作MPEG-1時一定要依照這個 參數設定 40

H. 261—影像壓縮 • 由ITU-T來定義在ISDN (Integrated Services digital network)上“影像電話”及“ 視訊會議”的服務規格。 • 傳輸的channel大小是p*64 kbps, p為 1~30.

H. 261—影像壓縮 • 由ITU-T來定義在ISDN (Integrated Services digital network)上“影像電話”及“ 視訊會議”的服務規格。 • 傳輸的channel大小是p*64 kbps, p為 1~30. • Common intermediate formate(CIF)—視訊 會議 • Quarter CIF(QCIF)—影像電話 42

H. 261 --Format 聲音/影像同步 CIF QCIF Picture Start code Temporal reference Picture Type GOB

H. 261 --Format 聲音/影像同步 CIF QCIF Picture Start code Temporal reference Picture Type GOB 1 GOB 2 GOB 3 ------ GOB 12 16 x 16 pixels GOB Start code Group number Quantization parameter Macro Block MB MB CIF: Y=352(pixels)x 288(pixels), Cb=Cr=172(pixels)x 144(pixels) ------ MB sub. Sampling QCIF: Y=176(pixels)x 144(pixels), Cb=Cr=82(pixels)x 72(pixels) 亮度、色彩度取半值 43

(A)The Basic MPEG-1 Inter-Frame coding Scheme • Macroblock structure, motion compensation, conditional replenishment of

(A)The Basic MPEG-1 Inter-Frame coding Scheme • Macroblock structure, motion compensation, conditional replenishment of Macroblocks. I P P P MB Y 1 Y 3 Coding Order Y 2 Y 4 U V 46

合併使用DCT/DPCM編碼 Control sz Image Blocks + VLC Q DCT bitstream - VB VB VLD

合併使用DCT/DPCM編碼 Control sz Image Blocks + VLC Q DCT bitstream - VB VB VLD Q* Q* DCT-1 + + MC MC FS DCT-1 + + FS DECODER ENCODER Image Blocks 49

Q—量化 區塊在量化之後,只有低頻的部份有非零值,為了能進一 步地減少儲存空間與通訊容量的大小盡可能地將零值放在 一起,使得處理時能以幾個零來表達,而非個別的處理每 個零,因此運用斜向掃描,沿著空間頻率大小增加的方向 作掃描。 Step. Size -80 4 -6 6 2 -2

Q—量化 區塊在量化之後,只有低頻的部份有非零值,為了能進一 步地減少儲存空間與通訊容量的大小盡可能地將零值放在 一起,使得處理時能以幾個零來表達,而非個別的處理每 個零,因此運用斜向掃描,沿著空間頻率大小增加的方向 作掃描。 Step. Size -80 4 -6 6 2 -2 -2 0 24 -8 8 12 0 0 0 2 10 -4 0 -12 -4 4 4 -2 8 0 -2 -6 10 4 -2 18 4 -4 6 -8 -4 -2 8 6 -4 0 12 0 6 0 0 8 0 -4 16 11 10 16 24 40 51 61 12 12 14 19 26 58 60 55 14 13 16 24 40 57 69 56 0 14 17 22 29 51 87 80 62 0 0 18 22 37 56 68 109 103 77 -2 0 0 24 35 55 64 81 104 113 92 0 0 -2 -2 49 64 78 87 103 121 120 101 -2 0 0 0 72 92 95 98 112 100 103 / 99 51

DCT掃描技術-DC Control sz Image Blocks + DCT DC 係數: bitstream VLC Q VB VB

DCT掃描技術-DC Control sz Image Blocks + DCT DC 係數: bitstream VLC Q VB VB VLD Q* DC係數: 平均強度 block中較低能量值, 經 由相鄰的區塊作掃瞄 低頻--具有大 部份的能量 區塊I -1 區塊 I+1 MC FS DECODER DCT-1 + + Image Blocks 52

DCT掃描技術-AC Control sz Image Blocks + VLC Q DCT bitstream VB VB VLD Q*

DCT掃描技術-AC Control sz Image Blocks + VLC Q DCT bitstream VB VB VLD Q* 7 0 AC 係數: block中其它非 0的 值 -5 0 0 0 0 2 -1 1 1 0 0 作“ZIG-ZAG”斜向 掃描 1 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 7 MC FS DECODER DCT-1 + + Image Blocks 53

FS—Frame Store • 在P-pictures編碼時,前一個I-或P-frame 要先存在FS中。 • MC(Motion compensation)is performed on Macro. Block basis –

FS—Frame Store • 在P-pictures編碼時,前一個I-或P-frame 要先存在FS中。 • MC(Motion compensation)is performed on Macro. Block basis – only one motion vector is estimated between frame N and frame N 1 for a particular Macroblock to be encoded. 57

Motion Compensation-MC Macro. Block to be encoded Mt Mt-Mr =Md, Best match Macro. Block

Motion Compensation-MC Macro. Block to be encoded Mt Mt-Mr =Md, Best match Macro. Block Mr Motion vecor, V DTC Quantization VLC/run-length Huffman 58

MPEG-1 P-frame Decode Control sz Image Blocks + DCT Q bitstream VLC VB VB

MPEG-1 P-frame Decode Control sz Image Blocks + DCT Q bitstream VLC VB VB VLD Q* MC FS DECODER DCT-1 + + Image Blocks 59

Q*—反轉量化—頻率 -80 4 -6 6 2 -2 -2 0 -5 0 0 0 0

Q*—反轉量化—頻率 -80 4 -6 6 2 -2 -2 0 -5 0 0 0 0 24 -8 8 12 0 0 0 2 2 -1 1 1 0 0 10 -4 0 -12 -4 4 4 -2 1 0 0 -1 0 0 0 0 8 0 -2 -6 10 4 -2 0 1 0 0 0 0 18 4 -4 6 -8 -4 0 0 0 0 0 -2 8 6 -4 0 -2 0 0 0 0 0 12 0 6 0 0 0 -2 -2 0 0 0 0 0 8 0 -4 -2 0 0 0 原本 乘上Step. Size -80 0 0 0 16 11 10 16 24 40 51 61 24 -12 14 19 0 0 12 12 14 19 26 58 60 55 14 0 0 -24 0 0 14 13 16 24 40 57 69 56 14 0 0 0 0 14 17 22 29 51 87 80 62 18 0 0 0 0 18 22 37 56 68 109 103 77 0 0 0 0 24 35 55 64 81 104 113 92 0 0 0 0 49 64 78 87 103 121 120 101 0 0 0 0 72 92 95 98 112 100 103 99 61 還 原

-1 DTC • b = At c A • 利用矩陣及反轉矩陣乘上係數值(還原後 的頻率矩陣), 求近似的Macroblock 中的 pixels值

-1 DTC • b = At c A • 利用矩陣及反轉矩陣乘上係數值(還原後 的頻率矩陣), 求近似的Macroblock 中的 pixels值 • 再將相關的marcoblock s組合為 Frame(prediction error),存在Frame Storage中,同時加上(已存在的N-1 Frame) 的motion compensation值,來還原Frame 62

MPEG-1 frames Order 播放順序 I B B P B B P 編碼順序 66

MPEG-1 frames Order 播放順序 I B B P B B P 編碼順序 66

彩色電視規格 • National Television Standards Committee(NTSC, USA), 可見480 lines; 525 lines/frame • Europe three

彩色電視規格 • National Television Standards Committee(NTSC, USA), 可見480 lines; 525 lines/frame • Europe three color standards (PAL, UK), 可見576 lines; 625 lines/frame • Consultative Committee for International Radiocommunications(CCIR, Germany), (可見 576 lines; 625 lines/frame • (SECAM, France), 可見 576 lines; 625 lines/frame 69

壓縮方法 DCT MPEG-1 MPEG-2 70

壓縮方法 DCT MPEG-1 MPEG-2 70

MPEG-2 -續 • MPEG-2 ISO. Rec 13818的Levels分為 MPEG-2 levels 規格 Low 和MPEG-1相容(SIF格式)352 x 288

MPEG-2 -續 • MPEG-2 ISO. Rec 13818的Levels分為 MPEG-2 levels 規格 Low 和MPEG-1相容(SIF格式)352 x 288 pixels, VHS影像品質, CD聲音 品質 Main 4: 2: 0 數位電視規格, 720 x 576 pixels, 攝影棚的影像品質,多立 體聲音頻道品質,最高可到 4: 2: 2的影像品質,傳輸速率可到 15 Mbps/20 Mbps High 1440 以 4: 2: 0數位電視規格為基礎, 解析度 1440 x 1152 pixels, 支援 HDTV 60 Mbps/80 Mbps 的4: 2: 2格式 High 以 4: 2: 0數位電視規格為基礎, 解析度 1920 x 1152 pixels, 寛螢幕 HDTV 80 Mbps/100 Mbps 的4: 2: 2格式 73

MPEG-2 -續 • MPEG-2 ISO. Rec 13818的Profile分為 MPEG-2 profiles 規格 Simple Non-Scalable (NO B-frame);

MPEG-2 -續 • MPEG-2 ISO. Rec 13818的Profile分為 MPEG-2 profiles 規格 Simple Non-Scalable (NO B-frame); 4: 2: 0 Main Non-Scalable (with B-frame); 4: 2: 0 SNR Scalable; 4: 2: 0; 2 layers Spatial resolution Scalable; 4: 2: 0; 3 layers High Non-Scalable; 4: 2: 2 Scalable: 4: 2: 0; 4: 2: 2 3 layers 74

MPEG-2 編碼 • 例如3個frames. I-, P- frmaes I P P top bottom 77

MPEG-2 編碼 • 例如3個frames. I-, P- frmaes I P P top bottom 77

Multi-resolution • Downscaled version is encoded into a base layer bit stream with reduced

Multi-resolution • Downscaled version is encoded into a base layer bit stream with reduced bit rate. • Upscaled reconstructed base layer video is used as a prediction for coding of the original input. • Prediction error is encoded into an enhancement layer bit stream. 79

Scalable coding of video Video in Enhancedment encoder Enhancedment DEcoder Enhancedment layer bitstream Downscaling

Scalable coding of video Video in Enhancedment encoder Enhancedment DEcoder Enhancedment layer bitstream Downscaling UP-scaling 空間上 空間上 時間上 時間上 BASE Layer encoder Lowresolution encoder BASE layer bitstream Highresolution video BASE Layer DEcoder Lowresolution video 80

MPEG-2架構-Encoder Image blocks VLC Q DCT Base layer bitstream VB Q* Q Q* VLC

MPEG-2架構-Encoder Image blocks VLC Q DCT Base layer bitstream VB Q* Q Q* VLC VB Enhancement layer bitstream DCT-1 MC FS Two layer for SNR-scalable Encoder 83

MPEG-2架構-DEcoder Base layer bitstream VB VB Enhancement layer bitstream VLC Q* DCT-1 MC Image

MPEG-2架構-DEcoder Base layer bitstream VB VB Enhancement layer bitstream VLC Q* DCT-1 MC Image blocks FS DEcoder 84