ELEC3203 · Digital Coding & Transmission Information Theory Fundamentals
Information Theory · Lecture notes Prof. Celik
ELEC3203 · Digital Coding and Transmission
Lecture 7

Wrap-up and Tutorial

Seven worked examples that revise the module. Each question comes with its learning outcome and context, the theory it draws on is recapped inside the solution, and the solution is built up step by step, with interactive figures wherever a parameter changes the answer.

Learning Objectives
  • Recognise which result from Lectures 1–6 each question is testing
  • Write complete, step-by-step solutions to source-coding, mutual-information and capacity questions
  • Relate source information rates to the capacity and bandwidth a channel needs
Slides
Podcast
Lecture 7 — Wrap-up and Tutorial: seven worked revision examples
$$H=-\sum_i p_i\log_2 p_i$$
$$R=H\,R_s$$
$$I(X,Y)=H(X)-H(X\mid Y)$$
$$C=B\log_2\!\left(1+\tfrac{S_P}{N_P}\right)$$
InstructorProf. Abdulkadir Çelik https://akadircelik.com ModuleELEC3203 CoversWorked Examples 7.1–7.7
▸ Source coding & RLC ▸ Huffman coding ▸ BSC & capacity ▸ Markov source & bandwidth
Lecture 7

Contents

Seven worked examples: source coding first, then channels and capacity.

This lecture revises the module through seven worked examples, ordered from source coding to channels and capacity. Each example opens with its learning outcome and why it matters, then states the question with a diagram of its set-up. The solution gives the background for each part before working through it. Try each one before opening its solution.

7.1  Memoryless sources and sources with memory

Same symbols, different information

EXAMPLE 7.1 · memoryless source versus source with memory
Learning outcome

Compare the entropy and information rate of memoryless sources and sources with memory, and choose the right coding strategy for each.

This example states the general rule behind every practical source coder in this lecture, including the speech and video coders of Examples 7.2 and 7.4. Two sources that look identical symbol by symbol can carry different amounts of information, and the difference decides which coder should be used.

Two digital sources have:
  1. The same source alphabet or symbol set of \(S=\{m_i,\ 1\le i\le q\}\);
  2. The same symbol probabilities of occurrence \(P=\{p_i,\ 1\le i\le q\}\), with \(p_i\) being the probability of \(m_i\) occurring;
  3. The same symbol rate of \(R_s\) [symbols/s]; and
  4. One digital source is memoryless, and the other has memory.
(i)
Which digital source has a larger entropy? and which digital source has a larger information rate?
(ii)
What is the best strategy of coding the memoryless digital source? and why?
(iii)
What is the best strategy of coding the digital source with memory? and why?
same alphabet S, same probabilities P, same symbol rate RₛSource 1memorylessABBCAADBCABDACBBH? R?Source 2with memoryAAAABBBBBBCCCAAAH? R?illustrative symbol streams: independent draws (top), runs that follow the previous symbol (bottom)
Figure 7.1.1. The two sources of Example 7.1. They agree on everything except memory.

7.2  Remove redundancy, then entropy-code

Judging a speech coder by its information rate

EXAMPLE 7.2 · the 64 kbps speech coder
Learning outcome

Explain why a source with memory must be decorrelated before it is entropy coded.

Every practical compression standard, from the speech codec in a phone call to video streaming, is built on this idea. This example takes a real 1970s telephone speech coder and asks whether it suits a mobile handset, where bandwidth is scarce. Answering it connects three ideas from Lectures 1–4: entropy coding, companding and source memory.

