Skip to content

feat(pdf-filter): implement LZWDecode filter with predictor support#122

Merged
Velli20 merged 1 commit intomainfrom
lzw-filter
Apr 5, 2026
Merged

feat(pdf-filter): implement LZWDecode filter with predictor support#122
Velli20 merged 1 commit intomainfrom
lzw-filter

Conversation

@Velli20
Copy link
Copy Markdown
Owner

@Velli20 Velli20 commented Apr 5, 2026

Add LZW decompression (PDF spec §7.4.4) and shared Predictor post-processing (§7.4.4.4) to the pdf-filter crate.

New modules:

  • lzw.rs: Pure-Rust LZW decoder with EarlyChange parameter support, variable-width codes (9-12 bits), MSB-first bit packing.
  • predictor.rs: TIFF Predictor 2 (horizontal differencing) and PNG predictors (None/Sub/Up/Average/Paeth). Shared by LZWDecode and FlateDecode.

Changes:

  • bitreader.rs: Add read_bits(n) for variable-width code extraction.
  • filter.rs: Add LZWDecode variant, Lzw/Flate DecodeParms, wire into decode pipeline. Also wire predictor support into FlateDecode.
  • lib.rs: Register new modules, update crate documentation.

Add LZW decompression (PDF spec §7.4.4) and shared Predictor
post-processing (§7.4.4.4) to the pdf-filter crate.

New modules:
- lzw.rs: Pure-Rust LZW decoder with EarlyChange parameter support,
  variable-width codes (9-12 bits), MSB-first bit packing.
- predictor.rs: TIFF Predictor 2 (horizontal differencing) and PNG
  predictors (None/Sub/Up/Average/Paeth). Shared by LZWDecode and
  FlateDecode.

Changes:
- bitreader.rs: Add read_bits(n) for variable-width code extraction.
- filter.rs: Add LZWDecode variant, Lzw/Flate DecodeParms, wire into
  decode pipeline. Also wire predictor support into FlateDecode.
- lib.rs: Register new modules, update crate documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Velli20 Velli20 merged commit 9396a6f into main Apr 5, 2026
4 checks passed
@Velli20 Velli20 deleted the lzw-filter branch April 5, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant