D ATA C OMMUNICATIONS Compression Techniques. D ATA C OMPRESSION Whether data, fax, video, audio, etc., compression can work wonders Compression can be.

Slides:



Advertisements
Similar presentations
15 Data Compression Foundations of Computer Science ã Cengage Learning.
Advertisements

Data Compression CS 147 Minh Nguyen.
Image Compression. Data and information Data is not the same thing as information. Data is the means with which information is expressed. The amount of.
Data Compression Michael J. Watts
Chapter 7 End-to-End Data
Chapter 5 Making Connections Efficient: Multiplexing and Compression
Spring 2003CS 4611 Multimedia Outline Compression RTP Scheduling.
1 Lecture 05 Making Connections Efficient: Multiplexing and Compression.
1 Chapter Five Making Connections Efficient: Multiplexing and Compression.
Data Compression Understanding Data Communications and Networks – William A. Shay (3 rd Edition)
Computer Science 335 Data Compression.
1 Chapter 5 Multiplexing : Sharing a Medium Data Communications and Computer Networks: A Business User’s Approach.
Chapter 10: Transmission Efficiency Business Data Communications, 4e.
CS :: Fall 2003 MPEG-1 Video (Part 1) Ketan Mayer-Patel.
Chapter Five Making Connections Efficient: Multiplexing and Compression Data Communications and Computer Networks: A Business User’s Approach, Fourth Edition.
Chapter Five Making Connections Efficient: Multiplexing and Compression Data Communications and Computer Networks: A Business User’s Approach Sixth Edition.
CMPT 365 Multimedia Systems
T.Sharon-A.Frank 1 Multimedia Image Compression 2 T.Sharon-A.Frank Coding Techniques – Hybrid.
CS430 © 2006 Ray S. Babcock Lossy Compression Examples JPEG MPEG JPEG MPEG.
Why Compress? To reduce the volume of data to be transmitted (text, fax, images) To reduce the bandwidth required for transmission and to reduce storage.
©Brooks/Cole, 2003 Chapter 15 Data Compression. ©Brooks/Cole, 2003 Realize the need for data compression. Differentiate between lossless and lossy compression.
1 JPEG Compression CSC361/661 Burg/Wong. 2 Fact about JPEG Compression JPEG stands for Joint Photographic Experts Group JPEG compression is used with.jpg.
Image Compression JPEG. Fact about JPEG Compression JPEG stands for Joint Photographic Experts Group JPEG compression is used with.jpg and can be embedded.
Image and Video Compression
Image Compression - JPEG. Video Compression MPEG –Audio compression Lossy / perceptually lossless / lossless 3 layers Models based on speech generation.
Trevor McCasland Arch Kelley.  Goal: reduce the size of stored files and data while retaining all necessary perceptual information  Used to create an.
Chapter Five Making Connections Efficient: Multiplexing and Compression Data Communications and Computer Networks: A Business User’s Approach Eighth Edition.
Lecture 10 Data Compression.
Chapter 2 Source Coding (part 2)
ECE472/572 - Lecture 12 Image Compression – Lossy Compression Techniques 11/10/11.
MPEG MPEG-VideoThis deals with the compression of video signals to about 1.5 Mbits/s; MPEG-AudioThis deals with the compression of digital audio signals.
MPEG-1 and MPEG-2 Digital Video Coding Standards Author: Thomas Sikora Presenter: Chaojun Liang.
MPEG: (Moving Pictures Expert Group) A Video Compression Standard for Multimedia Applications Seo Yeong Geon Dept. of Computer Science in GNU.
DATA COMPRESSION LOSSY COMPRESSION METHODS What it is… A compression of information that is acceptable in pictures or videos, but not texts or programs.
Data Compression.
Video Compression Techniques By David Ridgway.
1 Computer Networks: A Systems Approach, 5e Larry L. Peterson and Bruce S. Davie Chapter 7 End-to-End Data Copyright © 2010, Elsevier Inc. All rights Reserved.
JPEG. The JPEG Standard JPEG is an image compression standard which was accepted as an international standard in  Developed by the Joint Photographic.
Image Processing and Computer Vision: 91. Image and Video Coding Compressing data to a smaller volume without losing (too much) information.
CIS679: Multimedia Basics r Multimedia data type r Basic compression techniques.
JPEG CIS 658 Fall 2005.
Addressing Image Compression Techniques on current Internet Technologies By: Eduardo J. Moreira & Onyeka Ezenwoye CIS-6931 Term Paper.
Digital Image Processing Image Compression
1 Image Formats. 2 Color representation An image = a collection of picture elements (pixels) Each pixel has a “color” Different types of pixels Binary.
Compression video overview 演講者:林崇元. Outline Introduction Fundamentals of video compression Picture type Signal quality measure Video encoder and decoder.
Chapter Five Making Connections Efficient: Multiplexing and Compression Fundamentals of Networking and Data Communications Sixth Edition Copyright ©2011.
Spring 2000CS 4611 Multimedia Outline Compression RTP Scheduling.
JPEG Image Compression Standard Introduction Lossless and Lossy Coding Schemes JPEG Standard Details Summary.
Chapter Five Making Connections Efficient: Multiplexing and Compression Data Communications and Computer Networks: A Business User’s Approach, Fifth Edition.
JPEG.
STATISTIC & INFORMATION THEORY (CSNB134) MODULE 11 COMPRESSION.
MPEG CODING PROCESS. Contents  What is MPEG Encoding?  Why MPEG Encoding?  Types of frames in MPEG 1  Layer of MPEG1 Video  MPEG 1 Intra frame Encoding.
By Dr. Hadi AL Saadi Lossy Compression. Source coding is based on changing of the original image content. Also called semantic-based coding High compression.
IS502:M ULTIMEDIA D ESIGN FOR I NFORMATION S YSTEM M ULTIMEDIA OF D ATA C OMPRESSION Presenter Name: Mahmood A.Moneim Supervised By: Prof. Hesham A.Hefny.
Submitted To-: Submitted By-: Mrs.Sushma Rani (HOD) Aashish Kr. Goyal (IT-7th) Deepak Soni (IT-8 th )
Data Compression Michael J. Watts
Textbook does not really deal with compression.
JPEG Compression What is JPEG? Motivation
Data Compression.
Multimedia Outline Compression RTP Scheduling Spring 2000 CS 461.
JPEG.
Data Compression.
Chapter 7.2: Layer 5: Compression
Data Compression CS 147 Minh Nguyen.
15 Data Compression Foundations of Computer Science ã Cengage Learning.
Chapter 8 – Compression Aims: Outline the objectives of compression.
15 Data Compression Foundations of Computer Science ã Cengage Learning.
Presentation transcript:

D ATA C OMMUNICATIONS Compression Techniques

D ATA C OMPRESSION Whether data, fax, video, audio, etc., compression can work wonders Compression can be loss-less, or lossy 2

H UFFMAN C ODES A frequency dependent code Usually a smaller alphabet Must know frequency of occurrence of each character in the alphabet Order characters from highest to lowest or vice versa Select two smallest percentages; must be adjacent 3

H UFFMAN C ODES 4 Example: a frequency dependent code A8% B12% C10% D6% E18% F7% G20% H16% I 3%

H UFFMAN C ODES 5 Now send string A B C D E F G

R UN - LENGTH E NCODING 6 Replace runs of 0s with a count of how many 0s … ^ (30 0s)

L EMPEL -Z IV E NCODING Replace character strings with codes Problems: How do we make it dynamic? (Whatever the most frequently occurring strings are, compress those.) How do we find those strings? How does receiver know  is THE? Very popular algorithm – used in PKZIP, V.42bis modems and others 7

L EMPEL -Z IV E NCODING Works best on large files Typical performance of Lempel-Ziv: Program file: reduces to 44% original size Text file: reduces to 64% original size Image file: reduces to 88% original size 8

L EMPEL -Z IV E NCODING To begin store each character with its ASCII value (127 values) Then we will set the variable Buff = first character from the text file and set Next = the next character from the file. Then we will perform the following steps: 9