A 64 kbps speech coder was designed in 1970s. In this 64 kbps speech coder design, the speech waveform was filtered to limit its bandwidth to approximately 3.8 kHz and a sampling rate of 8 kHz was then applied. The resultant samples were first passed through an A-law compressor and the compressed samples were then quantised to 256 levels with each sample being represented by 8 bits.
(i)
Will you use this speech coder design for a mobile handset? Explain your answer clearly according to the information theory you have learnt in this course.
(ii)
What is the basic principle adopted in today’s speech source encoding techniques?
speechlow-pass≈ 3.8 kHzsampler8 kHzA-lawcompressorquantiser256 levels, 8 bits64 kbpshandset?8 bits × 8000 samples/s
Figure 7.2.1. The 1970s 64 kbps speech coder.
NO MEMORY · symbols are independent memoryless source 1 equiprobable symbols P(Xᵢ) = 1/q, H = log₂ q BCD (fixed length) is optimal every codeword has lᵢ = log₂ q bits P codeword A 1/4 00 B 1/4 01 C 1/4 10 D 1/4 11 2 non-equiprobable symbols H < log₂ q entropy coding (Shannon-Fano, Huffman) lᵢ ≈ −log₂ P(Xᵢ) less likely symbol → longer codeword P codeword A 1/2 0 B 1/4 10 C 1/8 110 D 1/8 111 WITH MEMORY · symbols are correlated source with memory remove redundancy decorrelate by prediction e(n) = x(n) − x̂(n) residual e(n) ≈ memoryless, unequal P code it with option 2
Figure 7.2.4. Choosing the source coder from the source statistics. For a memoryless source with equiprobable symbols, every symbol carries \(\log_2 q\) bits of information, so BCD is already optimal when \(q\) is a power of 2 and every codeword has the same length. Unequal probabilities call for entropy coding (Shannon-Fano or Huffman), which gives a symbol a longer codeword the less likely it is. A source with memory is first decorrelated to remove its redundancy, as in Example 7.2, so that the residual behaves as a memoryless source with unequal probabilities and can be coded with option 2.

7.3  Entropy, efficiency and Huffman coding

Building and using a variable-length code

EXAMPLE 7.3 · Huffman coding an 8-symbol source
Learning outcome

Construct a Huffman code and measure its gain over fixed-length coding using entropy and coding efficiency.

Fixed-length words such as BCD spend the same number of bits on every symbol, however likely it is. Huffman coding is the optimal symbol-by-symbol prefix code and appears inside JPEG, MP3 and ZIP. This example covers the complete workflow: find the information rate, build the code, compare efficiencies and decode.

A memoryless digital source emits symbols \(X_i\), \(1\le i\le 8\), in binary coded decimal (BCD) format with probabilities \(P(X_i)\) as given in Table 7.3.1, at a rate \(R_s=10^8\) Baud (Baud=symbol/s).
Table 7.3.1. Source symbols, probabilities and BCD words.
\(X_i\)\(P(X_i)\)BCD word
A0.27000
B0.20001
C0.17010
D0.15011
E0.07100
F0.06101
G0.05110
H0.03111
0.27A0000.20B0010.17C0100.15D0110.07E1000.06F1010.05G1100.03H111
Figure 7.3.1. Table 7.3.1 as a bar chart: probabilities above the bars, BCD words below. Every symbol gets a 3-bit word however likely it is.
(i)
What is the data rate of the uncoded BCD signal and what is the information rate of this source?
(ii)
Apply Huffman coding to the digital source characterised in Table 7.3.1.
(iii)
Derive the coding efficiency of both the uncoded BCD signal and the Huffman coded signal.
(iv)
What is the original symbol sequence of the Huffman coded signal 0111000101110101001 (The left most bit is the first bit of the coded signal)?

7.4  Run-length coding

From video redundancy to a compressed bit stream

EXAMPLE 7.4 · video source coding and run-length coding
Learning outcome

Apply the run-length coding equations to find a compression ratio, and decode a run-length coded stream by hand.

Once a video coder has removed spatial and temporal redundancy, its output is a long binary sequence dominated by zeros, and run-length coding is the standard way to compress it. This example links the principle of Example 7.2 to a calculation, then checks that you can run the decoder yourself, including the special all-ones codeword.

