SlideShare a Scribd company logo
1 of 11
Download to read offline
Shannon-Fano Algorithm
Variable Length Coding
Introduction
The Shannon-Fano algorithm was independently developed by Shannon at Bell Labs
and Robert Fana at MIT.
The encoding steps of the Shannon-Fano algorithm can be presented in the following
top-down manner:
1. Sort the symbols according to the frequency count of their occurrences.
2. Recursively divide the symbols into two parts, each with approximately the same
number of counts, until an parts contain only one symbol.
A natural way of implementing the above procedure is to build a binary tree. As a
convention, let's assign bit 0 to its left branches and 1 to the right branches.
Example
Symbols to be coded are the characters in the word SPEAKER.
The frequency count of the symbols is
Total number of symbols is 7
S 1
P 1
E 2
A 1
K 1
R 1
E,S:(3) P,A,K,R:(4)
(7)E 2
S 1
P 1
A 1
K 1
R 1
STEP 1
STEP 2.1
0 1
The first division yields two parts: (a) E,S with a total count of 3, denoted as E,S:(3); and (b) P,A,Kand R: with a
total count of 4, denoted as P,A,K,R:(4).
E,S: (3) P,A,K,R: (4)
(7)
STEP 2.2
E:(2) S: (1) P,A: (2) K,R: (2)
0
0 0
1
1
1
E,S :(3) P,A,K,R: (4)
(7)
STEP 2.3
E:(2) S: (1) P,A: (2) K,R: (2)
0
0 0
1
1 1
P: (1) A: (1) K:(1) R :(1)
0
0
1
1
Symbol Count Code Number of
bits used
Probability
Pi
E 2 00 4 (2*2) 2/7 = 0.29
S 1 01 2 1/7 =0.14
P 1 100 3 1/7=0.14
A 1 101 3 1/7=0.14
K 1 110 3 1/7=0.14
R 1 111 3 1/7=0.14
Total number of bits : 18 bits
Compression Ratio
If the total number of bits required to represent the data before compression is B0
and the total number of bits required to represent the data after compression is B1
,
then we define the compression ratio as
Compression Ratio = B0
/ B1
B0
= 8 * 7 Symbols Assume each character symbol require 8 bit
B1
= 18 bits
Compression Ratio = 56/18 = 3.11 [ Positive Compression ]
Average number of bits used by 7 symbols in the above solution = 18 / 7 = 2.57
Entropy (η)
According to the Claude E. Shannon, the entropy η of an information source with
alphabet S = {S1
, S2
, ••. ,Sn
} is defined as:
η = H(S) =
where Pi
is the probability that symbol Si
in S will occur.
The term indicates the amount of information contained in Si
, which
corresponds to the number of bits needed to encode Si
.
= 0.29 * log2
(1/0.29) + [ 0.14 * log2
(1/0.14) ] * 5
= 0.29 * log2
(3.45) + [ 0.14 * log2
(7.14) ] * 5
= 0.29 * log2
(3.45) + [ 0.14 * log2
(7.14) ] * 5
= 0.29 * 1.79 + [ 0.14 * 2.84) ] * 5
= 0.52 + 0.40 * 5 = 0.52 + 2.00 = 2.52
This suggests that the minimum average number of bits to code each character in the
word SPEAKER would be at least 2.52. The Shannon-Fano algorithm delivers
satisfactory coding results for data compression.
Entropy (η)
References
● Fundamentals of Multimedia by Ze-Nian Li and Mark S Drew, Pearson Education, 2009
● Log calculator by https://ncalculators.com

More Related Content

What's hot

Linear Block Codes
Linear Block CodesLinear Block Codes
Linear Block CodesNilaNila16
 
Simultaneous Smoothing and Sharpening of Color Images
Simultaneous Smoothing and Sharpening of Color ImagesSimultaneous Smoothing and Sharpening of Color Images
Simultaneous Smoothing and Sharpening of Color ImagesCristina Pérez Benito
 
Interpixel redundancy
Interpixel redundancyInterpixel redundancy
Interpixel redundancyNaveen Kumar
 
Noise filtering
Noise filteringNoise filtering
Noise filteringAlaa Ahmed
 
Homomorphic filtering
Homomorphic filteringHomomorphic filtering
Homomorphic filteringGautam Saxena
 
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...Madhumita Tamhane
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output PrimitivesRenita Santhmayora
 
Pulse Code Modulation (PCM)
Pulse Code Modulation (PCM)Pulse Code Modulation (PCM)
Pulse Code Modulation (PCM)Arun c
 
Manchester & Differential Manchester encoding scheme
Manchester & Differential Manchester encoding schemeManchester & Differential Manchester encoding scheme
Manchester & Differential Manchester encoding schemeArunabha Saha
 
Information Theory - Introduction
Information Theory  -  IntroductionInformation Theory  -  Introduction
Information Theory - IntroductionBurdwan University
 

What's hot (20)

Digital Audio in Multimedia
Digital Audio in MultimediaDigital Audio in Multimedia
Digital Audio in Multimedia
 
Linear Block Codes
Linear Block CodesLinear Block Codes
Linear Block Codes
 
Data Redundacy
Data RedundacyData Redundacy
Data Redundacy
 
Information theory
Information theoryInformation theory
Information theory
 
Line coding
Line codingLine coding
Line coding
 
Audio compression
Audio compressionAudio compression
Audio compression
 
Simultaneous Smoothing and Sharpening of Color Images
Simultaneous Smoothing and Sharpening of Color ImagesSimultaneous Smoothing and Sharpening of Color Images
Simultaneous Smoothing and Sharpening of Color Images
 
Interpixel redundancy
Interpixel redundancyInterpixel redundancy
Interpixel redundancy
 
Dcs unit 2
Dcs unit 2Dcs unit 2
Dcs unit 2
 
Noise filtering
Noise filteringNoise filtering
Noise filtering
 
Homomorphic filtering
Homomorphic filteringHomomorphic filtering
Homomorphic filtering
 
Noise Models
Noise ModelsNoise Models
Noise Models
 
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
Convolution codes - Coding/Decoding Tree codes and Trellis codes for multiple...
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
 
SPEECH CODING
SPEECH CODINGSPEECH CODING
SPEECH CODING
 
Pulse Code Modulation (PCM)
Pulse Code Modulation (PCM)Pulse Code Modulation (PCM)
Pulse Code Modulation (PCM)
 
Manchester & Differential Manchester encoding scheme
Manchester & Differential Manchester encoding schemeManchester & Differential Manchester encoding scheme
Manchester & Differential Manchester encoding scheme
 
Image compression models
Image compression modelsImage compression models
Image compression models
 
Information Theory - Introduction
Information Theory  -  IntroductionInformation Theory  -  Introduction
Information Theory - Introduction
 
BCH Codes
BCH CodesBCH Codes
BCH Codes
 

Similar to Shannon-Fano algorithm

Information Theory and coding - Lecture 3
Information Theory and coding - Lecture 3Information Theory and coding - Lecture 3
Information Theory and coding - Lecture 3Aref35
 
Lecture 2
Lecture 2Lecture 2
Lecture 2Muuluu
 
cp467_12_lecture14_image compression1.pdf
cp467_12_lecture14_image compression1.pdfcp467_12_lecture14_image compression1.pdf
cp467_12_lecture14_image compression1.pdfshaikmoosa2003
 
Data Communication & Computer Networks : Data Types
Data Communication & Computer Networks : Data TypesData Communication & Computer Networks : Data Types
Data Communication & Computer Networks : Data TypesDr Rajiv Srivastava
 
Information Theory MSU-EEE.ppt
Information Theory MSU-EEE.pptInformation Theory MSU-EEE.ppt
Information Theory MSU-EEE.pptrobomango
 
Huffman&Shannon-multimedia algorithms.ppt
Huffman&Shannon-multimedia algorithms.pptHuffman&Shannon-multimedia algorithms.ppt
Huffman&Shannon-multimedia algorithms.pptPrincessSaro
 
Block Encryption Algorithm Project.docx
Block Encryption Algorithm Project.docxBlock Encryption Algorithm Project.docx
Block Encryption Algorithm Project.docxUsamaAliLone3
 
Information Theory and coding - Lecture 2
Information Theory and coding - Lecture 2Information Theory and coding - Lecture 2
Information Theory and coding - Lecture 2Aref35
 
Theory of Fundamental of IT(Information technology).pptx
Theory of Fundamental of IT(Information technology).pptxTheory of Fundamental of IT(Information technology).pptx
Theory of Fundamental of IT(Information technology).pptxLovely Singh
 
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...venkatapranaykumarGa
 
Data representation
Data representationData representation
Data representationMysore
 
Unit 4 combinational circuit
Unit 4 combinational circuitUnit 4 combinational circuit
Unit 4 combinational circuitKalai Selvi
 

Similar to Shannon-Fano algorithm (20)

Information Theory and coding - Lecture 3
Information Theory and coding - Lecture 3Information Theory and coding - Lecture 3
Information Theory and coding - Lecture 3
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
cp467_12_lecture14_image compression1.pdf
cp467_12_lecture14_image compression1.pdfcp467_12_lecture14_image compression1.pdf
cp467_12_lecture14_image compression1.pdf
 
Materi Program.ppt
Materi Program.pptMateri Program.ppt
Materi Program.ppt
 
Data Communication & Computer Networks : Data Types
Data Communication & Computer Networks : Data TypesData Communication & Computer Networks : Data Types
Data Communication & Computer Networks : Data Types
 
Information Theory MSU-EEE.ppt
Information Theory MSU-EEE.pptInformation Theory MSU-EEE.ppt
Information Theory MSU-EEE.ppt
 
Arithmetic Coding
Arithmetic CodingArithmetic Coding
Arithmetic Coding
 
Huffman&Shannon-multimedia algorithms.ppt
Huffman&Shannon-multimedia algorithms.pptHuffman&Shannon-multimedia algorithms.ppt
Huffman&Shannon-multimedia algorithms.ppt
 
Block Encryption Algorithm Project.docx
Block Encryption Algorithm Project.docxBlock Encryption Algorithm Project.docx
Block Encryption Algorithm Project.docx
 
Compression ii
Compression iiCompression ii
Compression ii
 
W 9 numbering system
W 9 numbering systemW 9 numbering system
W 9 numbering system
 
W 9 numbering system
W 9 numbering systemW 9 numbering system
W 9 numbering system
 
Information Theory and coding - Lecture 2
Information Theory and coding - Lecture 2Information Theory and coding - Lecture 2
Information Theory and coding - Lecture 2
 
Theory of Fundamental of IT(Information technology).pptx
Theory of Fundamental of IT(Information technology).pptxTheory of Fundamental of IT(Information technology).pptx
Theory of Fundamental of IT(Information technology).pptx
 
Komdat-Kompresi Data
Komdat-Kompresi DataKomdat-Kompresi Data
Komdat-Kompresi Data
 
. computer codes
. computer codes. computer codes
. computer codes
 
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
14-Intermediate code generation - Variants of Syntax trees - Three Address Co...
 
Binary codes
Binary codesBinary codes
Binary codes
 
Data representation
Data representationData representation
Data representation
 
Unit 4 combinational circuit
Unit 4 combinational circuitUnit 4 combinational circuit
Unit 4 combinational circuit
 

More from MANISH T I

NAAC Criteria 3
NAAC  Criteria 3NAAC  Criteria 3
NAAC Criteria 3MANISH T I
 
Artificial intelligence - An Overview
Artificial intelligence - An OverviewArtificial intelligence - An Overview
Artificial intelligence - An OverviewMANISH T I
 
The future of blogging
The future of bloggingThe future of blogging
The future of bloggingMANISH T I
 
Socrates - Most Important of his Thoughts
Socrates - Most Important of his ThoughtsSocrates - Most Important of his Thoughts
Socrates - Most Important of his ThoughtsMANISH T I
 
Technical writing
Technical writingTechnical writing
Technical writingMANISH T I
 
Solar Image Processing
Solar Image Processing  Solar Image Processing
Solar Image Processing MANISH T I
 
Graph Theory Introduction
Graph Theory IntroductionGraph Theory Introduction
Graph Theory IntroductionMANISH T I
 
Rooted & binary tree
Rooted & binary treeRooted & binary tree
Rooted & binary treeMANISH T I
 
Colourful Living - Way of Life
Colourful Living - Way of LifeColourful Living - Way of Life
Colourful Living - Way of LifeMANISH T I
 
Introduction to Multimedia
Introduction to MultimediaIntroduction to Multimedia
Introduction to MultimediaMANISH T I
 
Soft Computing
Soft ComputingSoft Computing
Soft ComputingMANISH T I
 
Research Methodology - Methods of data collection
 Research Methodology - Methods of data collection Research Methodology - Methods of data collection
Research Methodology - Methods of data collectionMANISH T I
 
15 lessons of lord buddha
15 lessons of lord buddha15 lessons of lord buddha
15 lessons of lord buddhaMANISH T I
 
Image enhancement
Image enhancementImage enhancement
Image enhancementMANISH T I
 
Research Methodology - Introduction
Research  Methodology - IntroductionResearch  Methodology - Introduction
Research Methodology - IntroductionMANISH T I
 
DBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORMDBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORMMANISH T I
 
Simple Dictionary Compression
Simple Dictionary CompressionSimple Dictionary Compression
Simple Dictionary CompressionMANISH T I
 
Data Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length EncodingData Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length EncodingMANISH T I
 

More from MANISH T I (20)

Budgerigar
BudgerigarBudgerigar
Budgerigar
 
NAAC Criteria 3
NAAC  Criteria 3NAAC  Criteria 3
NAAC Criteria 3
 
Artificial intelligence - An Overview
Artificial intelligence - An OverviewArtificial intelligence - An Overview
Artificial intelligence - An Overview
 
The future of blogging
The future of bloggingThe future of blogging
The future of blogging
 
Socrates - Most Important of his Thoughts
Socrates - Most Important of his ThoughtsSocrates - Most Important of his Thoughts
Socrates - Most Important of his Thoughts
 
Technical writing
Technical writingTechnical writing
Technical writing
 
Solar Image Processing
Solar Image Processing  Solar Image Processing
Solar Image Processing
 
Graph Theory Introduction
Graph Theory IntroductionGraph Theory Introduction
Graph Theory Introduction
 
Rooted & binary tree
Rooted & binary treeRooted & binary tree
Rooted & binary tree
 
JPEG
JPEGJPEG
JPEG
 
Colourful Living - Way of Life
Colourful Living - Way of LifeColourful Living - Way of Life
Colourful Living - Way of Life
 
Introduction to Multimedia
Introduction to MultimediaIntroduction to Multimedia
Introduction to Multimedia
 
Soft Computing
Soft ComputingSoft Computing
Soft Computing
 
Research Methodology - Methods of data collection
 Research Methodology - Methods of data collection Research Methodology - Methods of data collection
Research Methodology - Methods of data collection
 
15 lessons of lord buddha
15 lessons of lord buddha15 lessons of lord buddha
15 lessons of lord buddha
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Research Methodology - Introduction
Research  Methodology - IntroductionResearch  Methodology - Introduction
Research Methodology - Introduction
 
DBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORMDBMS - FIRST NORMAL FORM
DBMS - FIRST NORMAL FORM
 
Simple Dictionary Compression
Simple Dictionary CompressionSimple Dictionary Compression
Simple Dictionary Compression
 
Data Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length EncodingData Compression - Text Compression - Run Length Encoding
Data Compression - Text Compression - Run Length Encoding
 

Recently uploaded

ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 

Recently uploaded (20)

Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 

Shannon-Fano algorithm

  • 2. Introduction The Shannon-Fano algorithm was independently developed by Shannon at Bell Labs and Robert Fana at MIT. The encoding steps of the Shannon-Fano algorithm can be presented in the following top-down manner: 1. Sort the symbols according to the frequency count of their occurrences. 2. Recursively divide the symbols into two parts, each with approximately the same number of counts, until an parts contain only one symbol. A natural way of implementing the above procedure is to build a binary tree. As a convention, let's assign bit 0 to its left branches and 1 to the right branches.
  • 3. Example Symbols to be coded are the characters in the word SPEAKER. The frequency count of the symbols is Total number of symbols is 7 S 1 P 1 E 2 A 1 K 1 R 1
  • 4. E,S:(3) P,A,K,R:(4) (7)E 2 S 1 P 1 A 1 K 1 R 1 STEP 1 STEP 2.1 0 1 The first division yields two parts: (a) E,S with a total count of 3, denoted as E,S:(3); and (b) P,A,Kand R: with a total count of 4, denoted as P,A,K,R:(4).
  • 5. E,S: (3) P,A,K,R: (4) (7) STEP 2.2 E:(2) S: (1) P,A: (2) K,R: (2) 0 0 0 1 1 1
  • 6. E,S :(3) P,A,K,R: (4) (7) STEP 2.3 E:(2) S: (1) P,A: (2) K,R: (2) 0 0 0 1 1 1 P: (1) A: (1) K:(1) R :(1) 0 0 1 1
  • 7. Symbol Count Code Number of bits used Probability Pi E 2 00 4 (2*2) 2/7 = 0.29 S 1 01 2 1/7 =0.14 P 1 100 3 1/7=0.14 A 1 101 3 1/7=0.14 K 1 110 3 1/7=0.14 R 1 111 3 1/7=0.14 Total number of bits : 18 bits
  • 8. Compression Ratio If the total number of bits required to represent the data before compression is B0 and the total number of bits required to represent the data after compression is B1 , then we define the compression ratio as Compression Ratio = B0 / B1 B0 = 8 * 7 Symbols Assume each character symbol require 8 bit B1 = 18 bits Compression Ratio = 56/18 = 3.11 [ Positive Compression ] Average number of bits used by 7 symbols in the above solution = 18 / 7 = 2.57
  • 9. Entropy (η) According to the Claude E. Shannon, the entropy η of an information source with alphabet S = {S1 , S2 , ••. ,Sn } is defined as: η = H(S) = where Pi is the probability that symbol Si in S will occur. The term indicates the amount of information contained in Si , which corresponds to the number of bits needed to encode Si .
  • 10. = 0.29 * log2 (1/0.29) + [ 0.14 * log2 (1/0.14) ] * 5 = 0.29 * log2 (3.45) + [ 0.14 * log2 (7.14) ] * 5 = 0.29 * log2 (3.45) + [ 0.14 * log2 (7.14) ] * 5 = 0.29 * 1.79 + [ 0.14 * 2.84) ] * 5 = 0.52 + 0.40 * 5 = 0.52 + 2.00 = 2.52 This suggests that the minimum average number of bits to code each character in the word SPEAKER would be at least 2.52. The Shannon-Fano algorithm delivers satisfactory coding results for data compression. Entropy (η)
  • 11. References ● Fundamentals of Multimedia by Ze-Nian Li and Mark S Drew, Pearson Education, 2009 ● Log calculator by https://ncalculators.com