SlideShare a Scribd company logo
5
Most read
11
Most read
12
Most read
Performance Analysis of Huffman
and Arithmetic coding Compression
algorithms
1
By: Ramakant Soni
Data Compression
• It is the process of encoding information using fewer bits than the
original representation.
• It is the process of reducing the size of a data file, although its
formal name is source coding.
Compression types:
1. Lossless compression
2. Lossy compression
• Compression is useful because it helps reduce resources usage,
such as data storage space or transmission capacity.
• Data compression is subject to a space-time complexity trade-off.
2
Need of analysis
• Which compression algorithm is Better?
• Decision Factor: Complexity
Complexity (Computational complexity ) theory focuses on
classifying computational problems according to their inherent
difficulty.
Difficulty of problems mean the resources used to get the solution.
Resources:
1. Space
2. Time
3
Compression Algorithms for analysis
• Huffman Coding
• Arithmetic Coding
4
Huffman Coding
• Huffman coding is an entropy encoding algorithm used for lossless
data compression.
• It encodes a source symbol into variable-length code which is
derived in a particular way based on the estimated probability of
occurrence of the source symbol.
5
Huffman Coding Algorithm:
Algorithm:
1. Start with a list of symbols and their frequency in the alphabet.
2. Select two symbols with the lowest frequency.
3. Add their frequencies and reduce the symbols.
4. Repeat the process starting from step-2 until only two values
remain.
5. The algorithm creates a prefix code for each symbol from the
alphabet simply by traversing the symbols back. It assigns 0 and 1
for each frequency value in each phase .
6
Example: Huffman Coding
Input: Six symbols and their respective Probability / Frequency Values
Steps:
1. Arrange the symbols in descending order of frequency values.
2. Add the two lowest values and remove the symbols
3. At the end we will be left with only two values
7
Example: Huffman Coding
Steps:
1. Moving backward assign the bits to the values.
2. With each succession phase(reverse) add bit values using step 1
Result:
Symbols with variable length codes.
8
Huffman Coding Complexity analysis
• Huffman algorithm is based on greedy approach to get the optimal
result(code length).
• Using the pseudo code:
• Running Time Function: T(n)= N[n+ log(2n-1)]+ Sn
• Complexity: O(N )
9
2
Arithmetic Coding
• Arithmetic coding is a form of entropy encoding used in lossless
data compression.
• A string of characters is represented using a fixed number of bits
per character.
• When a string is converted to arithmetic encoding, frequently used
characters will be stored with fewer bits and not-so-frequently
occurring characters will be stored with more bits.
• Arithmetic coding encodes the entire message into a single number,
a fraction n where (0.0 ≤ n < 1.0)
10
Arithmetic Coding Algorithm:
Algorithm:
1. Take character and symbol with their probabilities value as input.
2. The encoder divides the current interval [0,1) into sub-intervals,
each representing a fraction of the current interval proportional to
the probability of that symbol in the current context.
3. Whichever interval corresponds to the actual symbol that is next
to be encoded becomes the interval used in the next step.
4. When symbols get encoded, the resulting interval unambiguously
identifies the sequence of symbols that produced it.
5. Using the final interval and model we can reconstruct the symbol
sequence that must have entered the encoder to result in that
final interval.
11
Example: Arithmetic Coding
Input: 3 symbols(x) with respective probabilities(p) and a character
X={0,1,2} P={P0, P1, P2}={0.2, 0.4, 0.4 } x1..x3=210
12
Arithmetic Coding Complexity analysis
ARITHMETIC_IDEAL_ENCODE(M)
Set L= 0 and R = 1
FOR i = 1 to |M| DO
END FOR
Transmit the shortest binary fractional number that lies in the interval [L, L+R)
END
13
Arithmetic Coding Complexity analysis
Running time Function:
T(n)=N[log n+ a]+ Sn
N Number of input symbols
n current number of unique symbols
S  Time to maintain internal data structure
Complexity: O(N log n)
14
Complexity comparison
15
Conclusion
• Arithmetic Coding surpasses the Huffman technique in its
compression ability.
• The Huffman method assigns an integral number of bits to each
symbol, while arithmetic coding assigns one long code to the entire
input string.
• Arithmetic coding consists of a few arithmetic operations due to
which its complexity is less.
• In terms of complexity Arithmetic coding is asymptotically better
than Huffman’s.
16
Thank You
17

More Related Content

PPT
Huffman Coding
PPTX
Text compression
PPTX
Run length encoding
PPTX
Data compression
PPT
how to calclute time complexity of algortihm
PPT
Data representation
PDF
Lecture 2 role of algorithms in computing
PPT
Introduction to problem solving in c++
Huffman Coding
Text compression
Run length encoding
Data compression
how to calclute time complexity of algortihm
Data representation
Lecture 2 role of algorithms in computing
Introduction to problem solving in c++

What's hot (20)

