SlideShare uma empresa Scribd logo
1 de 10
Compression: Background The main idea behind the compression is to create such a code, for which the average length of the encoding vector (word) will not exceed the entropy of the original ensemble of messages. This means that in general those codes that are used for compression are not uniform.
Shannon-Fano Encoding Sources without memory are such sources of information, where the probability of the next transmitted symbol (message) does not depend on the probability of the previous transmitted symbol (message). Separable codes are those codes for which the unique decipherability holds. Shannon-Fano encoding constructs reasonably efficient separable binary codes for sources without memory.
Shannon-Fano Encoding Shannon-Fano encoding is the first established and widely used encoding method.  This method and the corresponding code were invented simultaneously and independently of each other by C. Shannon and R. Fano in 1948.
Shannon-Fano Encoding Let us have the ensemble of the original messages to be transmitted with their corresponding probabilities: Our task is to associate a sequence Ck of binary numbers of unspecified length nk to each message xk such that:
Shannon-Fano Encoding No sequences of employed binary numbers Ck can be obtained from each other by adding more binary digits to the shorter sequence (prefix property). The transmission of the encoded message is “reasonably” efficient, that is, 1 and 0 appear independently and with “almost” equal probabilities. This ensures transmission of “almost” 1 bit of information per digit of the encoded messages.
Shannon-Fano Encoding Another important general consideration, which was taken into account by C. Shannon and R. Fano, is that (as we have already considered) a more frequent message has to be encoded by a shorter encoding vector (word) and a less frequent message has to be encoded by a longer encoding vector (word).
Shannon-Fano Encoding: Algorithm The letters (messages) of (over) the input alphabet must be arranged in order from most probable to least probable. Then the initial set of messages must be divided into two subsets whose total probabilities are as close as possible to being equal.  All symbols then have the first digits of their codes assigned; symbols in the first set receive "0" and symbols in the second set receive "1". The same process is repeated on those subsets, to determine successive digits of their codes, as long as any sets with more than one member remain.  When a subset has been reduced to one symbol, this means the symbol's code is complete.
Shannon-Fano Encoding: Example x1,x2,x3,x4,x5,x6,x7,x8 1 0 x1,x2 x3,x4,x5,x6,x7,x8 01 00 11 10 x3,x4 x5,x6,x7,x8 x1 x2 100 101 110 111 x3 x4 x5,x6 x7,x8 1101 1100 1110 x5 x6 x7 x8
Shannon-Fano Encoding: Example Entropy Average length of the encoding vector The Shannon-Fano code gives 100% efficiency
Shannon-Fano Encoding: Properties It should be taken into account that the Shannon-Fano code is not unique because it depends on the partitioning of the input set of messages, which, in turn, is not unique. If the successive equiprobable partitioning is not possible at all, the Shannon-Fano code may not be an optimum code, that is, a code that leads to the lowest possible average length of the encoding vector for a given D.

Mais conteúdo relacionado

Mais procurados

Discrete cosine transform
Discrete cosine transform   Discrete cosine transform
Discrete cosine transform Rashmi Karkra
 
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
 
Frequency-Shift Keying
Frequency-Shift KeyingFrequency-Shift Keying
Frequency-Shift KeyingJessie Rama
 
PULSE CODE MODULATION (PCM)
PULSE CODE MODULATION (PCM)PULSE CODE MODULATION (PCM)
PULSE CODE MODULATION (PCM)vishnudharan11
 
4.5 equalizers and its types
4.5   equalizers and its types4.5   equalizers and its types
4.5 equalizers and its typesJAIGANESH SEKAR
 
Linear block coding
Linear block codingLinear block coding
Linear block codingjknm
 
Homomorphic filtering
Homomorphic filteringHomomorphic filtering
Homomorphic filteringGautam Saxena
 
Unipolar Encoding Techniques: NRZ & RZ
Unipolar Encoding Techniques: NRZ & RZUnipolar Encoding Techniques: NRZ & RZ
Unipolar Encoding Techniques: NRZ & RZArunabha Saha
 
Image Representation & Descriptors
Image Representation & DescriptorsImage Representation & Descriptors
Image Representation & DescriptorsPundrikPatel
 
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE ShivangiSingh241
 
Wavelet transform in two dimensions
Wavelet transform in two dimensionsWavelet transform in two dimensions
Wavelet transform in two dimensionsAyushi Gagneja
 
Pulse modulation
Pulse modulationPulse modulation
Pulse modulationstk_gpg
 

Mais procurados (20)

Subband Coding
Subband CodingSubband Coding
Subband Coding
 
error control coding
error control coding error control coding
error control coding
 
Turbo Codes
Turbo CodesTurbo Codes
Turbo Codes
 
Discrete cosine transform
Discrete cosine transform   Discrete cosine transform
Discrete cosine transform
 
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...
 
Frequency-Shift Keying
Frequency-Shift KeyingFrequency-Shift Keying
Frequency-Shift Keying
 
PULSE CODE MODULATION (PCM)
PULSE CODE MODULATION (PCM)PULSE CODE MODULATION (PCM)
PULSE CODE MODULATION (PCM)
 
4.5 equalizers and its types
4.5   equalizers and its types4.5   equalizers and its types
4.5 equalizers and its types
 
Linear block coding
Linear block codingLinear block coding
Linear block coding
 
Speech coding techniques
Speech coding techniquesSpeech coding techniques
Speech coding techniques
 
Line coding
Line codingLine coding
Line coding
 
Equalization
EqualizationEqualization
Equalization
 
Image compression models
Image compression modelsImage compression models
Image compression models
 
Homomorphic filtering
Homomorphic filteringHomomorphic filtering
Homomorphic filtering
 
Unipolar Encoding Techniques: NRZ & RZ
Unipolar Encoding Techniques: NRZ & RZUnipolar Encoding Techniques: NRZ & RZ
Unipolar Encoding Techniques: NRZ & RZ
 
Image Representation & Descriptors
Image Representation & DescriptorsImage Representation & Descriptors
Image Representation & Descriptors
 
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
DIGITAL COMMUNICATION: ENCODING AND DECODING OF CYCLIC CODE
 
Base band transmission
Base band transmissionBase band transmission
Base band transmission
 
Wavelet transform in two dimensions
Wavelet transform in two dimensionsWavelet transform in two dimensions
Wavelet transform in two dimensions
 
Pulse modulation
Pulse modulationPulse modulation
Pulse modulation
 

Semelhante a Shannon Fano

Information Theory and coding - Lecture 3
Information Theory and coding - Lecture 3Information Theory and coding - Lecture 3
Information Theory and coding - Lecture 3Aref35
 
Sienna 12 huffman
Sienna 12 huffmanSienna 12 huffman
Sienna 12 huffmanchidabdu
 
Chapter%202%20 %20 Text%20compression(2)
Chapter%202%20 %20 Text%20compression(2)Chapter%202%20 %20 Text%20compression(2)
Chapter%202%20 %20 Text%20compression(2)nes
 
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdfSHIVAM691605
 
Arithmetic coding
Arithmetic codingArithmetic coding
Arithmetic coding09lavee
 
710402_Lecture 1.ppt
710402_Lecture 1.ppt710402_Lecture 1.ppt
710402_Lecture 1.pptPratik Gohel
 
Data Communication & Computer network: Shanon fano coding
Data Communication & Computer network: Shanon fano codingData Communication & Computer network: Shanon fano coding
Data Communication & Computer network: Shanon fano codingDr Rajiv Srivastava
 
Sunzip user tool for data reduction using huffman algorithm
Sunzip user tool for data reduction using huffman algorithmSunzip user tool for data reduction using huffman algorithm
Sunzip user tool for data reduction using huffman algorithmDr Sandeep Kumar Poonia
 