L EMPEL -Z IV E NCODING Temp = concat(Buff, Next) is Temp in code table? Yes? Buff = Temp and get next Next No?send the code associated with Buff assign a code to Temp and store both in code table Buff = Next get next character from Input String and assign to Next repeat all steps until end-of-file 10

L EMPEL -Z IV E NCODING Try the string: “the thing in this is this” t = 116 h = 104 e = 101 = 32 11

A N LZ E NCODING E XAMPLE Initialize: Store each character with its ASCII value (127 values) So, first multiple-character code will be 128 String = “the thing in this is this” Send code 116 (‘t’), Store “th” as code 128 Send code 104 (‘h’), Store “he” as code 129 Send code 101 (‘e’), Store “e_“ as code 130 Send code 32 (‘_‘), Store “_t” as code 131 Send code 128 (‘th’), Store “thi” as code

LZ E NCODING E XAMPLE ( CONT ’ D ) String = “the thing in this is this” Send code 105 (‘i’), Store “in” as code 133 Send code 110 (‘n’), Store “ng” as code 134 Send code 103 (‘g’), Store “g_” as code 135 Send code 32 (‘_‘), Store “_i” as code 136 Send code 133 (‘in’) Store “in_” as code 137 Send code 131 (‘_t‘), Store “_th” as code 138 Send code 104 (‘h’), Store “hi” as code 139 Send code 105 (‘i’), Store “is” as code 140 Send code 115 (‘s’), Store “s_” as code

LZ E NCODING E XAMPLE ( CONT ’ D ) String = “the thing in this is this” Send code 136 (‘_i’), Store “_is” as code 142 Send code 110 (‘s_’), Store “s_t” as code 143 Send code 132 (‘thi’), Store “this” as code 144 Send code 115 (‘s‘) 14

L EMPEL -Z IV D ECODING After you transmit the string, how is the compressed code decoded? Note - the ONLY thing transmitted are the code values 15

LZ D ECODING LZ Decoding Algorithm: Initialize dictionary to contain all single characters and their codes (ASCII) Repeat Receive code Look up associated character block, B, in the dictionary. Take the last received block plus first character of block B and add this block with a new code to the dictionary Output the character block B. Until no more codes are received. 16

LZ D ECODING E XAMPLE Receive code 116, Output t Receive code 104, Store “th” as code 128, Output h Receive code 101, Store “he” as code 129, Output e Receive code 32, Store “e_“ as code 130, Output _ Receive code 128, Store “_t” as code 131, Output th Receive code 105, Store “thi” as code 132, Output i Receive code 110, Store “in” as code 133, Output n Receive code 103, Store “ng” as code 134, Output g Receive code 32, Store “g_” as code 135, Output _ Receive code 133, Store “_i” as code 136, Output in 17

LZ D ECODING E XAMPLE ( CONT ’ D ) Receive code 131, Store “in_” as code 137, Output _t Receive code 104, Store “_th” as code 138, Output h Receive code 105, Store “hi” as code 139, Output i Receive code 115, Store “is” as code 140, Output s Receive code 136, Store “s_” as code 141, Output _i Receive code 110, Store “_is” as code 142, Output s_ Receive code 132, Store “s_t” as code 143, Output thi Receive code 115, Store “this” as code 144, Output s Resulting output: the thing in this is this 18

R ELATIVE OR D IFFERENTIAL E NCODING Video does not compress well using Huffman or run-length encoding In one color video frame, not much is alike But what about from frame to frame? Send a frame, store it in a buffer Next frame is just difference from previous frame Then store that frame in buffer, etc. 19

First Frame Second Frame Difference

I MAGE C OMPRESSION One image - JPEG, or continuous images such as video - MPEG A color picture can be defined by red/green/blue, or luminance / chrominance / chrominance which are based on RGB values Either way, you have 3 values, each 8 bits, or 24 bits total (2 24 colors!) 21

