Multimedia Networking ECE 599

Similar documents
ECE 499/599 Data Compression & Information Theory. Thinh Nguyen Oregon State University

Ch. 2: Compression Basics Multimedia Systems

Lossless Compression Algorithms

Ch. 2: Compression Basics Multimedia Systems

Fundamentals of Multimedia. Lecture 5 Lossless Data Compression Variable Length Coding

EE67I Multimedia Communication Systems Lecture 4

IMAGE COMPRESSION. Image Compression. Why? Reducing transportation times Reducing file size. A two way event - compression and decompression

CS 335 Graphics and Multimedia. Image Compression

Welcome Back to Fundamentals of Multimedia (MR412) Fall, 2012 Lecture 10 (Chapter 7) ZHU Yongxin, Winson

Data Compression Fundamentals

Data Compression. An overview of Compression. Multimedia Systems and Applications. Binary Image Compression. Binary Image Compression

CMPT 365 Multimedia Systems. Media Compression - Image

IMAGE PROCESSING (RRY025) LECTURE 13 IMAGE COMPRESSION - I

A Research Paper on Lossless Data Compression Techniques

Intro. To Multimedia Engineering Lossless Compression

Chapter 1. Digital Data Representation and Communication. Part 2

Digital Communication Prof. Bikash Kumar Dey Department of Electrical Engineering Indian Institute of Technology, Bombay

Huffman Code Application. Lecture7: Huffman Code. A simple application of Huffman coding of image compression which would be :

So, what is data compression, and why do we need it?

David Rappaport School of Computing Queen s University CANADA. Copyright, 1996 Dale Carnegie & Associates, Inc.

VC 12/13 T16 Video Compression

Entropy Coding. - to shorten the average code length by assigning shorter codes to more probable symbols => Morse-, Huffman-, Arithmetic Code

Chapter 7 Lossless Compression Algorithms

Multimedia Communications ECE 728 (Data Compression)

Fundamentals of Video Compression. Video Compression

Lecture 8 JPEG Compression (Part 3)

15 Data Compression 2014/9/21. Objectives After studying this chapter, the student should be able to: 15-1 LOSSLESS COMPRESSION

Engineering Mathematics II Lecture 16 Compression

DigiPoints Volume 1. Student Workbook. Module 8 Digital Compression

CSE 421 Greedy: Huffman Codes

Wireless Communication

Repetition 1st lecture

IMAGE COMPRESSION- I. Week VIII Feb /25/2003 Image Compression-I 1

A COMPRESSION TECHNIQUES IN DIGITAL IMAGE PROCESSING - REVIEW

ECE 417 Guest Lecture Video Compression in MPEG-1/2/4. Min-Hsuan Tsai Apr 02, 2013

Data Compression Techniques

DIGITAL IMAGE PROCESSING WRITTEN REPORT ADAPTIVE IMAGE COMPRESSION TECHNIQUES FOR WIRELESS MULTIMEDIA APPLICATIONS

7.5 Dictionary-based Coding

IMAGE COMPRESSION TECHNIQUES

Digital Image Processing

Digital Image Processing

Encoding. A thesis submitted to the Graduate School of University of Cincinnati in

Data Representation. Types of data: Numbers Text Audio Images & Graphics Video

Image Coding and Compression

Compression; Error detection & correction

Lecture Information Multimedia Video Coding & Architectures

Video Compression MPEG-4. Market s requirements for Video compression standard

Lecture 6 Introduction to JPEG compression

Image coding and compression

DCT Based, Lossy Still Image Compression

Data Compression. Media Signal Processing, Presentation 2. Presented By: Jahanzeb Farooq Michael Osadebey

A New Compression Method Strictly for English Textual Data

IMAGE COMPRESSION TECHNIQUES

Image coding and compression

IMAGE COMPRESSION. Chapter - 5 : (Basic)

Data and information. Image Codning and Compression. Image compression and decompression. Definitions. Images can contain three types of redundancy

Image Compression for Mobile Devices using Prediction and Direct Coding Approach

Source Coding Basics and Speech Coding. Yao Wang Polytechnic University, Brooklyn, NY11201

CS/COE 1501

WIRE/WIRELESS SENSOR NETWORKS USING K-RLE ALGORITHM FOR A LOW POWER DATA COMPRESSION

Lecture 8 JPEG Compression (Part 3)

Data Compression Scheme of Dynamic Huffman Code for Different Languages

Lecture 12: Compression

Compression II: Images (JPEG)

Data compression.

Compression. storage medium/ communications network. For the purpose of this lecture, we observe the following constraints:

A Comprehensive Review of Data Compression Techniques

