Docsity

Multimedia Compression: Techniques, Requirements, and Algorithms - Prof. Samuel T. King, Study notes of Operating Systems

Partial preview of the text

Download Multimedia Compression: Techniques, Requirements, and Algorithms - Prof. Samuel T. King and more Study notes Operating Systems in PDF only on Docsity!

Multimedia

II

Video

Compression

CS

Fall

Klara Nahrstedt/Sam KingKlara

Nahrstedt/Sam

King

11/13/

OutlineOutline

•^

Basic Compression TechniquesBasic

Compression

Techniques

Run

Length

Compression

Huffman Coding

Huffman

Coding

•^

JPEG/MPEG

11/13/

Coding Requirements (2)Coding

Requirements

-^

Dialog

Applicationsg

pp

–^

End

‐to

‐end

delay

(EED)

should

not

exceed

‐200ms

–^

Face

‐to

‐face

application

needs

EED

of

ms

(compression

and

decompression included)decompression

included)

-^

Retrieval

Applications

–^

Fast

forward

and

rewind

data

retrieval

with

simultaneous

display

(fast

search

for

information

in

multimedia

database)

–^

Random

access

to

single

images

and

audio

frame,

access

time

should

be

less

than

0.5s

–^

Decompression

of

images,

video

or

audio

should

be

provided

without

link

to

other

data

units

(allow

for

random

access

and

editing)

11/13/

Classification of Compression TechniquesClassification

of

Compression

Techniques

-^

Entropy

Coding

py

g

–^

Lossless

encoding

–^

Examples:

run

‐length

coding,

Huffman

coding,

arithmetic

coding

S^

C di

-^

Source

C

oding

–^

Lossy encoding

-^

Examples:

content

prediction

technique

  • Difference

PCM,

Delta

Modulation

-^

Hybrid

Coding

–^

Combine entropy coding with source coding

-^

Combine

entropy

coding

with

source

coding

–^

Examples:

JPEG,

JPEG

H.

MPEG

MPEG

MPEG

MPEG

11/13/

Entropy Encoding (2)Entropy

Encoding

-^

We

wish

to

construct

and

transmit

a

message

using

N

symbols.

-^

Simplest

method:

use

binary

numbers

of

equal

length

to

represent

each

symbol

by

L

bits

(

L^

≥

log

(N)) 2

bits

per

2

symbol

.

Example:

consider

message

of

symbols,

then

L

will

be

approximately

bits

(L

log

This

type

of

coding

is

called

fixed

‐length

coding

-^

Fixed

‐length

coding

is

not

efficient

- need

statistical

coding

-^

Which

encoding

yields

better

compression,

run

‐length

coding

or

fixed

‐length

coding

for

the

string

AAAAAAAABBBCCCCCCCDD? 11/13/

Entropy

Encoding

•^

Statistical

encoding:

–^

Given

sequence

of

symbols:

s

s

…and

probability

of

occurrence

of

each

symbol

P(s

)=Pi

i

y^

(^

)^ i

i

–^

Example:

P(A)

P(B)=0.51,

P(

C)=0.09,

P(D)=0.13,

P(E)=0.

•^

Fixed

‐length

coding

encode

A,B,C,D,

E

with

bits

as

A=000,

B=001,

C=010,

D=011,

E=

–^

Question:

What

is

the

minimum

number

of

bits

per

symbol

in

statistical

encoding?

•^

The

theoretical

minimum

average

number

of

bits

per

codeword

is

known

as

ENTROPY(H)

•^

According

to

Shannon

H=

Pi

logi

P 2

bits i

per

codeword

–^

Example

above:

H=

‐^ (0.

x

log

x

log

x

l^

l^

l^

1 3 bit

d^

d

log

x

log

x

log

bit

s^

per

codeword

(approx)

-^

This

type

of

coding

represents

the

variable

‐length

coding

11/13/

Huffman Encoding (Example)Huffman

Encoding

(Example)

Step 1 : Sort all Symbols according to their probabilitiesStep

1

:^

Sort

all

Symbols

according

to

their

probabilities

(left

to

right)

from

Smallest

to

largest

these

are

the

leaves

of

the

Huffman

tree

P(B)

=

P(C)

=

P(E)

=

P(D) = 0.

P(A)=0 16

11/13/

( )

( )

P(D)

P(A)=

.

Huffman Encoding (Example)Huffman

Encoding

(Example)

P(CEDAB)

=

1

Step

2:

Build

a

binary

tree

from

left

to

Right

(^

)

Right Policy:

always

connect

two

smaller

nodes

together

(e.g.,

P(CE)

and

P(DA)

had

both

Probabilities

that

were

smaller

than

P(B),

Hence those two did connect first

P(B)

=

P(CEDA)

=

Hence

those

two

did

connect

first

P(CE)

=

P(DA)

=

P(C)

=

P(E)

=

P(D) = 0.

P(A)=0 16

11/13/

( )

( )

P(D)

P(A)=

.

Huffman Encoding (Example)Huffman

Encoding

(Example)

P(CEDAB)

=

1

Step

4:

Create

Huffman

Code

S^

b l A

011

(^

)

0

1

Symbol

A

=

011

Symbol

B

=

1

Symbol

C

=

000

Symbol

D

=

010

P(B)

=

P(CEDA)

=

0

1

y Symbol

E

=

(^001) P(CE)

=

P(DA)

=

0

1

P(C)

=

P(E)

=

P(D) = 0.

P(A)=0 16

0

1

0

1

11/13/

( )

( )

P(D)

P(A)=

.

JPEG

Set

of Compression Steps

JPEG

Set

of

Compression

Steps

Uncompressed

Picture

Picture PreparationPicture

Preparation

Picture

Processing

Adaptive

Feedback

Loop

Quantization

Loop

Entropy

Encoding

11/13/

Step 1: Block PreparationStep

Block

Preparation

11/13/

Step 2: DCT TransformationStep

DCT

Transformation

11/13/

Step

4:

Differential

Compression

for

DC

DCT

C

ffi i

C

oefficients

-^

Differential compression meansDifferential

compression

means

we

consider

similar

blocks

in

the

image

and

encode only the first block and for the rest of theencode

only

the

first

block

and

for

the

rest

of

the

similar

blocks,

we

encode

only

differences

between

the

previous

block

and

current

block.

11/13/

Step

5:

Zig

‐Zag

Organization

(f

i^

)

(from

matrix

to

vector)

11/13/