MPEG1 Video Coding Standard Jianping Fan Department of

  • Slides: 29
Download presentation
MPEG-1 Video Coding Standard Jianping Fan Department of Computer Science University of North Carolina

MPEG-1 Video Coding Standard Jianping Fan Department of Computer Science University of North Carolina at Charlotte, NC 28223 jfan@uncc. edu http: //www. cs. uncc. edu/~jfan

1. What does MPEG mean? MPEG: Moving Picture Experts Group 2. Why we do

1. What does MPEG mean? MPEG: Moving Picture Experts Group 2. Why we do not use MJPEG? 12 13 14 1. Spatial correlations among neighboring pixels! 2. Temporal correlations among neighboring frames!

3. Why we need MPEG? Temporal Redundancy Exploit temporal relationship among frames for coding!

3. Why we need MPEG? Temporal Redundancy Exploit temporal relationship among frames for coding! save our money for: a. Storage space; b. Bandwidth CIF: 352*288 Frame rate: 25 f/s Space: ~21. 6 Mbits/s MPEG 1. 5 Mbits/s

4. MPEG Video Structure Temporal relationships could be in short period! GOP 1 GOP

4. MPEG Video Structure Temporal relationships could be in short period! GOP 1 GOP 2 Why we need this? I GOP 3 GOP 4 time B B P B B B P GOP

4. MPEG Video Structure 16*16 macroblock 8*8 block frame Universal structure is very important

4. MPEG Video Structure 16*16 macroblock 8*8 block frame Universal structure is very important for universal decoder!!

5. MPEG-1 Encoder MPEG-1 has defined three frame coding types: I, P, B. I

5. MPEG-1 Encoder MPEG-1 has defined three frame coding types: I, P, B. I frame: Intra-coding frame P frame: motion-based predictive coding frame B frame: motion-based bidirectional predictive coding frame The difference between I and P or B: I can be encoded/decoded without reference The difference between P and B: P can be encoded/decoded with one reference

5. MPEG-1 Encoder DCT Q VLC IQ ME ME 01001…. Q: quantization IDCT 01001….

5. MPEG-1 Encoder DCT Q VLC IQ ME ME 01001…. Q: quantization IDCT 01001…. Buffer IQ VLC Buffer ME: motion estimation IQ: reverse quantization

5. MPEG-1 Encoder I B P

5. MPEG-1 Encoder I B P

6. How to Encode I Frame? slice Y block DCT U V macroblock 10010100010…………

6. How to Encode I Frame? slice Y block DCT U V macroblock 10010100010………… Entropy coding

6. How to Encode I Frame? a. Color Space (1) RGB: display (2) YUV:

6. How to Encode I Frame? a. Color Space (1) RGB: display (2) YUV: coding (3) CIE: more close to human vision b. DCT (Discrete Cosine Transformation) 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 00000000 00000000 255 DCT

6. How to Encode I Frame? b. DCT (Discrete Cosine Transformation) 255 255 255

6. How to Encode I Frame? b. DCT (Discrete Cosine Transformation) 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 00000000 00000000 255 DCT

6. How to Encode I Frame? DCT 255 120 0 0 217 110 0

6. How to Encode I Frame? DCT 255 120 0 0 217 110 0 0 120 0 0 0 110 0 0 0 0 0 0 0 0 7 5 0 0 1 0 0 2 3 0 0 0 2 1 0 0 0 0 0 0 0 0 0 0 Zigzag scale Quantization Q(u) = integer round (u/scale) (7, 0), (5, 0), (2, 0), (3, 4), (1, 41) Entropy coding

6. How to Encode I Frame?

6. How to Encode I Frame?

6. How to Encode I Frame? Entrpoy coding: Code 1 01 probability 1 Pc=1/2

6. How to Encode I Frame? Entrpoy coding: Code 1 01 probability 1 Pc=1/2 1 Pc=1/4 001 Pc=1/8 000 Pc=1/8 1 0 0 0 Huffman Tree

7. How to Encode P Frame? Motion-based prediction I or P frame I B

7. How to Encode P Frame? Motion-based prediction I or P frame I B B Current P frame P B B P

7. How to Encode P Frame? Motion compensation: motion vectors + errors

7. How to Encode P Frame? Motion compensation: motion vectors + errors

7. How to Encode P Frame? Motion estimation: a. Find the reference block at

7. How to Encode P Frame? Motion estimation: a. Find the reference block at the same position (x, y) Reference Frame Current Frame I, P blocks & Skip

7. How to Encode P Frame? b. Take the reference block as the search

7. How to Encode P Frame? b. Take the reference block as the search center

8. How to Encode B Frame? Forward prediction Previous reference I Backward prediction Current

8. How to Encode B Frame? Forward prediction Previous reference I Backward prediction Current frame B B P B Future reference B P

8. How to Encode B Frame? Why we need B frame? Higher compression ratio

8. How to Encode B Frame? Why we need B frame? Higher compression ratio I, P, B blocks & Skips

8. How to Encode B Frame? Why we cannot put too much B frames?

8. How to Encode B Frame? Why we cannot put too much B frames? Display order: 1 2 I B Encoding 1 order: I 3 B 4 P 5 B 6 7 8 B P B 9 10 11 12 13 B P B B P 4 2 3 7 5 6 10 8 9 13 11 12 P B Buffer Size: 3 frames B P B B

9. How to Design MPEG Decoder? Video sequence Sequence header GOPGOP GOP I-frame P-frame

9. How to Design MPEG Decoder? Video sequence Sequence header GOPGOP GOP I-frame P-frame header Picture header B-frame slice Slice macroblock header slice Sequence layer GOP layer Picture layer macroblock Macroblock Block(0) Block(1) header Sequence end code Slice layer Block(5) Macroblock layer

9. How to Design MPEG Decoder? a. Search for the start codes: Sequence header

9. How to Design MPEG Decoder? a. Search for the start codes: Sequence header code: 0 x 000001 B 5 Sequence end code: 0 x 000001 B 7 Group_start_code: 0 x 000001 B 8 32 bits Picture_start_code: 0 x 00000100 32 bits Slice_start_code: 0 x 000001 AF 32 bits

9. How to Design MPEG Decoder? b. Functions for decoding the video data: Sequence

9. How to Design MPEG Decoder? b. Functions for decoding the video data: Sequence header() 32 Sequence_start_code 12 Horizontal size 12 Vertical size 4 Pel_aspect_ratio 4 Picture_rate 1 Bit rate Marker_bit 10 Buffer_size 18 Q table 22 Done Quantization table

9. How to Design MPEG Decoder? Group_of_picture () 32 Group_start_code 1 Drop_frame_flag 5 Time_code_hours

9. How to Design MPEG Decoder? Group_of_picture () 32 Group_start_code 1 Drop_frame_flag 5 Time_code_hours 6 Time_code_minutes 1 Market_bit 6 Time_code_seconds 6 Time_code_pictures Close_gop 1 1 Picture( ) Done Broken_link

9. How to Design MPEG Decoder? Picture ( ) 32 10 3 16 Picture_start_code

9. How to Design MPEG Decoder? Picture ( ) 32 10 3 16 Picture_start_code Temporal_reference Picture_coding_type Decoding_delay 3 Forward_vector_type 3 Backward_vector_type Slice( ) Done

9. How to Design MPEG Decoder? Slice ( ) 32 5 Macroblock ( )

9. How to Design MPEG Decoder? Slice ( ) 32 5 Macroblock ( ) Done Slice_start_code Quantization scale

9. How to Design MPEG Decoder? Macroblock ( ) 11 Macroblock_escape 1 -11 Macroblock_address_increase

9. How to Design MPEG Decoder? Macroblock ( ) 11 Macroblock_escape 1 -11 Macroblock_address_increase 1 -6 Macroblock_type 5 Quantizer_scale Motion_vector ( ) 3 -9 Block (i) Done Coded_block_pattern

10. Where you can find MPEG? a. http: //www. mpeg. org b. http: //www.

10. Where you can find MPEG? a. http: //www. mpeg. org b. http: //www. cs. wayne. edu/~dil/research Question: If you are offered a job on designing MPEG decoder, how you can do? Show me the video frames from 1228 to 1338? IBM, Microsoft, Intel, NEC, Cisco, Eastman Kodak, ……, . com