Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- **Raw LZMA2 decoder** (`lzma2`): decodes the raw 7-Zip LZMA2 chunk stream
(codec id 21) — control-byte-framed chunks, self-terminating — distinct from
the `.xz` container. The 1-byte 7z dict-size coder property is passed via
`DecoderConfig::with_dict_prop`. Reuses the existing xz LZMA2 engine (the
shared codec was relocated to a crate-internal `lzma2_internal` module; `xz`
behavior unchanged). Decode-only.
- **BCJ2 filter** (`bcj2`): the 7-Zip 4-stream x86 branch filter
(`0303011B`), encode + decode via a dedicated `compcol::bcj2::{encode,decode}`
function API (the 4-input shape doesn't fit the single-stream `Decoder`
trait). Public-domain LZMA SDK algorithm; round-trip validated.
- **RLE90 codec** (`rle90`): the `0x90`/DLE run-length variant shared by ARC
method 3 ("packed") and classic StuffIt method 1, encoder + decoder.
Byte-compatible with the `arc_squeeze` internal RLE90 pre-pass.
Expand Down
17 changes: 15 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ default = ["alloc", "rle", "deflate", "zlib", "gzip", "factory"]
all = [
"alloc", "std", "tokio", "factory",
"rle", "rle90", "deflate", "deflate64", "zlib", "gzip",
"lzma", "xz",
"lzma", "xz", "lzma2",
"zstd", "brotli", "lz4", "snappy", "lzw", "lzss", "bzip2",
"zstd", "brotli", "lz4", "lz5", "snappy", "lzw", "bzip2",
"lzo", "lzx", "amiga_lzx", "quantum", "lzfse", "adc",
Expand All @@ -48,7 +48,7 @@ all = [
"zip_shrink",
"zip_reduce",
"lha",
"bcj", "delta",
"bcj", "bcj2", "delta",
"arc_crunch", "arc_squeeze", "arc_squash",
]
# Enables `alloc`-backed conveniences (e.g. the `factory` module, the
Expand Down Expand Up @@ -82,6 +82,12 @@ lzma = ["alloc"]
# xz container (RFC-style stream/block headers + check codes; the inner
# LZMA2 chunk codec is inlined inside `src/xz/`).
xz = ["lzma"]
# Raw LZMA2 chunk stream (7-Zip coder id 21) — the dict-reset control bytes
# + LZMA chunks, without the `.xz` container. Decode-only entry point that
# reuses the same LZMA2 chunk codec the `xz` feature uses. The 7z coder
# property is a 1-byte dictionary-size code. The encoder is an
# `Error::Unsupported` stub (produce LZMA2 via the `xz` encoder).
lzma2 = ["alloc", "lzma"]
# Zstandard (RFC 8478).
zstd = ["alloc"]
# Brotli (RFC 7932). Carries a 170 KiB built-in static dictionary when fully
Expand Down Expand Up @@ -210,6 +216,13 @@ lha = ["alloc"]
# compressors: forward rewrites relative branch operands to absolute form,
# inverse restores them. Encoder + decoder both implemented.
bcj = ["alloc"]
# BCJ2 — the 4-stream x86 branch filter from the public-domain LZMA SDK
# (7-Zip filter id 0303011B), distinct from the single-stream BCJ above.
# Decode recombines four input streams (main + call + jump + a range-coded
# control stream) into the filtered output. Exposes a dedicated function
# API (`compcol::bcj2::decode`) since the 4-input shape does not fit the
# single-input `Decoder` trait. Encoder also provided for round-trip tests.
bcj2 = ["alloc"]
# Delta filter — byte-wise delta with a configurable distance (1..=256).
# Reversible filter (xz/LZMA SDK lineage). Encoder + decoder both implemented.
delta = ["alloc"]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ flag, and a `compcol` binary turns the library into a Unix-style filter.
| LZW (`compress(1)` `.Z`) | `lzw` | `.lzw` | full | full | `compress(1)` / `uncompress(1)` |
| LZMA (legacy `.lzma`) | `lzma` | `.lzma` | full | full | `python3 -m lzma` (FORMAT_ALONE) |
| xz | `xz` | `.xz` | compressed-LZMA2 chunks + uncompressed fallback | full envelope + all reset variants | `xz(1)` both directions |
| Raw LZMA2 (7z coder 21) | `lzma2` | `.lzma2` | `Unsupported` (decode-only) | full (raw LZMA2 chunk stream; reuses the xz LZMA2 engine) | round-trip vs the xz LZMA2 encoder |
| Zstandard (RFC 8478) | `zstd` | `.zst` | LZ77 + Huffman literals + FSE_Compressed_Mode sequences + repeat offsets + RLE blocks | full Compressed_Block | `zstd(1)` both directions |
| Brotli (RFC 7932) | `brotli` | `.br` | LZ77 + length-limited Huffman + 704-symbol IC alphabet + static-dictionary refs | full (with 122 KiB static dictionary) | `brotli(1)` both directions |
| LZO (LZO1X-1) | `lzo` | `.lzo` | LZ77 hash matcher | full | `python3 -c "import lzo"` |
Expand All @@ -57,6 +58,7 @@ flag, and a `compcol` binary turns the library into a Unix-style filter.
| LZNT1 (NTFS native compression) | `lznt1` | `.lznt1` | full | full (per [MS-XCA] §2.5; 4 KiB-chunked LZ77, no entropy coding) | hand-built fixtures |
| LHA / LZH (`-lh1-`/`-lh4-`/`-lh5-`/`-lh6-`/`-lh7-`) | `lha` | `.lzh` | full (lh1 adaptive Huffman; lh4/5/6/7 static Huffman) | full (clean-room from Okumura LZHUF / ar002) | own round-trip (no reference fixture) |
| BCJ branch filters (x86, ARM, ARMT, ARM64, PPC, SPARC, IA-64, RISC-V) | `bcj` | `bcj-<arch>` | full (reversible filter) | full | round-trip identity (public-domain LZMA SDK transform) |
| BCJ2 (7z 4-stream x86 filter) | `bcj2` | — | `bcj2::encode` (fn API) | `bcj2::decode` (fn API) | round-trip identity (LZMA SDK algorithm) |
| Delta filter (distance 1..=256) | `delta` | `delta` | full (reversible filter) | full | round-trip identity |
| ARC Crunch (method 8) | `arc_crunch` | `.arc` | full (12-bit dynamic LZW) | full | own round-trip (no reference fixture) |
| ARC Squeeze (method 4) | `arc_squeeze` | `.sqz` | full (RLE + static Huffman) | full | own round-trip (no reference fixture) |
Expand Down
Loading
Loading