lecture 6 -_presentation_layer

54
BITS 2513 – Internet BITS 2513 – Internet Technology Technology Lecture 6: Lecture 6: Presentation Layer Presentation Layer

Upload: serioussamsoul

Post on 06-May-2015

2.253 views

Category:

Education


0 download

DESCRIPTION

Chapter 6 Internet Technology

TRANSCRIPT

Page 1: Lecture 6 -_presentation_layer

BITS 2513 – Internet BITS 2513 – Internet TechnologyTechnology

Lecture 6: Lecture 6: Presentation LayerPresentation Layer

Page 2: Lecture 6 -_presentation_layer

Topics CoveredTopics CoveredIntroduction to Presentation

LayerData RepresentationData Compression

Image Audio Video

Encryption

Page 3: Lecture 6 -_presentation_layer

Presentation LayerPresentation LayerThe presentation layer is the sixth

level of the seven layer OSI model. It responds to service requests

from the application layer and issues service requests to the session layer.

Concerned with syntax and semantics of the information exchanged between two systems.

Page 4: Lecture 6 -_presentation_layer

Presentation LayerPresentation Layer

Data Data

From application layer To application layer

From session layerTo session layer

Presentation layer Presentation layer

Page 5: Lecture 6 -_presentation_layer

Presentation FormatPresentation FormatIn 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.

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).

Page 6: Lecture 6 -_presentation_layer

Encoding/DecodingEncoding/DecodingThe 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.

On the receiving side, the application translates this arriving message into a representation it can process → the message is decoded.

Page 7: Lecture 6 -_presentation_layer

Presentation formattingPresentation formatting

Application

data

Presentation

encoding

Application

data

Presentation

decoding

Message Message Message■ ■ ■

Presentation formatting involves encoding and decoding application data.

Page 8: Lecture 6 -_presentation_layer

Presentation LayerPresentation LayerSpecific responsibilities of

presentation layer: Data Representation Data Compression Encryption

Page 9: Lecture 6 -_presentation_layer

DATA DATA REPRESENTATIONREPRESENTATION

Page 10: Lecture 6 -_presentation_layer

Data RepresentationData Representation

Different computers have different representations for characters.

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.

Page 11: Lecture 6 -_presentation_layer

Data RepresentationData RepresentationConverting the complex data

structures used by an application (strings, integers, structures, etc. ) into a byte stream transmitted across the network.

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?

Page 12: Lecture 6 -_presentation_layer

Data RepresentationData RepresentationPopular network data

representations include:◦ASN.1 - an ISO standard◦XDR - used with SunRPC

Page 13: Lecture 6 -_presentation_layer

ASN.1ASN.1Abstract 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:1. An abstract syntax that describes data

structures in an unambiguous way. Use “ integers”, “character strings”, and “structures” rather than bits and bytes.

2. A transfer syntax that describes the bit stream encoding of ASN.1 data objects.

Page 14: Lecture 6 -_presentation_layer

ASN.1ASN.1The main reasons for the success of ASN.1 is

that it is associated with several standardized encoding rules such as:◦ Basic Encoding Rules (BER) - X.209◦ Canonical Encoding Rules (CER)◦ Distinguished Encoding Rules (DER)◦ Packed Encoding Rules (PER) and◦ XER Encoding Rules (XER).

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.

Page 15: Lecture 6 -_presentation_layer

ASN.1ASN.1Example of ASN.1’S abstract

syntax:

Student ::= SEQUENCE {name [0] IMPLICIT OCTET STRING OPTIONAL,grad [1] IMPLICIT BOOLEAN OPTIONAL

DEFAULT FALSE,gpa [2] IMPLICIT REAL OPTIONAL,id [3] IMPLICIT INTEGER,bday [4] IMPLICIT OCTET STRING OPTIONAL}

Page 16: Lecture 6 -_presentation_layer

ASN.1ASN.1ASN.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

Page 17: Lecture 6 -_presentation_layer

XDRXDRSun Microsystem's External Data

Representation (XDR) is much simpler than ASN.1, but less powerful. For instance:1. 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.

2. In XDR, all data is transferred in units of 4 bytes. Numbers are transferred in network order, most significant byte first.

Page 18: Lecture 6 -_presentation_layer

XDRXDR4 bytes of XDR message:

Page 19: Lecture 6 -_presentation_layer

XDR (cont.)XDR (cont.)3. Strings consist of a 4 byte length,

followed by the data (and perhaps padding in the last byte).

4. Defined types include: integer, enumeration, boolean, floating point, fixed length array, structures, plus others.

One advantage that XDR has over ASN.1 is that current implementations of ASN.1 execute significantly slower than XDR.

