decomp(jpeg): scope RGB565420 edge pixel values #1061

Merged
coah80 merged 1 commits from agent/bittle/jpeg-pixel-review into main 2026-10-03 05:54:15 +00:00
coah80 commented 2026-10-03 05:52:44 +00:00 (Migrated from github.com)

Partial reconstruction

Give each RGB565420 edge pixel its actual luminance/red/blue/green local lifetime immediately after the existing chroma-update block. Use the original red→blue→green computation order while preserving overflow tests, clamping, packing, offsets and traversal. The already-exact RGB565444 sibling independently supports pixel-scoped ownership; no unrelated prior trial is imported.

  • RGB565420 edge: 94.692986% → 95.570175%, still 114/114 instructions
  • Positional differences: 73 → 65; unit 96.5207% → 96.58538%
  • Seven exact functions and all 12 sibling scores/bodies preserved; no allocated data

This is a partial fuzzy gain, not an exact function or linking claim.

Independent verification

Base 81ba279958fa6bbee69b5f14762243dd258ded6f; tested tree eb097881d1.

  • Full 43U build/progress/report/DOL passed; all 1,027 units compared with zero function/unit regressions
  • 8,721 vectors against an independent pixel model, candidate, original and baseline: 26,163 object executions
  • 808 edge-dimension combinations, 256 dimension-branch cases, 6,400 saturation inputs and 1,257 aligned input/output overlaps wholly inside convBuf
  • All 114 instructions exercised in each object; seven exact siblings independently ctxdiff-zero; all 12 other compiled bodies unchanged
  • Pool empty/identical; literal audit 12 functions, no candidates/errors; pre-existing set_converterRGB565 unequal extent skipped
  • DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; worktree/diff checks pass

These are bounded converter-model tests, not a full Wii/JPEG runtime test. Details: tools/decomp-assist/allhands-jpeg-pixel-lifetime.attempts.md. The earlier negative IFD1 experiment was fully restored and is not part of this patch.

Note

Scope RGB565420 edge pixel variables to column loop in TMCJPEGDEC_converterYUV420toRGB565edge

Refactors the edge converter in Texture_MCUtoRGB565.c to move RGB and temporary luminance variables from function scope to pixel-scoped variables inside the column loop. The conversion math, clamping, and output packing are unchanged. Also adds a matching reconstruction report in allhands-jpeg-pixel-lifetime.attempts.md.

Macroscope summarized 8e8f652.

## Partial reconstruction Give each RGB565420 edge pixel its actual luminance/red/blue/green local lifetime immediately after the existing chroma-update block. Use the original red→blue→green computation order while preserving overflow tests, clamping, packing, offsets and traversal. The already-exact RGB565444 sibling independently supports pixel-scoped ownership; no unrelated prior trial is imported. - RGB565420 edge: 94.692986% → 95.570175%, still 114/114 instructions - Positional differences: 73 → 65; unit 96.5207% → 96.58538% - Seven exact functions and all 12 sibling scores/bodies preserved; no allocated data This is a partial fuzzy gain, not an exact function or linking claim. ## Independent verification Base 81ba279958fa6bbee69b5f14762243dd258ded6f; tested tree eb097881d15aad85438153fb6e7f737e28c9cd11. - Full 43U build/progress/report/DOL passed; all 1,027 units compared with zero function/unit regressions - 8,721 vectors against an independent pixel model, candidate, original and baseline: 26,163 object executions - 808 edge-dimension combinations, 256 dimension-branch cases, 6,400 saturation inputs and 1,257 aligned input/output overlaps wholly inside convBuf - All 114 instructions exercised in each object; seven exact siblings independently ctxdiff-zero; all 12 other compiled bodies unchanged - Pool empty/identical; literal audit 12 functions, no candidates/errors; pre-existing set_converterRGB565 unequal extent skipped - DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d; worktree/diff checks pass These are bounded converter-model tests, not a full Wii/JPEG runtime test. Details: tools/decomp-assist/allhands-jpeg-pixel-lifetime.attempts.md. The earlier negative IFD1 experiment was fully restored and is not part of this patch. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Scope RGB565420 edge pixel variables to column loop in `TMCJPEGDEC_converterYUV420toRGB565edge` > Refactors the edge converter in [Texture_MCUtoRGB565.c](https://github.com/coah80/wii-ipl/pull/1061/files#diff-5c9e5cd4d235724c9e4882611e36ba794e9821ede7e7396a48272a942676ee86) to move RGB and temporary luminance variables from function scope to pixel-scoped variables inside the column loop. The conversion math, clamping, and output packing are unchanged. Also adds a matching reconstruction report in [allhands-jpeg-pixel-lifetime.attempts.md](https://github.com/coah80/wii-ipl/pull/1061/files#diff-137eca4cad1d0d84c47971170ac710404f63fbe71fc452cad4343a1f3c5cc22e). > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 8e8f652.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 05:54:13 +00:00 (Migrated from github.com)

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.
Sign in to join this conversation.