Skip to content

Improve hsd_803B51C8 matching - #3083

Closed
g-guthrie wants to merge 2 commits into
doldecomp:masterfrom
g-guthrie:agent/improve-hsd-803b51c8
Closed

Improve hsd_803B51C8 matching#3083
g-guthrie wants to merge 2 commits into
doldecomp:masterfrom
g-guthrie:agent/improve-hsd-803b51c8

Conversation

@g-guthrie

@g-guthrie g-guthrie commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What changed

  • model the JPEG comment and Huffman tables as fixed-size aggregate types so MWCC emits the original inline copy sequences
  • cache the quantization scale once per transformed block instead of reloading it for every coefficient
  • align local layout, integer widths, and dimension declaration order with the target function

Why

hsd_803B51C8 used generic memcpy calls and repeatedly loaded the quantization scale inside three unrolled loops. Those source shapes differed substantially from the original compiler output.

The aggregate assignments reproduce the target's paired loads/stores and counted AC-table loops, while the cached scale reproduces the target's single load before each unrolled division block.

Matching improvement

  • stripped function match: 81.44211% -> 94.7579%
  • candidate size: 2592 -> 2664 bytes
  • target size: 2660 bytes

Validation

  • pre-commit run --files src/sysdolphin/baselib/hsd_3B34.c
  • python3 tools/check/main.py --quiet src/sysdolphin/baselib/hsd_3B34.c
  • git diff --check
  • exact MWCC 1.2.5n compile and address-verified objdiff comparison against hsd_803B51C8

@decomp-dev

decomp-dev Bot commented Aug 14, 2026

Copy link
Copy Markdown

Report for GALE01 (76a4770 - 664ec55)

📈 2 improvements in unmatched items
Unit Item Bytes Before After
main/sysdolphin/baselib/hsd_3B34 hsd_803B51C8 +402 80.44% 95.56%
main/sysdolphin/baselib/hsd_3B34 extab +1 88.64% 90.91%

@g-guthrie

Copy link
Copy Markdown
Contributor Author

Superseded by #3077, which improves the same function further (+425 bytes vs +402 bytes in the decomp.dev report). Keeping the stronger single contribution open.

@g-guthrie g-guthrie closed this Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant