Huffman coding By: Justin Bancroft. Huffman coding is the most efficient way to code DCT coefficients.

Slides:



Advertisements
Similar presentations
The Game of Algebra or The Other Side of Arithmetic The Game of Algebra or The Other Side of Arithmetic © 2007 Herbert I. Gross by Herbert I. Gross & Richard.
Advertisements

JPEG Compresses real images Standard set by the Joint Photographic Experts Group in 1991.
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.
Huffman code and ID3 Prof. Sin-Min Lee Department of Computer Science.
MPEG4 Natural Video Coding Functionalities: –Coding of arbitrary shaped objects –Efficient compression of video and images over wide range of bit rates.
SIMS-201 Compressing Information. 2  Overview Chapter 7: Compression Introduction Entropy Huffman coding Universal coding.
SWE 423: Multimedia Systems
School of Computing Science Simon Fraser University
JPEG.
Data Compression Basics
JPEG Still Image Data Compression Standard
T.Sharon-A.Frank 1 Multimedia Image Compression 2 T.Sharon-A.Frank Coding Techniques – Hybrid.
Multimedia Data The DCT and JPEG Image Compression Dr Mike Spann Electronic, Electrical and Computer.
CS430 © 2006 Ray S. Babcock Lossy Compression Examples JPEG MPEG JPEG MPEG.
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.
©Brooks/Cole, 2003 Chapter 15 Data Compression. ©Brooks/Cole, 2003 Realize the need for data compression. Differentiate between lossless and lossy compression.
Image and Video Compression
Trevor McCasland Arch Kelley.  Goal: reduce the size of stored files and data while retaining all necessary perceptual information  Used to create an.
CS Spring 2012 CS 414 – Multimedia Systems Design Lecture 8 – JPEG Compression (Part 3) Klara Nahrstedt Spring 2012.
Entropy coding Present by 陳群元. outline constraints  Compression efficiency  Computational efficiency  Error robustness.
Klara Nahrstedt Spring 2011
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.
Multimedia Data DCT Image Compression
Indiana University Purdue University Fort Wayne Hongli Luo
JPEG CIS 658 Fall 2005.
Hardware/Software Codesign Case Study : JPEG Compression.
Lossless Compression CIS 465 Multimedia. Compression Compression: the process of coding that will effectively reduce the total number of bits needed to.
An introduction to audio/video compression Dr. Malcolm Wilson.
B-Trees. Motivation for B-Trees So far we have assumed that we can store an entire data structure in main memory What if we have so much data that it.
Design of Novel Two-Level Quantizer with Extended Huffman Coding for Laplacian Source Lazar Velimirović, Miomir Stanković, Zoran Perić, Jelena Nikolić,
CS Spring 2014 CS 414 – Multimedia Systems Design Lecture 10 – Compression Basics and JPEG Compression (Part 4) Klara Nahrstedt Spring 2014.
Digital Image Processing Lecture 21: Lossy Compression Prof. Charlene Tsai.
The task of compression consists of two components, an encoding algorithm that takes a file and generates a “compressed” representation (hopefully with.
Foundation of Computing Systems
JPEG (Joint Photographic Expert Group)
Vector Quantization CAP5015 Fall 2005.
Lecture 6 Excess Notation. Excess 8 notation indicates that the value for zero is the bit pattern for 8, that is 1000 Excess 8 notation indicates that.
JPEG.
CS654: Digital Image Analysis
Page 11/28/2016 CSE 40373/60373: Multimedia Systems Quantization  F(u, v) represents a DCT coefficient, Q(u, v) is a “quantization matrix” entry, and.
STATISTIC & INFORMATION THEORY (CSNB134) MODULE 11 COMPRESSION.
Introduction to JPEG m Akram Ben Ahmed
JPEG. Introduction JPEG (Joint Photographic Experts Group) Basic Concept Data compression is performed in the frequency domain. Low frequency components.
Huffman code and Lossless Decomposition Prof. Sin-Min Lee Department of Computer Science.
Lampel ZIV (LZ) code The Lempel-Ziv algorithm is a variable-to-fixed length code Basically, there are two versions of the algorithm LZ77 and LZ78 are the.
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.
4C8 Dr. David Corrigan Jpeg and the DCT. 2D DCT.
Lossless Compression-Statistical Model Lossless Compression One important to note about entropy is that, unlike the thermodynamic measure of entropy,
Information Theory Information Suppose that we have the source alphabet of q symbols s 1, s 2,.., s q, each with its probability p(s i )=p i. How much.
Virtual University of Pakistan Lecture No. 11 Statistics and Probability by Miss Saleha Naghmi Habibullah.
JPEG Compression What is JPEG? Motivation
Huffman Codes ASCII is a fixed length 7 bit code that uses the same number of bits to define each character regardless of how frequently it occurs. Huffman.
IMAGE PROCESSING IMAGE COMPRESSION
Data Compression.
Digital Image Processing Lecture 21: Lossy Compression May 18, 2005
Digital Image Processing Lecture 21: Lossy Compression
JPEG.
Data Compression.
Data Compression CS 147 Minh Nguyen.
MPEG4 Natural Video Coding
Image Coding and Compression
B-Trees.
Presentation transcript:

Huffman coding By: Justin Bancroft

Huffman coding is the most efficient way to code DCT coefficients.

Quantized DCT coefficients

Computers read code at the most basic level in binary. Thus, how programmers transfer symbols into binary needs to be discussed first. This process is done by constructing a tree and is best illustrated with an example. This example is found by following this link, and scrolling down to pg Constructing a Binary Tree

Things to consider about how programmers code symbols. The probabilities of the symbols occurring are determined by programmers depending on several factors not precisely known to us. Unlike the example shown, sometimes the symbols are in numbers. Generally, lower numbers, such as 0-9, will have higher probabilities of appearing in codes and documents, and thus programmers usually assign higher probabilities to lower number symbols. If a symbol has a higher probability, the path of the symbol will end towards the top of the tree. The lower number symbols will contain less bits because the path does not extend as far down the tree. Because the probabilities assigned to symbols is only known to programmers, we will simply refer to tables provided by programmers in order to code symbols.

The Core of Huffman Coding

DC and AC Coefficients Because the first term of the quantized DCT coefficient is the most important, we separate this coefficient from the others and code it differently. The first coefficient of a quantized DCT matrix is called the DC coefficient. All the other coefficients of a quantized DCT matrix are called AC coefficients.

The DC Coefficient We first consider how to code the DC coefficient. On average, two adjacent 8x8 quantized DCT blocks are going to be similar to one another because of the nature of images. The respective DC coefficients of those blocks will therefore also be similar. Thus, we take into account the fact that the difference between DC coefficients of neighboring blocks is usually going to be a low number. Whereas, the DC coefficient itself could be a relatively large number compared to the difference of two DC coefficients. So, instead of coding the DC coefficients themselves, we seek to code the difference between two DC coefficients in adjacent blocks.

Difference DC Coefficient Symbol 1 To code the difference between the DC coefficients, we have to code two different symbols. The first symbol is the bit size of the difference of two DC coefficients which can be found with the following formula. To code symbol 1, we refer to table 6.1 on the following slide.

Table 6.1

Difference DC Coefficient Symbol 2 The second symbol is the actual difference of two DC coefficients in adjacent blocks given by, k is an 8x8 quantized DCT block and k+1 is k’s adjacent 8x8 quantized DCT block. To code symbol 2, we refer to table 6.2 on the following slide.

Table 6.2

Coding the Difference DC coefficient In order to code the difference DC coefficient, we simply combine the codes for Symbol 1 and Symbol 2 of the difference DC coefficient. That is, For example, if the binary code for symbol one was 101 and the binary code for symbol two was 1001, then the code for the difference DC coefficient would be (101)(1001). Note that the parenthesis would not actually appear in the code.

The AC coefficients Now we consider how to code the AC coefficients. It is worth noting that many AC coefficients will be zero. It can also be expected that there will be several sequential AC coefficients that will all be zero. We take advantage of this fact. Why do we want several zero AC coefficients in a row? It is because the zero AC coefficients are not actually coded. Instead. only the nonzero AC coefficients are coded and the code takes into consideration the number of zero AC coefficients between non-zero AC coefficients. We sequence through AC coefficients in a zigzag like pattern in figure 6.20, shown in the next slide, because it is the best way to get several zero AC coefficients in a row.

Zigzag Sequence for AC coefficients

Non-zero AC Coefficient Symbol 1 Like the DC coefficient, the non-zero AC coefficient is coded in two symbols. The first symbol is, (r,S). r is the number of zero coefficients that are sequenced through until arriving at the non-zero AC coefficient. S is the bit size of the non-zero AC coefficient. The bits size is found in the same way as it was found for the Difference of the DC coefficients, except that we find the bit size of an AC coefficient using its actual value. To code symbol 1, we refer to table 6.3 on the next slide.

Table 6.3

Non-zero AC Coefficient Symbol 2 The second symbol is the value of the non- zero AC coefficient. The code for this symbol can be found using the same table we used to find the code for symbol 2 of the DC difference coefficient, table 6.2.

Coding the AC coefficients To code an AC coefficient, we simply combine the codes for symbol 1 and symbol 2 in the same way that we combined the DC difference coefficient symbols. That is, Since the zero AC coefficients are not coded, it is easier to think of AC coefficients as being coded in groups rather than individually.

Huffman Coding efficiency The Huffman method is efficient for two reasons. First, it reduces the amount of bits necessary to store the DC coefficients by storing the difference between the DC coefficients rather than the value of the DC coefficients themselves. Second, the Huffman coding method reduces the amount of bits necessary to store the AC coefficients by not individually coding the zero AC coefficients.