fix(libSceVideodec2): mark returned pictures as not discarded #10913
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10913"
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 thuanquang on 2026-10-25T09:41:10Z.
What
SceVideodec2::OutputInfohad no member at offset 0xb, sosceVideodec2DecodeandsceVideodec2Flushnever wrote that byte, and a caller saw whatever it had left there. This PR names the byteisDiscardedFrameand sets it to 0 when a picture is returned; a result without a picture and a refused access unit leave it as the caller set it. Astatic_assertpins the layout (size 0x38, the flag at 0xb,codecTypeat 0xc,frameBufferat 0x20).Sources for the field:
libSceVideodec2.sprx(https://github.com/boykopovar/AnyPS5/pull/10913#issuecomment-6397761452): Decode and Flush write the byte only where a picture is returned, from a flag in the decoder core's result, and leave it untouched in a result without a picture and for a refused access unit. This PR follows that. The core's flag itself is not modelled: AnyPS5 returns no picture for a VP9 frame that is not shown, so a returned picture has 0.IsDiscardedFrameat this offset (Videodec2.cs#L150-L192).is_discarded_framethere and writesfalsein every Decode and Flush result that passes its argument checks, with or without a picture (libVideoDec2.cpp#L91-L483).thisSizein the output it passes to its VP9 Decode call (0x13728dd) and to Flush (0x1371f7e), and takes a picture only whenisValidis set and this byte is 0; otherwise it drops the picture. Read from disassembly, not measured on a console.Not measured by us: the firmware behaviour above comes from that review, not from a console run or our own reading; when the decoder core sets the flag is not modelled. The debt entry records this.
Where it stops on
mainPPSA05110 (own dump), on unmodified
main48c160c58b(2026-10-27; #10887 and #10614 are merged, so nothing local is needed any more): after New Game, about 430 s into a run from a system save, the opening movie's second VP9 decoder starts and the title stops withThe same stop was first seen on
main61fc572ceeplus a local build of #10887's declarations and #10614.(integer divide by zero in the title's code). A local hook (not part of this PR) logged byte 0xb as each Decode or Flush call arrived, before AnyPS5 writes the output, which is what
mainhands back: 2143 of the first 2400 pictures came with it nonzero (every logged value was 0x62; an earlier run had 0x5e). They span the title's two movies so far; the decoder of the movie at the stop was created before picture 300, so at least 1874 of them came after it. The title drops those pictures, so its movie player has no displayed frame and divides by that frame's time unit, which is still 0.Tested
main57f506f811.testDiscardedFrameFlaginguest_videodec2: it fills the output with 0xFF, as a caller's old stack bytes would, refuses an empty access unit, and decodes a VP9 and an H.264 stream through Decode and Flush. A returned picture must have the byte at 0; a result without a picture and the refused access unit must leave it at 0xFF. Onmain's library it fails 3/3 witha returned picture is marked as discarded; with this change it passes 3/3.guest_videodec2,guest_videodec2_unimplemented,guest_vdecsw,guest_videodec: 4/4 pass, three times.isValid, so that difference does not reach it.mainaeff26bd9(comment):guest_videodec2,guest_videodec2_unimplementedandguest_videodecpass 3 of 3 with 0 warnings; withExport.cppandinclude/Api.hppfrommain,guest_videodec2fails. macOS was not built.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 MarcZX10 on 2026-10-25T09:49:25Z.
Review: APPROVED
Reviewed exact head
d39564ff0efbbc4a87bd15c408f298250a001188.The output layout is pinned with offsets matching the candidate field declaration.
ClearOutputresetsisDiscardedFramefor a successful Decode/Flush result, and the refused empty-access-unit return explicitly callsClearOutputbefore returning its error code. Invalid pointer/handle paths throw rather than returning an output structure. The new regression initializes the output bytes to0xffand checks the flag after a refused access unit, valid decoded pictures, and flush output; it exercises both VP9 and H.264. The PR also records the remaining console uncertainty in technical debt rather than claiming that all discarded-frame semantics are known.The author reports that the focused regression failed 3/3 on main and passed 3/3 with this change; four neighboring videodec tests passed three times, and their PPSA05110 run completed the opening movie and entered gameplay. GitHub eligibility, intake, labels, conventions, and report checks pass; platform product jobs are skipped by path policy. Local
git diff --checkandtools/check_conventions.py --base upstream/main --head upstream/pr-10913pass. I did not independently run the decoder tests or title.No blocking issue found in the scoped output-flag correction.
AI-assisted: yes.