270 likes | 479 Views
Multimedia Communications EG 371 and EG 348. Dr Matthew Roach dr.matt.roach@iee.org Lecture 4 Fundamentals of compression. Speech, Image & Multimedia communications. Dr Matt Roach Lecture 4 History of video formats. Chromatic images. Colour Represented by vector not scalar
E N D
Multimedia CommunicationsEG 371 and EG 348 Dr Matthew Roach dr.matt.roach@iee.org Lecture 4 Fundamentals of compression Multimedia communications EG-371 Dr Matt Roach
Speech, Image & Multimedia communications Dr Matt Roach Lecture 4 History of video formats Multimedia communications EG-371 Dr Matt Roach
Chromatic images • Colour • Represented by vector not scalar • Red, Green, Blue (RGB) • Hue, Saturation, Value (HSV) • luminance, chrominance (Yuv , Luv) S=0 Green Hue degrees: Red, 0 deg Green 120 deg Blue 240 deg Red Green V=0 Multimedia communications EG-371 Dr Matt Roach
Chrominance components • HVS • Sensitive to luminance • RGB (4:4:4) • Luminance • 2 chrominance • Y = 0.299 R + 0.587 G + 0.114 B • Cb = B - Y • Cr = R - Y Multimedia communications EG-371 Dr Matt Roach
4:2:2 format 1 2 3 4 5 - - - - - - - - - - - - - - - - - - - - - - - - M • Studio quality • History dictates • Luminance • 13.5 MHz • Chrominance • 6.75 MHz 1 2 3 4 5 N Chrominance sample Multimedia communications EG-371 Dr Matt Roach
4:2:0 Digitised format 1 2 3 4 5 - - - - - - - - - - - - - - - - - - - - - - - - M • Broadcast quality • 525 line system • Y = 640 x 480 • Cb = Cr = 320 x 240 • 60 Hz • 625 line system • Y = 768 x 576 • Cb = Cr = 384 x 288 • 50 Hz 1 2 3 4 5 N Chrominance sample Multimedia communications EG-371 Dr Matt Roach
Source intermediate format SIF 4:1:1 1 2 3 4 5 6 7 - - - - - - - - - - - - - - - - - - - - - M • VCR quality • 525 line system • Y = 320 x 240 • Cb = Cr = 160 x 120 • 30 Hz • 625 line system • Y = 384 x 288 • Cb = Cr = 192 x 144 • 25 Hz 1 2 3 4 5 6 7 N Chrominance sample (Y) Luminance sample (Cb, Cr) Multimedia communications EG-371 Dr Matt Roach
Common intermediate format CIF (4:1:1) • CIF • Spatial resolution SIF 625 line system • Y = 384 x 288 • Cb = Cr = 192 x 144 • Temporal resolution SIF 525 line system • 30 Hz • 4CIF • Y= 720 x 576, Cb = Cr = 360 x 288 • 16CIF • Y= 1440 x 1152, Cb = Cr = 720 x 576 Multimedia communications EG-371 Dr Matt Roach
Quarter CIFQCIF (4:1:1) 1 2 3 4 5 6 7 8 9 10 11 12 13 - - - - - - - - M • 64 Kbps networks • Y = 180 x 144 • Cb = Cr = 90 x 72 • 15/7.5 Hz • Modems • S-QCIF • Y = 128 x 96 • Cb = Cr = 64 x 48 1 2 3 4 5 6 7 8 9 10 11 12 13 N Chrominance sample (Y) Luminance sample (Cb, Cr) Multimedia communications EG-371 Dr Matt Roach
Bit rates Spatial Resolution • Luminance • Chrominance • Temporal resolution • Frames per second • Number of bits per sample • 8 bits i.e. 1 byte Multimedia communications EG-371 Dr Matt Roach
Bit rate example CIF • Y = 384 x 288 • Cb = Cr = 192 x 144 • 30 Hz • 384 x 288 x 8 x 30 + 2(192 x 144 x 8 x 30) • 39,813,120 bps = 39 Mbps Multimedia communications EG-371 Dr Matt Roach
Bit rate example4:2:0 (broadcast quality) • Y = 720 x 480 • Cb = Cr = 480 x 240 • 60 Hz (interlaced fields) • 720 x 240 x 8 x 60 + 2(480 x 240 x 8 x 60) • 124,416,000 bps = 124 Mbps Multimedia communications EG-371 Dr Matt Roach
CIF • CIF • 39 Mbps • QCIF • 4.6 Mbps • S-QCIF • 2.2 Mbps • ISDN • 64 Kbps • 128 Kbps • 2.0 Mbps • Modem • < 56 Kbps Multimedia communications EG-371 Dr Matt Roach
Common Container Formats • AVI (.avi) • M-JPEG, DivX, nearly any format (not Sorenson). • Quicktime • Locked Apple Sorenson codec, or for Cinepak (free), also mjpeg • WMV (.wmv) • MPEG4; nearly any codec, Microsoft spinoffs of MPEG-4 • ASF ("Advanced Streaming Format", .asf) • a subset of wmv, intended primarily for streaming: an early Microsoft implementation of an MPEG4 codec. Multimedia communications EG-371 Dr Matt Roach
Common Codecs • MPEG-1 • Old, supported by everything (at least up to 352x240), reasonably efficient. • A good format for the web • Video quality is not as crisp as MPEG-2 • Small file size • Good picture quality • Compressed format • Require special playback program • Cannot Edit • MPEG-2 • A souped-up version of MPEG-1, with better compression. 720x480. Used in HDTV, DVD, and SVCD. • Good Quality, Can burn onto DVD disc • Large file size, 4.7GB for 2 hours of video • MPEG-4 • A family of codecs, some of which are open, others Microsoft proprietary. • MJPEG ("Motion JPEG") • A codec consisting of a stream of JPEG images. Common in video from digital cameras, but it doesn't compress well, so it's not good for web distribution. Multimedia communications EG-371 Dr Matt Roach
Common Codecs cont. • WMV ("Windows Media Video") • A collection of Microsoft proprietary video codecs. • Since version 7, it has used a special version of MPEG4. • Small file size • Good picture quality • Ideal for web transmission • Compressed format • Cannot Edit • RM ("Real Media") • a closed codec developed by Real Networks for streaming video and audio. Maybe also a container? • DivX • incomplete early MPEG-4 codec inside an AVI container; DivX 4 and later are a more full MPEG-4 codec.. No resolution limit. Requires more horsepower to play than mpeg1, but less than mpeg2. • Hard to find mac and windows players. • Good Quality with reasonably small file size • Not a standard video format • Cannot produce video onto DVD or CD Multimedia communications EG-371 Dr Matt Roach
Common Codecs cont. • DV ("Digital Video") • Usually used for video grabbed via firewire off a video camera. Fixed at 720x480 @ 29.97FPS, or 720x576 @ 25 FPS. Not very highly compressed. • Superb quality, record back to DV tape • Large file size, 25GB for 60 min of video • Sorenson 3: • Apple's proprietary codec, commonly used for distributing movie trailers (inside a quicktime container). • Quicktime 6: • Apple's implementation of an MPEG4 codec. • Good picture quality • Ideal for web transmission • Larger file size (compare to other streamable formats) • Cannot Edit Multimedia communications EG-371 Dr Matt Roach
Histogram Equalisation, E(l) • Increases dynamic range of an image • Enhances contrast of image to cover all possible grey levels • Ideal histogram = flat • same no. of pixels at each grey level • Ideal no. of pixels at each grey level = Multimedia communications EG-371 Dr Matt Roach
Histogram equalisation Typical histogram Ideal histogram Multimedia communications EG-371 Dr Matt Roach
E(l) Algorithm • Allocate pixel with lowest grey level in old image to 0 in new image • If new grey level 0 has less than ideal no. of pixels, allocate pixels at next lowest grey level in old image also to grey level 0 in new image • When grey level 0 in new image has > ideal no. of pixels move up to next grey level and use same algorithm • Start with any unallocated pixels that have the lowest grey level in the old image • If earlier allocation of pixels already gives grey level 0 in new imageTWICE its fair share of pixels, it means it has also used up its quota for grey level 1 in new image • Therefore, ignore new grey level one and start at grey level 2 ….. Multimedia communications EG-371 Dr Matt Roach
Simplified Formula • E(l) equalised function • max maximum dynamic range • round round to the nearest integer (up or down) • L no. of grey levels • N*M size of image • t(l) accumulated frequencies Multimedia communications EG-371 Dr Matt Roach
Histogram equalisation examples Typical histogram After histogram equalisation Multimedia communications EG-371 Dr Matt Roach
Before HE After HE Ideal=3 Histogram Equalisation e.g. Multimedia communications EG-371 Dr Matt Roach
In a noiseless channel, the encoder is used to remove any redundancy 2 types of encoding LOSSLESS LOSSY Design concerns Compression ratio, CR achieved Quality achieved Trade off between CR and quality PVR removed, image quality is reduced 2 classes of criteria OBJECTIVE fidelity criteria SUBJECTIVE fidelity criteria OBJECTIVE: if loss is expressed as a function of IP / OP Fidelity Criteria Multimedia communications EG-371 Dr Matt Roach
Input f(x,y) compressed output f(x,y) error e(x,y) = f(x,y) -f(x,y) erms = root mean squared error SNR = signal to noise ratio PSNR = peak signal to noise ratio Fidelity Criteria Multimedia communications EG-371 Dr Matt Roach
Image statistics • MEAN = • VARIANCE2 = • STANDARDEVIATION = Multimedia communications EG-371 Dr Matt Roach