1 Chapter 3 Text and image compression. 2 3.2 Compression principles u Source encoders and destination decoders u Lossless and lossy compression u Entropy.

Slides:



Advertisements
Similar presentations
T.Sharon-A.Frank 1 Multimedia Compression Basics.
Advertisements

15 Data Compression Foundations of Computer Science ã Cengage Learning.
Data Compression CS 147 Minh Nguyen.
Chapter 7 End-to-End Data
School of Computing Science Simon Fraser University
Department of Computer Engineering University of California at Santa Cruz Data Compression (3) Hai Tao.
Spatial and Temporal Data Mining
JPEG.
Computer Science 335 Data Compression.
Data Compression Basics
Fundamentals of Multimedia Chapter 7 Lossless Compression Algorithms Ze-Nian Li and Mark S. Drew 건국대학교 인터넷미디어공학부 임 창 훈.
T.Sharon-A.Frank 1 Multimedia Image Compression 2 T.Sharon-A.Frank Coding Techniques – Hybrid.
Lecture 3 Text and Image Compression. Compression Principles By compression the volume of information to be transmitted can be reduced. At the same time.
5. 1 JPEG “ JPEG ” is Joint Photographic Experts Group. compresses pictures which don't have sharp changes e.g. landscape pictures. May lose some of the.
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.
1 Lossless Compression Multimedia Systems (Module 2) r Lesson 1: m Minimum Redundancy Coding based on Information Theory: Shannon-Fano Coding Huffman Coding.
©Brooks/Cole, 2003 Chapter 15 Data Compression. ©Brooks/Cole, 2003 Realize the need for data compression. Differentiate between lossless and lossy compression.
Roger Cheng (JPEG slides courtesy of Brian Bailey) Spring 2007
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.
Spring 2015 Mathematics in Management Science Binary Linear Codes Two Examples.
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 2 Source Coding (part 2)
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 8 – JPEG Compression (Part 3) Klara Nahrstedt Spring 2012.
1 Image Compression. 2 GIF: Graphics Interchange Format Basic mode Dynamic mode A LZW method.
Klara Nahrstedt Spring 2011
CS Spring 2011 CS 414 – Multimedia Systems Design Lecture 7 – Basics of Compression (Part 2) Klara Nahrstedt Spring 2011.
Page 110/6/2015 CSE 40373/60373: Multimedia Systems So far  Audio (scalar values with time), image (2-D data) and video (2-D with time)  Higher fidelity.
Concepts of Multimedia Processing and Transmission IT 481, Lecture 5 Dennis McCaughey, Ph.D. 19 February, 2007.
JPEG. The JPEG Standard JPEG is an image compression standard which was accepted as an international standard in  Developed by the Joint Photographic.
Indiana University Purdue University Fort Wayne Hongli Luo
CIS679: Multimedia Basics r Multimedia data type r Basic compression techniques.
JPEG CIS 658 Fall 2005.
Chapter 7 – End-to-End Data Two main topics Presentation formatting Compression We will go over the main issues in presentation formatting, but not much.
1 Classification of Compression Methods. 2 Data Compression  A means of reducing the size of blocks of data by removing  Unused material: e.g.) silence.
Digital Image Processing Image Compression
Lossless Compression CIS 465 Multimedia. Compression Compression: the process of coding that will effectively reduce the total number of bits needed to.
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 There is need for compression: bandwidth constraints of multimedia applications exceed the capability of communication channels Ex. QCIF bit.
COMPRESSION. Compression in General: Why Compress? So Many Bits, So Little Time (Space) CD audio rate: 2 * 2 * 8 * = 1,411,200 bps CD audio storage:
CS Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014.
Lecture 4: Lossless Compression(1) Hongli Luo Fall 2011.
The task of compression consists of two components, an encoding algorithm that takes a file and generates a “compressed” representation (hopefully with.
CS654: Digital Image Analysis Lecture 34: Different Coding Techniques.
JPEG (Joint Photographic Expert Group)
JPEG.
STATISTIC & INFORMATION THEORY (CSNB134) MODULE 11 COMPRESSION.
Introduction to JPEG m Akram Ben Ahmed
Multi-media Data compression
1 Data Compression Hae-sun Jung CS146 Dr. Sin-Min Lee Spring 2004.
Chapter 7 Lossless Compression Algorithms 7.1 Introduction 7.2 Basics of Information Theory 7.3 Run-Length Coding 7.4 Variable-Length Coding (VLC) 7.5.
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 7 – Basics of Compression (Part 2) Klara Nahrstedt Spring 2012.
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 )
JPEG Compression What is JPEG? Motivation
IMAGE COMPRESSION.
Data Compression.
JPEG.
Data Compression.
Data Compression CS 147 Minh Nguyen.
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.
UNIT IV.
Image Coding and Compression
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:

1 Chapter 3 Text and image compression

2 3.2 Compression principles u Source encoders and destination decoders u Lossless and lossy compression u Entropy encoding u Source encoding

Source encoder and destination decoders u Figure 3.1

