HeadlinesBriefing favicon HeadlinesBriefing.com

Rust crate for forward error correction

Hacker News •
×

Brian Armstrong revisited his 2016 C library libcorrect, rewriting it in Rust. Using nightly's std::simd, he built a templated, generic Viterbi decoder that dispatches at runtime based on available instruction sets. For small rates and orders, all calculations stay in registers; larger codes use memory while still leveraging SIMD acceleration.

The crate implements standard convolutional codes common in SDR and spacecraft, such as rate‑1/2 k=7, rate‑1/2 k=9, rate‑1/3 k=9, and rate‑1/6 k=15, and supports any rate from 1/2 to 1/8 and any order from k=4 to k=16. Both hard‑ and soft‑decision decoding are available, with soft symbols correcting more errors when the demodulator reports confidence.

Reed–Solomon error‑and‑erasure decoding over GF(2⁸) is also provided, including the standard CCSDS (255,223) code in conventional and on‑the‑wire dual‑basis forms. The crate derives its primitive polynomials from the published CCSDS standard and matches the behavior of Phil Karn’s libfec.

Compatibility is maintained with libfec; a companion fec‑shim exposes the Rust API under libfec’s C ABI for legacy codebases. With SIMD enabled, fec outperforms both libcorrect and libfec on x86. Future roadmap includes wider Reed–Solomon fields, hard‑decision erasures, and punctured convolutional codes.