feat(libSceVdecsw): decode H.264 through FFmpeg #1208

Closed
CnRJay wants to merge 1 commit from upstream-pr/1208 into main
CnRJay commented 2026-10-07 17:34:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-07T17:34:55Z.


What

Implements libSceVdecsw (13 exports) on top of FFmpeg's H.264 decoder:

  • compute memory and queue: sceVdecswQueryComputeMemoryInfo, sceVdecswAllocateComputeQueue, sceVdecswReleaseComputeQueue;
  • decoder lifecycle: sceVdecswQueryDecoderMemoryInfo, sceVdecswCreateDecoder, sceVdecswDeleteDecoder, sceVdecswResetDecoder;
  • decoding: sceVdecswSetDecodeInput, sceVdecswTrySyncDecodeInput, sceVdecswSetDecodeOutput, sceVdecswTrySyncDecodeOutput, sceVdecswFinalizeDecodeSequence;
  • picture info: sceVdecswGetAvcPictureInfo.

Signatures, structure layouts (both config and output info versions), argument checks and error codes follow shadPS4's vdecsw.cpp.

  • An access unit is decoded when it is submitted, in Annex B or with 4-byte NAL lengths. Its input result is therefore ready at once, and TrySyncDecodeInput never reports a pending decode.
  • Frames are written as NV12, with the pitch aligned to 64 and the height to 16 as in shadPS4. The padding rows repeat the last row.
  • Picture info keeps the input timestamps and attached data in display order. It also reports the IDR flag, profile, level, picture size in macroblocks and cropping (in H.264's 2-pixel units). The VUI, SEI and NAL presence fields are zero.
  • The following throw: codecs other than H.264, interlaced pictures, decoding errors, input after finalizing without a reset, and non-positive frame dimensions in the memory query.

The H.264 test stream from GuestVideodec2.cpp moves to core/libs/tests/H264TestStream.hpp, so both tests check the same reference pictures. The libSceVdecsw unknown-signature entries in TechnicalDebt are replaced by one entry that lists the sources and the gaps.

Tested

Ubuntu 24.04, GCC 13.3, Release build. The new guest_vdecsw test passes:

  • the queries and every error code above;
  • decoding the 6-picture stream in Annex B and length-prefixed form, with both output info sizes. Each picture's NV12 hash matches the Videodec2 reference, in display order with its timestamps, padding and picture info;
  • finalize, the last-frame flag and reset.

guest_videodec2 still passes with the shared header. Not tested with a title.
Also checked on Windows 11 (MinGW GCC Release build): guest_vdecsw and guest_videodec2 pass.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4776210140 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1208). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-07T17:34:55Z. --- ### What Implements libSceVdecsw (13 exports) on top of FFmpeg's H.264 decoder: - compute memory and queue: `sceVdecswQueryComputeMemoryInfo`, `sceVdecswAllocateComputeQueue`, `sceVdecswReleaseComputeQueue`; - decoder lifecycle: `sceVdecswQueryDecoderMemoryInfo`, `sceVdecswCreateDecoder`, `sceVdecswDeleteDecoder`, `sceVdecswResetDecoder`; - decoding: `sceVdecswSetDecodeInput`, `sceVdecswTrySyncDecodeInput`, `sceVdecswSetDecodeOutput`, `sceVdecswTrySyncDecodeOutput`, `sceVdecswFinalizeDecodeSequence`; - picture info: `sceVdecswGetAvcPictureInfo`. Signatures, structure layouts (both config and output info versions), argument checks and error codes follow shadPS4's `vdecsw.cpp`. - An access unit is decoded when it is submitted, in Annex B or with 4-byte NAL lengths. Its input result is therefore ready at once, and `TrySyncDecodeInput` never reports a pending decode. - Frames are written as NV12, with the pitch aligned to 64 and the height to 16 as in shadPS4. The padding rows repeat the last row. - Picture info keeps the input timestamps and attached data in display order. It also reports the IDR flag, profile, level, picture size in macroblocks and cropping (in H.264's 2-pixel units). The VUI, SEI and NAL presence fields are zero. - The following throw: codecs other than H.264, interlaced pictures, decoding errors, input after finalizing without a reset, and non-positive frame dimensions in the memory query. The H.264 test stream from `GuestVideodec2.cpp` moves to `core/libs/tests/H264TestStream.hpp`, so both tests check the same reference pictures. The libSceVdecsw unknown-signature entries in TechnicalDebt are replaced by one entry that lists the sources and the gaps. ### Tested Ubuntu 24.04, GCC 13.3, Release build. The new `guest_vdecsw` test passes: - the queries and every error code above; - decoding the 6-picture stream in Annex B and length-prefixed form, with both output info sizes. Each picture's NV12 hash matches the Videodec2 reference, in display order with its timestamps, padding and picture info; - finalize, the last-frame flag and reset. `guest_videodec2` still passes with the shared header. Not tested with a title. Also checked on Windows 11 (MinGW GCC Release build): `guest_vdecsw` and `guest_videodec2` pass. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-07 17:41:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T17:41:23Z.


