CCSDS 131.4-B short block-length LDPC codes
0
fork

Configure Feed

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

OCaml 91.5%
Dune 2.3%
Other 6.3%
16 1 0

Clone this repository

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

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

Download tar.gz
README.md

short-ldpc#

Pure OCaml implementation of CCSDS 131.4-B Short Block-Length LDPC Codes.

Overview#

Short block-length LDPC codes for telemetry frames where turbo codes and regular LDPC codes have insufficient block length. Uses pseudo-random regular LDPC matrices with sum-product (belief propagation) decoding.

Three code sizes are provided: k=128, k=256, and k=512 bits, all at rate 1/2.

Installation#

Install with opam:

$ opam install short-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 short-ldpc

Usage#

(* Pick a code: 256-bit information block, rate 1/2 *)
let code = Short_ldpc.ccsds_256

(* Encode 32 bytes: codeword is 64 bytes (32 data + 32 parity) *)
let data = Bytes.make 32 '\xAB'
let codeword = Short_ldpc.encode code data

let () =
  Printf.printf "Code rate: %.2f\n" (Short_ldpc.rate code);
  (* Decode with up to 50 BP iterations *)
  match Short_ldpc.decode ~max_iter:50 code codeword with
  | Ok recovered -> assert (recovered = data)
  | Error msg -> Printf.eprintf "decode failed: %s\n" msg

API Overview#

  • ccsds_128, ccsds_256, ccsds_512 -- Pre-built rate-1/2 LDPC codes
  • encode -- Systematic LDPC encoding (data to codeword)
  • decode -- Belief propagation decoding with configurable max iterations
  • rate -- Query the code rate (k/n)

References#

  • CCSDS 131.4-B-1 -- Short Block Length LDPC Codes for TC Synchronization and Channel Coding

Licence#

ISC License. See LICENSE.md for details.