SOURCE CODING PROF. A.M.ALLAM LECTURES 10/15/2016 1 Lecture5: Lossless Compression Techniques Fixed to variable mapping: we encoded source symbols of fixed length into variable length code sequences Source Symbol s k Symbol Probability P k Code I Code II Symbol Code , Word c k Code Word Length l k Symbol Code Word c k Code Word Length l k s 0 1/2 00 2 0 1 s 1 1/4 01 2 10 2 s 2 1/8 10 2 110 3 s 3 1/8 11 2 1111 4 Variable to fixed mapping encode variable length source sequences into a fixed length code words Variable to variable mapping encode variable length source sequences into a variable length code words Fixed to fixed mapping: we encoded source symbols of fixed length into fixed length code sequences
30
Embed
Lecture5: Lossless Compression Techniqueseee.guc.edu.eg/Courses/Communications/COMM901... · Lecture5: Lossless Compression Techniques Huffman Code The average codeword length is
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
SOURCE CODING PROF. A.M.ALLAM
LECTURES 10/15/2016 1
Lecture5: Lossless Compression Techniques
Fixed to variable mapping: we encoded source symbols of fixed length into variable length code
sequences
Source Symbol sk Symbol
Probability
Pk
Code I Code II
Symbol Code ,
Word ck
Code Word
Length lk
Symbol Code
Word ck
Code Word
Length lk
s0 1/2 00 2 0 1
s1 1/4 01 2 10 2
s2 1/8 10 2 110 3
s3 1/8 11 2 1111 4
Variable to fixed mapping encode variable length source sequences into a fixed length code
words
Variable to variable mapping encode variable length source sequences into a variable length code
words
Fixed to fixed mapping: we encoded source symbols of fixed length into fixed length code sequences
SOURCE CODING PROF. A.M.ALLAM
LECTURES 10/15/2016
Shannon Fano Code
It is a technique for constructing a prefix code based on a set of symbols and their probabilities (estimated or measured)
1-Source symbols are listed in order of decreasing probability from left to right
4-Recursively apply the steps 2 and 3 to each of the two halves, subdividing groups and adding bits to the codes until each symbol has become a corresponding code leaf on the tree
2-Divide the list into two parts, with the total probability (or frequency of occurrence) of the left
part being as close to the total of the right as possible
3-The left part of the list is assigned the binary digit 0, and the right part is assigned the digit 1
This means that the codes for the symbols in the first part will all start with 0, and the codes in the
second part will all start with 1
Algorithm
It is suboptimal in the sense that it does not achieve the lowest
possible expected code word length
The technique was proposed by Claude Shannon and was
attributed to Robert Fano
Lecture5: Lossless Compression Techniques
2
SOURCE CODING PROF. A.M.ALLAM
Ex: Assume a sequence of alphabet A={ a , b , c , d , e , f } with the following occurrence
weights, {9, 8, 6, 5, 4, 2} respectively. Apply Shannon Fano coding and discuss the