Page 20: Lecture 6 -_presentation_layer

DATA DATA COMPRESSIONCOMPRESSION

Page 21: Lecture 6 -_presentation_layer

Data CompressionData CompressionReduces the number of bits contained

in the information. Lossless Compression -- data is

compressed and can be uncompressed without loss of information. These are referred to as bit-preserving or reversible compression systems.

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

Page 22: Lecture 6 -_presentation_layer

Why Compression?Why Compression?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).

It’s hard to move data on the Internet at >1Mbps.

The Internet does not allow applications to use more than their “fair share” of the bandwidth on a congested link.

Need to compress the data at the sender and decompress it at the receiver.

Page 23: Lecture 6 -_presentation_layer

Why Compression?Why Compression?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.

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.

Page 24: Lecture 6 -_presentation_layer

Steps of Data Steps of Data CompressionCompressionPerformed in the compression of still

images, audio and video data streams:1.Picture preparation – generates an

appropriate digital representation if the information in the medium being compressed.

2.Picture processing –make use of the various compression algorithms

3.Quantization – values determined in previous step are quantized according to a specific resolution and characteristic curve.

4.Entropy encoding – with a sequential of individual bits and bytes, different techniques are used to perform a final, lossless compression

Page 25: Lecture 6 -_presentation_layer

Steps of Data Steps of Data CompressionCompression

Uncompressed Picture

Picture Preparation

Picture Processing

Quantization

Entropy Encoding

Compressed Picture

Major steps of image compression, can also be applied to audio and video data

Page 26: Lecture 6 -_presentation_layer

IMAGE COMPRESSIONIMAGE COMPRESSIONDATA COMPRESSION

Page 27: Lecture 6 -_presentation_layer

Image CompressionImage Compressionto represent images with less

data in order to save storage costs or transmission time.

possible to reduce file size to 10% from the original without noticeable loss in quality.

Image compression can be lossless or lossy.

Page 28: Lecture 6 -_presentation_layer

Image CompressionImage CompressionLossless

- 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).

Page 29: Lecture 6 -_presentation_layer

Image CompressionImage CompressionLossy

- reduces image quality. Cannot get the original image back & lose some information. Use in: natural images such as photos of landscapesMethods: discrete cosine transform (DCT, used in JPEG) or wavelet transform (used in JPEG 2000), color quantization

Page 30: Lecture 6 -_presentation_layer

FORMAT FILE EXTENTI

ON

TYPE OF COMPRESSI

ON

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.

Comparison of graphics file formats

Page 31: Lecture 6 -_presentation_layer

Block Diagram of JPEG Block Diagram of JPEG CompressionCompression

Sourceimage

JPEG compression

DCT Quantization EncodingCompressed

image

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

Page 32: Lecture 6 -_presentation_layer

AUDIO COMPRESSIONAUDIO COMPRESSIONDATA COMPRESSION

Page 33: Lecture 6 -_presentation_layer

Audio CompressionAudio CompressionA form of data compression

designed to reduce the size of audio files

Audio compression can be lossless or lossy

Audio compression algorithms are typically referred to as audio codecs.

Page 34: Lecture 6 -_presentation_layer

Audio CompressionAudio Compression Lossless - allows one to preserve an

exact copy of one's audio filesUsage: For archival purposes, editing, audio quality.Codecs: Free Lossless Audio Codec (FLAC) Apple Lossless MPEG-4 ALS Monkey's Audio Lossless Predictive Audio Compression (LPAC) Lossless Transform Audio Compression (LTAC)

Page 35: Lecture 6 -_presentation_layer

Audio CompressionAudio Compression 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: MP2- MPEG-1Layer 2 audio codec MP3 – MPEG-1 Layer 3 audio codec MPC Musepack Vorbis Ogg Vorbis AAC Advanced Audio Coding (MPEG-2 and MPEG-4) WMA Windows Media Audio AC3 AC-3 or Dolby Digital A/52

Page 36: Lecture 6 -_presentation_layer

MPEGMPEGStands for Moving Picture Experts Group. MPEG is

an ISO/IEC working group, established in 1988 to develop standards for digital audio and video formats.

MPEG-1Designed for up to 1.5 Mbit/secStandard 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.

MPEG-2Designed for between 1.5 and 15 Mbit/secStandard on which Digital Television set top boxes and DVD compression is based. Designed for the compression and transmission of digital broadcast television

Page 37: Lecture 6 -_presentation_layer

MPEG (cont.)MPEG (cont.) 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.

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.

Page 38: Lecture 6 -_presentation_layer