Progress report (cea1ef1 → 7781730)

📈 System libraries: 86.46% (+0.44%, +13 implemented functions)

✅ 13 implemented
Library Name
libSceVdecsw sceVdecswAllocateComputeQueue
libSceVdecsw sceVdecswCreateDecoder
libSceVdecsw sceVdecswDeleteDecoder
libSceVdecsw sceVdecswFinalizeDecodeSequence
libSceVdecsw sceVdecswGetAvcPictureInfo
libSceVdecsw sceVdecswQueryComputeMemoryInfo
libSceVdecsw sceVdecswQueryDecoderMemoryInfo
libSceVdecsw sceVdecswReleaseComputeQueue
libSceVdecsw sceVdecswResetDecoder
libSceVdecsw sceVdecswSetDecodeInput
libSceVdecsw sceVdecswSetDecodeOutput
libSceVdecsw sceVdecswTrySyncDecodeInput
libSceVdecsw sceVdecswTrySyncDecodeOutput
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6043441816 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1208#issuecomment-6043441816). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-07T17:41:23Z. --- <!-- progress-report --> ### Progress report (cea1ef1 → 7781730) 📈 **System libraries**: 86.46% (+0.44%, +13 implemented functions) <details> <summary>✅ 13 implemented</summary> | Library | Name | | - | - | | libSceVdecsw | `sceVdecswAllocateComputeQueue` | | libSceVdecsw | `sceVdecswCreateDecoder` | | libSceVdecsw | `sceVdecswDeleteDecoder` | | libSceVdecsw | `sceVdecswFinalizeDecodeSequence` | | libSceVdecsw | `sceVdecswGetAvcPictureInfo` | | libSceVdecsw | `sceVdecswQueryComputeMemoryInfo` | | libSceVdecsw | `sceVdecswQueryDecoderMemoryInfo` | | libSceVdecsw | `sceVdecswReleaseComputeQueue` | | libSceVdecsw | `sceVdecswResetDecoder` | | libSceVdecsw | `sceVdecswSetDecodeInput` | | libSceVdecsw | `sceVdecswSetDecodeOutput` | | libSceVdecsw | `sceVdecswTrySyncDecodeInput` | | libSceVdecsw | `sceVdecswTrySyncDecodeOutput` | </details>
oneandonlydean commented 2026-10-08 03:25:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T03:25:59Z.


Which title reaches libSceVdecsw on main? With the ID and the log line this can go in; otherwise I'll close it until one does. The same goes for #950 and #1206: no title is shown calling sceKernelGetEventError or the four libSceHttp functions (PPSA23566 imports them, but nothing shows it stopping at one).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6051541802 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1208#issuecomment-6051541802). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T03:25:59Z. --- Which title reaches libSceVdecsw on main? With the ID and the log line this can go in; otherwise I'll close it until one does. The same goes for #950 and #1206: no title is shown calling `sceKernelGetEventError` or the four libSceHttp functions (PPSA23566 imports them, but nothing shows it stopping at one).
CnRJay commented 2026-10-08 19:29:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-08T19:29:58Z.


Closing for now: no title log on main shows a stop at these exports yet. The branch stays on the fork; I'll reopen with the title ID and log line if one turns up.

🤖 Closed by Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6067489391 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1208#issuecomment-6067489391). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-08T19:29:58Z. --- Closing for now: no title log on `main` shows a stop at these exports yet. The branch stays on the fork; I'll reopen with the title ID and log line if one turns up. _🤖 Closed by [Claude Code](https://claude.com/claude-code)_

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1208
No description provided.