CS 414 – Multimedia Systems Design Lecture 10 – MPEG-1 Video (Part 5) Administrative Outline Comment on JPEG LossesMotion Picture Expert Group (MPEG)MPEG General Information MPEG Image Preparation (Resolution and Dimension)MPEG Image Preparation - BlocksMPEG Video ProcessingSelecting I, P, or B FramesMPEG-1 Video I-FramesMPEG Video P-FramesMotion Computation for P FramesMatching MethodsSlide Number 15Slide Number 16Syntax of P FrameMPEG Video B FramesMPEG Video Decoding MPEG Video QuantizationMPEG-1 Interchange FormatConclusionCS 414 - Spring 2011CS 414 – Multimedia Systems DesignLecture 10 – MPEG-1 Video (Part 5)Klara NahrstedtSpring 2011CS 414 - Spring 2011Administrative MP1 out – deadline February 18Outline MPEG-1 Hybrid Coding MP3 Audio Encoding Reading: Required: Media Coding Book, Section 7.7.1-7.7.4 and lectures Recommended Paper on MP3: Davis Pan, “A Tutorial on MPEG/Audio Compression”, IEEE Multimedia, pp. 6-74, 1995 Recommended books on JPEG/ MPEG Audio/Video Fundamentals: Haskell, Puri, Netravali, “Digital Video: An Introduction to MPEG-2”, Chapman and Hall, 1996 Pennebaker, Mitchel, “JPEG: Still Image Data Compression Standard, VNR Publisher, 1993CS 414 - Spring 2011Comment on JPEG Losses Losses in JPEG compression occur during the quantization because S(u,v)’ = Round(S(u,v)/Q(u,v)).1. Image Preparation => 2. DCT Transform S(u,v) = DCT(S(x,y)) => 3. Quantization with S(u,v)’ = Round(S(u,v)/Q(u,v) => 4. Entropy Encoding => 5. Transmission of compressed Image => 6. Entropy Decoding =>7. De-quantization S(u,v)’’ = S(u,v)’*Q(u,v) Compression Loss since S(u,v)” ≠ S(u,v) => 8. Apply Inverse DCT => 9. Display ImageCS 414 - Spring 2011Motion Picture Expert Group (MPEG) General Information about MPEG Began in 1988; Part of Same ISO as JPEG MPEG-1/Video MPEG/Audio – MP3 MPEG-2 MPEG-4 MPEG-7 MPEG-21CS 414 - Spring 2011MPEG General Information Goal: data compression 1.5 Mbps MPEG defines video, audio coding and system data streams with synchronization MPEG information Aspect ratios: 1:1 (CRT), 4:3 (NTSC), 16:9 (HDTV) Refresh frequencies: 23.975, 24, 25, 29.97, 50, 59.94, 60 HzCS 414 - Spring 2011MPEG Image Preparation (Resolution and Dimension) MPEG defines exactly format Three components: Luminance and two chrominance components (2:1:1) Resolution of luminance comp:X1 ≤ 768; Y1 ≤ 576 pixels Pixel precision is 8 bits for each component Example of Video format: 352x240 pixels, 30 fps; chrominance components: 176x120 pixelsCS 414 - Spring 2011MPEG Image Preparation -Blocks Each image is divided into macro-blocks Macro-block : 16x16 pixels for luminance; 8x8 for each chrominance component Macro-blocks are useful for Motion Estimation No MCUs which implies sequential non-interleaving order of pixels valuesCS 414 - Spring 2011MPEG Video Processing Intra frames (same as JPEG) typically about 12 frames between I frames Predictive frames encode from previous I or P reference frame Bi-directional frames encode from previous and future I or P framesCS 414 - Spring 2011I P IP PB B B B B B B BSelecting I, P, or B Frames Heuristics change of scenes should generate I frame limit B and P frames between I frames B frames are computationally intenseType Size CompressI 18K 7:1P 6K 20:1B 2.5K 50:1Avg 4.8K 27:1CS 414 - Spring 2011MPEG-1 Video I-FramesCS 414 - Spring 2011Intra-coded imagesI-frames – points of random access in MPEG streamI-frames use 8x8 blocks defined withinMacro-blockNo quantization table for all DCT coefficients, onlyquantization factorMPEG Video P-FramesCS 414 - Spring 2011Predictive coded framesrequire information of previous I frame and or previous P frame for encoding/decodingFor Temporary Redundancywe determine last P or I framethat is most similar to the block under considerationMotion Estimation MethodMotion Computation for P Frames Predictive search Look for match window within a given search window Match window – macro-block Search window – arbitrary window size depending how far away are we willing to look Displacement of two match windows is expressed by motion vectorCS 414 - Spring 2011Matching Methods SSD metric SAD metric Minimum error represents best match must be below a specified threshold error and perceptual similarity not always correlated∑−=−=102)(NiiiyxSSD∑−=−=10||NiiiyxSADCS 414 - Spring 2011CS 414 - Spring 2011Example of Finding Minimal SSDCS 414 - Spring 2011Example of Comparing Minimal SSD and SADSyntax of P FrameCS 414 - Spring 2011Addr: address the syntax of P frameType: INTRA block is specified if no good match was found Quant: quantization value per macro-block (vary quantization to fine-tune compression)Motion Vector: a 2D vector used for motion compensation provides offset from coordinate position in target image to coordinates in reference imageCBP(Coded Block Pattern): bit mask indicates which blocks are presentMPEG Video B FramesCS 414 - Spring 2011Bi-directionally Predictive-coded framesMPEG Video Decoding CS 414 - Spring 2011I1P1I2P2P3B1B2B3B4B5B6B7B8B2I1P1I2P2P3B1B3B4B5B6B7B8Display OrderDecoding OrderMPEG Video Quantization AC coefficients of B/P frames are usually large values, I frames have smaller values Adjust quantization If data rate increases over threshold, then quantization enlarges step size (increase quantization factor Q) If data rate decreases below threshold, then quantization decreases QCS 414 - Spring 2011MPEG-1 Interchange FormatCS 414 - Spring 2011GOP GOP...SeqSeq Seq…SeqSeqSCVideoParamBitstreamParamQT,miscPict Pict...GOPSCGOPParamTimeCodeMB MB...SSCQScaleVertPosSlice Slice...PSCType BufferParamEncodeParamCBP b5...AddrType MotionVectorQScaleb0GOP LayerSequence LayerPicture LayerSlice LayerMacro-block LayerBlock LayerConclusion MPEG system data stream Interchange format for audio and video streams Interleave audio and video packets; insert time stamps into each “frame” of data Synchronization SRC – system clock reference; DTS – decoding time stamp; PTS –presentation time stamp During encoding Insert SCR values into system stream Stamp each frame with PTS and DTS Use encode time to approximate decode time During decoding Initialize local decoder clock with start values Compare PTS to the value of local clock Periodically synchronize
View Full Document