Skip to content

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

Closed
CnRJay wants to merge 1 commit into
boykopovar:mainfrom
CnRJay:feat/vdecsw-h264-decoder
Closed

CnRJay wants to merge 1 commit into
boykopovar:mainfrom
CnRJay:feat/vdecsw-h264-decoder

Conversation

@CnRJay

@CnRJay CnRJay commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

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

Implement the software video decoder: compute memory and queue queries,
decoder memory queries, decoder creation, deletion and reset, access
unit input and frame output with their non-blocking syncs, sequence
finalization and AVC picture info. Signatures, structure layouts,
argument checks and error codes follow shadPS4.

An access unit is decoded when it is submitted, in Annex B or with
4-byte NAL lengths, so its input result is ready at once. Frames are
written as NV12 with the pitch aligned to 64 and the height to 16, with
the padding rows repeating the last row. Picture info keeps the input
timestamps and attached data in display order. Codecs other than H.264,
interlaced pictures, decoding errors and input after finalizing without
a reset throw.

The H.264 stream used by the Videodec2 test moves to a shared header so
the new test checks the same reference pictures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

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

@oneandonlydean

Copy link
Copy Markdown
Collaborator

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

CnRJay commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants