feat(zgfx): add LZ77 compression support#1097
Merged
CBenoit merged 2 commits intoDevolutions:masterfrom Feb 13, 2026
Merged
Conversation
30d8e5c to
b3215da
Compare
There was a problem hiding this comment.
Pull request overview
Adds ZGFX (RDP8) compression-side support and a convenience API for preparing EGFX payloads as ZGFX-segmented PDUs, complementing the existing ZGFX decompressor.
Changes:
- Introduces an LZ77-based ZGFX compressor (
Compressor) with a prefix hash table over a 2.5MB history window. - Adds ZGFX segment wrapping helpers for uncompressed and “already-compressed” payloads.
- Adds a high-level
compress_and_wrap_egfxAPI withNever/Auto/Alwayscompression mode selection.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| crates/ironrdp-graphics/src/zgfx/wrapper.rs | Adds ZGFX single/multipart segment wrapping helpers and tests. |
| crates/ironrdp-graphics/src/zgfx/mod.rs | Wires new modules and re-exports Compressor, wrapper functions, and the new API. |
| crates/ironrdp-graphics/src/zgfx/compressor.rs | Implements ZGFX LZ77 compression with hash-based match lookup and bitstream encoding. |
| crates/ironrdp-graphics/src/zgfx/api.rs | Adds CompressionMode and compress_and_wrap_egfx convenience API with tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
Thanks! PR now needs to be rebased on top of master |
Implements the compression side of the ZGFX codec (MS-RDPEGFX 2.2.1.1.1) and utilities for wrapping data in ZGFX segment structure. Compressor uses a hash table mapping 3-byte prefixes to history positions for O(1) match candidate lookup against the 2.5 MB sliding window. Segment wrapping handles both single and multipart formats, with support for compressed and uncompressed payloads. A high-level API provides auto/always/never compression mode selection.
- Deduplicate HISTORY_SIZE between compressor and decompressor - Enforce MAX_POSITIONS_PER_PREFIX in boundary indexing path - Guard compress_and_wrap_egfx against oversized compressed output by falling back to uncompressed wrapping
4a2246a to
8459928
Compare
Contributor
Author
|
OK, thanks. Done. |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds ZGFX (RDP8) LZ77 compression to complement the existing decompressor, plus a high-level API for EGFX PDU preparation with auto/always/never mode selection.
The compressor uses a hash table mapping 3-byte prefixes to history positions for O(1) match candidate lookup against the 2.5 MB sliding window.
Depends on #1076 (segment wrapping utilities).