(i)
According to the information theory, what is the basic principle adopted in video source encoding techniques?
(ii)
You have designed a video source coder. The output bit sequence of your video source coder contains \(6.4067\times10^{14}\) bits, in which the bit 0 has the probability of occurring 0.999 and the bit 1 has the probability of occurring 0.001. You decide to encode this bit sequence by the run length encoder (RLC) with a codeword length of \(n=10\) bits. What compression ratio can be achieved? Calculate the length of the bit sequence after the RLC encoding.
(iii)
The RLC of the above video source coder produces the following bit sequence (The left most bit is the first bit of the sequence):
1111111101 0000000000 1111111111 1111111110 1111111101 ···
What is the input bit sequence to the RLC?
(ii) ENCODING video sourcecoder6.4067×10¹⁴ bitsP(0) = 0.999, P(1) = 0.001 RLC encodern = 10 bitsratio d/n = ?length = ? (iii) DECODING: RLC output, first bit on the left 11111111010000000000111111111111111111101111111101···RLC input? five 10-bit codewords, read one at a time
Figure 7.4.1. The set-up of parts (ii) and (iii): the video coder output is run-length coded, and part (iii) runs the RLC backwards.

7.5  The binary symmetric channel and mutual information

How much information survives a noisy binary link

EXAMPLE 7.5 · mutual information of a BSC
Learning outcome

Compute the joint and conditional probabilities and the mutual information of a binary symmetric channel, and turn the result into an error-free rate.

The binary symmetric channel is the simplest model of a noisy digital link: the demodulator of Lecture 6 turns an AWGN channel into one. Mutual information measures how much of the source’s information survives the channel, and its maximum is the channel capacity. The example asks first for intuition about the entropies, then for the full calculation.

A binary symmetric channel (BSC) is depicted in Figure 7.5.1,
X₁X₀Y₁Y₀1 − ε1 − εεεP(X₁) = 1 − pP(X₀) = pP(Y₁)P(Y₀)
Figure 7.5.1. The binary symmetric channel.
(i)
For what values of \(p\) and \(\varepsilon\) are the source and destination entropies, \(H(X)\) and \(H(Y)\), identical? In general, is \(H(Y)\ge H(X)\) or \(H(Y)\le H(X)\) true? Justify your answer.
(ii)
Given \(p=\frac12\) and \(\varepsilon=\frac1{16}\), calculate all the probabilities \(P(X_i,Y_j)\) as well as \(P(X_i\mid Y_j)\), and derive the numerical value for the mutual information \(I(X,Y)\).
(iii)
The source of this BSC of \(p=\frac12\) and \(\varepsilon=\frac1{16}\) emits the binary symbols with the rate of \(10^8\) Baud (Baud=symbol/s). What is the maximum achievable rate of this BSC for achieving error-free transmission?

7.6  The Shannon-Hartley capacity

Bandwidth and power, the two resources of a link

EXAMPLE 7.6 · Shannon-Hartley capacity
Learning outcome

State the Shannon-Hartley law and use it to reason about the trade-off between bandwidth and transmit power.

Bandwidth and power are what a wireless system pays for: spectrum is licensed and power drains batteries. The Shannon-Hartley law sets the highest rate that a given amount of each can deliver. This example asks you to state the law precisely, read it as a trade-off and evaluate it for one channel.

(i)
State the Shannon-Hartley channel capacity formula, and define clearly each variable in the formula. According to this channel capacity formula, what are the two basic resources for digital communications? Discuss how you can trade off these two resources to achieve the required channel capacity.
(ii)
The signal-to-noise ratio (SNR) of a wireless channel is SNR = 127, and the bandwidth of this wireless channel is 10 MHz. What is the capacity of this channel?
transmitterSₚwireless channelB = 10 MHz+AWGN, NₚSNR = 127receiverC = ?
Figure 7.6.1. The wireless channel of part (ii).

