feat(libSceJpegDec): decode pixel format 10 as packed Y8U8Y8V8 #26193
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/26193"
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 Ducengarth on 2026-11-23T12:41:22Z.
What
sceJpegDecDecodeandsceJpegDecDecodeWithInputControlaccepted pixel format 10 (Y8U8Y8V8) and then threw. This decodes it.Decoder::Jpeg::DecodePlanarYuvdecodes a JPEG, at any of the four down-scales, into its own Y, Cb and Cr planes through TurboJPEG's planar decoder, with no RGB round trip. It throws for sources that are not YCbCr or grayscale, and for subsamplings TurboJPEG cannot split into planes.Y0 Cb Y1 Crrows of(width + 1) / 2 * 4bytes. That is the layout KytyPS5 uses, and the input libSceJpegEnc reads for the same format number (#23534).Tested
Linux x86-64 (WSL Ubuntu 24.04, GCC 13.3, Ninja, Release,
BUILD_TESTING=ON), at 771f1b1d9e on7db4926943; rebased todb7f53ffe1on8e1af3d9b0, where main changed none of the JPEG files.ctest -R '^(decoder_jpeg|guest_jpeg_.*)$': 14/14 passed.guest_jpeg_dec_y8u8y8v8:sceJpegEncEncodeformat 10 at 4:2:2: every byte comes back within 3.decoder_jpegcovers plane sizes and values for 4:4:4, 4:2:2 and 4:2:0, scaled plane ratios, grayscale, invalid scales, and empty, garbage and truncated input.Export.cppthe new test fails (sceJpegDecDecode: pixel format is not implemented).check_conventions.pyanddebt_fold.py --checkpass.pr_overlap.py --branchreports no overlap across 2,552 open PRs.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-23T12:43:48Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
db7f53ffe1:tools/check_conventions.pypassed.decoder_jpeg_tests,guest_jpeg_dec_y8u8y8v8_testsbuilt cleanly.decoder_jpeg,guest_jpeg_dec_y8u8y8v8):core/Decoder/Jpeg/include/Decoder/Jpeg.hpp,core/Decoder/Jpeg/src/Jpeg.cpp,core/libs/prx/libSceJpegDec/Export.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T12:56:18Z.
Review: APPROVED
I ran a focused native Windows GCC 15.2 fixture with the pinned TurboJPEG. A complete 5×3 grayscale JPEG produced exact format-10 bytes through both exports, including the repeated last luma sample, neutral chroma, and untouched 20-byte pitch padding. The same executable built against base
8e1af3d9b0reached the expected unimplemented-format exception at runtime.Removing only EOI kept the header readable. Format 10 returned 0x80650012 through both exports without touching the output, and the direct export also left imageInfo untouched. Unscaled RGBA accepted the same input on both revisions. A negative input callback after a successful header parse propagated its original status without output. This was a Windows decoder fixture using generated data.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-23T13:42:53Z.
Review: APPROVED
Windows build and run of head
db7f53ffe1with GCC 16, merged ontomain8e1af3d9b0(clean merge). The Tested section is Linux only.Setup: Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (
x86_64-ucrt-posix-seh, r3), Release full build, run from PowerShell. Built together with #26165, #26189, #26190 and #26191, which touch other files.^(decoder_jpeg|guest_jpeg_.*)$:main13 of 13, and with this PR 14 of 14 in 2 of 2 runs, including the newguest_jpeg_dec_y8u8y8v8anddecoder_jpeg's planar cases.bias = pair & 1→0),guest_jpeg_dec_y8u8y8v8aborts withfailed: packed output. One of your mutations, caught on Windows too.The code: the packing takes its chroma ratios from TurboJPEG's own plane sizes (
chromaRatiothrows on anything but 1, 2 or 4). It strides the luma by the padded plane width, so the odd-width 4:2:2 and 4:1:1 sources index the right samples. An odd last pair repeats Y0 and uses its own chroma, and the result packs through the existingreportImagepath. The pitch and size checks use the sameimageRowSizeascheckTarget, so a pitch of 0 and an explicit one agree.AI-assisted: yes (Claude Code)