I MAGE C OMPRESSION A VGA screen is 640 x 480 pixels 24 bits x 640 x 480 = 7,372,800 bits. Ouch! And video comes at you 30 images per second. Double Ouch! We need compression! 22

JPEG Joint Photographic Experts Group Compresses still images Lossy JPEG compression consists of 3 phases: Discrete cosine transformations (DCT) Quantization Encoding 23

JPEG S TEP 1 - DCT Divide image into a series of 8x8 pixel blocks If the original image was 640x480 pixels, the new picture would be 80 blocks x 60 blocks (next slide) If B&W, each pixel in 8x8 block is an 8-bit value (0-255) 24

25 80 blocks 60 blocks 640 x 480 VGA Screen Image Divided into 8 x 8 Pixel Blocks

JPEG S TEP 1 - DCT If color, each pixel is 24 bits, or 3 8-bit groups Thus, each pixel value is represented by three 8x8 arrays B&W or color, the DCT is applied to these 8x8 arrays 26

JPEG S TEP 1 - DCT So what does DCT do? Takes an 8x8 array (P) and produces a new 8x8 array (T) using cosines T matrix contains a collection of values called spatial frequencies. These spatial frequencies relate directly to how much the pixel values change as a function of their positions in the block 27

JPEG S TEP 1 - DCT An image with uniform color changes (little fine detail) has a P array with closely similar values and a corresponding T array with many zero values (next slide) An image with large color changes over a small area (lots of fine detail) has a P array with widely changing values, and thus a T array with many non-zero values 28

29

JPEG S TEP 2 - Q UANTIZATION The human eye can’t see small differences in color So take T matrix and divide all values by 10. This will give us more zero entries. More 0s means more compression! But this is too lossy. And dividing all values by 10 doesn’t take into account that upper left of matrix has more action (the less subtle features of the image, or low spatial frequencies) 30

JPEG S TEP 2 - Q UANTIZATION So divide T matrix by another matrix (U) with smaller values in upper left corner and larger values in lower right corner (next slide) Result is matrix Q 31

U matrix Q[i][j] = Round(T[i][j] / U[i][j]), for i = 0, 1, 2, …7 and j = 0, 1, 2, …7

JPEG S TEP 3 - E NCODING Now take the quantized matrix Q and perform run-length encoding on it But don’t just go across the rows. Longer runs of zeros if you perform the run-length encoding in a diagonal fashion (next slide, from White text) 33

JPEG S TEP 3 - E NCODING 34

JPEG How do you get the image back? Undo run-length encoding Multiply matrix Q by matrix U yielding matrix T Apply similar cosine calculations to get original P matrix back 35

MPEG Motion Pictures Expert Group MPEG-1: CD-ROM video, early broadcast satellite systems MPEG-2: multimedia entertainment and HDTV MPEG-3: originally intended for HDTV MPEG-4: videoconferencing MPEG like JPEG but uses temporal redundancy 36

MPEG Don’t transmit complete frames, just what has changed from last frame But what happens when a scene changes? Or someone walks thru a door? Or you turn on the TV part way thru the broadcast? 37

MPEG I-frame - intrapicture frame - self-contained frame P-frame - predicted frame - just the differences from the last frame B-frame - bidirectional frame - similar to P-frame but difference between previous frame and future frame 38

MPEG 39 IBBPBBI ^ diff from prior I frame B frames are interpolated from previous I frame and next P frame Order of transmission: I P B B I B B

MPEG P-frames are coded using motion-compensated prediction Screen reduced to macroblocks Macroblocks contain values of luminance, chrominance, chrominance 40

MPEG MPEG algorithm compares a macroblock from previous screen with one from current screen (the 2 macroblocks that look the most alike) and computes a motion vector Motion vector (what’s changed between macroblocks and how) stores in matrix similar to JPEG Intel MMX technology really helps 41

R EVIEW Q UESTIONS Given the following: A (18%), B (36%), C (24%), D (13%), F (9%), calculate a Huffman Code Perform a run-length encoding on the following: What are the advantages of Lempel-Ziv? What are the three steps in JPEG? What are the different frames in MPEG and how are they used to create a video? 42