Home /Modules/compression/COMPRESSION.md

COMPRESSION.md

compression/COMPRESSION.md · 87 line(s) · markdown

SLeeLa Compression Standards Registry

Date: 2026-10-23

1. Purpose

This document establishes the general-purpose data-compression coverage expected by SLeeLa and separates algorithm identification from actual compress/decompress implementation. It is the compression counterpart to the audio-codec registry in codecs/CODECS.md.

2. Registry

IDStandardExtensionsPrimary useCurrent handler
STORERaw / store (identity).binNo compression (fallback)Native
RLERun-length encoding (PackBits).rleSimple runs / imagesNative
HUFFMANCanonical Huffman.huffEntropy codingNative
LZWLempel-Ziv-Welch.lzw, .ZDictionary / legacyNative
DEFLATERFC 1951 raw DEFLATE.deflateGeneral purposeBackend
ZLIBRFC 1950 zlib wrapper.zzGeneral purposeBackend
GZIPRFC 1952 gzip wrapper.gzFile / HTTP transportBackend
BZIP2Burrows-Wheeler + Huffman.bz2High-ratio filesBackend
LZMALZMA.lzmaHigh-ratio archivesBackend
XZ.xz container over LZMA2.xzHigh-ratio archivesBackend
ZSTDZstandard.zstFast, high-ratioBackend
LZ4LZ4.lz4Very fastBackend
BROTLIBrotli.brWeb contentBackend
SNAPPYSnappy (framed).szFast, in-memoryBackend
ZIPZIP archive.zipArchive containerContainer

3. Capability Semantics

The registry distinguishes:

This distinction is required for reliable capability reporting.

4. Implementation Order

  1. Establish the common plugin ABI, registry, and the Loader/Unloader/Manager.
  2. Ship the native baseline: Store, RLE, Huffman, LZW (lossless, in-package).
  3. Add the general-purpose DEFLATE family (DEFLATE, zlib, gzip) via backends.
  4. Add the high-ratio family (bzip2, LZMA, xz) via backends.
  5. Add the modern fast family (zstd, lz4, brotli, snappy) via backends.
  6. Add the ZIP container adapter.
  7. Add conformance fixtures for every algorithm actually implemented.

5. Security and Correctness

Every compressor/decompressor must:

The native algorithms honour this: RLE/Huffman/LZW validate magic and bound every read/write, and decode rejects malformed streams with SLEELA_COMPRESSION_ERR_FORMAT.

6. Licensing

Compression support must not imply that a patent, proprietary SDK, or third-party implementation is included in SLeeLa. Each external backend must be reviewed for its license and distribution terms before it becomes a bundled dependency. No third-party libraries are bundled in-tree; backend handlers dispatch to a host-registered adapter.

7. Status

The registry establishes coverage and dispatch contracts, and four native algorithms are fully implemented in-package with passing tests. Backend handlers identify their format and fail cleanly until an approved backend adapter is registered — they never fake a successful (de)compress.