Convolutional Codes
Definition: Convolutional Code
Convolutional Code
A convolutional code with rate and constraint length encodes one input bit at a time by combining it with the previous input bits through linear modulo-2 functions (generator polynomials).
The encoder has memory elements (shift registers), so the encoder state is one of possible states. The output at each time step is coded bits.
The generator polynomials specify which register taps are XOR-ed to produce each output bit.
Unlike block codes, convolutional codes operate on a continuous stream. The constraint length determines the code's memory and, together with the generators, its free distance.
Definition: Trellis Representation
Trellis Representation
The trellis of a convolutional code is a graph that unfolds the encoder state diagram over time. At each time step :
- Each node represents one of the encoder states.
- Each branch represents a state transition caused by an input bit, labelled with the output bits.
The trellis has a regular structure: every column (time step) has the same set of states, and the branching pattern repeats.
A valid codeword corresponds to a path through the trellis starting from the all-zero state.
The trellis provides the foundation for efficient ML decoding via the Viterbi algorithm and soft-output decoding via the BCJR algorithm.
Viterbi Algorithm (ML Sequence Decoding)
Theorem: Free Distance and Error Probability Bound
The free distance of a convolutional code is the minimum Hamming distance between any two distinct paths in the trellis that diverge from and re-merge to the same state:
The bit error probability under ML (Viterbi) decoding with soft decisions on an AWGN channel is bounded by
where counts the information-bit errors associated with paths at distance .
The free distance plays the same role for convolutional codes as does for block codes. The asymptotic coding gain is .
Union bound
The probability that the decoder selects a wrong path diverging at any trellis step is upper-bounded by the union of pairwise error events. Each event at Hamming distance contributes .
Dominant term
At moderate-to-high SNR, the sum is dominated by paths at the minimum distance , giving the stated bound.
Viterbi Algorithm Step-by-Step
Trellis Diagram and Viterbi Decoding
Visualise the trellis of a rate-1/2 convolutional code and watch the Viterbi algorithm find the ML path. Adjust the constraint length and SNR to see how the survivor paths evolve.
Parameters
Example: Rate-1/2 Convolutional Code with K = 3
Consider the rate-1/2 convolutional code with constraint length and generator polynomials and (in octal: 7 and 5).
(a) Draw the state diagram and determine the number of states.
(b) Find the free distance .
(c) Compute the asymptotic coding gain.
State diagram
The encoder has memory elements, so there are states: , , , .
From state : input 0 output , stay in ; input 1 output , go to .
The full state transition table defines the trellis.
Free distance
The minimum-weight path diverging from and re-merging to state is: ... actually the minimum path gives output with weight 5.
for this code (a well-known result).
Coding gain
Asymptotic coding gain:
In dB: dB.
BCJR/MAP Decoding for Soft Outputs
The BCJR algorithm (Bahl, Cocke, Jelinek, Raviv, 1974) computes the a posteriori probability (APP) for each information bit given the entire received sequence. Unlike the Viterbi algorithm (which finds the best sequence), BCJR minimises the bit error probability.
The key outputs are log-likelihood ratios (LLRs):
The BCJR algorithm uses forward () and backward () recursions through the trellis, combined with branch metrics (), to compute these LLRs. Its complexity is the same order as Viterbi: .
BCJR is essential for iterative decoding in turbo codes, where the soft outputs of one decoder are fed as soft inputs to another.
Quick Check
A rate-1/2 convolutional code has constraint length . How many states does the Viterbi decoder track at each time step?
9
256
512
81
The decoder tracks states. This is why large constraint lengths become computationally expensive.
Common Mistake: Viterbi Complexity Grows Exponentially with K
Mistake:
Assuming that increasing the constraint length always gives better performance at manageable complexity.
Correction:
The Viterbi decoder complexity is per decoded bit. Doubling squares the number of states. In practice, (256 states) is typical for Viterbi decoding. For larger effective memories, turbo codes or LDPC codes achieve better performance with iterative decoding at linear complexity per iteration.
Historical Note: Andrew Viterbi and the Viterbi Algorithm (1967)
1967Andrew Viterbi published his dynamic-programming decoding algorithm in 1967 while at UCLA. Initially considered of theoretical interest, the Viterbi algorithm became the dominant decoding method for convolutional codes in the 1970s when hardware implementations became feasible. It was adopted in the NASA deep-space probes, the GSM mobile standard, and countless other systems. Viterbi co-founded Qualcomm in 1985, which applied convolutional coding to CDMA cellular systems.
Trellis
A time-indexed graph representing the state transitions of a convolutional encoder. Each path through the trellis corresponds to a valid coded sequence.
Related: Convolutional Code, Viterbi Algorithm
Viterbi Algorithm
A dynamic-programming algorithm that finds the maximum-likelihood path through a trellis in complexity linear in the sequence length and exponential in the constraint length.
Related: Trellis Representation, Ml Decoding, Convolutional Code
Free Distance
The minimum Hamming distance between any two paths in the trellis of a convolutional code. Determines the asymptotic error performance under ML decoding.
Related: Convolutional Code, Hamming Distance, Coding Gain
Constraint Length
The parameter of a convolutional code, equal to the number of input bits that influence the current output (one current + past bits). The encoder has states.
Related: Convolutional Code, Trellis Representation