Implementation of Lossless Compression Algorithms for Text Data
Implementation of Lossless Compression Algorithms for Text DataImplementation of Lossless Compression Algorithms for Text Data
Implementation of Lossless Compression Algorithms for Text DataBRNSSPublicationHubI
 

Semelhante a Shannon Fano (20)

Information Theory and coding - Lecture 3
Information Theory and coding - Lecture 3Information Theory and coding - Lecture 3
Information Theory and coding - Lecture 3
 
Arithmetic Coding
Arithmetic CodingArithmetic Coding
Arithmetic Coding
 
Lossless
LosslessLossless
Lossless
 
Lossless
LosslessLossless
Lossless
 
Sienna 12 huffman
Sienna 12 huffmanSienna 12 huffman
Sienna 12 huffman
 
Chapter%202%20 %20 Text%20compression(2)
Chapter%202%20 %20 Text%20compression(2)Chapter%202%20 %20 Text%20compression(2)
Chapter%202%20 %20 Text%20compression(2)
 
Huffman Encoding Pr
Huffman Encoding PrHuffman Encoding Pr
Huffman Encoding Pr
 
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf
12_HuffmanhsjsjsjjsiejjssjjejsjCoding_pdf.pdf
 
Arithmetic coding
Arithmetic codingArithmetic coding
Arithmetic coding
 
710402_Lecture 1.ppt
710402_Lecture 1.ppt710402_Lecture 1.ppt
710402_Lecture 1.ppt
 
Data Communication & Computer network: Shanon fano coding
Data Communication & Computer network: Shanon fano codingData Communication & Computer network: Shanon fano coding
Data Communication & Computer network: Shanon fano coding
 
Komdat-Kompresi Data
Komdat-Kompresi DataKomdat-Kompresi Data
Komdat-Kompresi Data
 
Lecture 3.pptx
Lecture 3.pptxLecture 3.pptx
Lecture 3.pptx
 
Lecture 3.pptx
Lecture 3.pptxLecture 3.pptx
Lecture 3.pptx
 
Unequal-Cost Prefix-Free Codes
Unequal-Cost Prefix-Free CodesUnequal-Cost Prefix-Free Codes
Unequal-Cost Prefix-Free Codes
 
Sunzip user tool for data reduction using huffman algorithm
Sunzip user tool for data reduction using huffman algorithmSunzip user tool for data reduction using huffman algorithm
Sunzip user tool for data reduction using huffman algorithm
 
Implementation of Lossless Compression Algorithms for Text Data
Implementation of Lossless Compression Algorithms for Text DataImplementation of Lossless Compression Algorithms for Text Data
Implementation of Lossless Compression Algorithms for Text Data
 
Huffman Coding
Huffman CodingHuffman Coding
Huffman Coding
 
Lec5 Compression
Lec5 CompressionLec5 Compression
Lec5 Compression
 
Coding and Decoding
Coding and DecodingCoding and Decoding
Coding and Decoding
 

Mais de anithabalaprabhu (20)

Ch 04 Arithmetic Coding ( P P T)
Ch 04  Arithmetic  Coding ( P P T)Ch 04  Arithmetic  Coding ( P P T)
Ch 04 Arithmetic Coding ( P P T)
 
Compression
CompressionCompression
Compression
 
Datacompression1
Datacompression1Datacompression1
Datacompression1
 
Speech Compression
Speech CompressionSpeech Compression
Speech Compression
 
Z24 4 Speech Compression
Z24   4   Speech CompressionZ24   4   Speech Compression
Z24 4 Speech Compression
 
Dictor
DictorDictor
Dictor
 
Dictionary Based Compression
Dictionary Based CompressionDictionary Based Compression
Dictionary Based Compression
 
Module 4 Arithmetic Coding
Module 4 Arithmetic CodingModule 4 Arithmetic Coding
Module 4 Arithmetic Coding
 
Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)Ch 04 Arithmetic Coding (Ppt)
Ch 04 Arithmetic Coding (Ppt)
 
Compression Ii
Compression IiCompression Ii
Compression Ii
 
06 Arithmetic 1
06 Arithmetic 106 Arithmetic 1
06 Arithmetic 1
 
Lassy
LassyLassy
Lassy
 
Compression Ii
Compression IiCompression Ii
Compression Ii
 
Lossy
LossyLossy
Lossy
 
Planning
PlanningPlanning
Planning
 
Losseless
LosselessLosseless
Losseless
 
Lec32
Lec32Lec32
Lec32
 
Huffman Student
Huffman StudentHuffman Student
Huffman Student
 
Huffman Coding
Huffman CodingHuffman Coding
Huffman Coding
 
Huffman1
Huffman1Huffman1
Huffman1
 

Último

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 

Último (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

Shannon Fano

  • 1. Compression: Background The main idea behind the compression is to create such a code, for which the average length of the encoding vector (word) will not exceed the entropy of the original ensemble of messages. This means that in general those codes that are used for compression are not uniform.
  • 2. Shannon-Fano Encoding Sources without memory are such sources of information, where the probability of the next transmitted symbol (message) does not depend on the probability of the previous transmitted symbol (message). Separable codes are those codes for which the unique decipherability holds. Shannon-Fano encoding constructs reasonably efficient separable binary codes for sources without memory.
  • 3. Shannon-Fano Encoding Shannon-Fano encoding is the first established and widely used encoding method. This method and the corresponding code were invented simultaneously and independently of each other by C. Shannon and R. Fano in 1948.
  • 4. Shannon-Fano Encoding Let us have the ensemble of the original messages to be transmitted with their corresponding probabilities: Our task is to associate a sequence Ck of binary numbers of unspecified length nk to each message xk such that:
  • 5. Shannon-Fano Encoding No sequences of employed binary numbers Ck can be obtained from each other by adding more binary digits to the shorter sequence (prefix property). The transmission of the encoded message is “reasonably” efficient, that is, 1 and 0 appear independently and with “almost” equal probabilities. This ensures transmission of “almost” 1 bit of information per digit of the encoded messages.
  • 6. Shannon-Fano Encoding Another important general consideration, which was taken into account by C. Shannon and R. Fano, is that (as we have already considered) a more frequent message has to be encoded by a shorter encoding vector (word) and a less frequent message has to be encoded by a longer encoding vector (word).
  • 7. Shannon-Fano Encoding: Algorithm The letters (messages) of (over) the input alphabet must be arranged in order from most probable to least probable. Then the initial set of messages must be divided into two subsets whose total probabilities are as close as possible to being equal. All symbols then have the first digits of their codes assigned; symbols in the first set receive "0" and symbols in the second set receive "1". The same process is repeated on those subsets, to determine successive digits of their codes, as long as any sets with more than one member remain. When a subset has been reduced to one symbol, this means the symbol's code is complete.
  • 8. Shannon-Fano Encoding: Example x1,x2,x3,x4,x5,x6,x7,x8 1 0 x1,x2 x3,x4,x5,x6,x7,x8 01 00 11 10 x3,x4 x5,x6,x7,x8 x1 x2 100 101 110 111 x3 x4 x5,x6 x7,x8 1101 1100 1110 x5 x6 x7 x8
  • 9. Shannon-Fano Encoding: Example Entropy Average length of the encoding vector The Shannon-Fano code gives 100% efficiency
  • 10. Shannon-Fano Encoding: Properties It should be taken into account that the Shannon-Fano code is not unique because it depends on the partitioning of the input set of messages, which, in turn, is not unique. If the successive equiprobable partitioning is not possible at all, the Shannon-Fano code may not be an optimum code, that is, a code that leads to the lowest possible average length of the encoding vector for a given D.