feat(libSceJxr): implement quantizer remapping, AC prediction mode and zigzag scan setup #14933
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14933"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Noxy-HNR on 2026-11-02T01:36:48Z.
What
Four libSceJxr codec helpers currently throw:
remapQP,formatQuantizer,getACPredModeandInitZigzagScan. They now call jxrlib's strPredQuant.c, strcodec.c and image.c, built from3rdparty/jxrlib, through a C bridge (src/NativeQuant.c). No jxrlib logic is copied intocore/.remapQP/formatQuantizerfill the 20-byteCWMIQuantizer(QP, offset, reciprocal mantissa/exponent) from its index, copying channel 0 or 1 first for uniform/mixed modes.getACPredModepicks horizontal, vertical or no AC prediction from a 1,160-byteCWMIMBInfo.InitZigzagScanfills the three 4x4 scan tables of a 704-byteCCodingContext; null is ignored, as in jxrlib.The bridge asserts these layouts (LP64, without
WMP_OPT_QT). The C++ adapters insrc/Quantizer.cppthrow on a null quantizer, quantizer table, used channel or macroblock, on more than 16 channels, and on a scaled shift that would push the QP outside 32 bits. Review fix7c1b94d83ecalculates the shift plus index exponent in 64-bit arithmetic before checking its range; the regression coversINT32_MINandINT32_MAXfor indices 3 and 255. 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.Tested
Latest independent verification at
7c1b94d83e: Windows 11 x86-64, WinLibs GCC 15.2.0, Release. Rebuiltguest_jxr_quantizer_tests,guest_jxr_stream_testsandguest_jxr_tests; 3/3 passed.Linux source-level sanitizer probe: Ubuntu 26.04, GCC 15.2.0,
-fsanitize=undefined -fno-sanitize-recover=all,UBSAN_OPTIONS=halt_on_error=1, using the exact adapter, C bridge and pinned nativeremapQP. All four extreme-shift calls throw without changing the quantizer; valid lossless and scaled calls reach the native implementation and pass their controls. The same probe with the pre-fix adapter from21a07dbca2stops on signed overflow in the exponent calculation. This is a focused source probe, not a full Linux guest-runtime run.The earlier hosted Windows job passed all ten JXR tests but timed out in
check_compile_test_crlf_and_quoted_response_definitions_compile_without_changing_build_outputsandavplayer_http_transport. After the PR was closed and reopened, the fresh Windows job passed on the same head,7c1b94d83e. The latest conventions and library-portability checks also pass. The earlier timeouts were not reproduced or attributed to a specific cause.Earlier reported validation:
New
guest_jxr_quantizertest, comparing the guest exports with jxrlib called directly:remapQPfor all 256 indices, shifts 0 to 2, with and without scaled arithmetic, plus known values (lossless index 0, index 4, index 255).2,000 random
formatQuantizertables (1 to 16 channels, every mode).20,000 random macroblocks for
getACPredModeacross the colour formats, plus no, horizontal, vertical and balanced energy.InitZigzagScanover a randomised context, and null.Every rejected argument.
Linux x86-64 (Ubuntu 24.04, GCC 13), Release, upstream
93dbd0f82a:ctest -R guest_jxr10/10 passed.Windows 11 x86-64, WinLibs MinGW GCC 15.2.0, Release:
ctest -R guest_jxr10/10 passed, including the_patchedlookup tests.python tools/check_conventions.py --base origin/mainandpython core/libs/tests/test_public_headers.py --audit-only(399 libraries, 26,813 exports): passed.python tools/pr_overlap.py --branch claude/jxr-quantizer(1,867 open PRs): no shared exports or new files. #14425, #14631, #14905 and #14916 touch neighbouring lines ofCMakeLists.txt,Export.cpp,include/Api.hppand the debt file. Merge order is #14905, #14916, then this PR. These are integration prerequisites, with no runtime dependency between the features. Rebase and rerun the focused tests after they merge.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)