1 / 58

Multimedia

Multimedia. CS-3013 & CS-502 Operating Systems. 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

Download Presentation

Multimedia

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Multimedia CS-3013 & CS-502Operating Systems Multimedia topics

  2. 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 7Silbershatz, Chapter 20 Multimedia topics

  3. CD-ROMs • See Tanenbaum, pp. 306-310 • 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 Multimedia topics

  4. 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 Multimedia topics

  5. CD-ROM File SystemISO 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. 310-313 Multimedia topics

  6. DVD devices • Similar in concept, different in details • More data, higher bandwidth • Details not provided here • Tanenbaum, pp. 313-315 Multimedia topics

  7. 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 • … Multimedia topics

  8. 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 Multimedia topics

  9. System and OS Challenges • Bandwidths and Compression • Jitter • Processor Scheduling • Disk Scheduling • Network Streaming Multimedia topics

  10. 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 Multimedia topics

  11. Memory CD-ROM drive Device Sound card System Organization (simple) memory bus CPU audio stream • Separate data path for audio stream • Main system bus and CPU were too busy/slow to handle real-time audio Multimedia topics

  12. Ether-net SCSI USB Modem Soundcard Printer Mouse Key-board System Organization (typ. Pentium) Main Memory video stream viaISA & bridge tographics card AGP Port Level 2 cache CPU Bridge Graphics card Moni-tor ISA bridge PCI bus IDE disk audio stream viaISA bridge to sound card ISA bus Multimedia topics

  13. Video Server • Multiple CPUs • Disk farm • 1000s of disks • Multiple high-bandwidth network links • Cable TV • Video on demand • Internet Multimedia topics

  14. Multimedia topics

  15. Challenges • Compression • to keep bandwidth manageable • “Quality of Service” • to deliver sounds and images on time for acceptable quality reproduction Multimedia topics

  16. 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 Multimedia topics

  17. Why Compression? – Video • “Standard” TV frame = 640  480 pixels @ 25-30 frames/sec (fps)  • 9,216,000 pixels/sec = 27,648,000 bytes/sec • Typical movie  133 minutes • approx. 210 gigabytes (standard resolution)! • HDTV = 1280  720 pixels @ 30 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 Multimedia topics

  18. 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 Multimedia topics

  19. 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; 1.5-15 mb/sec • DVD encoding • MPEG-4 – combined audio, video, graphics • 2D & 3D animations Multimedia topics

  20. JPEG compression (single frame) • 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) • Down-sample I, Q channels • i.e., average over 22 pixels to reduce resolution • lossy compression, but barely noticeable to eye • Partition each channel into 88 blocks • 4800 Y blocks, 1200 each I & Q blocks Multimedia topics

  21. JPEG (continued) Multimedia topics

  22. JPEG (continued) Multimedia topics

  23. JPEG (continued) • Calculate Discrete Cosine Transform (DCT) of each 88 block • What is a Discrete Cosine Transform? • Divide 88 block of DCT values by 88quantization table • Effectively throwing away higher frequencies • Linearize 88 block, run-length encode, and apply a Huffman code to reduce to a small fraction of original size (in bytes) Multimedia topics

  24. JPEG (concluded) • 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 original @ 20:1 • JPEG algorithm is symmetric • Same speed forwards and backwards Multimedia topics

  25. 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 Multimedia topics

  26. Temporal Locality (example) Consecutive Video Frames Multimedia topics

  27. B B B I B B B B B B B B B B B B P P P P 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 I B B B P Multimedia topics

  28. 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. Multimedia topics

  29. 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 Multimedia topics

  30. “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! Multimedia topics

  31. Multimedia topics

  32. 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 Multimedia topics

  33. Processor Scheduling for Real-TimeRate Monotonic Scheduling (RMS) • Assume m periodic processes • Process i requires Ci msec of processing time everyPi 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 Multimedia topics

  34. 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 Multimedia topics

  35. 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! Multimedia topics

  36. Processor Scheduling for Real-TimeEarliest Deadline First (EDF) • When each process i become ready, it announces deadline Difor its next task. • Scheduler always assigns processor to process with earliest deadline. • May pre-empt other real-time processes Multimedia topics

  37. 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 Di+1 < Di , then i and i+1 can be interchanged without affecting QoS guarantee to either one. Multimedia topics

  38. 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 Multimedia topics

  39. Questions? Multimedia topics

  40. 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 TextFrame AudioFrame Multimedia topics

  41. 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 Multimedia topics

  42. Frame vs. Block organization larger smaller Multimedia topics

  43. 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 Multimedia topics

  44. Placing Multiple files on Single DiskZipf’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 = 0.341N = 100  C = 0.193N = 1000  C = 0.134N = 10000  C = 0.102 Multimedia topics

  45. Zipf’s Law applied to US cities • Points represent populations 20largest cities • sorted on rank order Multimedia topics

  46. Application of Zipf’s Law tomovie file placement • Organ-pipe distribution of files on server • most popular movie in middle of disk • next most popular either on either side, etc. Multimedia topics

  47. 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 Multimedia topics

  48. 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 Multimedia topics

  49. 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 Multimedia topics

  50. Push vs. Pull server Multimedia topics

More Related