Module p25::coding::bmcf [] [src]

Decodes Reed Solomon and BCH codes using the Berlekamp-Massey, Chien Search, and Forney algorithms.

Decoding Procedure

The standard [1]-[11] procedure for Reed Solomon/BCH error correction has the following steps:

  1. Generate the syndrome polynomial s(x) = s1 + s2x + ··· + s2tx2t-1, where si = r(αi) using the received word polynomial r(x).
  2. Use s(x) to build the error locator polynomial Λ(x) = (1 + a1x) ··· (1 + aex), where deg(Λ(x)) = e ≤ t is the number of detected errors.
  3. Find the roots a1-1, ..., aE-1 of Λ(x), such that Λ(ai-1) = 0. Then for each, if ai-1 = αki, the error location within the received word is taken as mi in αmi ≡ α-ki (modulo the field).
  4. Verify that e = E.
  5. Construct the error evaluator polynomial Ω(x) = Λ(x)s(x) mod x2t and compute each error pattern bi = Ω(ai-1) / Λ'(ai-1).
  6. For each (mi, bi) pair, correct the symbol at location mi using the bit pattern bi.

This module implements steps 2 through 5. The implementation uses several well-known techniques exist to perform these steps relatively efficiently: the Berlekamp-Massey algorithm for step 2, Chien Search for step 3, and the Forney algorithm for step 5.

Berlekamp-Massey Algorithm

The Berlekamp-Massey algorithm has many variants [1], [2], [9], [12], [13] mostly with subtle differences. The key observation from Massey's generalization is to view Λ(x) as the "connection polynomial" of a linear feedback shift register (LFSR) that generates the sequence of syndromes s1, ..., s2t. The algorithm then synthesizes Λ(x) when constructing the corresponding unique shortest LFSR that generates those syndromes.

Chien Search

With Λ(x) = Λ0 + Λ1x + Λ2x2 + ··· + Λexe (where Λ0 = 1), let Pi = [p0, ..., pe], 0 ≤ i < n, which is indexed as Pi[k], 0 ≤ k ≤ e.

Starting with the base case i = 0, let P0[k] = Λk so that Λ(α0) = Λ(1) = Λ0 + Λ1 + ··· + Λe = sum(P0).

Then for i > 0, let Pi[k] = Pi-1[k]⋅αk so that Λ(αi) = sum(Pi).

Forney Algorithm

The Forney algorithm reduces the problem of computing error patterns to evaluating Ω(x) / Λ'(x), where Ω(x) = s(x)Λ(x) mod x2t. This requires no polynomial long division, just a one-time polynomial multiplication and derivative evaluation to create Ω(x), then two polynomial evaluations and one codeword division for each error.

Structs

ErrorDescriptions

Computes error locations and patterns from the roots of the error locator polynomial Λ(x).

ErrorLocator

Finds the error location polynomial Λ(x) from the syndrome polynomial s(x).

Errors

Decodes and iterates over codeword errors.

PolynomialRoots

Finds the roots of the given error locator polynomial Λ(x).