Skip to content

feat(zgfx): add LZ77 compression support#1097

Merged
CBenoit merged 2 commits intoDevolutions:masterfrom
glamberson:zgfx-compressor-standards
Feb 13, 2026
Merged

feat(zgfx): add LZ77 compression support#1097
CBenoit merged 2 commits intoDevolutions:masterfrom
glamberson:zgfx-compressor-standards

Conversation

@glamberson
Copy link
Contributor

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).

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_egfx API with Never/Auto/Always compression 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.

@CBenoit
Copy link
Member

CBenoit commented Feb 13, 2026

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
@glamberson glamberson force-pushed the zgfx-compressor-standards branch from 4a2246a to 8459928 Compare February 13, 2026 13:21
@glamberson
Copy link
Contributor Author

OK, thanks. Done.

Copy link
Member

@CBenoit CBenoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@CBenoit CBenoit merged commit 4871548 into Devolutions:master Feb 13, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants