LDPC codes with belief propagation decoding
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

OCaml 94.6%
Dune 1.4%
Other 4.0%
26 1 0

Clone this repository

https://tangled.org/gazagnaire.org/ocaml-ldpc https://tangled.org/did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-ldpc
git@git.recoil.org:gazagnaire.org/ocaml-ldpc git@git.recoil.org:did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-ldpc

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

ldpc#

Low-Density Parity-Check codes with belief propagation decoding.

ldpc implements the CCSDS 131.0-B-4 AR4JA (Accumulate-Repeat-4-Jagged-Accumulate) family: circulant-based parity-check matrices, systematic encoding, and sum-product belief propagation decoding. Ships with the rate_1_2 preset (k=1024 information bits, n=2048 transmitted bits) used on near-Earth and deep-space links.

Installation#

Install with opam:

$ opam install ldpc

If opam cannot find the package, it may not yet be released in the public opam-repository. Add the overlay repository, then install it:

$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install ldpc

Usage#

The rate-1/2 code takes k/8 = 128 data bytes and emits n/8 = 256 codeword bytes:

# let data = Bytes.make 128 '\x5a' in
  let codeword = Ldpc.encode Ldpc.ccsds_rate_1_2 data in
  Bytes.length codeword
- : int = 256

Belief-propagation decoding recovers the data from a corrupted codeword. max_iter caps the number of sum-product iterations (default 50):

# let data = Bytes.make 128 '\x5a' in
  let codeword = Ldpc.encode Ldpc.ccsds_rate_1_2 data in
  (* Flip a handful of bits. *)
  for i = 0 to 7 do
    Bytes.set_uint8 codeword (i * 17)
      (Bytes.get_uint8 codeword (i * 17) lxor 0x80)
  done;
  match Ldpc.decode ~max_iter:50 Ldpc.ccsds_rate_1_2 codeword with
  | Ok recovered -> Bytes.equal recovered data
  | Error _ -> false
- : bool = true

Licence#

ISC