PDF
Digital Image Processing - Image Compression
PPT
Lzw coding technique for image compression
PPTX
Introduction to Image Compression
PPTX
digital image processing
PPSX
Edge Detection and Segmentation
PPTX
Image compression .
PPT
Discrete cosine transform
ODP
image compression ppt
PPTX
Chapter 9 morphological image processing
PPTX
Image compression: Techniques and Application
PPTX
Color Image Processing
PPTX
Transform coding
PDF
Image compression
PPTX
Hit and-miss transform
PPTX
Point processing
PPT
Wavelet transform in image compression
PPTX
Chapter 8 image compression
PPTX
Spatial Filters (Digital Image Processing)
PPTX
Intensity Transformation
PPT
Arithmetic coding
Digital Image Processing - Image Compression
Lzw coding technique for image compression
Introduction to Image Compression
digital image processing
Edge Detection and Segmentation
Image compression .
Discrete cosine transform
image compression ppt
Chapter 9 morphological image processing
Image compression: Techniques and Application
Color Image Processing
Transform coding
Image compression
Hit and-miss transform
Point processing
Wavelet transform in image compression
Chapter 8 image compression
Spatial Filters (Digital Image Processing)
Intensity Transformation
Arithmetic coding
Ad

Viewers also liked (20)

PDF
Arithmetic Coding
PDF
Ch 04 Arithmetic Coding (Ppt)
PPT
Lec7 8 9_10 coding techniques
PDF
Module 4 Arithmetic Coding
PDF
06 Arithmetic 1
PPT
Huffman Student
PPTX
Huffman coding
PPTX
Data compression
PPTX
Introduction for Data Compression
PPTX
Compression project presentation
PPTX
Data compression
PPTX
4 data compression
PPTX
video compression techique
PDF
Chapter 5 - Data Compression
PPTX
Data compression techniques
PPTX
Data Compression In SQL
PDF
Data compression huffman coding algoritham
PPTX
Data compression
PPTX
A new algorithm for data compression technique using vlsi
PPTX
Huffman Coding
Arithmetic Coding
Ch 04 Arithmetic Coding (Ppt)
Lec7 8 9_10 coding techniques
Module 4 Arithmetic Coding
06 Arithmetic 1
Huffman Student
Huffman coding
Data compression
Introduction for Data Compression
Compression project presentation
Data compression
4 data compression
video compression techique
Chapter 5 - Data Compression
Data compression techniques
Data Compression In SQL
Data compression huffman coding algoritham
Data compression
A new algorithm for data compression technique using vlsi
Huffman Coding
Ad

Similar to Huffman and Arithmetic coding - Performance analysis (20)

PDF
Arithmetic coding
PPTX
arithmetic coding for signal and multimedia processing
PDF
Implementation of Lossless Compression Algorithms for Text Data
PPT
Huffman coding
PDF
Sunzip user tool for data reduction using huffman algorithm
PPTX
Presented by Anu Mattatholi
PPTX
Greedy algorithm
PDF
Introduction to Source Coding.pdf
PDF
Unit 3 Arithmetic Coding
PPT
Huffman coding.ppt
PDF
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf
PPTX
Digital image processing- Compression- Different Coding techniques
PDF
Ijrdtvlis11 140006
PPTX
Huffman Coding Algorithm Presentation
PPT
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
PPT
Hufman coding basic
PPT
Multimedia compression
PPT
hufman coding for compression algorithm.ppt
PPT
hufman code presentation and how to compress data using hufman code
Arithmetic coding
arithmetic coding for signal and multimedia processing
Implementation of Lossless Compression Algorithms for Text Data
Huffman coding
Sunzip user tool for data reduction using huffman algorithm
Presented by Anu Mattatholi
Greedy algorithm
Introduction to Source Coding.pdf
Unit 3 Arithmetic Coding
Huffman coding.ppt
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf
Digital image processing- Compression- Different Coding techniques
Ijrdtvlis11 140006
Huffman Coding Algorithm Presentation
2.3 unit-ii-text-compression-a-outline-compression-techniques-run-length-codi...
Hufman coding basic
Multimedia compression
hufman coding for compression algorithm.ppt
hufman code presentation and how to compress data using hufman code

More from Ramakant Soni (13)

PDF
GATE 2021 Exam Information
PDF
What is Algorithm - An Overview
PDF
Role of Data Cleaning in Data Warehouse
PDF
Internet of things
PDF
NOSQL- Presentation on NoSQL
PDF
UML daigrams for Bank ATM system
PDF
Collaboration diagram- UML diagram
PDF
Activity diagram-UML diagram
PDF
Sequence diagram- UML diagram
PDF
Class diagram- UML diagram
PDF
Use Case diagram-UML diagram-2
PDF
Use Case diagram-UML diagram-1
PDF
UML Diagrams- Unified Modeling Language Introduction
GATE 2021 Exam Information
What is Algorithm - An Overview
Role of Data Cleaning in Data Warehouse
Internet of things
NOSQL- Presentation on NoSQL
UML daigrams for Bank ATM system
Collaboration diagram- UML diagram
Activity diagram-UML diagram
Sequence diagram- UML diagram
Class diagram- UML diagram
Use Case diagram-UML diagram-2
Use Case diagram-UML diagram-1
UML Diagrams- Unified Modeling Language Introduction

Recently uploaded (20)