7.7  A Markov source over an AWGN channel

Matching a source with memory to a Gaussian channel

EXAMPLE 7.7 · minimum bandwidth for an 8-ary Markov source
Learning outcome

Compute the entropy of a first-order Markov source and the minimum channel bandwidth for error-free transmission.

This example joins the two halves of the module. The source side (Lecture 3) says how many bits per second really need to be sent; the channel side (Lecture 6) says how many a channel of given bandwidth and SNR can carry. Setting the two equal gives the smallest bandwidth that can work.

A digital communication system uses an 8-ary signalling scheme with the transmission rate of 100 MBaud (\(10^8\) [symbols/s]). The probabilities of occurrence for the eight symbols at the transmitter are respectively
\(P(X_1)=0.2,\ P(X_2)=0.1,\ P(X_3)=0.1,\ P(X_4)=0.1,\)
\(P(X_5)=0.1,\ P(X_6)=0.1,\ P(X_7)=0.1,\ P(X_8)=0.2.\)
It is known that this 8-ary symbol source is a first-order Markov process with the known transition probability matrix
\(\Gamma=[p_{ij}]=\)
0.20.00.00.00.00.30.30.2
0.20.20.00.00.00.00.30.3
0.30.20.20.00.00.00.00.3
0.30.30.20.20.00.00.00.0
0.00.40.30.20.10.00.00.0
0.00.00.40.30.20.10.00.0
0.00.00.00.40.30.20.10.0
0.00.00.00.00.40.30.10.2
where \(p_{ij}=P(X_j\mid X_i)\), \(1\le i,j\le 8\), are the transition probabilities.
(i)
Determine the information rate of the source at the transmitter.
(ii)
The channel is an ideal additive white Gaussian noise (AWGN) channel, and the channel’s signal to noise ratio is known to be 63. Determine the minimum channel bandwidth required to achieve error-free transmission.
8-ary Markov sourceΓ = [pᵢⱼ], Rₛ = 10⁸ symbols/sR = ?ideal AWGN channelSNR = 63Bₘᵢₙ = ?destinationerror-free
Figure 7.7.1. The system of Example 7.7. Darker cells of \(\Gamma\) above are the more likely transitions.

7.8  Summary

Reference sheet for the worked examples

7.1 · Sources with memory
$$ H=-\sum_i p_i\log_2 p_i,\quad H_M=\sum_i p_iH_i $$
$$ H_M\le H\le\log_2 q $$
Memory lowers the information rate; a symbol-by-symbol coder only reaches \(H\).
7.2 · Remove redundancy first
$$ e(n)=x(n)-\hat x(n) $$
$$ \sigma_e^2=(1-\rho^2)\,\sigma_x^2 $$
Code only the innovation, then entropy-code it.
7.3 · Entropy coding
$$ R=H\,R_s,\quad \bar L=\sum_i p_i l_i $$
$$ \eta=H/\bar L $$
Huffman: merge the two least probable entries until one remains.
7.4 · Run-length coding
$$ N=2^n-1,\quad d=\frac{1-p^N}{1-p} $$
$$ \text{ratio}=d/n $$
All-ones codeword: \(N\) zeros with no closing 1.
7.5 · Binary symmetric channel
$$ I(X,Y)=H(X)-H(X|Y) $$
$$ C=1-H_b(\varepsilon)\ \text{at}\ p=\tfrac12 $$
\(H(Y)\ge H(X)\); multiply by \(R_s\) for bits/s.
7.6 · Shannon-Hartley
$$ C=B\log_2\!\left(1+\frac{S_P}{N_P}\right) $$
$$ C_\infty=1.44\,S_P/N_0 $$
Trade bandwidth against power.
7.7 · Minimum bandwidth
$$ R=R_s\sum_i p_iH_i\le C $$
$$ B_{\min}=\frac{R}{\log_2(1+\text{SNR})} $$
Exploiting memory reduces the bandwidth needed.