Lecture 6 -_presentation_layer

3,422 views

Published on

Chapter 6 Internet Technology

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,422
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
205
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Lecture 6 -_presentation_layer

  1. 1. BITS 2513 – Internet Technology Lecture 6: Presentation Layer
  2. 2. Topics Covered <ul><li>Introduction to Presentation Layer </li></ul><ul><li>Data Representation </li></ul><ul><li>Data Compression </li></ul><ul><ul><li>Image </li></ul></ul><ul><ul><li>Audio </li></ul></ul><ul><ul><li>Video </li></ul></ul><ul><li>Encryption </li></ul>
  3. 3. Presentation Layer <ul><li>The presentation layer is the sixth level of the seven layer OSI model. </li></ul><ul><li>It responds to service requests from the application layer and issues service requests to the session layer. </li></ul><ul><li>Concerned with syntax and semantics of the information exchanged between two systems. </li></ul>
  4. 4. Presentation Layer From application layer To application layer From session layer To session layer Presentation layer Presentation layer Data Data
  5. 5. Presentation Format <ul><li>In the case of the sender and receiver seeing the same data, the issue is one of agreeing to a message format, called a presentation format . </li></ul><ul><li>The presentation layer may represent (encode) the data in various ways (e.g., data compression, or encryption), but the receiving peer will convert the encoding back into its original meaning (decode). </li></ul>
  6. 6. Encoding/Decoding <ul><li>The sending program translates the data it wants to transmit from the representation it uses internally into a message that can be transmitted over the network -> the data is encoded in a message. </li></ul><ul><li>On the receiving side, the application translates this arriving message into a representation it can process -> the message is decoded . </li></ul>
  7. 7. Presentation formatting Presentation formatting involves encoding and decoding application data. Application data Presentation encoding Application data Presentation decoding Message Message Message ■ ■ ■
  8. 8. Presentation Layer <ul><li>Specific responsibilities of presentation layer: </li></ul><ul><ul><li>Data Representation </li></ul></ul><ul><ul><li>Data Compression </li></ul></ul><ul><ul><li>Encryption </li></ul></ul>
  9. 9. DATA REPRESENTATION
  10. 10. Data Representation <ul><li>Different computers have different representations for characters. </li></ul><ul><li>If two dissimilar computers are to exchange text, say e-mail, they must agree on the representation to be used in the exchange. Then one must translate from, or into, the agreed upon representation. </li></ul>
  11. 11. Data Representation <ul><li>Converting the complex data structures used by an application (strings, integers, structures, etc. ) into a byte stream transmitted across the network. </li></ul><ul><li>Representing information in such a way that communicating peers agree to the format of the data being exchanged. E.g., How many bits does an integer contain?, ASCII or EBCDIC character set? </li></ul>
  12. 12. Data Representation <ul><li>Popular network data representations include: </li></ul><ul><ul><li>ASN.1 - an ISO standard </li></ul></ul><ul><ul><li>XDR - used with SunRPC </li></ul></ul>
  13. 13. ASN.1 <ul><li>Abstract Syntax Notation (ASN.1) is an ISO standard that addresses the issue of representing, encoding, transmitting, and decoding data structures. It consists of two parts: </li></ul><ul><ul><li>An abstract syntax that describes data structures in an unambiguous way. Use “ integers”, “character strings”, and “structures” rather than bits and bytes. </li></ul></ul><ul><ul><li>A transfer syntax that describes the bit stream encoding of ASN.1 data objects. </li></ul></ul>
  14. 14. ASN.1 <ul><li>The main reasons for the success of ASN.1 is that it is associated with several standardized encoding rules such as: </li></ul><ul><ul><li>Basic Encoding Rules (BER) - X.209 </li></ul></ul><ul><ul><li>Canonical Encoding Rules (CER) </li></ul></ul><ul><ul><li>Distinguished Encoding Rules (DER) </li></ul></ul><ul><ul><li>Packed Encoding Rules (PER) and </li></ul></ul><ul><ul><li>XER Encoding Rules (XER). </li></ul></ul><ul><li>These encoding rules describe how the values defined in ASN.1 should be encoded for transmission, regardless of machine, programming language, or how it is represented in an application program. </li></ul>
  15. 15. ASN.1 <ul><li>Example of ASN.1’S abstract syntax: </li></ul><ul><ul><ul><li>Student ::= SEQUENCE { </li></ul></ul></ul><ul><ul><ul><li>name [0] IMPLICIT OCTET STRING OPTIONAL, </li></ul></ul></ul><ul><ul><ul><li>grad [1] IMPLICIT BOOLEAN OPTIONAL DEFAULT FALSE, </li></ul></ul></ul><ul><ul><ul><li>gpa [2] IMPLICIT REAL OPTIONAL, </li></ul></ul></ul><ul><ul><ul><li>id [3] IMPLICIT INTEGER, </li></ul></ul></ul><ul><ul><ul><li>bday [4] IMPLICIT OCTET STRING OPTIONAL </li></ul></ul></ul><ul><ul><ul><li>} </li></ul></ul></ul>
  16. 16. ASN.1 <ul><li>ASN.1 is currently used in ISO protocol suite such as X.400 for electronic mail, X.500 for directory services, H.323 (VoIP) and SNMP </li></ul>
  17. 17. XDR <ul><li>Sun Microsystem's External Data Representation (XDR) is much simpler than ASN.1, but less powerful. For instance: </li></ul><ul><ul><li>XDR uses implicit typing. Communicating peers must know the type of any exchanged data. In contrast, ASN.1 uses explicit typing ; it includes type information as part of the transfer syntax. </li></ul></ul><ul><ul><li>In XDR, all data is transferred in units of 4 bytes. Numbers are transferred in network order, most significant byte first. </li></ul></ul>
  18. 18. XDR 4 bytes of XDR message:
  19. 19. XDR (cont.) <ul><ul><li>Strings consist of a 4 byte length, followed by the data (and perhaps padding in the last byte). </li></ul></ul><ul><ul><li>Defined types include: integer, enumeration, boolean, floating point, fixed length array, structures, plus others. </li></ul></ul><ul><li>One advantage that XDR has over ASN.1 is that current implementations of ASN.1 execute significantly slower than XDR. </li></ul>
  20. 20. DATA COMPRESSION
  21. 21. Data Compression <ul><li>Reduces the number of bits contained in the information. </li></ul><ul><li>Lossless Compression -- data is compressed and can be uncompressed without loss of information. These are referred to as bit-preserving or reversible compression systems. </li></ul><ul><li>Lossy Compression – aim to obtain the best possible fidelity for a given bit-rate or minimizing the bit-rate to achieve a given fidelity measure. Most suited to video and audio compression techniques </li></ul>
  22. 22. Why Compression? <ul><li>Sometimes programs need to send more data in a timely fashion than the bandwidth of the network supports. (For example, a video stream that needs 10Mbps to transmit on a 1 Mbps network). </li></ul><ul><li>It’s hard to move data on the Internet at >1Mbps. </li></ul><ul><li>The Internet does not allow applications to use more than their “fair share” of the bandwidth on a congested link. </li></ul><ul><li>Need to compress the data at the sender and decompress it at the receiver. </li></ul>
  23. 23. Why Compression? <ul><li>In terms of storage, the capacity of a storage device can be effectively increased with methods that compresses a body of data on its way to a storage device and decompresses it when it is retrieved. </li></ul><ul><li>In terms of communications, the bandwidth of a digital communication link can be effectively increased by compressing data at the sending end and decompressing data at the receiving end. </li></ul>
  24. 24. Steps of Data Compression <ul><li>Performed in the compression of still images, audio and video data streams: </li></ul><ul><li>Picture preparation – generates an appropriate digital representation if the information in the medium being compressed. </li></ul><ul><li>Picture processing –make use of the various compression algorithms </li></ul><ul><li>Quantization – values determined in previous step are quantized according to a specific resolution and characteristic curve. </li></ul><ul><li>Entropy encoding – with a sequential of individual bits and bytes, different techniques are used to perform a final, lossless compression </li></ul>
  25. 25. Steps of Data Compression Major steps of image compression, can also be applied to audio and video data Uncompressed Picture Picture Preparation Picture Processing Quantization Entropy Encoding Compressed Picture
  26. 26. IMAGE COMPRESSION <ul><li>DATA COMPRESSION </li></ul>
  27. 27. Image Compression <ul><li>to represent images with less data in order to save storage costs or transmission time. </li></ul><ul><li>possible to reduce file size to 10% from the original without noticeable loss in quality. </li></ul><ul><li>Image compression can be lossless or lossy . </li></ul>
  28. 28. Image Compression <ul><li>Lossless - Image quality is not reduced. Use in : artificial images that contain sharp-edged lines such as technical drawings, textual graphics, comics, maps or logos. Methods : run-length encoding (RLE), entropy coding (Huffman coding) and dictionary coders (LZW) . </li></ul>
  29. 29. Image Compression <ul><li>Lossy - reduces image quality. Cannot get the original image back & lose some information. Use in : natural images such as photos of landscapes Methods : discrete cosine transform (DCT, used in JPEG) or wavelet transform (used in JPEG 2000), color quantization </li></ul>
  30. 30. Comparison of graphics file formats FORMAT FILE EXTENTION TYPE OF COMPRESSION METHODS USAGE BMP (bitmap) .bmp Cosiderably compressed with lossless ZIP used to store bitmap digital images JPEG (Joint Photographic Experts Group) .jpg , .jpeg , .jpe Lossy Lossless - Discrete Cosine Transform (DCT) & Chroma Subsampling - Run-Length Encoding (RLE) For natural images GIF (Graphics Interchange Format .gif , .giff , .gfa Lossless LZW (Lempel-Ziv-Welch) For artificial images (sharp-edge lines and few colors) & support animation PNG (Portable Network Graphics) .png Lossless DEFLATE Better compression & features than GIF, but don’t support animation TIFF (Tagged Image File Format) .tiff , .tif Lossless RLE / LZW / DEFLATE / ZIP Flexible file format, can store multiple images in a single file JPEG2000 jp2, .j2c, jpc, j2k, jpx Lossy & Lossless Discrete Wavelet Transform (DWT) Better image quality than JPEG (up to 20%), not widely used because of some patent issues.
  31. 31. Block Diagram of JPEG Compression Transformation coding performed using the Discrete Cosine Transform (DCT) Quantization of all DCT coefficients ( a lossy process) Huffman coding and arithmetic coding as entropy encoding methods
  32. 32. AUDIO COMPRESSION <ul><li>DATA COMPRESSION </li></ul>
  33. 33. Audio Compression <ul><li>A form of data compression designed to reduce the size of audio files </li></ul><ul><li>Audio compression can be lossless or lossy </li></ul><ul><li>Audio compression algorithms are typically referred to as audio codecs . </li></ul>
  34. 34. Audio Compression <ul><li>Lossless - allows one to preserve an exact copy of one's audio files Usage: For archival purposes, editing, audio quality. Codecs: </li></ul><ul><ul><li>Free Lossless Audio Codec (FLAC) </li></ul></ul><ul><ul><li>Apple Lossless </li></ul></ul><ul><ul><li>MPEG-4 ALS </li></ul></ul><ul><ul><li>Monkey's Audio </li></ul></ul><ul><ul><li>Lossless Predictive Audio Compression (LPAC) </li></ul></ul><ul><ul><li>Lossless Transform Audio Compression (LTAC) </li></ul></ul>
  35. 35. Audio Compression <ul><li>Lossy - irreversible changes , achieves far greater compression, use psychoacoustics to recognize that not all data in an audio stream can be perceived by the human auditory system. Usage: distribution of streaming audio, or interactive applications Codecs: </li></ul><ul><ul><li>MP2- MPEG-1Layer 2 audio codec </li></ul></ul><ul><ul><li>MP3 – MPEG-1 Layer 3 audio codec </li></ul></ul><ul><ul><li>MPC Musepack </li></ul></ul><ul><ul><li>Vorbis Ogg Vorbis </li></ul></ul><ul><ul><li>AAC Advanced Audio Coding (MPEG-2 and MPEG-4) </li></ul></ul><ul><ul><li>WMA Windows Media Audio </li></ul></ul><ul><ul><li>AC3 AC-3 or Dolby Digital A/52 </li></ul></ul>
  36. 36. MPEG <ul><li>Stands for Moving Picture Experts Group. MPEG is an ISO/IEC working group, established in 1988 to develop standards for digital audio and video formats. </li></ul><ul><li>MPEG-1 Designed for up to 1.5 Mbit/sec Standard for the compression of moving pictures and audio. Most popular is level 3 of MPEG-1 (MP3). MPEG-1 is the standard of compression for VideoCD. </li></ul><ul><li>MPEG-2 Designed for between 1.5 and 15 Mbit/sec Standard on which Digital Television set top boxes and DVD compression is based. Designed for the compression and transmission of digital broadcast television </li></ul>
  37. 37. MPEG (cont.) <ul><li>MPEG-4 Standard for multimedia and Web compression. MPEG-4 is based on object-based compression, similar in nature to the Virtual Reality Modeling Language. It also allows developers to control objects independently in a scene, and therefore introduce interactivity. </li></ul><ul><li>MPEG-7 (under development) - also called the Multimedia Content Description Interface. Contrary to the previous MPEG standards, which described actual content, MPEG-7 will represent information about the content. </li></ul>
  38. 38. MPEG Audio Encoding Uncompressed Audio Signal Division in 32 Frequency Bands Psychoacoustic Model Quantization (if applicable) Entropy Encoding Compressed Audi o Data controls
  39. 39. Audio Compression Formats – MP3 <ul><li>Creation Process Stages: </li></ul><ul><ul><li>Separation into Frames </li></ul></ul><ul><ul><li>Spectral Analysis </li></ul></ul><ul><ul><li>“ Masking” ( P sychoacoustic M odels ) </li></ul></ul><ul><ul><li>Processing ~ Bit Rate & Joint Stereo </li></ul></ul><ul><ul><li>Compressing ( Hoffman ZIP ) </li></ul></ul><ul><li>CBR & VBR (Constant Bit Rate and Variable Bit Rate) </li></ul><ul><li>Most Popular </li></ul><ul><ul><li>Many codec's and players </li></ul></ul>
  40. 40. Audio Compression Formats – Ogg Vorbis <ul><li>Creation Process Stages: </li></ul><ul><ul><li>Same as those in MP3 </li></ul></ul><ul><li>Improvements over MP3 </li></ul><ul><ul><li>Designed for Streaming Connection </li></ul></ul><ul><ul><li>Real Stereo ~ No Multiplexing </li></ul></ul><ul><ul><li>Multi-Channel Support (more than Mono & Stereo) </li></ul></ul><ul><ul><li>Bit Rate Scaling </li></ul></ul><ul><li>Preferred VBR </li></ul><ul><li>New Codec </li></ul><ul><ul><li>Free Source Code </li></ul></ul><ul><ul><li>One codec and few players </li></ul></ul>
  41. 41. Audio Compression Formats – WMA <ul><li>Advanced System Format (ASF) including: </li></ul><ul><ul><li>Support for Meta Data </li></ul></ul><ul><ul><li>Scripting </li></ul></ul><ul><ul><li>Security Features </li></ul></ul><ul><li>CBR & VBR (only after version 9) </li></ul><ul><li>Industrial Support </li></ul><ul><ul><li>Free Codec </li></ul></ul><ul><ul><li>Few Players </li></ul></ul>
  42. 42. VIDEO COMPRESSION <ul><li>DATA COMPRESSION </li></ul>
  43. 43. Video Compression <ul><li>Storing and transmitting uncompressed raw video is not an efficient technique because it needs large amounts of storage and bandwidth. </li></ul><ul><li>DVD, DSS, and internet video, all use digital data -> take a lot of space to store and large bandwidth to transmit. </li></ul><ul><li>Video compression technique is used to compress the data for these applications -> less storage space and less bandwidth to transmit data. </li></ul>
  44. 44. Video Compression <ul><li>Videos are sequences of images displayed at a high rate. Each of these images is called a frame. </li></ul><ul><li>Human eye can not notice small changes in the frames such as a slight difference in color. </li></ul><ul><li>Therefore, video compression standards do not require the encoding of all the details and some of the less important video details are lost. This is because lossy compression is used due to its ability to get very high compression ratios. </li></ul><ul><li>Typically 30 frames are displayed on the screen every second.  </li></ul>
  45. 45. Video Compression Process <ul><li>Start by encoding the first frame using a still image compression method. </li></ul><ul><li>It should then encode each successive frame by identifying the differences between the frame and its predecessor, and encoding these differences. If the frame is very different from its predecessor it should be coded independently of any other frame. </li></ul><ul><li>In the video compression literature, a frame that is coded using its predecessor is called inter frame (or just inter), while a frame that is coded independently is called intra frame (or just intra). </li></ul>
  46. 46. Video Compression Techniques <ul><li>Flow Control and Buffering </li></ul><ul><li>Temporal Compression </li></ul><ul><li>Spatial Compression  </li></ul><ul><li>Discrete Cosine Transform (DCT) </li></ul><ul><li>Vector Quantization (VQ) </li></ul><ul><li>Fractal Compression </li></ul><ul><li>Discrete Wavelet Transform (DWT). </li></ul>
  47. 47. Video Compression Formats <ul><li>The ISO/IEC, or International Organization for Standardization and the International Electrotechnical Commission, have a group called the Moving Pictures Experts Group or MPEG. MPEG is responsible, for the familiar compression formats MPEG-1 , MPEG-2 and MPEG-4 . </li></ul><ul><li>The ITU-T standardizes formats for the International Telecommunications Union, a United Nations Organization. Some popular ITU-T compression formats include the H.261 and H.264 formats. </li></ul><ul><li>There are other compression formats, such as Intel Indeo and RealVideo (based on the ITU-T H.263 codec), AVI, DivX, Quicktime, Windows Media Video (WMV). </li></ul>
  48. 48. ENCRYPTION
  49. 49. Encryption <ul><ul><li>To carry sensitive information, a system must be able to assure privacy. </li></ul></ul><ul><ul><li>As the number of attacks increase and as the public Internet is used to transmit private data, it is increasingly difficult to protect information. </li></ul></ul><ul><ul><li>One way to safeguard data from attacks is encrypting the data. </li></ul></ul><ul><ul><li>Practically, encryption is suitably done in presentation layer besides transport and physical layer. </li></ul></ul>
  50. 50. Encryption <ul><ul><li>Encryption – sender transform original information (plaintext) to another form (ciphertext) by a function that is parameterised by a key. </li></ul></ul><ul><ul><li>Decryption – reverses the original process to transform the message (ciphertext) back to its original form (plaintext). </li></ul></ul>
  51. 51. Encryption Example of Encryption / Decryption Process Plaintext Plaintext Ciphertext
  52. 52. Basic Terms and Concepts <ul><li>Cryptography – the science of transforming information so that it is secure while it is being transmitted or stored. Data is scrambled so that it cannot viewed by unauthorized users. </li></ul><ul><li>Cryptosystem – a disguises message that allows only selected people to see through the disguise. </li></ul><ul><li>Cryptanalysis – the science of breaking a crptosystem </li></ul><ul><li>Key – a value that is used by an algorithm to encrypt and decrypt a message. </li></ul><ul><li>Cipher – an encryption/decryption algorithm tool that is used to create encrypted/decrypted text </li></ul>
  53. 53. Encrytption/Decryption Keys <ul><li>Symmetric Keys – use same key to encrypt and decrypt a message. Eg.: Data Encryption Standard (DES), Triple DES (3DES), Advanced Encryption Standard (AES) </li></ul><ul><li>Asymmetric Keys -2 keys are needed (public key and private key); 1 key to encrypt, another key to decrypt and vice versa. Eg.: RSA and Diffie-Hellman </li></ul>
  54. 54. How Encryption Protects <ul><li>Because cryptography is concerned with the storage or transmission of information, five key security functions need to be fulfilled: </li></ul>Protection Description Confidentiality Allow only authorized users to access information. Authentication Verify who the sender was and trust the sender is who they claim to be. Integrity Trust the information has not been altered Nonrepudiation Ensure that the sender or receiver cannot deny that a message was sent or received. Access Control Restrict availability to information.

×