Skip to content

feat(egfx): add ClearCodec client-side decode dispatch#1175

Open
Greg Lamberson (glamberson) wants to merge 2 commits intoDevolutions:masterfrom
lamco-admin:feat/clearcodec-client-decode
Open

feat(egfx): add ClearCodec client-side decode dispatch#1175
Greg Lamberson (glamberson) wants to merge 2 commits intoDevolutions:masterfrom
lamco-admin:feat/clearcodec-client-decode

Conversation

@glamberson
Copy link
Copy Markdown
Contributor

Follow-up to #1174.

Wires ClearCodec into the EGFX client's WireToSurface1 codec dispatch,
matching the existing AVC420 and Uncompressed decode patterns.

Changes:

  • ClearCodecDecoder field on GraphicsPipelineClient (always enabled,
    pure Rust, no external codec dependency)
  • Codec1Type::ClearCodec arm decodes bitmap data and converts BGRA
    output to RGBA for the uniform BitmapUpdate pixel format
  • Decoder caches (V-bar, glyph) reset on ResetGraphics
  • 3 integration tests (basic decode, RGBA output verification,
    reset/re-decode cycle)
  • 1 unit test for BGRA-to-RGBA channel reordering

Unlike H.264 which requires an external decoder via the H264Decoder
trait, ClearCodec is pure Rust (ironrdp-graphics) and initialized
unconditionally.

Copy link
Copy Markdown

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

This PR introduces ClearCodec support across the stack (PDU parsing, graphics encode/decode, and EGFX client/server integration) and adds a comprehensive test suite to validate correctness and resilience.

Changes:

  • Added ClearCodec PDU parsing modules (residual, bands, subcodec, RLEX) under ironrdp-pdu.
  • Implemented ClearCodecDecoder/ClearCodecEncoder (with glyph/V-bar caching) under ironrdp-graphics.
  • Integrated ClearCodec handling into EGFX client decode path and EGFX server frame queuing; added new tests in testsuite-core.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
crates/ironrdp-testsuite-core/tests/graphics/mod.rs Registers the new ClearCodec graphics test module.
crates/ironrdp-testsuite-core/tests/graphics/clearcodec.rs Adds extensive round-trip and adversarial ClearCodec tests.
crates/ironrdp-testsuite-core/tests/egfx/client.rs Adds EGFX pipeline tests for ClearCodec processing/reset behavior.
crates/ironrdp-pdu/src/codecs/mod.rs Exposes the new ClearCodec codec module in the PDU crate.
crates/ironrdp-pdu/src/codecs/clearcodec/mod.rs Implements ClearCodec bitmap stream + composite payload decoding.
crates/ironrdp-pdu/src/codecs/clearcodec/residual.rs Implements residual layer (BGR RLE) encode/decode helpers.
crates/ironrdp-pdu/src/codecs/clearcodec/bands.rs Implements bands layer decoding (V-bar structures).
crates/ironrdp-pdu/src/codecs/clearcodec/subcodec.rs Implements subcodec layer decoding for regions.
crates/ironrdp-pdu/src/codecs/clearcodec/rlex.rs Implements RLEX subcodec decoding.
crates/ironrdp-graphics/src/lib.rs Exposes ironrdp_graphics::clearcodec.
crates/ironrdp-graphics/src/clearcodec/mod.rs Adds ClearCodec encoder/decoder and decode compositing pipeline.
crates/ironrdp-graphics/src/clearcodec/glyph_cache.rs Implements glyph cache storage for ClearCodec.
crates/ironrdp-graphics/src/clearcodec/vbar_cache.rs Implements V-bar cache storage and reconstruction for bands.
crates/ironrdp-egfx/src/server.rs Adds a send_clearcodec_frame helper to enqueue ClearCodec frames.
crates/ironrdp-egfx/src/client.rs Adds ClearCodec decode path and BGRA→RGBA conversion for bitmap updates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Copy Markdown

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 client-side ClearCodec decode support to EGFX by wiring a persistent ClearCodec decoder into WireToSurface1 codec dispatch and normalizing output pixels to the existing RGBA BitmapUpdate format.

