CS-3013 & CS-502, Summer 2006 Multimedia topics1 Multimedia CS-3013 & CS-502 Operating Systems.

Slides:



Advertisements
Similar presentations
MPEG: A Video Compression Standard for Multimedia Applications Václav Hlaváč CTU Prague, Initial material were slides of Didier.
Advertisements

Data Compression CS 147 Minh Nguyen.
Multimedia SystemsCS-502 Fall Multimedia Systems CS-502 Operating Systems Fall 2007 (Slides include materials from Operating System Concepts, 7 th.
Multimedia Systems As Presented by: Craig Tomastik.
Chapter 20: Multimedia Systems Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 20: Multimedia Systems What is Multimedia.
29.1 Chapter 29 Multimedia Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 20: Multimedia Systems.
Motivation Application driven -- VoD, Information on Demand (WWW), education, telemedicine, videoconference, videophone Storage capacity Large capacity.
1 Multimedia Chapter Introduction to multimedia 7.2 Multimedia files 7.3 Video compression 7.4 Multimedia process scheduling 7.5 Multimedia file.
Spring 2003CS 4611 Multimedia Outline Compression RTP Scheduling.
CS-3013 & CS-502, Summer 2006 Multimedia topics (continued)1 Multimedia Topics (continued) CS-3013 & CS-502 Operating Systems.
Multimedia Systems 1 CS502 Spring 2006 Multimedia Systems CS-502 Operating Systems.
MPEG: A Video Compression Standard for Multimedia Applications Didier Le Gall Communications of the ACM Volume 34, Number 4 Pages 46-58, 1991.
Spatial and Temporal Data Mining
MPEG: A Video Compression Standard for Multimedia Applications Didier Le Gall Communications of the ACM Volume 34, Number 4 Pages 46-58, 1991.
Computer Science 335 Data Compression.
Chapter 7 Multimedia Operating Systems
T.Sharon-A.Frank 1 Multimedia Image Compression 2 T.Sharon-A.Frank Coding Techniques – Hybrid.
Multimedia Systems (Part 1) CS-502 Fall Multimedia Systems (Part 1) CS-502 Operating Systems Fall 2006 (Slides include materials from Operating System.
Multimedia Systems (Part 2)
1 JPEG Compression CSC361/661 Burg/Wong. 2 Fact about JPEG Compression JPEG stands for Joint Photographic Experts Group JPEG compression is used with.jpg.
Image Compression - JPEG. Video Compression MPEG –Audio compression Lossy / perceptually lossless / lossless 3 layers Models based on speech generation.
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 32 – Media Server (Part 2) Klara Nahrstedt Spring 2012.
Using Multimedia on the Web
Media File Formats Jon Ivins, DMU. Text Files n Two types n 1. Plain text (unformatted) u ASCII Character set is most common u 7 bits are used u This.
1 Digital Video. 2  Until the arrival of the Pentium processor, in 1993, even the most powerful PCs were limited to capturing images no more than 160.
CS 1308 Computer Literacy and the Internet. Creating Digital Pictures  A traditional photograph is an analog representation of an image.  Digitizing.
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 8 – JPEG Compression (Part 3) Klara Nahrstedt Spring 2012.
ECE472/572 - Lecture 12 Image Compression – Lossy Compression Techniques 11/10/11.
MPEG: A Video Compression Standard for Multimedia Applications Didier Le Gall Communications of the ACM Volume 34, Number 4 Pages 46-58, 1991.
Joonwon Lee OS Support for Multimedia.
Multimedia Data Video Compression The MPEG-1 Standard
MPEG: (Moving Pictures Expert Group) A Video Compression Standard for Multimedia Applications Seo Yeong Geon Dept. of Computer Science in GNU.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 19/20: Real-time and Multimedia Systems Inclusions from Tanenbaum,
Klara Nahrstedt Spring 2011
 Refers to sampling the gray/color level in the picture at MXN (M number of rows and N number of columns )array of points.  Once points are sampled,
XE33OSA Chapter 20: Multimedia Systems. 20.2XE33OSA Silberschatz, Galvin and Gagne ©2005 Chapter 20: Multimedia Systems What is Multimedia Compression.
Multimedia Operating Systems ●File System Paradigms ●File Replacement ●Caching ●Disk.
DIGITAL Video. Video Creation Video captures the real world therefore video cannot be created in the same sense that images can be created video must.
1 Lecture 17 – March 21, 2002 Content-delivery services. Multimedia services Reminder  next week individual meetings and project status report are due.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Multimedia Systems.
Image Processing and Computer Vision: 91. Image and Video Coding Compressing data to a smaller volume without losing (too much) information.
MULTIMEDIA TECHNOLOGY SMM 3001 MEDIA - VIDEO. In this chapter How digital video differs from conventional analog video How digital video differs from.
8. 1 MPEG MPEG is Moving Picture Experts Group On 1992 MPEG-1 was the standard, but was replaced only a year after by MPEG-2. Nowadays, MPEG-2 is gradually.
Spring 2000CS 4611 Multimedia Outline Compression RTP Scheduling.
Marwan Al-Namari 1 Digital Representations. Bits and Bytes Devices can only be in one of two states 0 or 1, yes or no, on or off, … Bit: a unit of data.
COMP135/COMP535 Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 2 Lecture 2 – Digital Representations.
STATISTIC & INFORMATION THEORY (CSNB134) MODULE 11 COMPRESSION.
CS Spring 2014 CS 414 – Multimedia Systems Design Lecture 19 – Multimedia Transport Subsystem (Part 2) + Midterm Review Klara Nahrstedt Spring 2014.
CS Spring 2009 CS 414 – Multimedia Systems Design Lecture 27 – Media Server (Part 2) Klara Nahrstedt Spring 2009.
Chapter 20: Multimedia Systems
Multimedia Systems Operating System Presentation On
Chapter 20: Multimedia Systems
Data Compression.
Multimedia Outline Compression RTP Scheduling Spring 2000 CS 461.
Data Compression.
Video Compression - MPEG
Data Compression CS 147 Minh Nguyen.
Chapter 20: Multimedia Systems
Chapter 7 Multimedia 7.1 Introduction to multimedia
Chapter 7 Multimedia 7.1 Introduction to multimedia
Judith Molka-Danielsen, Oct. 02, 2000
Chapter 7 Multimedia 7.1 Introduction to multimedia
Chapter 7 Multimedia 7.1 Introduction to multimedia
Chapter 20: Multimedia Systems
Chapter 7 Multimedia 7.1 Introduction to multimedia
Chapter 20: Multimedia Systems
Chapter 20: Multimedia Systems
Presentation transcript:

CS-3013 & CS-502, Summer 2006 Multimedia topics1 Multimedia CS-3013 & CS-502 Operating Systems

CS-3013 & CS-502, Summer 2006 Multimedia topics2 Outline CD devices and formats Requirements and challenges for audio and video in computer systems Systems for multimedia Compression and bandwidth Processor scheduling File, disk, and network management Tanenbaum, Chapter 7 Silbershatz, Chapter 20

CS-3013 & CS-502, Summer 2006 Multimedia topics3 CD-ROMs See Tanenbaum, pp Audio CD –Molded polycarbonate –120 mm diameter with 15 mm hole –One single spiral track Starts in center, spirals outward 22,188 revolutions, approx 5.6 kilometers long –Constant linear velocity under read head Audio playback:– 120 cm/sec Variable speed motor:– 200 – 530 rpm ISO standard IS 10149, aka the Red Book

CS-3013 & CS-502, Summer 2006 Multimedia topics4 CD-ROM (continued) Problem for adapting to data usage –No bad block recovery capability! ISO standard for data: Yellow Book –Three levels of error-correcting schemes: – Symbol, Frame, Sector ~7200 bytes to record 2048 byte payload per sector –Mode 2: less error correction in exchange for more data rate Audio and video data –Sectors linearly numbered from center to edge Read speed –1x ~ 153,000 bytes/sec –40x ~ 5.9 megabytes/sec ISO standard for multi-media: Green Book –Interleaved audio, video, data in same sector

CS-3013 & CS-502, Summer 2006 Multimedia topics5 CD-ROM File System ISO 9660 — High Sierra Write once  contiguous file allocation Variable length directories Variable length directory entries Points to first sector of file File size and metadata stored in directory entry Variable length names Several extensions to standard for additional features See Tanenbaum, pp

CS-3013 & CS-502, Summer 2006 Multimedia topics6 DVD devices Similar in concept, different in details More data, higher bandwidth Details not provided here –Tanenbaum, pp

CS-3013 & CS-502, Summer 2006 Multimedia topics7 What do we mean by “multimedia” Audio and video within a computer system –CD’s & DVD’s –Computer hard drive Live broadcast & web casts –Webcams, Skype, … Video on demand –Pause, fast forward, reverse, etc. Interactive meetings –Presentations with 2-way audio –Teleconferencing Interactive gaming …

CS-3013 & CS-502, Summer 2006 Multimedia topics8 Requirements “Smooth” audio and video –Deterioration in quality >> jerky playback –Note: human is more sensitive to jitter in audio than to jitter in video! Audio/video on PC’s doing something else Multiple concurrent streams –Video & multimedia servers –TiVo, etc. Wide range of network bandwidths

CS-3013 & CS-502, Summer 2006 Multimedia topics9 System and OS Challenges Bandwidths and Compression Jitter Processor Scheduling Disk Scheduling Network Streaming

CS-3013 & CS-502, Summer 2006 Multimedia topics10 Some System Architectures Simple: –Data paths for audio/video that are separate from computational data paths Modern –Fast system bus, CPU, devices Video server –Disk farm and multiple streams

CS-3013 & CS-502, Summer 2006 Multimedia topics11 audio stream CD-ROM drive System Organization (simple) Separate data path for audio stream Main system bus and CPU were too busy/slow to handle real-time audio CPU Memory memory bus DeviceSound card

CS-3013 & CS-502, Summer 2006 Multimedia topics12 video stream via ISA & bridge to graphics card audio stream via ISA bridge to sound card System Organization (typ. Pentium) ISA bridge IDE disk Main Memory CPU Level 2 cache Bridge Moni- tor Graphics card USB Key- board Mouse Ether- net SCSI Modem Sound card Printer PCI bus ISA bus AGP Port

CS-3013 & CS-502, Summer 2006 Multimedia topics13 Video Server Multiple CPUs Disk farm –1000s of disks Multiple high-bandwidth network links –Cable TV –Video on demand –Internet

CS-3013 & CS-502, Summer 2006 Multimedia topics14

CS-3013 & CS-502, Summer 2006 Multimedia topics15 Challenges Compression –to keep bandwidth manageable “Quality of Service” –to deliver sounds and images on time for acceptable quality reproduction

CS-3013 & CS-502, Summer 2006 Multimedia topics16 Why Compression? – CD-quality audio 22,050 Hz  44,100 samples/sec 16 bits per sample Two channels  176,400 bytes/sec  1.4 mbits/sec –Okay for a modern PC –Not okay for 56 kb/sec modem (speed) or iPod (space)! MP-3  0.14 mbits/sec (10:1) –Same audio quality! –Compression ratio varies with type of music

CS-3013 & CS-502, Summer 2006 Multimedia topics17 Why Compression? – Video “Standard” TV frame = 640  frames/sec (fps)   9,216,000 pixels/sec = 27,648,000 bytes/sec Typical movie  133 minutes  approx. 210 gigabytes (standard resolution)! HDTV = 1280  fps  82,944,000 bytes/sec (and rising!) DVD holds ~ 4.7 gigabytes  average of ~ 620 kilobytes/sec! “Standard” movie of 133 minutes requires serious compression just to fit onto DVD

CS-3013 & CS-502, Summer 2006 Multimedia topics18 Video Compression Requirements Compression ratio > 50:1 i.e., 210 gigabytes:4.7 gigabytes Visually indistinguishable from original Even when paused Fast, cheap decoder Slow encoder is okay VCR controls Pause, fast forward, reverse

CS-3013 & CS-502, Summer 2006 Multimedia topics19 Video Compression Standards MPEG (Motion Picture Experts Group) –Based on JPEG (Joint Photographic Experts Group) –Multi-layer Layer 1 = system and timing information Layer 2 = video stream Layer 3 = audio and text streams Three standards –MPEG-1 – 352  240 frames; < 1.5 mb/sec ( < VHS quality) Layer 3 = MP3 Audio standard –MPEG-2 – standard TV & HDTV; mb/sec DVD encoding –MPEG-4 – combined audio, video, graphics 2D & 3D animations

CS-3013 & CS-502, Summer 2006 Multimedia topics20 JPEG compression (single frame) 1.Convert RGB into YIQ Y = luminance (i.e., brightness) ~ black-white TV I, Q = chrominance (similar to saturation and hue) Reason: Human eye is more sensitive to luminance than to color (rods vs. cones) 2.Down-sample I, Q channels i.e., average over 2  2 pixels to reduce resolution lossy compression, but barely noticeable to eye 3.Partition each channel into 8  8 blocks 4800 Y blocks, 1200 each I & Q blocks

CS-3013 & CS-502, Summer 2006 Multimedia topics21 JPEG (continued)

CS-3013 & CS-502, Summer 2006 Multimedia topics22 JPEG (continued)

CS-3013 & CS-502, Summer 2006 Multimedia topics23 JPEG (continued) 4.Calculate Discrete Cosine Transform (DCT) of each 8  8 block What is a Discrete Cosine Transform? 5.Divide 8  8 block of DCT values by 8  8 quantization table Effectively throwing away higher frequencies 6.Linearize 8  8 block, run-length encode, and apply a Huffman code to reduce to a small fraction of original size (in bytes)

CS-3013 & CS-502, Summer 2006 Multimedia topics24 JPEG (concluded) 7.Store or transmit 8  8 quantization table followed by list of compressed blocks Achieves 20:1 compression with good visual characteristics Higher compression ratios possible with visible degradation JPEG algorithm executed backwards to recover image Visually indistinguishable from 20:1 JPEG algorithm is symmetric Same speed forwards and backwards

CS-3013 & CS-502, Summer 2006 Multimedia topics25 MPEG JPEG-like encoding of each frame Takes advantage of temporal locality I.e., each frame usually shares similarities with previous frame  encode and transmit only differences Sometimes an object moves relative to background  find object in previous frame, calculate difference, apply motion vector

CS-3013 & CS-502, Summer 2006 Multimedia topics26 Temporal Locality (example) Consecutive Video Frames

CS-3013 & CS-502, Summer 2006 Multimedia topics27 MPEG organization Three types of frames –I-frame: Intracoded or Independent. Full JPEG-encoded frame Occurs at intervals of a second or so Also at start of every scene –P-frame: Predictive frame Difference from previous frame –B-frame: Bidirectional frame Like p-frame but difference from both previous and next frame IBBBP BBBPBBBPBBBIBBBPBBBP

CS-3013 & CS-502, Summer 2006 Multimedia topics28 MPEG Characteristics Non-uniform data rate! Compression ratios of 50:1 – 80:1 are readily obtainable Asymmetric algorithm –Fast decode (like JPEG) –Encode requires image search and analysis to get high quality differences Cheap decoding chips available for –graphics cards –DVD players, etc.

CS-3013 & CS-502, Summer 2006 Multimedia topics29 MPEG Problem – Fast Forward/Reverse Cannot simply skip frames –Next desired frame might be B or P derived from a skipped frame Options: –Separate fast forward and fast reverse files MPEG encoding of every nth frame See Tanenbaum §7.5.1 – video-on-demand server –Display only I and P frames If B frame is needed, derive from nearest I or P

CS-3013 & CS-502, Summer 2006 Multimedia topics30 “Movie” File Organization One MPEG-2 video stream Multiple audio streams Multiple languages Multiple text streams Subtitles in multiple languages All interleaved Possibly in multiple files!

CS-3013 & CS-502, Summer 2006 Multimedia topics31

CS-3013 & CS-502, Summer 2006 Multimedia topics32 Operating System Challenge How to get the contents of a movie file from disk or DVD drive to video screen and speakers. –Fixed frame rate (25 or 30 fps) –Steady audio rate –Bounded jitter Classical problem in real-time scheduling –Obscure niche become mainstream! –See Silbershatz, Chapter 19

CS-3013 & CS-502, Summer 2006 Multimedia topics33 Processor Scheduling for Real-Time Rate Monotonic Scheduling (RMS) Assume m periodic processes –Process i requires C i msec of processing time every P i msec. –Equal processing every interval — like clockwork! Assume Let priority of process i be –Statically assigned Let priority of non-real-time processes be 0

CS-3013 & CS-502, Summer 2006 Multimedia topics34 Rate Monotonic Scheduling (continued) Scheduler simply runs highest priority process that is ready –May pre-empt other real-time processes –Real-time processes become ready in time for each frame or sound interval

CS-3013 & CS-502, Summer 2006 Multimedia topics35 Rate Monotonic Scheduling (continued) Theorem: using these priorities, scheduler can guarantee the needed Quality of Service (QoS), provided that Asymtotically approaches ln 2 as m   I.e., must maintain some slack in scheduling Assumes fixed amount of processing per periodic task –Not MPEG!

CS-3013 & CS-502, Summer 2006 Multimedia topics36 Processor Scheduling for Real-Time Earliest Deadline First (EDF) When each process i become ready, it announces deadline D i for its next task. Scheduler always assigns processor to process with earliest deadline. May pre-empt other real-time processes

CS-3013 & CS-502, Summer 2006 Multimedia topics37 Earliest Deadline First Scheduling (continued) No assumption of periodicity No assumption of uniform processing times Theorem: If any scheduling policy can satisfy QoS requirement for a sequence of real time tasks, then EDF can also satisfy it. –Proof: If i scheduled before i+1, but D i+1 < D i, then i and i+1 can be interchanged without affecting QoS guarantee to either one.

CS-3013 & CS-502, Summer 2006 Multimedia topics38 Earliest Deadline First Scheduling (continued) EDF is more complex scheduling algorithm Priorities are dynamically calculated Processes must know deadlines for tasks EDF can make higher use of processor than RMS Up to 100% However, it is usually a good idea to build in some slack

CS-3013 & CS-502, Summer 2006 Multimedia topics39 Questions?

CS-3013 & CS-502, Summer 2006 Multimedia topics40 Multimedia File & Disk Management Single movie or multimedia file on PC disk –Interleave audio, video, etc. So temporally equivalent blocks are near each other –Attempt contiguous allocation Avoid seeks within a frame Text Frame Audio Frame

CS-3013 & CS-502, Summer 2006 Multimedia topics41 File organization – Frame vs. Block Frame organization Small disk blocks (4-16 Kbytes) Frame index entries point to starting block for each frame Frames vary in size (MPEG) Advantage: very little storage fragmentation Disadvantage: large frame table in RAM Block organization Large disk block (256 Kbytes) Block index entries point to first I-frame of a sequence Multiple frames per block Advantage: much smaller block table in RAM Disadvantage: large storage fragmentation on disk

CS-3013 & CS-502, Summer 2006 Multimedia topics42 Frame vs. Block organization smaller larger

CS-3013 & CS-502, Summer 2006 Multimedia topics43 File Placement on Server Random Striped “Organ pipe” allocation –Most popular video in center of disk –Next most popular on either side of it –Etc. –Least popular at edges of disk –Minimizes seek distance

CS-3013 & CS-502, Summer 2006 Multimedia topics44 Placing Multiple files on Single Disk Zipf’s Law Rank items by “popularity” Zif’s Law says: Probability that next customer will choose item k is approximately C/k –Where C is a normalization constant such that N = 10  C = N = 100  C = N = 1000  C = N =  C = 0.102

CS-3013 & CS-502, Summer 2006 Multimedia topics45 Zipf’s Law applied to US cities Points represent populations 20 largest cities – sorted on rank order

CS-3013 & CS-502, Summer 2006 Multimedia topics46 Application of Zipf’s Law to movie file placement Organ-pipe distribution of files on server –most popular movie in middle of disk –next most popular either on either side, etc.

CS-3013 & CS-502, Summer 2006 Multimedia topics47 Disk Scheduling (server) Scheduling disk activity is just as important as scheduling processor activity Advantage:– Predictability Unlike disk activity of ordinary computing In server, there will be multiple disk requests in each frame interval One request per frame for each concurrent video stream

CS-3013 & CS-502, Summer 2006 Multimedia topics48 Disk Scheduling (continued) SCAN (Elevator) algorithm for each frame interval Sort by cylinder # Complete in time for start of next frame interval Variation – SCAN–EDF: Sort requests by deadline Group similar deadlines together, apply SCAN to group Particularly useful for non-uniform block sizes and frame intervals

CS-3013 & CS-502, Summer 2006 Multimedia topics49 Network Streaming Traditional HTTP Stateless Server responds to each request independently Real-Time Streaming Protocol (RTSP) Client initiates a “push” request for stream Server provides media stream at frame rate

CS-3013 & CS-502, Summer 2006 Multimedia topics50 Push vs. Pull server

CS-3013 & CS-502, Summer 2006 Multimedia topics51 Bandwidth Negotiation Client (or application) provides feedback to server to adjust bandwidth E.g., –Windows Media Player –RealPlayer –Quicktime

CS-3013 & CS-502, Summer 2006 Multimedia topics52 Conclusion Multimedia computing is challenging Possible with modern computers Compression is essential, especially for video Real-time computing techniques move into mainstream Processor and disk scheduling There is much more to this subject than fits into one class

CS-3013 & CS-502, Summer 2006 Multimedia topics53 Reading Assignments Tanenbaum, pp –CD and DVD devices Tanenbaum, Chapter 7 –Multimedia systems

CS-3013 & CS-502, Summer 2006 Multimedia topics54

CS-3013 & CS-502, Summer 2006 Multimedia topics55 Digression on Transforms Fourier’s Theorem Every continuous, periodic function can be reduced to the sum of a series of sine waves The Fourier transform is a representation of that function in terms of the frequencies of those sine waves Original function can be recovered from its Fourier transform Fourier transforms occur frequently in nature!

CS-3013 & CS-502, Summer 2006 Multimedia topics56 Nyquist’s Theorem (1924) If a continuous function is sampled at a frequency 2f, then the function can be recovered from those samples provided that its maximum Fourier frequency is  f.

CS-3013 & CS-502, Summer 2006 Multimedia topics57 Discrete Cosine Transform A form of the Fourier Transform When applied to an 8  8 block of samples (i.e. pixel values) yields an 8  8 block of spatial frequencies Original 8  8 block of samples can be recovered from its DCT. –Assuming infinite arithmetic precision

CS-3013 & CS-502, Summer 2006 Multimedia topics58 More on Nyquist If arithmetic precision is not infinite, we get quantization error during sampling Recovered signal has quantization noise i.e., a lossy transform