## Summary On the WASM web client, frame **decode** dominates (~93% of frame time on a 1080p RemoteFX replay), and within decode the **RFX inverse DWT was ~48%** (the YCbCr→RGBA convert is already SIMD via `yuv`; the entropy/RLE stages are inherently sequential). This vectorizes the inverse DWT with the portable [`wide`](https://crates.io/crates/wide) crate (`i16x8`), so the same code lowers to **wasm `simd128`, x86 SSE/AVX, and ARM NEON** — desktop and browser both benefit. The encode path is unchanged. ## How it stays bit-exact (no `unsafe`, no `cfg` split) The lifting steps need i32 intermediates only for the averages. Overflow-free SWAR identities let the whole kernel stay in `i16` lanes (no widen/narrow): - `ceil_avg(a,b) = (a|b) - ((a^b)>>1)` ≡ `(a + b + 1) >> 1` - `floor_avg(a,b) = (a&b) + ((a^b)>>1)` ≡ `(a + b) >> 1` and `(2x+1)>>1 == x` / `(x+x)>>1 == x` simplify the first/last rows. Every other op is wrapping `i16` arithmetic, identical to the old `i32`-intermediate-then-`as i16` truncation. ## Performance 1080p RemoteFX replay, headless Chromium, wasm release `+simd128`, 8-pass median: | inverse DWT | decode (ms) | |---|--:| | scalar (baseline) | ~1598 | | **portable `wide` SIMD** | **~985** | → inverse DWT ~2×, **~39% off the decode stage**. (Absolute ms carry ~±15% machine-load noise; the ratio is stable. Per-frame this is a throughput win — decode was already within real-time budget.) ## Correctness Verified bit-exact three ways: - the replay-bench **framebuffer CRC32** is unchanged, - the existing **native DWT tests** pass (so it's exact on x86 too, not just wasm), - an **exhaustive** check of the SWAR identities over all `i16 × i16` pairs (0 mismatches). ## Notes - `wide` is a single-user dep in `ironrdp-graphics`; chosen over `std::simd` (still nightly-only) and over per-arch intrinsics (one portable kernel vs three). - Reproducible bench branches: `bench/draw-*` (renderer) and the DWT measurements were taken on the replay-bench harness branch (the capture corpus is gitignored).
IronRDP fuzzing
Difference between fuzzing and property testing
ironrdp correctness is validated in various ways. Two of these are fuzzing and property testing.
Both of these methods involve feeding random inputs to the API in order to check if the program is
behaving as expected or not.
However,
-
Fuzzing is well suited for black-box-like testing. Inputs are typically guided by instrumentalizing the code (coverage…) rather than manually informed.
-
Property testing requires the developer to describe the interesting inputs and properties to test.
-
When fuzzing, some properties are tested as well, but those are typically simple (absence of crash, round-trip…).
-
In contrast, property testing is well suited when testing more complex properties.
-
With fuzzing, we are actively trying to show that something is (unexpectedly) broken.
-
With property testing, we are actively trying to show that the properties are holding (as expected).
Targets
pdu_decoding
Feeds random inputs to PDU decoding code.
bitmap_stream
Feeds random inputs to the RDP6 bitmap decoder.
rle_decompression
Feeds random inputs to the interleaved Run-Length Encoding (RLE) bitmap decoder.
bulk_mppc
Feeds random inputs to the MPPC bulk decompressor (ironrdp-bulk). The first
input byte selects between RDP4 mode (low bit clear, 8 KB history) and RDP5
mode (low bit set, 64 KB history); remaining bytes are the compressed payload.
bulk_ncrush
Feeds random inputs to the NCRUSH bulk decompressor (RDP6.0, ironrdp-bulk).
bulk_xcrush
Feeds random inputs to the XCRUSH bulk decompressor (RDP6.1, ironrdp-bulk).
XCRUSH has the largest sliding-window history of the bulk family (2 MB).
bulk_round_trip
Compresses arbitrary input via BulkCompressor::compress, then decompresses
the result via BulkCompressor::decompress, and asserts byte-equality with
the original input. First input byte selects the algorithm (RDP4 / RDP5 /
RDP6 / RDP6.1). Catches asymmetric bugs where the compressor produces output
the decompressor cannot consume, or the decompressor produces output that
does not equal the original input.
Building crates with the arbitrary feature
Several crates expose an optional arbitrary feature that enables
arbitrary::Arbitrary implementations on their
PDU types. This is the foundation for structure-aware fuzzing harnesses that
generate valid-looking inputs rather than raw bytes.
To verify the feature compiles cleanly for a single crate:
cargo check -p ironrdp-pdu --features arbitrary
The feature is also compatible with the no_std + alloc build path:
cargo check -p ironrdp-pdu --no-default-features --features arbitrary,alloc
A handful of PDU types do not implement Arbitrary. They fall into two categories:
- Types with non-derivable fields (e.g.,
StaticChannelSetkeyed byTypeId). These are either skipped via#[arbitrary(default)]on the containing struct's field, or hand-rolled with a placeholder. - Error types that are not part of the wire-protocol surface (e.g.,
ServerLicenseError). Most error enums fall here: they are constructed locally rather than decoded from the wire, so the fuzzer has no reason to generate them. The exception is wire-protocol error PDUs such asDisconnectProviderUltimatuminmcs.rs, which do implementArbitrarybecause they are decoded from the wire.
Inline source comments mark each skip with the rationale.