diff --git a/libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse.c b/libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse.c index 7822cd04..7cf15e36 100644 --- a/libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse.c +++ b/libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse.c @@ -366,7 +366,7 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder, return; } pInfo->xResNum = readU32(p, byteOrder); - p = (const u8*)(pInfo->thumbnailData + offset + 4); + p = pInfo->thumbnailData + (offset + 4); if (pInfo->thumbnailData > p) { return; } @@ -386,7 +386,7 @@ static void TMCJPEGDEC_IFD0_tag_parse(TMCCJPEGDecExifData* pInfo, u16 byteOrder, return; } pInfo->yResNum = readU32(p, byteOrder); - p = (const u8*)(pInfo->thumbnailData + offset + 4); + p = pInfo->thumbnailData + (offset + 4); if (pInfo->thumbnailData > p) { return; } diff --git a/tools/decomp-assist/jpeg-next-reconstruction-attempts.md b/tools/decomp-assist/jpeg-next-reconstruction-attempts.md new file mode 100644 index 00000000..9974f660 --- /dev/null +++ b/tools/decomp-assist/jpeg-next-reconstruction-attempts.md @@ -0,0 +1,82 @@ +# JPEG follow-on reconstruction + +Base: `813660b9`, branch `agent/bittle/jpeg-reconstruction-next`. +The already-reviewed EXIF candidate `b9305280` was preserved unchanged as local +cherry-pick `164dbbc5`. This log concerns a separate follow-on to that candidate. + +## Retained change + +IFD0 rational denominator addresses now use the same explicit offset grouping as +IFD1: add four to the TIFF offset, then add the thumbnail-data base. The redundant +same-type pointer cast is removed. This is a two-line source change; it introduces +no new tag interpretation, new memory access, or function. + +- `TMCJPEGDEC_IFD0_tag_parse`: 99.386696 -> 99.49065 fuzzy +- EXIF unit: 98.94104 -> 98.98035 fuzzy +- EXIF exact functions: 3/6 -> 3/6; matched code remains 1348/5088 bytes +- IFD0 remains 480/481 instructions; this is not an exact match or linking result +- All other 33 owned functions retain their baseline scores + +No changes are retained in the color converters or IDCT. No declaration-order +search, forced registers, volatile, assembly, padding, headers, configuration, +linking changes, remote writes, or edits to the entropy decoder were made. + +## Rejected reconstruction trials + +Every equal or regressing trial was restored before validation. + +- Separate rational numerator/denominator pointer lifetimes in IFD0 and IFD1: + unchanged from the retained expression; restored +- RGB444's common edge-sibling channel evaluation and clipping order with a + separate luminance value: 98.71429 -> 98.62637; restored +- Explicit odd-coefficient differences in the luminance second-pass butterfly: + 83.05058 -> 81.42802; restored +- Extract the luminance first-pass row transform to a static inline helper: + 83.05058 -> 81.12062; restored. The trial script initially omitted helper + local declarations, causing a compiler error; that experiment was corrected, + measured, and then fully restored +- Extract RGBA pixel packing to a static inline helper: + - 411: 82.6033 -> 81.72314; restored + - 422 and edge: unchanged at 87.72298 and 90.08849; restored + - 420 and edge: unchanged at 89.40523 and 87.458336; restored + - 211 and edge: unchanged at 91.15385 and 92.0; restored + - 444: unchanged at 90.670105; restored + - 444 edge: 88.90909 -> 87.70909; restored + +These were source-structure trials, not permutations of register declarations. +The source-neutral scheduling differences that remain were not chased through +artificial source changes. + +## Verification + +The baseline report was generated after building the unchanged cherry-picked +candidate. The final report was freshly generated after restoring every rejected +trial and rebuilding all four owned objects. + +- Full 4.3U build: PASS +- All 34 owned function scores compared against the baseline: zero regressions +- All 11 previously exact functions retain exact-name objdiff 100 and ctxdiff 0 +- Pool checks before trials and after the final build: all four identical, + zero strings +- Neither source nor original object has allocated non-code sections in any of + the four owned units +- DOL SHA1: `26116613f624061ba99c8d1a299aaa6efa85670d` +- The existing read-only bounded PPC audit tools were inspected before use; + their scripts are unchanged +- Converter/IDCT audit: all 9,456 paired calls pass + +- EXIF audit: all 267,282 paired calls pass, including the 42 version-byte + overlap cases preserved by the preceding candidate +- `git diff --check 813660b9`: PASS, including the base-relative committed diff +- The working tree is paused for parent review after the focused local commit +These interpreter tests are bounded samples, not formal equivalence or Wii +runtime tests. Their existing coverage and modeling limitations still apply. + +## Existing external overlap + +The prior EXIF log documents the already fetched +`origin/agent/w1009/tmc` branch's overlap with EXIF and color reconstruction. +That overlap remains relevant to parent integration. This follow-on was derived +from the current source, the prior owned reconstruction, and local object +comparisons. No external branch was merged, copied, fetched, or contacted. +The parent should preserve the previously queued EXIF candidate separately. diff --git a/tools/decomp-assist/jpeg-next-reconstruction-validation.txt b/tools/decomp-assist/jpeg-next-reconstruction-validation.txt new file mode 100644 index 00000000..df7c2c92 --- /dev/null +++ b/tools/decomp-assist/jpeg-next-reconstruction-validation.txt @@ -0,0 +1,63 @@ +main/libs/RVLMiddleware/TMC_JPEG/src/buffer/idct_block_var 89.06892 -> 89.06892 +POOL IDENTICAL up to 0 (mine=0 base=0) +No allocated non-code sections in either object +main/libs/RVLMiddleware/TMC_JPEG/src/exif/exif_parse 98.94104 -> 98.98035 +POOL IDENTICAL up to 0 (mine=0 base=0) +TMCCJPEGDecGetOffsetEXIF: src 0x26c base 0x26c insns 155/155; diffs 0: [] +TMCCJPEGDecGetInfoEXIF: src 0x210 base 0x210 insns 132/132; diffs 0: [] +TMCJPEGDEC_IFD0_tag_parse 99.386696 -> 99.49065 +TMCJPEGDEC_ThumbnailCheck: src 0xc8 base 0xc8 insns 50/50; diffs 0: [] +No allocated non-code sections in either object +main/libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoRGB565 96.44502 -> 96.44502 +POOL IDENTICAL up to 0 (mine=0 base=0) +TMCJPEGDEC_converterYUV422toRGB565edge: src 0x1ac base 0x1ac insns 107/107; diffs 0: [] +TMCJPEGDEC_converterYUV211toRGB565: src 0x188 base 0x188 insns 98/98; diffs 0: [] +TMCJPEGDEC_converterYUV211toRGB565edge: src 0x1b4 base 0x1b4 insns 109/109; diffs 0: [] +TMCJPEGDEC_converterYUV444toRGB565edge: src 0x1a0 base 0x1a0 insns 104/104; diffs 0: [] +TMCJPEGDEC_converterYUV400toRGB565: src 0x118 base 0x118 insns 70/70; diffs 0: [] +TMCJPEGDEC_converterYUV400toRGB565edge: src 0x14c base 0x14c insns 83/83; diffs 0: [] +No allocated non-code sections in either object +main/libs/RVLMiddleware/TMC_JPEG/src/texturecvtr/Texture_MCUtoRGBA8 90.32323 -> 90.32323 +POOL IDENTICAL up to 0 (mine=0 base=0) +TMCJPEGDEC_converterYUV400toRGBA8: src 0x130 base 0x130 insns 76/76; diffs 0: [] +TMCJPEGDEC_converterYUV400toRGBA8edge: src 0x164 base 0x164 insns 89/89; diffs 0: [] +No allocated non-code sections in either object +34 owned function scores checked; 11 exact functions preserved; zero regressions +26116613f624061ba99c8d1a299aaa6efa85670d build/43U/main.dol + +TMCJPEGDEC_IFD0_tag_parse 131072 selector cases PASS +TMCJPEGDEC_IFD1_tag_parse 131072 selector cases PASS +TMCJPEGDEC_IFD0_tag_parse 132746 cases PASS; own-body instruction coverage 480 / 480 source; 481 / 481 original +TMCJPEGDEC_IFD1_tag_parse 132704 cases PASS; own-body instruction coverage 239 / 239 source; 241 / 242 original +TMCJPEGDEC_exif_parse 1832 cases PASS; own-body instruction coverage 212 / 212 source; 212 / 212 original +TOTAL 267282 paired EXIF calls PASS + +TMCJPEGDEC_converterYUV411toRGBA8: 100 cases PASS; instruction coverage source 242/242, original 242/242 +TMCJPEGDEC_converterYUV411toRGBA8edge: 400 cases PASS; instruction coverage source 112/112, original 112/112 +TMCJPEGDEC_converterYUV422toRGBA8: 100 cases PASS; instruction coverage source 148/148, original 148/148 +TMCJPEGDEC_converterYUV422toRGBA8edge: 400 cases PASS; instruction coverage source 113/113, original 113/113 +TMCJPEGDEC_converterYUV420toRGBA8: 100 cases PASS; instruction coverage source 153/153, original 153/153 +TMCJPEGDEC_converterYUV420toRGBA8edge: 400 cases PASS; instruction coverage source 120/120, original 120/120 +TMCJPEGDEC_converterYUV211toRGBA8: 100 cases PASS; instruction coverage source 104/104, original 104/104 +TMCJPEGDEC_converterYUV211toRGBA8edge: 400 cases PASS; instruction coverage source 115/115, original 115/115 +TMCJPEGDEC_converterYUV444toRGBA8: 100 cases PASS; instruction coverage source 97/97, original 97/97 +TMCJPEGDEC_converterYUV444toRGBA8edge: 400 cases PASS; instruction coverage source 110/110, original 110/110 +TMCJPEGDEC_converterYUV400toRGBA8: 100 cases PASS; instruction coverage source 57/76, original 57/76 +TMCJPEGDEC_converterYUV400toRGBA8edge: 400 cases PASS; instruction coverage source 70/89, original 70/89 +TMCJPEGDEC_set_converterRGBA8: 1024 cases PASS; instruction coverage source 168/169, original 169/170 +TMCJPEGDEC_converterYUV411toRGB565: 100 cases PASS; instruction coverage source 217/217, original 217/217 +TMCJPEGDEC_converterYUV411toRGB565edge: 400 cases PASS; instruction coverage source 106/106, original 106/106 +TMCJPEGDEC_converterYUV422toRGB565: 100 cases PASS; instruction coverage source 136/136, original 136/136 +TMCJPEGDEC_converterYUV422toRGB565edge: 400 cases PASS; instruction coverage source 107/107, original 107/107 +TMCJPEGDEC_converterYUV420toRGB565: 100 cases PASS; instruction coverage source 141/141, original 141/141 +TMCJPEGDEC_converterYUV420toRGB565edge: 400 cases PASS; instruction coverage source 114/114, original 114/114 +TMCJPEGDEC_converterYUV211toRGB565: 100 cases PASS; instruction coverage source 98/98, original 98/98 +TMCJPEGDEC_converterYUV211toRGB565edge: 400 cases PASS; instruction coverage source 109/109, original 109/109 +TMCJPEGDEC_converterYUV444toRGB565: 100 cases PASS; instruction coverage source 91/91, original 91/91 +TMCJPEGDEC_converterYUV444toRGB565edge: 400 cases PASS; instruction coverage source 104/104, original 104/104 +TMCJPEGDEC_converterYUV400toRGB565: 100 cases PASS; instruction coverage source 51/70, original 51/70 +TMCJPEGDEC_converterYUV400toRGB565edge: 400 cases PASS; instruction coverage source 64/83, original 64/83 +TMCJPEGDEC_set_converterRGB565: 1024 cases PASS; instruction coverage source 168/169, original 169/170 +TMCJPEGDEC_IdctBlock_Lumi: 704 cases PASS; instruction coverage source 257/257, original 257/257 +TMCJPEGDEC_IdctBlock_Col: 704 cases PASS; instruction coverage source 454/454, original 454/454 +TOTAL: 9456 differential cases PASS; GPR14-GPR31, stack pointer and LR preserved