Changes:

  • Add ClearCodec decode path in GraphicsPipelineClient (including BGRA→RGBA conversion and reset behavior on ResetGraphics).
  • Introduce/extend ClearCodec wire-format parsing in ironrdp-pdu and codec implementation (decoder/encoder + caches) in ironrdp-graphics.
  • Add integration/unit tests covering decode dispatch, pixel format conversion, cache/reset behavior, and adversarial inputs.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
crates/ironrdp-egfx/src/client.rs Adds ClearCodec decoder to client dispatch, resets state on ResetGraphics, and converts BGRA output to RGBA BitmapUpdate.
crates/ironrdp-egfx/src/server.rs Adds send_clearcodec_frame() helper for emitting ClearCodec WireToSurface1 frames.
crates/ironrdp-graphics/src/lib.rs Exposes the new clearcodec module.
crates/ironrdp-graphics/src/clearcodec/mod.rs Implements ClearCodec decoder/encoder and composite layer application (residual/bands/subcodecs).
crates/ironrdp-graphics/src/clearcodec/glyph_cache.rs Introduces glyph cache storage for ClearCodec glyph hits.
crates/ironrdp-graphics/src/clearcodec/vbar_cache.rs Adds V-bar and short V-bar ring-buffer cache implementation used by bands layer.
crates/ironrdp-pdu/src/codecs/mod.rs Exports the ClearCodec wire-format module.
crates/ironrdp-pdu/src/codecs/clearcodec/mod.rs Defines ClearCodec stream/container structures, flags, and composite payload parsing.
crates/ironrdp-pdu/src/codecs/clearcodec/residual.rs Adds residual layer (BGR RLE) decode/encode helpers.
crates/ironrdp-pdu/src/codecs/clearcodec/bands.rs Adds bands layer parsing (V-bar references and inline short V-bar misses).
crates/ironrdp-pdu/src/codecs/clearcodec/subcodec.rs Adds subcodec layer region parsing (raw/NSCodec/RLEX).
crates/ironrdp-pdu/src/codecs/clearcodec/rlex.rs Adds RLEX subcodec decoding (palette + packed run/suite segments).
crates/ironrdp-testsuite-core/tests/graphics/mod.rs Registers the new ClearCodec graphics tests module.
crates/ironrdp-testsuite-core/tests/graphics/clearcodec.rs Adds ClearCodec codec-level integration tests (round-trip, adversarial inputs, cache/session behavior).
crates/ironrdp-testsuite-core/tests/egfx/client.rs Adds EGFX client integration tests for ClearCodec dispatch, RGBA output verification, and reset/re-decode cycle.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@glamberson Greg Lamberson (glamberson) force-pushed the feat/clearcodec-client-decode branch 2 times, most recently from dcf7f7d to a1c0315 Compare April 1, 2026 14:15
Add ClearCodec (MS-RDPEGFX 2.2.4.1) codec support across two crates:

ironrdp-pdu: Wire-format decode/encode for all ClearCodec layers
(residual BGR RLE, bands with V-bar caching, subcodec dispatch
including RLEX palette-indexed RLE). Full round-trip test coverage.

ironrdp-graphics: ClearCodecDecoder with persistent V-bar and glyph
caches. ClearCodecEncoder with residual-only encoding and glyph
deduplication for server-side bitmap compression.
Wire ClearCodec decoder into the EGFX client WireToSurface1 codec
dispatch. Persistent decoder with V-bar and glyph caches is stored
on GraphicsPipelineClient and reset on ResetGraphics. BGRA output
is converted to RGBA for the uniform BitmapUpdate format.

Includes RLEX stop_index bounds validation against palette count
and client-side decode tests in ironrdp-testsuite-core.
@glamberson Greg Lamberson (glamberson) force-pushed the feat/clearcodec-client-decode branch from a1c0315 to 9611e12 Compare April 1, 2026 15:04
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.

3 participants