MPEG Audio EncodingMPEG Audio Encoding

Uncompressed Audio

Signal

Division in 32 Frequency Bands

Psychoacoustic Model

Quantization

(if applicable) Entropy Encoding

Compressed Audi o

Data

controls

Page 39: Lecture 6 -_presentation_layer

Audio Compression Formats Audio Compression Formats – MP3– MP3 Creation Process Stages:

Separation into Frames Spectral Analysis “Masking” ( Psychoacoustic Models ) Processing ~ Bit Rate & Joint Stereo Compressing ( Hoffman ZIP )

CBR & VBR (Constant Bit Rate and Variable Bit Rate)

Most Popular Many codec's and players

Page 40: Lecture 6 -_presentation_layer

Audio Compression Formats Audio Compression Formats – Ogg Vorbis– Ogg Vorbis Creation Process Stages:

Same as those in MP3 Improvements over MP3

Designed for Streaming Connection Real Stereo ~ No Multiplexing Multi-Channel Support (more than Mono &

Stereo) Bit Rate Scaling

Preferred VBR New Codec

Free Source Code One codec and few players

Page 41: Lecture 6 -_presentation_layer

Audio Compression Formats Audio Compression Formats – WMA– WMA Advanced System Format (ASF)

including: Support for Meta Data Scripting Security Features

CBR & VBR (only after version 9) Industrial Support

Free Codec Few Players

Page 42: Lecture 6 -_presentation_layer

VIDEO COMPRESSIONVIDEO COMPRESSIONDATA COMPRESSION

Page 43: Lecture 6 -_presentation_layer

Video CompressionVideo CompressionStoring and transmitting uncompressed

raw video is not an efficient technique because it needs large amounts of storage and bandwidth.

DVD, DSS, and internet video, all use digital data → take a lot of space to store and large bandwidth to transmit.

Video compression technique is used to compress the data for these applications → less storage space and less bandwidth to transmit data.

Page 44: Lecture 6 -_presentation_layer

Video CompressionVideo CompressionVideos are sequences of images displayed

at a high rate. Each of these images is called a frame.

Human eye can not notice small changes in the frames such as a slight difference in color.

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.

Typically 30 frames are displayed on the screen every second. 

Page 45: Lecture 6 -_presentation_layer

Video Compression Video Compression ProcessProcess

1. Start by encoding the first frame using a still image compression method.

2. 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.

3. 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).

Page 46: Lecture 6 -_presentation_layer

Video Compression Video Compression TechniquesTechniquesFlow Control and BufferingTemporal Compression Spatial Compression Discrete Cosine Transform (DCT)Vector Quantization (VQ)Fractal Compression Discrete Wavelet Transform

(DWT).

Page 47: Lecture 6 -_presentation_layer

Video Compression Video Compression FormatsFormats

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.

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.

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).

Page 48: Lecture 6 -_presentation_layer

ENCRYPTIONENCRYPTION

Page 49: Lecture 6 -_presentation_layer

EncryptionEncryption• To carry sensitive information, a

system must be able to assure privacy.• As the number of attacks increase and

as the public Internet is used to transmit private data, it is increasingly difficult to protect information.• One way to safeguard data from

attacks is encrypting the data.• Practically, encryption is suitably done

in presentation layer besides transport and physical layer.

Page 50: Lecture 6 -_presentation_layer

EncryptionEncryption

Encryption – sender transform original information (plaintext) to another form (ciphertext) by a function that is parameterised by a key.

Decryption – reverses the original process to transform the message (ciphertext) back to its original form (plaintext).

Page 51: Lecture 6 -_presentation_layer

EncryptionEncryption

Example of Encryption / Decryption Process

Plaintext

Plaintext

Ciphertext

Page 52: Lecture 6 -_presentation_layer

Basic Terms and ConceptsBasic Terms and ConceptsCryptography – 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.

Cryptosystem – a disguises message that allows only selected people to see through the disguise.

Cryptanalysis – the science of breaking a crptosystem

Key – a value that is used by an algorithm to encrypt and decrypt a message.

Cipher – an encryption/decryption algorithm tool that is used to create encrypted/decrypted text

Page 53: Lecture 6 -_presentation_layer

Encrytption/Decryption Encrytption/Decryption KeysKeysSymmetric Keys – use same key

to encrypt and decrypt a message. Eg.: Data Encryption Standard (DES), Triple DES (3DES), Advanced Encryption Standard (AES)

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

Page 54: Lecture 6 -_presentation_layer

How Encryption ProtectsHow Encryption ProtectsBecause cryptography is concerned

with the storage or transmission of information, five key security functions need to be fulfilled:

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.