Lossless and lossy compression u Lossless compression algorithm, when the compressed information is decompressed, there is no loss of information to be reversible u Lossy compression algorithms, is normally not to reproduce an exact copy of the source information after decompression u Example application of lossy compression are for the transfer of digitized images and audio and video streams

Entropy encoding u Run-length encoding u When the source information comprises long substrings of the same character or binary digit. u Instead of transmitting these directly, they are sent in the form of a string of codewords, each indicating both the bit - 0 or 1 - and the number of bits in the substring …

Entropy encoding u This could be represented as:0,7,1,10 0,5,1,2… u Alternatively, if we ensure the first substring always comprises binary 0s, then the string could be represented as 7,10,5,2… u Statistical encoding u Statistical encoding exploits this property by using a set of variable length codewords with the shortest codewords used to represent the most frequently occurring symbols

Entropy encoding u Ensure that a shorter codeword in the set does not form the start of a longer codeword otherwise the decoder will interpret the string on the wrong codeword boundaries í prefix property u Huffman coding algorithm u Minimum average number of bits that are required to transmit a particular source stream is known as the entropy of the source

Entropy encoding u Shannon: Entropy, u Average number of bits per codeword :

Entropy encoding u Example Comprises only the six different characters M,F,Y,N,0 AND 1 -- Frequency of occurrence of 0.25, 0.25, 0.125, 0.125, 0.125, and If the encoding algorithm under following set of codewords: M=10, F=11, Y=010, N=011, 0=000,1=001

Source encoding u Differential encoding -- Instead of using a set of relatively large codewords to represent the amplitude of each value/signal, a set of smaller codewords can be used each of which indicates only the difference in amplitude between the current value/signal being encoded -- For example, 12 bits to obtain the required dynamic range but the maximum difference in amplitude between successive samples of the signal requires only 3-bits

Source encoding u Transform encoding -- As we scan across a set of pixel locations -- The rate of change in magnitude will vary from zero, if all the pixel values remain the same -- A high rate of change it each pixel magnitude changes from one location to the next -- The rate of change in magnitude as one traverses the matrix gives rise to a term known as spatial frequency

Source encoding -- Figure 3.2

Source encoding -- The human eye is less sensitive to the higher spatial frequency components -- If we can transform the original spatial form of representation into an equivalent representation involving spatial frequency components, then we can more readily identify and eliminate those higher frequency components which the eye cannot detect thereby reducing the volume of information

Source encoding -- The transformation of a two-dimensional matrix of pixel values into an equivalent matrix of spatial frequency components discrete cosine transform(DCT) - Figure 3.2(b)

Text compression u Static coding u Dynamic or adaptive coding

Static Huffman coding u First analyzed and the character types and their relative frequency determined u An example of a Huffman code tree is AAAABBCD u A binary 0 for the left branch and a binary 1 for the right branch

Static Huffman coding u Figure 3.3

Static Huffman coding u listing the resulting weights of all the leaf and branch nodes in the tree starting with the smallest weight and proceeding from left to right and from bottom to top u 4 × 1 + 2× 2 + 1×3 + 1×3 = 14 bits u Example 3.2 u Figure 3.4 u Huffman codewords have the unique property that a shorter codeword will never form the start of a longer codeword prefix property

Static Huffman coding u Figure 3.5

Dynamic Huffman coding u The receiver being able to determine the character that is received, can also carry out the same modifications to its own copy of the tree so that it can interpret the next codeword received according to the new updated tree structure u Example : this is simple

Dynamic Huffman coding u Figure 3.6

Dynamic Huffman coding u Since three is empty, the uncompressed ASCII char is sent and the tree is created. (Fig 3.6 (a)) u The encoder first checks whether the character is already present in the tree u If it is not present, then the encoder sends the current codeword for the empty leaf- again determined by its position in the tree - Fig. 3.6 (b), (c), (d), (e)

Dynamic Huffman coding u The empty leaf being assigned to the 0-branch and the character to the 1-branch - Fig. 3.6 (b) u If the character is already present in the tree, then the frequency of occurrence of the leaf node is incremented by unity – Fig. 3.6 (g)(f) u If it is, then the encoder sends the current codeword for the character in the normal way u First list the weights of the leaf and branch nodes in the updated tree from left to right and from bottom to top starting at the empty leaf - Fig. 3.6 (a)(b)

Dynamic Huffman coding u If they are all in weight order, all is well and the tree is left unchanged - Fig. 3.6 (a)(b) u If there is a node out of order, the structure of the tree is modified by exchanging the position of this node with the other node in the tree-to produce an incremented weight order - Fig. 3.6 ©(d)(e)(f)(g)

Arithmetic coding u Arithmetic coding yields a single codeword for each encoded string of characters u The first step is to divide the numeric range from 0 to 1 into a number of different characters present in the message to be sent u The size of each segment by the probability of the related character u The first character to be encoded w is in the range 0.8 To 0.9

Arithmetic coding u Figure 3.7

