fix(graphics): mirror decoder GR-mode adaptation in RLGR1 encoder#1370
Open
Rocco De Angelis (rdeangel) wants to merge 1 commit into
Open
fix(graphics): mirror decoder GR-mode adaptation in RLGR1 encoder#1370Rocco De Angelis (rdeangel) wants to merge 1 commit into
Rocco De Angelis (rdeangel) wants to merge 1 commit into
Conversation
In the GR-mode zero branch the RLGR1 encoder updated kp with UP_GR (+4) while the decoder (compute_rlgr1_magnitude) uses UQ_GR (+3). The asymmetric adaptation makes the adaptive k parameter diverge between the two sides, after which the bitstream is misinterpreted: a randomized encode->decode round-trip failed on 1877 of 2000 inputs before this change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
In
rlgr::encode, the RLGR1 GR-mode zero branch updateskpwithUP_GR(+4), while the decoder's corresponding branch (compute_rlgr1_magnitude) usesUQ_GR(+3), which is the value MS-RDPRFX 3.1.8.1.7.2 and FreeRDP'srfx_rlgr.cprescribe for GR mode. Because RLGR adaptation is implicit, encoder and decoder must updatekidentically from the coded symbols alone; with this mismatch the two sides'kdiverges as soon as a zero value is coded in GR mode, and the remainder of the bitstream is misinterpreted (mode selection and run lengths depend onk).Evidence
A randomized encode→decode round-trip (deterministic LCG, mostly-zero inputs with small magnitudes, i.e. the shape of quantized wavelet coefficients) failed on 1877 of 2000 inputs before this change. Example:
The divergence starts right after the first GR-mode zero. With the one-line fix, all 2000 round-trips pass.
Changes
UQ_GRin the GR-mode zero branch of the RLGR1 encoder, mirroring the decoder.rlgr1_round_trip_randomizedregression test (rlgr.rspreviously had no tests).Found while debugging RemoteFX Progressive (EGFX) interop against xrdp in an IronRDP-based client.
🤖 Generated with Claude Code