All Coding
All Coding
I(xi) b its
5
ii. If “a”= e = 2.71828, then has the unit of nats 4
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Properties of P(xi)
Example: Find the entropy of the source producing the following messages:
Solution:
Binary Source Entropy
In information theory, the binary entropy function, denoted H(X) or Hb(X) is defined as the entropy of a Bernoulli
process with probability p of one of two values. Mathematically, the Bernoulli trial is modelled as a random variable X
that can take on only two values: 0 and 1:
We have:
Then:
If
The unit of H(X) is bits/symbol and the rate of producing the symbols is symbol/sec, so that the unit of R(X) is bits/sec.
Where
is the average time duration of symbols, is the time duration of the symbol .
Example: A source produces dots ‘.’ And dashes ‘-‘ with P(dot)=0.65. If the time duration of dot is 200ms and that for a
dash is 800ms. Find the average source entropy rate.
Mutual information for noisy channel
Consider the set of symbols , the transmitter my produce. The receiver may receive . Theoretically, if
the noise and jamming is neglected, then the set X=set Y. However and due to noise and jamming, there
will be a conditional probability
The amount of information that provides about is called the mutual information between and . This is
given by:
Properties of :
1. It is symmetric, .
2. if aposteriori probability > a priori probability, provides +ve information about .
3. if aposteriori probability = a priori probability, which is the case of statistical independence when
provides no information about .
4. if aposteriori probability a priori probability, provides -ve information about , or adds ambiguity.
Also
Joint Entropy & Conditional Entropy
In information theory, joint entropy is a measure of the uncertainty associated with a set of variables.
The conditional entropy quantifies the amount of information needed to describe the outcome of a random
variable Y given that the value of another random variable X is known.
Transinformation (average mutual information)
It is the statistical average of all pair . This is denoted by and is given by:
or
2.
H
Source Coding
Prof. Dr. Mahmood F. Mosleh
Source coding
An important problem in communications is the efficient representation of data generated by a discrete source. The
process by which this representation is accomplished is called source encoding. An efficient source encoder must
satisfies two functional requirements:
ii. The source code is uniquely decodable, so that the original source sequence can be reconstructed perfectly
from the encoded binary sequence.
Code Efficiency
We have:
The overall code length, L, can be defined as the average code word length:
If the alphabet X consists of the 7 symbols {a, b, c, d, e, f, g}, then the following fixed-length code of block
length L = 3 could be used.
The encoded output contains L bits per source symbol. For the above example the source sequence bad...
would be encoded into 001000011... . Note that the output bits are simply run together (or, more technically,
concatenated). This method is nonprobabilistic; it takes no account of whether some symbols occur more
frequently than others, and it works robustly regardless of the symbol frequencies. This is used when the
source produces almost equiprobable messages or,
, then
To address this problem, the Prefix-free codes must be used: A prefix code is a type of code system
(typically a variable-length code) distinguished by its possession of the "prefix property", which requires
that there is no code word in the system that is a prefix (initial segment) of any other code word in the
system. For example:
Huffman Code
The Huffman coding algorithm comprises two steps, reduction and splitting:
Example: Design Huffman codes for having the probabilities
Symbol A B C D E F G H
Probability 0.1 0.18 0.4 0.05 0.06 0.1 0.07 0.04
Shannon- Fano Code
In Shannon–Fano coding, the symbols are arranged in order from most probable to least probable, and
then divided into two sets 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". As long as any sets with more than one member remain, the same process is
repeated on those sets, to determine successive digits of their codes.
Example: Develop the Shannon - Fano code for the following set of messages, then find the code efficiency.
Code
bits/symbol
0.35 0 0 2
bits/symbol
0.2 0 1 2
0.15 1 0 0 3
0.12 1 0 1 3
0.10 1 1 0 3
0.08 1 1 1 3
Shannon- Fano Code, with r=3
Code
0.35 0 1
ternary unit/symbol
0.2 1 0 2
ternary unit/symbol
0.15 1 1 2
𝐻(𝑋)
𝜂= × 100 % =91 . 636 % 0.12 2 0 2
𝐿𝐶
0.10 2 1 2
0.08 2 2 2
Shannon Code
0.3 2 0 00 2
• The information, consisting of individual bits, is fed into a shift register in order to be
encoded.
A convolutional encoder is generally characterized in (n, k, or (k / n, K )
form
K)
where :
– k inputs and n outputs
• In practice, usually k=1 is chosen.
Rc k / n is the coding rate, determining the number of data
bits per coded bit.
– K is the constraint length of the convolutinal code (where the encoder has
K-1 memory elements).
Convolutional encoder
Convolutional Encoder
c1
Input data bits
c2
1 0 0
0 1 0
1
0
At time t = 3 0
1 0 1
0
Using the (7, 5)8 NSC Code to Encode the
Message 101000
0 1 0 0 0 1
0 1
At time t = 0
6
0 0 0
=[11 10 00 10 11 00]
State Table of a Convolutional Code
• The memory elements can contain four possible values: 00, 01, 10, 11
• These values are called states and only certain state transitions are allowed. For
example, we cannot go from state 00 to state 11 in one step or stay in state 10.
• All possible state transitions, along with their corresponding input and
outputs, can be determined from the encoder and stored in a state table.
• The state table for the (7, 5)8 NSC code is shown below:
Input Initial State Next State Output
S1 S2 S1 S2 c1 c2
0 0 0 0 0 0 0
1 0 0 1 0 1 1
0 0 1 0 0 1 1
1 0 1 1 0 0 0
0 1 0 0 1 1 0
1 1 0 1 1 0 1
0 1 1 0 1 0 1
1 1 1 1 1 1 0
State diagram of a Convolutional
Code
• A more compact form of the state table is the state diagram
• The state is represented by the content of the memory, i.e., the (K- 1)k previous bits,
namely, the (K-1)k bits contained in the first (K-1)k stages of the shift register. Hence,
there are 2 (K-1)k states.
1/10 Input/Output
11
What is the codeword for the message
1/01
m = [1 0 0 1 1 1]?
0/01 0/10
01 10
1/00
0/11 1/11
00
State Input/Output
11 1/10
Trellis Diagrams
Example1: Consider the binary convolutional encoder with constraint length K=3, k=1, and
n=3. The generators are: g1=[100], g2=[101], and g3=[111]. The generators are more
conveniently given in octal form as (4,5,7)
Q1 Q2 Q3
[g1]=[1 0 0], C1=Q1
[g2]=[1 0 1] , C2=Q1+Q3
[g3]=[1 1 1 ], C3=Q1+Q2+Q3
State Table of a Convolutional Code
Input bit:
101
C1=Q1+Q3+Q4
C2=Q1+Q2+Q4
C3=Q1+Q3
State Table of a Convolutional Code
Example of State Diagram (2)
Example of Trellis Diagram (2)