Repository navigation
feat(libSceJxr): implement decoder post-processing helpers - #16282
Merged
Merged
Conversation
# Conflicts: # docs/dev/debt/libSceJxr.md
# Conflicts: # core/libs/prx/libSceJxr/Export.cpp # core/libs/prx/libSceJxr/include/Api.hpp # docs/dev/debt/libSceJxr.md
# Conflicts: # core/libs/prx/libSceJxr/Export.cpp # core/libs/prx/libSceJxr/include/Api.hpp # docs/dev/debt/libSceJxr.md
Progress report (a55cabd → ade7b2c)📈 System libraries: 33.27% (+0.03%, +11 implemented functions) ✅ 11 implemented
Changed libraries (implemented exports)
|
Contributor
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
Noxy-HNR
marked this pull request as ready for review
November 6, 2026 16:00
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
12 tasks done
This was referenced Nov 7, 2026
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.
What
Four libSceJxr decoder post-processing helpers currently throw:
slideOneMBRow,updatePostProcInfo,postProcMBandpostProcBlock. They now call jxrlib's postprocess.c, built from3rdparty/jxrlib, through a C bridge (src/NativePostProc.c). No jxrlib logic is copied intocore/.slideOneMBRowswaps each channel's previous and current macroblock-info rows, and marks the new rows bumpy at the top or bottom edge.updatePostProcInforecords a macroblock's DC and its macroblock and block textures.postProcMBsmooths the 2-pixel macroblock boundaries between four neighbouring macroblocks and stores their block DCs.postProcBlockdeblocks the 16 blocks of the upper-left macroblock.All four work on the caller's
tagPostProcInfo* [16][2]row table, 88-byte LP64tagPostProcInfoentries (the bridge asserts the layout) andPixelImacroblock rows. The C++ adapters insrc/PostProc.cppthrow on a null table, a null macroblock or row the call dereferences, more than 16 channels, a channel past 15, and a column or row width whose byte offset overflows. Before calling jxrlib they open host writes on exactly the table, info entries and pixel ranges each call writes, so a read-only guest page throws instead of faulting. The row length is not an argument, so a column past the caller's row cannot be detected.cmake/Jxr.cmakebuildspostprocess.cwith-fwrapv. Its smoothing and DC comparisons overflowInton extreme pixel or DC values, which is undefined behaviour in the host build. With-fwrapvthey wrap instead, and in-range results don't change.The row table comes from
initPostProcand is released bytermPostProc, which #16267 and #16269 added tomain. That the console's module uses these prototypes and layouts is inferred from the export names. Nothing is checked on a console, and the debt file records this. No title unblock is claimed.This branch is built on #15689, which includes #15479, so the diff also shows their commits. This PR's own change is commit
3980822836; the merge commits after it bring in the updated #15689. It goes right after #15689.Tested
New
guest_jxr_postproctest. Each case builds a randomized row table and macroblock rows, clones it, runs the guest export on one copy and jxrlib directly on the other, and compares the rows, the pixels and the table pointers (by offset):slideOneMBRowfor 0, 1, 3 and 16 channels, widths 0 to 12, every top/bottom combination, three slides in a row.updatePostProcInfofor every column and several channels, with dense, sparse and all-zero macroblocks (smooth and bumpy textures).postProcMBandpostProcBlockfor every column 0 to 12, thresholds 0, 1, 4 and 100, and flat and mixed textures. Also extreme values (random 32-bit pixels and DCs, thresholdINT32_MAX).sceKernelMprotect(checked withVirtualQuery). Each call is rejected exactly when a page it writes is read-only, and succeeds once write access is restored.postProcMB/postProcBlockby one, makes the test fail.Results:
40ea2a1518on upstream6bf3a19b81(after feat(libSceJxr): initialize postprocessing buffers #16267 and feat(libSceJxr): release postprocessing buffers #16269 merged):ctest -R guest_jxr15/15 passed in each of 3 runs. Earlier,1a408e876don upstreamc36ab99c74also passed 15/15 in each of 3 runs. The first version,3980822836on upstream04cdd52760, passed 13/13 in each of 3 runs.-fsanitize=signed-integer-overflow -fno-sanitize-recover=all) onpostprocess.cwith the test's case generator: in-range cases are clean with or without-fwrapv. Extreme cases stop with signed overflow atpostprocess.c:187without-fwrapv, and are clean with it.40ea2a1518,ctest -R guest_jxr15/15 passed in each of 3 runs, including the read-only page checks. Earlier,1a408e876dalso passed 15/15 in each of 3 runs. The first version,3980822836, passed 13/13 in each of 3 runs, including the read-only page checks, and the build log showspostprocess.ccompiled with-fwrapv.python tools/check_conventions.py --base origin/mainandpython core/libs/tests/test_public_headers.py --audit-only(406 libraries, 30,646 exports): passed.python tools/pr_overlap.py --branch claude/jxr-postproc(1,894 open PRs): no shared exports. It could not compare 11 open libSceJxr PRs that conflict withmain(feat(libSceJxr): implement the jxrlib SimpleBitIO reader #15148, feat(libSceJxr): implement the PKFactory and PKCodecFactory constructors #15232, feat(libSceJxr): return success from four jxrlib defaults as firmware 13.42 does #15626, feat(libSceJxr): implement descriptive metadata cleanup #15645, feat(libSceJxr): enumerate supported pixel format conversions #15646, feat(libSceJxr): implement PKImageDecode query and metadata exports #15684, feat(libSceJxr): implement the linked-list WMPStream #15771, feat(libSceJxr): implement the FILE-backed WMPStream functions #15772, feat(libSceJxr): implement the generic PKImageEncode #15774, and feat(libSceJxr): implement the pixel format hash, image IID lookups, aligned allocation and IDPEmpty #14905 and feat(libSceJxr): implement bit I/O through the pinned jxrlib #14916, which have since merged). Checked by hand, none of them adds these four functions. They overlap only on neighbouring lines ofCMakeLists.txt,Export.cpp,include/Api.hppand the debt file.No console or retail-title test.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)