PPTX
Welding lecture in detail for understanding
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
composite construction of structures.pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Construction Project Organization Group 2.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PPT
Mechanical Engineering MATERIALS Selection
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
OOP with Java - Java Introduction (Basics)
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
web development for engineering and engineering
PDF
Digital Logic Computer Design lecture notes
PDF
PPT on Performance Review to get promotions
PDF
Well-logging-methods_new................
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Welding lecture in detail for understanding
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
composite construction of structures.pdf
CYBER-CRIMES AND SECURITY A guide to understanding
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Construction Project Organization Group 2.pptx
Internet of Things (IOT) - A guide to understanding
Mechanical Engineering MATERIALS Selection
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
R24 SURVEYING LAB MANUAL for civil enggi
OOP with Java - Java Introduction (Basics)
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
web development for engineering and engineering
Digital Logic Computer Design lecture notes
PPT on Performance Review to get promotions
Well-logging-methods_new................
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...

Huffman and Arithmetic coding - Performance analysis

  • 1. Performance Analysis of Huffman and Arithmetic coding Compression algorithms 1 By: Ramakant Soni
  • 2. Data Compression • It is the process of encoding information using fewer bits than the original representation. • It is the process of reducing the size of a data file, although its formal name is source coding. Compression types: 1. Lossless compression 2. Lossy compression • Compression is useful because it helps reduce resources usage, such as data storage space or transmission capacity. • Data compression is subject to a space-time complexity trade-off. 2
  • 3. Need of analysis • Which compression algorithm is Better? • Decision Factor: Complexity Complexity (Computational complexity ) theory focuses on classifying computational problems according to their inherent difficulty. Difficulty of problems mean the resources used to get the solution. Resources: 1. Space 2. Time 3
  • 4. Compression Algorithms for analysis • Huffman Coding • Arithmetic Coding 4
  • 5. Huffman Coding • Huffman coding is an entropy encoding algorithm used for lossless data compression. • It encodes a source symbol into variable-length code which is derived in a particular way based on the estimated probability of occurrence of the source symbol. 5
  • 6. Huffman Coding Algorithm: Algorithm: 1. Start with a list of symbols and their frequency in the alphabet. 2. Select two symbols with the lowest frequency. 3. Add their frequencies and reduce the symbols. 4. Repeat the process starting from step-2 until only two values remain. 5. The algorithm creates a prefix code for each symbol from the alphabet simply by traversing the symbols back. It assigns 0 and 1 for each frequency value in each phase . 6
  • 7. Example: Huffman Coding Input: Six symbols and their respective Probability / Frequency Values Steps: 1. Arrange the symbols in descending order of frequency values. 2. Add the two lowest values and remove the symbols 3. At the end we will be left with only two values 7
  • 8. Example: Huffman Coding Steps: 1. Moving backward assign the bits to the values. 2. With each succession phase(reverse) add bit values using step 1 Result: Symbols with variable length codes. 8
  • 9. Huffman Coding Complexity analysis • Huffman algorithm is based on greedy approach to get the optimal result(code length). • Using the pseudo code: • Running Time Function: T(n)= N[n+ log(2n-1)]+ Sn • Complexity: O(N ) 9 2
  • 10. Arithmetic Coding • Arithmetic coding is a form of entropy encoding used in lossless data compression. • A string of characters is represented using a fixed number of bits per character. • When a string is converted to arithmetic encoding, frequently used characters will be stored with fewer bits and not-so-frequently occurring characters will be stored with more bits. • Arithmetic coding encodes the entire message into a single number, a fraction n where (0.0 ≤ n < 1.0) 10
  • 11. Arithmetic Coding Algorithm: Algorithm: 1. Take character and symbol with their probabilities value as input. 2. The encoder divides the current interval [0,1) into sub-intervals, each representing a fraction of the current interval proportional to the probability of that symbol in the current context. 3. Whichever interval corresponds to the actual symbol that is next to be encoded becomes the interval used in the next step. 4. When symbols get encoded, the resulting interval unambiguously identifies the sequence of symbols that produced it. 5. Using the final interval and model we can reconstruct the symbol sequence that must have entered the encoder to result in that final interval. 11
  • 12. Example: Arithmetic Coding Input: 3 symbols(x) with respective probabilities(p) and a character X={0,1,2} P={P0, P1, P2}={0.2, 0.4, 0.4 } x1..x3=210 12
  • 13. Arithmetic Coding Complexity analysis ARITHMETIC_IDEAL_ENCODE(M) Set L= 0 and R = 1 FOR i = 1 to |M| DO END FOR Transmit the shortest binary fractional number that lies in the interval [L, L+R) END 13
  • 14. Arithmetic Coding Complexity analysis Running time Function: T(n)=N[log n+ a]+ Sn N Number of input symbols n current number of unique symbols S  Time to maintain internal data structure Complexity: O(N log n) 14
  • 16. Conclusion • Arithmetic Coding surpasses the Huffman technique in its compression ability. • The Huffman method assigns an integral number of bits to each symbol, while arithmetic coding assigns one long code to the entire input string. • Arithmetic coding consists of a few arithmetic operations due to which its complexity is less. • In terms of complexity Arithmetic coding is asymptotically better than Huffman’s. 16