chapter 7 end-to-end data ohanes dadian, danny luong, yu lu

60
Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Upload: trevion-whiteside

Post on 14-Dec-2015

219 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Chapter 7 End-to-End Data

Ohanes Dadian, Danny Luong, Yu Lu

Page 2: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Contents7.1 Presentation Formatting

7.1.1 Taxonomy7.1.2 Examples7.1.3 Markup Languages

7.2 Multimedia Data7.2.1 Lossless Compression Techniques7.2.2 Image Representation and Compression7.2.3 Video Compression7.2.4 Audio Compression

Page 3: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Definition Data

What is it? Importance

Presentation Format Agreement An important aspect Data manipulation function

Encoding Argument marshalling

Decoding Argument unmarshalling

Page 4: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

7.1 Presentation Formatting

Page 5: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Challenges of Presentation Formatting Different representation in Floating-Point

Numbers IEEE standard 754 format Nonstandard format

Different registers sizes 16-bit register 32-bit register 64-bit register

Different representation in Integers Big-Endian Little-Endian

Page 6: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

7.1.1 Taxonomy

Data Types

Conversion Strategy

Tags

Stubs

Page 7: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Data Types Lowest Level - Base Types

Integers Floating-point numbers Characters

Medium Level – Flat Types Structures Arrays

Highest Level – Complex Types Those types that are built using pointers

Page 8: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Data Types

Page 9: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Conversion Strategy Canonical intermediate Form

Sender: internal representation external

representation Receiver: external representation internal

representation Receiver-Makes-Right

Sender : Do not convert, send its internal

representation directly receiver : Any representation internal

representation Combined

Page 10: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Conversion Strategy Debate

Canonical intermediate Form vs. Receiver-Makes-Right

Page 11: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

7.2.1 Lossless Compression Techniques Data Compression

What is it? Bandwidth vs Throughput When to compress?

Data Compression Categories Lossy vs Lossless

Lossless Compression Techniques Run Length Encoding Differential Pulse Code Modulation Dictionary-Based Methods

Page 12: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Tags Tagged Data

A tag = additional information Help the receiver decoding data

Untagged Data How does the receiver know how to decode? Think any object-oriented language as an example

Page 13: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Stubs On the Client Side

Marshal the arguments into a message On the Server Side

Converts the message back into variables

Page 14: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Stubs

Page 15: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

7.1.2 Examples External Data Representation (XDR)

Supports the entire C-type System without function pointers

defines canonical intermediate form Does not use tags Uses compiled stubs

Page 16: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

7.1.2 Examples Abstract Syntax notation One (ASN.1)

Supports the C-type system without function pointers

Defines canonical intermediate form Uses type tags Uses either interpreted or compiled stubs

Representation <tag , length , value>

Page 17: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

7.1.2 Examples Network Data Representation (NDR)

Supports the C-type system Defines receiver-makes-right Uses tags Generates the necessary stubs

Representation

Page 18: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

7.1.3 Markup Languages(XML) Extensible Markup Language – XML

What is xml? Can be sent as data over internet Can be configuration file used in frameworks

XML Schema Document – XSD Defines XML

Namespace Solve name clashes URI – Uniform Resource Identifier (detail in Chapter

9) xmlns: emp =

“http://www.example.com/employee” <emp: title> head Bottle Washer </emp:title>

Page 19: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

XML--Example

Page 20: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

XSD--Example

Page 21: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Data Compression Data Compression: Less data for the same

message, increase throughput

Bandwidth vs Throughput Bandwidth – Physical Throughput – Logical

When to compress? Time Cost

Page 22: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Data Compression Categories

Two different categories Lossy Lossless

Pros and Cons of each technique Compression ratio Exact reconstruction

Lossless Lossy

Page 23: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

7.2.1 Lossless Compression Techniques Data Compression

What is it? Bandwidth vs Throughput When to compress?

Data Compression Categories Lossy vs Lossless

Lossless Compression Techniques Run Length Encoding Differential Pulse Code Modulation Dictionary-Based Methods

Page 24: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Data Compression Data Compression: Less data for the same

message, increase throughput

Bandwidth vs Throughput Bandwidth – Physical Throughput – Logical

When to compress? Time Cost

Page 25: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Data Compression Categories

Two different categories Lossy Lossless

Pros and Cons of each technique Compression ratio Exact reconstruction

Lossless Lossy

Page 26: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Lossless Compression Techniques

Run Length Encoding

Differential Pulse Code Modulation

Dictionary-Based Method

Page 27: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Run Length Encoding (RLE) One of the simplest method of data

compression A lossless compression method Consecutive data elements saved as one

element and a count Simplified Example

AAAAAAAAAABBBBBOOOOOOOOO10A5B9O

Real world deals with binary instead Most useful on data that contains repeated

elements

Page 28: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Differential Pulse Code Modulation (DPCM) Another simple lossless compression

algorithm Output a reference symbol Output the difference between new symbol and

the reference

Example AAABBCDDDD A0001123333

Work better on digital images

Page 29: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Dictionary-Based Method

The last lossless compression algorithm we

discuss

The idea is to build a dictionary (common

phrases)

Replace common phrases with index

Dictionary constructed during compression

sent along with the code

A lot of research on how to build an efficient

dictionary

Page 30: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

7.2.2 Image Representation and Compression

Focus on GIF & JPEG Differences between GIF and JPEG

JPEG Compression Phases DCT Phase Quantization Phase Encoding Phase

Page 31: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Difference between GIF and JPEG Graphic Interchange Format (GIF)

RGB color space 8 bits each dimension = 24 bits total Instead of sending 24 bits, reduce to 8 bits first 28 = 256 color Picture has more than 256 colors, change it and

cut it down Good compression ratio, but low quality

