decomp(jpeg): refine Lumi butterfly declaration order #1091

Merged
coah80 merged 1 commits from agent/bittle/lumi-inner-order into main 2026-10-03 11:00:05 +00:00
coah80 commented 2026-10-03 10:58:28 +00:00 (Migrated from github.com)

Scope

One adjacent swap of existing uninitialized s32 declarations inside Lumi's first-pass butterfly. All assignments, arithmetic, scopes, initializers, accesses and Col source remain unchanged. No compiler/configuration changes, artificial branches or padding.

Measured gain

  • TMCJPEGDEC_IdctBlock_Lumi: 83.05058% → 83.657585%
  • Unit: 89.06892% → 89.28833%; global: 99.72777% → 99.72798%
  • 257/257 instructions; normalized positional ctxdiff remains187
  • Col remains92.47577%, body byte-identical
  • This is a fuzzy gain, not an exact match: unit exact0/2 and code0/2844 unchanged

Exactly120 permutations of the five existing inner declarations were really compiled and officially scored. Parent independently regenerated all120 saved-object official scores;20 tie for best. Retained first best is the minimal adjacent swap. This exhausts only the fixed five-local block, not broader source possibilities.

Independent verification

Fresh parent worktree and full default43U build on f46483afafa066cf1dfaa6e7603241b9c7beeff4; tested tree7a6eeb833c91981aa052f97033129bca92ebc053.

  • All1027 unit/function reports checked: no regressions, only Lumi changes
  • Empty allocated non-code sections and sibling body preserved
  • Pool identical; literal audit both functions, zero errors/skips
  • Separate exact-integer scalar model against candidate/original/baseline:6569 vectors/19707 executions, including2208 fitting input-output overlaps;257/257 instruction coverage for all three
  • Repository JPEG differential suite:9456 cases passes; preserved nonvolatile GPRs, SP and LR
    -8 workflow tests and main/leaf checks pass
  • Full default build, progress and explicit43U/ok pass
  • DOL SHA1:26116613f624061ba99c8d1a299aaa6efa85670d

Tests are bounded interpreter diagnostics, not formal proof or hardware execution. No original binaries/disassembly are included. Detailed source scope, prior coverage, hashes and evidence are in tools/decomp-assist/allhands-jpeg-lumi-inner-orders.attempts.md.

Opened for human review; no merge or auto-merge requested.

Note

Reorder Lumi butterfly declarations in TMCJPEGDEC_IdctBlock_Lumi

Moves oddHighSum ahead of oddLowDifference in the first-pass non-DC butterfly block of the Lumi IDCT. No expressions, types, or output stores change.

Macroscope summarized f451707.

## Scope One adjacent swap of existing uninitialized s32 declarations inside Lumi's first-pass butterfly. All assignments, arithmetic, scopes, initializers, accesses and Col source remain unchanged. No compiler/configuration changes, artificial branches or padding. ## Measured gain - TMCJPEGDEC_IdctBlock_Lumi: 83.05058% → 83.657585% - Unit: 89.06892% → 89.28833%; global: 99.72777% → 99.72798% - 257/257 instructions; normalized positional ctxdiff remains187 - Col remains92.47577%, body byte-identical - This is a fuzzy gain, not an exact match: unit exact0/2 and code0/2844 unchanged Exactly120 permutations of the five existing inner declarations were really compiled and officially scored. Parent independently regenerated all120 saved-object official scores;20 tie for best. Retained first best is the minimal adjacent swap. This exhausts only the fixed five-local block, not broader source possibilities. ## Independent verification Fresh parent worktree and full default43U build on f46483afafa066cf1dfaa6e7603241b9c7beeff4; tested tree7a6eeb833c91981aa052f97033129bca92ebc053. - All1027 unit/function reports checked: no regressions, only Lumi changes - Empty allocated non-code sections and sibling body preserved - Pool identical; literal audit both functions, zero errors/skips - Separate exact-integer scalar model against candidate/original/baseline:6569 vectors/19707 executions, including2208 fitting input-output overlaps;257/257 instruction coverage for all three - Repository JPEG differential suite:9456 cases passes; preserved nonvolatile GPRs, SP and LR -8 workflow tests and main/leaf checks pass - Full default build, progress and explicit43U/ok pass - DOL SHA1:26116613f624061ba99c8d1a299aaa6efa85670d Tests are bounded interpreter diagnostics, not formal proof or hardware execution. No original binaries/disassembly are included. Detailed source scope, prior coverage, hashes and evidence are in tools/decomp-assist/allhands-jpeg-lumi-inner-orders.attempts.md. Opened for human review; no merge or auto-merge requested. <!-- 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] > ### Reorder Lumi butterfly declarations in `TMCJPEGDEC_IdctBlock_Lumi` > Moves `oddHighSum` ahead of `oddLowDifference` in the first-pass non-DC butterfly block of the Lumi IDCT. No expressions, types, or output stores change. > > - Adds an experiment report to [allhands-jpeg-lumi-inner-orders.attempts.md](https://github.com/coah80/wii-ipl/pull/1091/files#diff-634421778c09a2fa6239b98ffbf63169992cad5ef0c08bd8df6554d093aa2662) covering all 120 declaration permutations, selection criteria, and validation evidence for the chosen order in [idct_block_var.c](https://github.com/coah80/wii-ipl/pull/1091/files#diff-a274164d13198c046348fb647cba8dc885eaf013132027c97c324a7004d5242a). > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized f451707.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 11:00:02 +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.