--- license: apache-2.0 library_name: compressionkit pipeline_tag: other tags: - compressionkit - signal-compression - ecg - spiht - wavelet - edge-ai - dsp --- # compressionkit-ecg-spiht-8x A **ECG** signal compression codec built on wavelet + SPIHT + arithmetic coding. **DSP-only — no trained weights.** The deployable artifact is the bitstream contract plus a portable C99 reference implementation. ## Operating point | Field | Value | |-------|-------| | Modality | ECG | | Sample rate | 256 Hz | | Frame size | 512 samples | | Target CR | 8x | | Wavelet | `bior4.4` | | DWT levels | 6 | | Bit budget | 1024 bits/frame | | Entropy coder | arithmetic coding | ## Quality metrics ### Fidelity & Robustness Both fidelity yardsticks are reported so the codec is judged fairly: **faithfulness** is PRD vs the recorded (still-noisy) input, while **truth fidelity** is PRD vs clean ground truth. Lower is better. | Metric | Value | |--------|-------| | Truth PRD vs clean (%) | 1.86 | | Truth PRD at native noise (%) | 38.31 | | Faithful PRD vs input (%) | 3.88 | | PRD degradation slope (PRD%/dB) | 3.99 | | PRD at 0 dB SNR (%) | 51.77 | | PRD at -6 dB SNR (%) | 79.87 | | Pure-noise imprint autocorr | 0.2469 | ### Time Domain _PRD here is faithfulness (vs the recorded input); see **Fidelity & Robustness** above for the clean-truth and noise-regime view._ | Metric | Mean | Median | P90 | |--------|------|--------|-----| | PRD vs input — faithfulness (%) | 3.8840 | 3.0432 | 7.4458 | | RMSE | 0.0388 | 0.0304 | 0.0745 | | Cosine Similarity | 0.9987 | 0.9995 | 0.9999 | ### Spectral - **Band Total Relative Error (median):** 0.0158 ### Bitrate ## Python quickstart ```python from compressionkit.runtime import load_codec codec = load_codec("Ambiq/compressionkit-ecg-spiht-8x") enc = codec.compress(frame) # frame: (frame_size,) float32 recon = codec.decompress(enc) ``` ## C quickstart ```c #include "spiht_app_config.h" float frame[APP_SPIHT_FRAME_SIZE]; uint8_t bitstream[APP_SPIHT_MAX_BYTES]; /* ... fill frame from sensor (post-denoise, if hybrid) ... */ size_t nbits = spiht_encode_frame(&enc, bitstream, APP_SPIHT_MAX_BITS); ``` ## Files | File | Description | |------|-------------| | `config.json` | Deploy manifest (`family: "spiht"`) | | `spiht_config.json` | Codec parameters (language-neutral) | | `sample_stimulus.npz` | Synthetic test frames | | `reference_vectors.npz` | Reference encode/decode vectors | | `c_sources/spiht.[ch]` | Portable C99 reference | | `c_sources/spiht_app_config.h` | Codec-specific defines | | `model_card.json` | Provenance metadata | | `scorecard.json` | Frozen evaluation summary | ## Dataset & license Evaluation data: PTB-XL (CC BY 4.0). Sample data may include excerpts under the original license terms. Codec source released under the **APACHE-2.0** license. ## Citation ```bibtex @software{compressionkit, author = {Ambiq AI}, title = {compressionKIT: Signal Compression for Edge AI}, url = {https://github.com/AmbiqAI/compressionkit} } ```