EEC-682/782 Computer Networks I Lecture 21 Wenbing Zhao wenbingz@gmail.com http://academic.csuohio.edu/zhao_w/teaching/eec682.htm (Lecture nodes are based on materials supplied by Dr. Louise Moser at UCSB and Prentice-Hall) Outline Review of last lecture WWW Today s topics Multimedia Assignment #2 issued today Due May 3, 2005 (two weeks from now) Use my google mail account to turn in: wenbingz@gmail.com -Wenbing Zhao 2 1
The World Wide Web Architectural Overview Static Web Documents Dynamic Web Documents HTTP The HyperText Transfer Protocol Performance Enhancements -Wenbing Zhao 3 Architectural Overview WWW consists of a vast collection of documents or Web pages Each page may contain links to other pages. Users can follow a link by clicking on it, which then takes them to the page pointed to The idea of having one page point to another is called hypertext Invented by Vannevar Bush, a MIT EE professor, in 1945 Browser program used to view Web pages Hyperlinks strings of text that are links to other pages -Wenbing Zhao 4 2
URLs Uniform Resource Locaters URL Uniform Resource Locator URL encodes three types of information What is the page called local name uniquely indicating the specific page Where is the page located DNS name of the server on which the page is located How can the page be accessed protocol, e.g., http, ftp -Wenbing Zhao 5 Statelessness and Cookies HTTP is basically stateless Sometimes, it is necessary to have stateful Web client/server communications Cookies: name derives from ancient programmer slang in which a program calls a procedure and gets something back that it may need to present later to get some work done Some examples of cookies -Wenbing Zhao 6 3
HTML HyperText Markup Language (a) The HTML for a sample Web page. (b) The formatted page. (b) -Wenbing Zhao 7 XML and XSL Drawback of HTML Mixes content with formatting Does not provide structure to Web pages XML: extensible Markup Language Describes Web content in a structured way XSL: extensible Style Language Describes the formatting independently of the content -Wenbing Zhao 8 4
Dynamic Web Documents Server-side dynamic Web page generation CGI Common Gateway Interface Standard interface to allow Web servers to talk to back-end programs and scripts that can accept input and generate HTML pages in response PHP PHP: Hypertext Preprocessor PHP scripts embeded inside HTML pages and have them be executed by the server itself to generate response page JSP - Java Server Pages ASP Active Server Pages Client-side dynamic Web page generation JavaScript -Wenbing Zhao 9 HyperText Transfer Protocol HTTP HyperText Transfer Protocol It specifies what messages clients may send to servers and what responses they get back in return. Each interaction consists of one ASCII request, followed by one EFC 822 MIME-like response Defined in RFC 2616 HTTP Connection In HTTP 1.0: make connection, sends a request, gets a response, tears down connection In HTTP 2.0: connection can be reused Methods: had some provision for object-oriented programming Message header -Wenbing Zhao 10 5
Performance Enhancement Caching Save pages that have been requested in case they are used again Client-side technique Server replication Replicate server s contents at multiple locations Sometimes called mirroring Content delivery networks Deliver contents for their providers to end users efficiently for a fee Whole process starts with URL replacement so all contents point to a CDN server On receiving client s request, the request is redirected to the closest proxy server -Wenbing Zhao 11 Multimedia Introduction to Audio Audio Compression Streaming Audio Internet Radio Voice over IP Introduction to Video Video Compression Video on Demand The MBone The Multicast Backbone -Wenbing Zhao 12 6
Introduction to Audio The frequency range: 20Hz 20,000Hz The ear hears logarithmically. Ratio of two sounds with power A and B is expressed in db (decibels): db = 10 log 10 (A/B) Low limit of audibility for a 1-kHz sine wave as 0 db Ordinary conversion is about 50 db Pain threshold is about 120 db => a dynamic range of a factor of 1 million -Wenbing Zhao 13 Introduction to Audio Audio waves can be converted to digital form by an ADC (Analog Digital Converter) Quantization noise: the error introduced by the finite number of bits per sample On a telephone line, 8000 samples/sec, frequencies about 4kHz are lost <= Nyquist theorem Audio CDs: digitized with a sampling rate of 44,100 samples/sec (enough to capture freq. up to 22,050Hz) The samples are 16 bits each and are linear over the range of amplitudes Allow only 65,536 distinct values Needs a bandwidth of 1.411 Mbps for stereo -Wenbing Zhao 14 7
Introduction to Audio (a) A sine wave. (b) Sampling the sine wave. (c) Quantizing the samples to 4 bits. -Wenbing Zhao 15 Audio Compression Two ways to do audio compression Waveform coding: the signal is transformed mathematically by a Fourier transform into its frequency components. The amplitude of each component is then encoded in a minimal way. The goal is to reproduce the waveform accurately at the other end in as few bits as possible Perceptual coding: exploits certain flaws in the human auditory system to encode a signal in such a way that it sounds the same to a human listener, even if it looks quite different on an oscilloscope Some sounds can mask other sounds Frequency masking: a loud sound in one frequency band can hide a softer sound in another frequency band Temporal masking: it takes the human ear a brief period of time to hear the masked signal even after the masking signal goes away MP3 (MPEG audio layer 3) is based on perceptual coding -Wenbing Zhao 16 8
Audio Compression (a) The threshold of audibility as a function of frequency (b) The masking effect -Wenbing Zhao 17 Streaming Audio A straightforward way to implement clickable music on a Web page -Wenbing Zhao 18 9
Streaming Audio The media player has four major jobs to do Manage the user interface Handle transmission errors Decompress the music Eliminate jitter -Wenbing Zhao 19 Streaming Audio When packets carry alternate samples, the loss of a packet reduces the temporal resolution rather than creating a gap in time. -Wenbing Zhao 20 10
Streaming Audio The media player buffers input from the media server and plays from the buffer rather than directly from the network. -Wenbing Zhao 21 Streaming Audio RTSP (Real Time Streaming Protocol) provides the mechanism for the player to control the server. It does not provide for the data stream, which is usually RTP. RTSP commands from the player to the server. -Wenbing Zhao 22 11
Internet Radio An example radio station. -Wenbing Zhao 23 Voice over IP ITU recommendation for Voice of IP H.323 Visual Telephone Systems and Equipment for Local Area Networks Which Provide a Non-Guaranteed Quality of Service The H323 architectural model for Internet telephony. -Wenbing Zhao 24 12
Voice over IP The H323 protocol stack. -Wenbing Zhao 25 Voice over IP G.711 PCM system. It encodes a single voice channel by sampling 8000 times per second with an 8-bit sample to give uncompressed speech at 64 kbps All H.323 systems must support G.711 H.245 protocol needed to allow terminals to negotiate which one they are going to use It also negotiates other aspects of the connection such as the bit rate RTP needed for actual data transmission RTCP is needed for the control of the RTP channels Q.931 protocol for establishing and releasing connections, providing dial tones, making ringing sounds, and the rest of standard telephony H.225 protocol for terminals to talk to the gatekeeper RAS (Registration/Admission/Status) channel: PC-to-gatekeeper channel This channel allows terminals to join and leave the zone, request and return bandwidth, and provide status updates -Wenbing Zhao 26 13
Voice over IP Logical channels between the caller and callee during a call. -Wenbing Zhao 27 SIP The Session Initiation Protocol A simpler and more modular way to do voice over IP, by IETF The SIP methods defined in the core specification. -Wenbing Zhao 28 14
SIP Use a proxy and redirection servers with SIP. -Wenbing Zhao 29 Comparison of H.323 and SIP 15
Video Analog Systems Frame: to represent the two-dimensional image in front of it as a one-dimensional voltage as a function of time, the camera scans an electron beam rapidly across the image and slowly down it, recording the light intensity as it goes. At the end of the scan, called a frame, the beam retraces. Field: half frame with odd or even scan lines Interlacing: the technique to eliminate the flicking by displaying odd and even scan lines with increased rate Noninterlaced television or video is called progressive. -Wenbing Zhao 31 Video Analog Systems The scanning pattern used for NTSC video and television. -Wenbing Zhao 32 16
Video Analog Systems Television system standards National Television Standards Committee (NTSC) Phase Alternating Line (PAL) Sequential Couleur Avec Memoire (SECAM) High Definition TeleVision (HDTV) To allow color transmissions to be viewed on black-and-white receivers, RGB signals into a luminance (brightness) signal and two chrominance (color) signals The eye is much more sensitive to the luminance signal than to the chrominance signals Luminance signal can be broadcast at the same frequency as old black-and-white signal Two chrominance signals are broadcast in narrow bands at higher frequencies -Wenbing Zhao 33 Video Compression Requirements on encoding and decoding Decoding happens a lot and it must be fast For most of video documents, it is OK if the encoding algorithm is complex and time consuming For real-time multimedia, encoding must also be fast and efficient Encode/decode process need not be invertible A video is just a sequence of images plus sound A good algorithm for encoding a single image is a good starting point. When the decoded output is not exactly the same as original input, the system is said to be lossy JPEG Joint Photographic Experts Group -Wenbing Zhao 34 17
The JPEG Standard The operation of JPEG in lossy sequential mode. -Wenbing Zhao 35 The JPEG Standard (a) RGB input data. (b) After block preparation. -Wenbing Zhao 36 18
The JPEG Standard (a) One block of the Y matrix. (b) The DTC coefficients. (a) (b) -Wenbing Zhao 37 The JPEG Standard Computation of the quantized DTC coefficients. -Wenbing Zhao 38 19
The JPEG Standard The order in which the quantized values are transmitted -Wenbing Zhao 39 The MPEG Standard MPEG Motion Picture Experts Group MPEG-1: to produce video-recorder-quality output 352x240 for NTSC, bit rate of 1.2 Mbps 352x240 image with 24 bits/pixel and 25 frames/sec requires 50.7 Mbps. We need a factor of 40 compression MPEG-2: designed for compressing broadcast-quality video into 4 to 6 Mbps. Later, MPEG-2 was expanded to support higher resolution, including HDTV It forms the basis for DVD and digital satellite television -Wenbing Zhao 40 20
The MPEG Standard Synchronization of the audio and video streams in MPEG-1 90-kHz -Wenbing Zhao 41 The MPEG Standard MPEG-1 output consists of four kinds of frames I (Intracoded) frames: self-contained JPEG-encoded still pictures P (Predictive) frames: block-by-block difference with the last frame B (Bidirectional) frames: differences between the last and next frame D (DC-coded) frames: block averages used for fast forward -Wenbing Zhao 42 21
The MPEG Standard I-frames: still pictures coded using a variant of JPEG, also using full-resolution luminance and half-resolution chrominance along each axis It is necessary to have I-frames appear in the output stream periodically for three reasons MPEG-1 can be used for a multicast transmission, with viewers tuning it at will. Without periodical I-frames, anyone who missed first frame could never decode any subsequent frames If any frame were received in error, no further ecoding would be possible Without I-frames, while doing a fast forward or rewind, the decoder would have to calculate every frame passed over so it would know the full value of the one it stopped on -Wenbing Zhao 43 The MPEG Standard Macroblocks 16x16 pixels in luminance space and 8x8 pixels in chrominance space. A macroblock is encoded by searching the previous frame for it or something only slightly different from it P-frames: code interframe differences. They are based on the idea of macroblocks Three consecutive frames. -Wenbing Zhao 44 22
The MPEG Standard B-frames: similar to P-frames, except that they allow the reference macroblock to be in either a previous frame or in a succeeding frame This additional freedom allows improved motion compensation and is also useful when objects pass in front of, or behind, other objects To do B-frame encoding, the encoder needs to hold three decoded frames in memory at once: the past one, the current one, and the future one -Wenbing Zhao 45 The MPEG Standard D-frames: only used to make it possible to display a low-resolution image when doing a rewind or fast forward. Each D-frame entry is just the average value of one block, with no further encoding -Wenbing Zhao 46 23
The MPEG Standard MPEG-2: targeted at broadcast television as well as DVD It supports both progressive and interlaced images (MPEG-1 supports only progressive images) Supports four resolution level Low (352x240) Main (720x480) High-1440 (1440x1152) High (1920x1080) -Wenbing Zhao 47 Video on Demand Overview of a video-on-demand system. 24
Video Servers Zipf s law: experimentally, when N movies are available, the fraction of all requests being for the k th most popular one is approximately C/k. Here C is computed to normalize the sum to 1, namely, C = 1/(1+1/2+1/3+ +1/N) A video server storage hierarchy. Video Servers The hardware architecture of a typical video server. -Wenbing Zhao 50 25
Video on Demand Distribution network ADSL Bandwidth not quite big enough FTTC Fiber To The Curb Telephone company runs optical fiber from the end office into each residential neighborhood, terminating in a device called an ONU (Optical Network Unit) FTTH Fiber To The Home Everyone can have an OC-1, OC-3, or even higher carrier if that is required. FTTH is very expensive and will not happen for years HFC Hybrid Fiber Coax Currently being installed by cable TV providers. Uses 750-MHz coax cables -Wenbing Zhao 51 The MBone The Multicast Backbone MBone consists of multicast islands connected by tunnels. -Wenbing Zhao 52 26
Exercises 7.5. DNS uses UDP instead of TCP. If a DNS packet is lost, there is no automatic recovery. Does this cause a problem, and if so, how is it solved? 7.6. In addition to being subject to loss, UDP packets have a maximum length, potentially as low as 576 bytes. What happens when a DNS name to be looked up exceeds this length? Can it be sent in two packets? 7.28. Although it was not mentioned in the text, an alternative form for a URL is to use the IP address instead of its DNS name. An example of using an IP address is http://192.31.231.66/index.html. How does the browser know whether the name following the scheme is a DNS name or an IP address? -Wenbing Zhao 53 Exercises 7.40. The If-Modified-Since header can be used to check whether a cached page is still valid. Requests can be made for pages containing images, sound, video, and so on, as well as HTML. Do you think the effectiveness of this technique is better or worse for JPEG images as compared to HTML? Think carefully about what ''effectiveness'' means and explain your answer. 7.47. Could a psychoacoustic model be used to reduce the bandwidth needed for Internet telephony? If so, what conditions, if any, would have to be met to make it work? If not, why not? 7.48. An audio streaming server has a one-way distance of 50 msec with a media player. It outputs at 1 Mbps. If the media player has a 1-MB buffer, what can you say about the position of the low-water mark and the high-water mark? -Wenbing Zhao 54 27
Exercises 7.52. Can a 1-bit error in an MPEG frame affect more than the frame in which the error occurs? Explain your answer. -Wenbing Zhao 55 28