Computer and Machine Vision

Source Coding Techniques

Lecture Information. Mod 01 Part 1: The Need for Compression. Why Digital Signal Coding? (1)

Bi-Level Image Compression

CMPSCI 240 Reasoning Under Uncertainty Homework 4

Department of electronics and telecommunication, J.D.I.E.T.Yavatmal, India 2

( ) ; For N=1: g 1. g n

Introduction to Video Compression

Topic 5 Image Compression

Greedy Algorithms CHAPTER 16

CHAPTER 6. 6 Huffman Coding Based Image Compression Using Complex Wavelet Transform. 6.3 Wavelet Transform based compression technique 106

More Bits and Bytes Huffman Coding

Course Syllabus. Website Multimedia Systems, Overview

JPEG: An Image Compression System. Nimrod Peleg update: Nov. 2003

Lecture 6 Review of Lossless Coding (II)

An Asymmetric, Semi-adaptive Text Compression Algorithm

International Journal of Emerging Technology and Advanced Engineering Website: (ISSN , Volume 2, Issue 4, April 2012)

A Image Comparative Study using DCT, Fast Fourier, Wavelet Transforms and Huffman Algorithm

CS/COE 1501

Part 1 of 4. MARCH

Introduction to Video Encoding

Compression; Error detection & correction

Data compression with Huffman and LZW

International Journal of Trend in Research and Development, Volume 3(2), ISSN: A Review of Coding Techniques in the Frequency

Research Article Does an Arithmetic Coding Followed by Run-length Coding Enhance the Compression Ratio?

Mahdi Amiri. February Sharif University of Technology

Huffman Coding Author: Latha Pillai

Multimedia Systems Image III (Image Compression, JPEG) Mahdi Amiri April 2011 Sharif University of Technology

G64PMM - Lecture 3.2. Analogue vs Digital. Analogue Media. Graphics & Still Image Representation

An Advanced Text Encryption & Compression System Based on ASCII Values & Arithmetic Encoding to Improve Data Security

ENTROPY ENCODERS: HUFFMAN CODING AND ARITHMETIC CODING 1

Data Compression 신찬수

ISSN (ONLINE): , VOLUME-3, ISSUE-1,

Transcription:

Multimedia Networking ECE 599 Prof. Thinh Nguyen School of Electrical Engineering and Computer Science Based on B. Lee s lecture notes. 1

Outline Compression basics Entropy and information theory basics Lossless coding Run-Length Huffman Arithmetic Lossy coding DPCM 2

Compression basics Redundancy exists in many places Texts Redundancy(German) > Redundancy(English) Video and images Redundancy (videos) > redundancy(images) Audio Redundancy(music)? Redundancy(speech) Eliminate redundancy keep essential information Assume 8 bits per character Uncompressed: aaaaaaaaab: 10x8 = 80 bits Compressed: 9ab = 3x8 = 24 bits Reduce the amount of bits to store the data Small storage, small network bandwidth, low storage devices. Ex: 620x560 pixels/frame 24 bits/pixel 1 MB 30 fps 30 MB/s (CD-ROM 2x 300KB/s) 30 minutes 50 GB 3

Compression basics 4

Compression methods JPEG (DCT), JPEG-2000 (Wavelet) Images JBIG Fax LZ (gzip) Text MPEG Video 16:1 compression ratio 5

Compression Classification Compression Lossless Decoded data = original data Comp. ratio < lossy comp. ratio Eliminate redundancy Used where errors are not allowed, e.g, computer programs. LZ, JBIG Lossy Decoded data ~ original data Comp. ratio > lossless comp. ratio Keeping important information Used where small errors are allowed, e.g, images, videos. JPEG, MPEG 6

Information theory basics Amount of information within data is defined as the number of bits to represent different patterns in the data (Hartley 1928). l A message of symbols and every symbol has a choice of possibilities. Number of possible patterns is l n Number of bits to present different patterns is l log{n} n 7

Information theory basics Shannon s measure of information is the number of bits to represent the amount of uncertainty (randomness) in a data source, and is defined as entropy H = n i= 1 p log( p i i ) n Where there are symbols 1, 2,, each with probability of occurrence of p i n 8

Examples An binary image can be considered a random source of two symbols black and white. P(black) < p(white) P(black) > p(white) More uncertainty = more information 9

Entropy Intuition n Why H = p i log( p i ) i= 1 Suppose you have a long random string of two binary symbols 0 and 1, and the probability of symbols 1 and 0 are p0 and p1 Ex: 00100100101101001100001000100110001. If any string is long enough say N, it is likely to contain Np 0 s and 1 s. 0 Np1 The probability of this string equal to p = p Np 0 1 0 p Np 1 0 1 Hence, # of possible patterns is 1/ Np Np p = p0 p1 1 Np # bits to represent all possible patterns is log( = 0 Np1 p p1 ) i= 0 The average # of bits to represent the symbol is therefore 1 i= 0 p i log p i 0 Np log i 10 p i

Entropy and compression Entropy is the minimum number of bits per symbols to completely represent a random data source. A compression scheme is optimal if its average number of bits/symbol equals to the entropy. Example: in an 8-bit image with uniform distribution of pixel values, i.e. p i =1/ 256, the entropy of this image is 8 bits. 255 p i log p i = 255 i= 0 i= 0 1 256 log 1 256 = 8 11

Entropy and compression We are interested in finding a map from the symbols to the code such that the average bits/symbols equals to the entropy. Clearly, this depends on the distribution, i.e. the probability of occurrences of each symbol. Intuitively, we want to use fewer bits to represent the frequent symbols, and longer bits to represent rare symbols in order to minimize the average bits/symbols. Example: suppose the source contains 3 symbols a, b, and c with p(a) =.8, p(b) =.15 and p(c) =.05. a = 0 b = 10 average bits/symbols =.8 +.15*2 +.05*2 c = 11 12

Lossless coding: Run-Length encoding (RLE) Redundancy is removed by not transmitting consecutive pixels or character values that are equal. The repeated value can be coded once, along with the number of times it repeats. Useful for coding black and white images e.g. fax. 13

Binary RLE Code the run length so 0 s using k bits. Transmit the code. Do not transmit runs of 1 s. Two consecutive 1 s are implicitly separately by a zero-length run of zero. Example: suppose we use 4 bits to encode the run length (maximum run length of 15) for following bit patterns 14

RLE Performance Worst case behavior: transition occurs on each bit. Since we use k bits to represent the transition, we wasted k-1 bits. Best case behavior: no transition and use k bits to represent run length then the compression ratio is (2^k-1)/k. 15

Lossless coding: Huffman Coding Input values are mapped to output values of varying length, called variable-length code (VLC). Most probable input values are coded with fewer bits. No code word can be prefix of another code word. 16

Huffman Code Construction Initialization: put all nodes (values, characters, or symbols) in an sorted list. Repeat until the list has only one node: Combine the two nodes having the lowest frequency (probability). Create a parent node assigning the sum of the children s probability and insert it in the list. Assign code 0, 1 to the two branches and delete children from the list. 17

Huffman example 18

Huffman Efficiency Entropy H of the example above H = (5/8)log(5/8) + 2(3/32)log(3/32)+ 2(1/32)log(1/32) + (1/8)log(1/8) = 1.75 bits Huffman code: 5/8 + (3/32) 3 + 3 (3/32) + 4 (1/32)+3 (1/8) + 4 (1/32) = 1.81 bits Fixed length code: 3 bits. Huffman code is much better than fixed length code. 19

Huffman coding Optimal if symbols are coded one at a time! A A B D C D A E. 00 00 011 H ( x) R( x) H ( x) + 1 20

Arithmetic Coding Huffman coding method is optimal when and only when the symbol probabilities are integral powers of ½, which rarely is the case. In arithmetic coding, each symbol is coded by considering prior data Relies on the fact that coding efficiency can be improved when symbols are combined. Yields a single code word for each string of characters. Each symbol is a portion of a real number between 0 and 1. 21

Arithmetic vs. Huffman Arithmetic encoding does not encode each symbol separately; Huffman encoding does. Arithmetic encoding transmits only length of encoded string; Huffman encoding transmits the Huffman table. Compression ratios of both are similar when the entropy is high. When entropy is low, arithmetic coding outperforms Huffman coding. 22

Arithmetic Coding Algorithm 23

Arithmetic Coding Example 24

Arithmetic Coding Example 25

Code Generator for Encoder 26

Code Generator Example 27

Decoding 28

Decoding Example 29

Arithmetic Coding Issues 30

Arithmetic Coding Intuition Sequence with larger probability is represented with larger range s, hence smaller number of bits. 31

Huffman Coding, Run-Lengh Coding, and Arithmetic Coding Question A A A A A B A A A A A A A A A A A A A B B C C A A A B A A B A B C A B A C B A C B C A B C C C A 32

Is there such thing as too much compression? What if an error happens in the encoded bit stream, e.g. a bit flips or lost packet? What happens to the decoded data? Is it all corrupted. How extensive is the damage to the data? Little redundancy can be a good thing! (for transmission over lossy channel) 33