Arithmetic coding u The segment for the character e, is from 0.8 to 0.83( × 0.1) u Character n from 0.83 to 0.86 ( × 0.1) u The character e has a range from 0.8 to ( × 0.03), the character n from to ( × 0.03) u P136 之解釋 u The maximum number of characters in a string is determined by the precision with which floating- point numbers

Lemple-Ziv coding u A table containing all the possible character strings u The encoder sends only the index of where the word is stored in the table and, on receipt of each index, the decoder uses this to access the corresponding word/string of characters from the table u Dictionary-based compression algorithm u Example 3.3

Lemple-Ziv-Welsh coding u Initially, the dictionary held by both the encoder and decoder contains only the character set u The remaining entries in the dictionary are then built up dynamically by both the encoder and decoder and contain the words that occur in the text

Lemple-Ziv-Welsh coding u Figure 3.8

Lemple-Ziv-Welsh coding u The encoder prior to sending each word in the form of single characters, first checks to determine if the word is currently stored in its dictionary and, if it is, it sends only the index for the word u The available space become full, then the number of entries is allowed to increase incrementally

Image compression Graphic interchange format(GIF) u The resulting table of colors therefore consists of 256 entries, each of which contains a 24-bit color value u Figure 3.9 u GIF also allow an image to be stored and subsequently transferred over the network in an interlaced mode u The first contains 1/8 of the total compressed image data, the second a further 1/8, the third a further 1/4, and the last the remaining 1/2

33

Graphic interchange format u Figure 3.9

Graphic interchange format u Figure 3.10

Tagged image file format u The supports pixel resolutions of up to 48 bits-16 bits each for R, G, and B u The LZW compression algorithm that is used

Digitized pictures JPEG -- There are five main stages associated with this mode:image/block preparation, forward DCT, quantization, entropy encoding, and frame building

JPEG -- Figure 3.14

JPEG u Image/block preparation -- Once the source image format has been selected and prepared -- Block preparation -- It would be too time consuming to compute the DCT of the total matrix in a single step so each matrix is first divided into set of smaller 8× 8 submatrics as a block

JPEG -- Figure 3.15

JPEG u Forward DCT -- Each pixel value is quantized using 8 bits which produces a value in the range 0 to 255 for the intensity/luminance values-R,G,B or Y - and a value in the range -128 to +127 for the two chrominance values-C b and C r -- All the values are first centered around zero by subtracting The input 2-D matrix is represented by :P[x,y] and the transformed matrix by F[i, j]

JPEG u Figure 3.16

JPEG u Quantization -- The human eye responds primarily to the DC coefficient and the lower spatial frequency coefficients -- Quantization phase by dropping-in practice, setting to zero-those spatial frequency coefficients in the transformed matrix whose amplitudes are less than a defined threshold value

JPEG u The quantization process aims to reduce the size of the DC and AC coefficients so that less bandwidth is required u A division operation is performed using the defined threshold value as the divisor u Example 3.4 u The quantization table with the threshold value to be used with a particular DCT coefficient in the corresponding position in the matrix

JPEG u Figure 3.17

JPEG u An example set of threshold values is given in the quantization table, it can conclude a number of points: -- The computation of the quantized coefficients involves rounding the quotients to the nearest integer value -- The threshold values used, increase in magnitude with increasing spatial frequency -- The DC coefficient in the transformed matrix is largest -- Many of the higher-frequency coefficients are zero

JPEG u Entropy encoding four steps:vectoring, differential encoding, run- length encoding, and Huffman encoding u Vectoring -- represent the values in the form of a single- dimension vector as vectoring -- Zig-zag scan -- the DC coefficient and lower-frequency AC coefficients-both horizontal and vertical-are scanned first

JPEG u Figure 3.18

JPEG u Differential encoding -- the first element in each transformed block is the DC coefficient which is a measure of the average color/luminance/chrominance -- the DC coefficient varies only slowly from one block to the next -- differential encoding since this encodes only the difference between each pair of values -- for example, if the sequence of DC coefficeints in consecutive quantized blocks- one per block –was: 12, 13, 11, 11, 10, …

JPEG -- the corresponding difference values would be : 12, 1, -2, 0, -1, … -- the difference values are then encoded in the form (SSS,value) -- the SSS field indicates the number of bits needed to encode the value -- the value field the actual bits that represent the value -- Figure Example 3.5

51

JPEG u Run-length encoding -- The remaining 63 values in the vector are the AC coefficients -- Each pair is made up of (skip, value) where skip is the number of zeros in the run -- Figure 3.18 would be encoded as: (0,6) (0,7)(0,3)(0,3) (0,3) (0,2)(0,2)(0,2)(0,2)(0,0) -- Final pair (0,0) indicates the end of the string for this block and that all the remaining coefficients in the block are zero

JPEG u Huffman encoding -- Significant levels of compression can be obtained by replacing long string of binary digits by a string of much shorter codewords -- The length of each codeword being a function of its relative frequency of occurrence

JPEG u Frame building -- The frame builder is to encapsulate all the information relating to an encoded image/picture in this format -- Figure 3.20

JPEG -- Figure 3.20

JPEG u Jpeg decoding -- Figure 3.21

57 Exercises u Section u Section u Section