| Crates.io | rust-aec |
| lib.rs | rust-aec |
| version | 0.1.1 |
| created_at | 2025-12-27 04:31:23.641214+00 |
| updated_at | 2025-12-28 09:31:00.775846+00 |
| description | Pure Rust decoder for CCSDS 121.0-B-3 Adaptive Entropy Coding (AEC), focused on GRIB2 template 5.0=42. |
| homepage | https://github.com/hkwk/rust-aec |
| repository | https://github.com/hkwk/rust-aec |
| max_upload_size | |
| id | 2006679 |
| size | 83,801 |
Pure Rust decoder for CCSDS 121.0-B-3 Adaptive Entropy Coding (AEC), with an initial focus on GRIB2 Data Representation Template 5.0 = 42 (CCSDS/AEC).
This crate was created to avoid native libaec build friction (C/CMake/bindgen) on Windows while keeping byte-for-byte compatibility.
Repository: https://github.com/hkwk/rust-aec
Documentation (English): docs/README.md
See CHANGELOG.md for recent changes and release notes.
| rust-aec | libaec |
|---|---|
![]() |
![]() |
libaec using an “oracle” byte-for-byte comparison on real GRIB2 data (in the upstream workspace that hosts this crate).decode(input, params, output_samples) -> Result<Vec<u8>, AecError>: decode an AEC bitstream into packed sample bytes.AecParams / AecFlags: minimal parameter set aligned with libaec’s aec_stream.flags_from_grib2_ccsds_flags(ccsds_flags: u8): helper for GRIB2 template 5.42.libaec flag combination.You need:
payload: the GRIB2 Section 7 payload (the CCSDS/AEC bitstream)num_points: number of decoded samples (GRIB2: section5.num_encoded_points)bits_per_sample, block_size, rsi, ccsds_flags: from GRIB2 template 5.42use rust_aec::{decode, flags_from_grib2_ccsds_flags, AecParams};
let params = AecParams::new(
12, // bits_per_sample
32, // block_size
128, // rsi
flags_from_grib2_ccsds_flags(0x0e),
);
let decoded: Vec<u8> = decode(&payload, params, num_points)?;
decoded is a byte vector of length num_points * bytes_per_sample, where bytes_per_sample = ceil(bits_per_sample/8).
Byte order is controlled by the MSB flag.
This crate ships a small example binary:
cargo run -p rust-aec --example decode_aec_payload -- --payload aec_payload.bin --samples 1038240
AecFlags::DATA_PREPROCESS is set, the output bytes are the reconstructed sample values (inverse preprocessing applied).MIT. See LICENSE.
rust-aec for template 42.This repository may contain vendored third-party sources under vendor/ (e.g. libaec-sys/libaec) for local reference and oracle comparisons.
Cargo.toml exclude.rust-aec itself remains a pure Rust implementation.