CCSDS 121.0-B-3 Lossless Data Compression (Rice/Golomb coding)
0
fork

Configure Feed

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

Add/update READMEs for all recently updated packages

Created 7 new READMEs: xmlt, dsp, demod, rtlsdr, erasure,
short-ldpc, ccsds (meta-package with full protocol suite table).

Updated 4 thin READMEs: rice (19→54 lines), mal (35→66),
cbort (52→89, mentions streaming GADT), csvt (45→73, bytesrw).

Each has: title, spec reference, quick start example, API overview.

+46 -11
+46 -11
README.md
··· 1 - # ocaml-ccsds-121 1 + # rice 2 + 3 + Pure OCaml implementation of CCSDS 121.0-B-3 Lossless Data Compression. 4 + 5 + ## Overview 6 + 7 + Rice/Golomb adaptive entropy coding for science instrument data. Used by 8 + missions including Mars rovers, JWST, and Earth observation satellites for 9 + lossless compression of image and science data. 2 10 3 - OCaml implementation of **CCSDS 121.0-B-3** Lossless Data Compression, 4 - the Rice/Golomb adaptive entropy coding algorithm used by space missions 5 - (Mars rovers, JWST, Earth observation satellites) for lossless 6 - compression of image and science instrument data. 11 + The codec implements the full CCSDS 121.0-B-3 bitstream format: configurable 12 + block size, sample bit depth, reference sample interval, and two prediction 13 + modes (unit delay and neighborhood). 7 14 8 - ## Reference 15 + ## Installation 9 16 10 - [CCSDS 121.0-B-3](https://public.ccsds.org/Pubs/121x0b3.pdf) — Lossless 11 - Data Compression. Consultative Committee for Space Data Systems, 2020. 17 + ``` 18 + opam install rice 19 + ``` 12 20 13 21 ## Usage 14 22 15 23 ```ocaml 16 - let cfg = Ccsds_121.config ~block_size:16 ~bits_per_sample:16 () 17 - let compressed = Ccsds_121.compress cfg data 18 - let original = Ccsds_121.decompress cfg compressed 24 + (* Configure: 16 samples per block, 16-bit samples *) 25 + let cfg = Rice.config ~block_size:16 ~bits_per_sample:16 () 26 + 27 + (* Compress raw sample data *) 28 + let data = Bytes.make 1024 '\x00' in (* 512 x 16-bit samples *) 29 + let compressed = Rice.compress cfg data 30 + 31 + (* Decompress: must specify how many samples to recover *) 32 + match Rice.decompress ~sample_count:512 cfg compressed with 33 + | Ok original -> Printf.printf "recovered %d bytes\n" (Bytes.length original) 34 + | Error msg -> Printf.eprintf "decompression failed: %s\n" msg 35 + 36 + (* Use neighborhood predictor for 2D image data *) 37 + let cfg_2d = Rice.config_with_predictor Neighborhood cfg 19 38 ``` 39 + 40 + ## API Overview 41 + 42 + - **`config`** -- Create compression configuration: `block_size` (8-64), `bits_per_sample` (1-32), `rsi` 43 + - **`compress`** -- Compress data to CCSDS 121.0-B-3 compliant bitstream 44 + - **`decompress`** -- Decompress with explicit sample count 45 + - **`config_with_predictor`** -- Set prediction mode: `Unit_delay` or `Neighborhood` 46 + 47 + ## References 48 + 49 + - [CCSDS 121.0-B-3](https://public.ccsds.org/Pubs/121x0b3.pdf) -- Lossless 50 + Data Compression. Consultative Committee for Space Data Systems, 2020. 51 + 52 + ## Licence 53 + 54 + ISC License. See [LICENSE.md](LICENSE.md) for details.