Page 32: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Difference between GIF and JPEG Joint Photographic Experts Group (JPEG)

Most widely used More suited to photographic images Transforming RGB color to YUV color space

(lossless) Y component represent brightness (luminance) UV components represent color (chrominance) Human eyes have separate receptors for

brightness and color By separating brightness and color, we can

perform compression separately Human eyes are less sensitive to color, so we can

compress UV component more aggressively (lossy)

Page 33: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

GIF Compression Phases No phases One single step

Lossless Each color is represented by 24 bits Reduce it down to 8 bits Only 256 color possible More than 256 color, merge to closest color

Usage Sharp-edged images (logos)

Page 34: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

JPEG Compression Phases 3 different phases

DCT (lossless) Quantization (lossy) Encoding

Page 35: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

JPEG Compression Phases Discrete Cosine Transform (DCT) Phase

Closely related to the Fast Fourier Transform (FFT) 8x8 matrix of pixel value => matrix of frequency

coefficients Help Filter out least important pattern Lossless Formula

Page 36: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

JPEG Compression Phases Quantization Phase

DCT phases only transform the data into something easier to recognize

Quantization Phase drops the insignificant bits of the frequency Coefficients

Truncate information => Lossy

Dropping the insignificant bits of the frequency coefficients

Page 37: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

JPEG Compression Phases Encoding Phase

Final phase Encodes the quantized frequency coefficients in a

compact form Coefficients are processed in zigzag sequence Further compression can be applied e.g. Run

Length Encoding

Page 38: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

7.2.3 Video Compression What is a video?

A succession of frames, or images. Frames can be compressed using DCT

Like JPEG Compression should take into consideration

the redundancy between frames. Two successive frames likely have a lot of the

same information, depending on the moving object.

Page 39: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

MPEG The MPEG format provides standards for

multimedia compression. Includes compression, decompression, processing

and coded-representation. MPEG 1, MPEG 2, MPEG 4

Named after the group that invented it. Moving Picture Experts Group Established in 1988 and included experts from ISO

and IEC.

Page 40: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

How MPEG Works

Page 41: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Frame Types MPEG compresses frames into three types.

I frames, P frames and B frames. I frames

Self-dependent. P frames

Specifies difference from the previous I frame. B frames

Interpolation between the previous and subsequent I or P frames.

Page 42: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Frame Types, contd.

Page 43: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Frame Types, contd.

Page 44: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Frame Types, contd.8 x 8 Macroblock

Y Y Y Y

Y Y Y Y

Y Y Y Y

Y Y Y Y

U U V V

U U V V

Page 45: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Effectiveness and Performance MPEG video can be compressed with up to a

90:1 ratio. Encoding/Decoding can be performed on

software and hardware. Hardware being the most prominent for encoding. Software being the most prominent for decoding.

Page 46: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

7.2.4 Transmitting MPEG over a Network MPEG defines video stream.

Does not dictate how stream is stored. Complex but modular. Three variations.

MPEG 1, MPEG 2 and MPEG 4. Focus on Main Profile MPEG 2 stream.

Used by DVD. Nested Structure

Page 47: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

MPEG Format

Page 48: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Transmitting MPEG over a Network, contd. Allows for trading picture quality for

bandwidth. Need to packetize stream.

Not an issue with TCP. For UDP, streams are broken at selected points.

Macroblock boundaries. Application Level Framing.

Need to deal with packet loss. Mark frames with drop probability.

Need to deal with application latency constraints.

Page 49: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

MPEG Video Compression Algorithm

Page 50: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

7.2.4 Audio Compression MPEG provides audio compression standard.

MPEG I/2 Layer III (MP3). Example:

CD quality audio at 44.1 KHz sampling rate requires 1.41 Mbps bitrate. 4.32 Mbps with synchronization and error correction

overhead. Some compression is in needed for network

transfer. MP3 compression solves this issue.

Page 51: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

MP3 Compression Algorithm

Page 52: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Audio Compression, contd. Optimization lies in the number of subbands

used and how many bits are allocated for each subband. Governed by psychoacoustic models.

Why is this the case? Take the following for example.

A male voice requires more bits to low-frequency subbands.

A female voice requires more bits to low-frequency subbands.

Change in frequency is done by dynamically changing the quantization tables used for each subband.

Page 53: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Summary Discussed how application data is encoded in

network packets. Presentation Formatting. Compression.

Lossy Lossless.

Provide high quality media.

Page 54: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Q & A

Page 55: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Thank You

Page 56: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

ReferencesPeterson, Larry L., and Bruce S. Davie.

Computer Networks: A Systems Approach. 5th ed. Amsterdam: Morgan Kaufmann, 2012. Print.

Motion Picture Experts Group. Wikipedia. http://en.wikipedia.org/wiki/Mpeg (accessed February 19, 2013).

Page 57: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Extra Slides

Page 58: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Frame Types, contd.B Frame Macroblock

Coordinate c

Motion Vector relative to previous reference frame

a

Motion Vector relative to subsequent reference frame

b

Delta for each pixel in macroblock

d

Page 59: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Frame Types, contd. Goal: Find the corresponding reference pixel

using the past and future reference frames. Past Reference Frame

Fp

Future Reference Frame Ff

Page 60: Chapter 7 End-to-End Data Ohanes Dadian, Danny Luong, Yu Lu

Other Video Encoding Standards ITU-T has defined the H series of codecs for

video, audio, control and multiplexing. H.261, H.263

First and second generation for video encoding. Targeted for lower speeds. Available in 64-kbps increments.

H.264 New generation codec. Part of the MPEG-4 standard. One of the most popular codecs for HD video on web

and mobile platforms. Used by Blu-ray, iTunes, YouTube, Flash, Silverlight and

various HDTV broadcasts.