Commit Graph
42 Commits
Author SHA1 Message Date
Kyon 8d08a1338a feat(libSceVideodec2): declare 3 additional exports 2026-10-27 12:57:10 +00:00
AZLisme 6721b44a95 fix(videodec2): normalize internal VP9 metadata snapshots 2026-10-27 06:16:45 +08:00
AZLisme 7843323dc2 fix(videodec): read owned metadata for internal callers 2026-10-27 06:16:45 +08:00
AZLisme 98ce5ccf72 fix(videodec2): match native picture argument validation 2026-10-27 06:16:45 +08:00
AZLisme 31e2d6644f fix(videodec2): reject inaccessible HEVC metadata outputs 2026-10-27 06:16:45 +08:00
AZLisme 2aa0ffbbcf feat(libSceVideodec2): expose HEVC picture metadata 2026-10-27 06:16:44 +08:00
thuanquangandClaude 294ab651de fix(libSceVideodec2): mark returned pictures as not discarded
OutputInfo had no member at offset 0xb, so sceVideodec2Decode and
sceVideodec2Flush never wrote that byte, and a returned picture carried
whatever the caller had left there. Name it isDiscardedFrame, as
SharpProspero and KytyPS5 do, and set it to 0 when a picture is
returned; a result without a picture leaves it as the caller set it.

Co-Authored-By: Claude <[email protected]>
2026-10-25 20:03:05 +07:00
boykopovar f38d29fd08 refactor(sdk): add canonical headers for remaining libraries 2026-10-24 23:17:42 +03:00
3mro777o e036b873ee fix(libSceVdecsw): report the HEVC picture bit depth
Videodec2 now outputs 10-bit HEVC Main 10 frames, so the HEVC picture info
takes bitDepthLumaMinus8 and bitDepthChromaMinus8 from the decoded frame
instead of leaving them 0. The Main 10 stream moves to HevcFixture.hpp so the
Vdecsw test can decode it.
2026-10-22 22:16:55 +02:00
3mro777o 3aee4b3b09 feat(libSceVdecsw): implement sceVdecswGetHevcPictureInfo
Vdecsw read every decoded picture's info through Videodec2's AVC picture
info, which throws for HEVC, so an HEVC decoder failed on its first
picture. Videodec2 now hands Vdecsw a codec-independent picture header,
records whether an HEVC access unit starts with an IDR slice, and Vdecsw
keeps the AVC or the 0xb8-byte HEVC picture info for each picture.

The HEVC test stream moves to HevcFixture.hpp so the Vdecsw test can
decode it.
2026-10-22 22:16:36 +02:00
Dean 44602d61df Merge pull request #8660 from JJenkx/fix/videodec2-flush-without-pending
fix(libSceVideodec2): flush without draining when no picture is pending
2026-10-23 08:54:24 +13:00
Dean b786b907c8 Merge pull request #8113 from Nixitov/feat/videodec2-init-library
feat(libSceVideodec2): declare sceVideodec2InitLibrary
2026-10-23 02:22:58 +13:00
JJenkxandClaude Opus 5.5 28d9f26bdd fix(libSceVideodec2): flush without draining when no picture is pending
sceVideodec2Flush drained libavcodec with an empty packet whenever the decoder
was not already flushing, and the next sceVideodec2Decode then restarted the
decoder with avcodec_flush_buffers, dropping its reference pictures. A caller
that flushes after every access unit, as Sony's PSP emulator does for its
H.264 movies, lost every P picture after the first: libavcodec withholds
pictures after a restart until it reaches a keyframe, so Daxter (PPSA09695)
got 8 pictures from 459 access units and showed a black screen ("Failed to
obtain a video frame") instead of its intro movie.

Flush now drains only when a decoded access unit has not produced its picture
yet. With nothing pending there is nothing to return, and the decoder keeps its
references for the units that follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 02:01:36 -04:00
Dean d430e40b50 Merge pull request #8122 from YossiYad/fix/videodec2-empty-access-unit
fix(libSceVideodec2): return access unit errors for a null or empty access unit
2026-10-22 18:53:34 +13:00
Nixitov 4bd46aa9ef feat(libSceVideodec2): declare sceVideodec2InitLibrary
AI-assisted: yes
2026-10-21 18:01:44 +02:00
David abe827df20 Merge remote-tracking branch 'origin/main' into feat/videodec2-unimplemented-exports
# Conflicts:
#	docs/dev/debt/libSceVideodec2.md
2026-10-21 12:41:51 +04:00
JJenkxandClaude Opus 5.5 844372448b fix(libSceVideodec2): answer the generic picture query for VP9 pictures
sceVideodec2GetPictureInfo writes the decoder's own picture layout. For a
VP9 decoder it now writes the 88-byte VP9 layout that
sceVideodec2GetVp9PictureInfo returns, instead of throwing. Mortal Shell 2
(PPSA34008) calls the generic query with that structure for its intro
movie. HEVC pictures still throw.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 22:11:22 -04:00
Dean 4a7fd7fa4a Merge pull request #7778 from YossiYad/fix/videodec2-avcc-length-startcode
fix(libSceVideodec2): frame an access unit whose length prefix looks like a start code
2026-10-20 15:52:57 +13:00
Yossi Yadgar 9664503056 fix(libSceVideodec2): return access unit errors for a null or empty access unit
sceVideodec2Decode threw for these, which ended the title. Media Player Classic PS5 submits an empty unit when its own converter misreads a length prefix as a start code, and it counts the error and keeps playing on a console.
2026-10-20 01:39:53 +03:00
David 5032fa60f5 test(libSceVideodec2): check that the thirteen exports report not implemented 2026-10-20 02:20:55 +04:00
David b2ce42ff1a feat(libSceVideodec2): export the decoder preset and HEVC functions as not implemented 2026-10-20 02:18:32 +04:00
David 2534c106c6 feat(libSceVideodec2): export the library and memory functions as not implemented 2026-10-20 02:16:23 +04:00
Adrià 8d5d4df966 Merge pull request #7181 from milescoviello/fix/videodec2-empty-parameter-sets
fix(libSceVideodec2): skip the parameter-set copy when there are none
2026-10-19 19:46:41 +02:00
Yossi Yadgar f4f471f415 fix(libSceVideodec2): settle an access unit that reads as both Annex-B and AVCC
A unit opening with 00 00 01 xx can also tile as AVCC when its first NAL
is 0x1xx bytes long, in either direction. Annex-B requires a zero_byte
before the first NAL of an access unit, so a unit opening with a 3-byte
start code is taken as AVCC unless the decoder has already seen
unambiguous Annex-B units that open that way. A unit opening with
00 00 00 01 that also tiles keeps the framing of the last unambiguous unit,
Annex-B when there is none.

Media Player Classic PS5 sends Annex-B units with 4-byte start codes and
leaves exactly the colliding samples in AVCC, so the decoder's last framing
alone would choose wrong there.
2026-10-19 13:53:35 +03:00
Yossi Yadgar eb4d64a3b0 fix(libSceVideodec2): frame an access unit whose length prefix looks like a start code 2026-10-19 13:01:57 +03:00
john.maiaandClaude Opus 5.5 beba5fad03 feat(libSceVideodec2): output 10-bit pictures as low-bit 16-bit words
A picture deeper than 8 bits threw ("output deeper than 8 bits is not
implemented"), which stops Mortalfin (PPSA99141) as soon as it plays an HEVC
Main10 video (#6640).

A 10-bit picture is now written as 16-bit little-endian words with the sample
in the low 10 bits: Y rows, then interleaved UV rows at framePitchInBytes
times the height. framePitch is in samples and framePitchInBytes in bytes
(twice the width, aligned to 256). QueryDecoderMemoryInfo sizes a frame of an
HEVC or VP9 profile 2 configuration with two bytes per sample.

The layout and sizes follow EVO-PLAYER-PS5, which decodes and presents 1080p
HEVC Main10 on hardware through this path: its 10-bit check
(pitch_bytes >= pitch * 2), its UV offset, its low-bit sampling factor, and
the 1920x1088 Main10 frame buffer its hardware log reports (6128 KB after
rounding to 16 KiB).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 09:58:14 +02:00
thuanquangandClaude Opus 5.5 e1341df3b9 fix(libSceVideodec2): decode after a flush without a reset
sceVideodec2Decode threw when it followed sceVideodec2Flush without
sceVideodec2Reset. It now resets FFmpeg's drained decoder and decodes the
unit, keeping the pictures the flush has not returned yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-18 02:42:34 +07:00
milescovielloandClaude Opus 5.5 8a6b022d89 fix(libSceVideodec2): skip the parameter-set copy when there are none
sceVideodec2Decode copied decoder.parameterSets into the packet before
the access unit, also when no parameter sets were pending. An empty
std::vector's data() may be null, and memcpy with a null source is
undefined even for zero bytes. A UBSan build reports it in
guest_videodec2 and guest_vdecsw.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-17 15:13:28 +00:00
Adrià b7cedd900d Merge pull request #5803 from YossiYad/fix/videodec2-avc-parameter-sets
fix(libSceVideodec2): hold an AVC unit of parameter sets for the next slice
2026-10-15 20:18:10 +02:00
RickandClaude Opus 5.5 6fd0e33431 fix(libSceVideodec2): report the coded picture size
Decode and Flush let FFmpeg crop every picture to its display size, so a
1080p H.264 stream came out as 1920x1080 with the chroma after 1080 luma
rows. The console reports and writes the coded picture: EVO-PLAYER-PS5's
hardware run of a 1080p H.264 IDR returned 1920x1088 with pitch 2048 and
the chroma after the 1088 luma rows, and ProsperoLight rejects a 1080p
H.264 or HEVC picture whose height is not 1088. FFmpeg's cropping is now
off, so the frame size, the chroma offset and the sizes in the AVC
picture info are those of the coded picture. The pitch is unchanged, and
the frame size QueryDecoderMemoryInfo reports, which aligns the maximum
height to 32 rows, still holds a picture coded within the maximum and the
macroblock-padded H.264 picture of a maximum given as the display size.

libSceVdecsw derived its crop offsets from the difference between that
size and the macroblock grid, which is now zero. It takes the crop FFmpeg
exports for the picture from libSceVideodec2 instead.

The H.264 fixture is coded at 64x48 with frame_crop_bottom_offset 4: its
pictures are checked at 64x48 and the crop through Vdecsw. The HEVC and
VP9 fixtures are coded at 64x40 and keep their hashes. The new hashes come
from FFmpeg 8.1 decoding with apply_cropping 0, hashed as the tests do;
the same method reproduces every previous H.264, HEVC and VP9 hash.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-14 19:39:34 +02:00
Yossi Yadgar 102db2e1a4 fix(libSceVideodec2): hold an AVC unit of parameter sets for the next slice
Twispero (PPSA99474) plays a Twitch stream through its own FFmpeg demuxer
and submits the H.264 sequence and picture parameter sets as an access
unit of their own, before the first slices. libavcodec rejects a packet
with parameter sets and no slice (h264 "no frame!", AVERROR_INVALIDDATA,
with or without AV_EF_EXPLODE), so sceVideodec2Decode threw "packet
submission failed" and the title stopped as soon as a stream was opened.

A unit without a slice NAL (types 1 to 5) is now kept on the decoder and
put in front of the next unit that has one, and the call returns with no
picture. sceVideodec2Reset drops what is kept.
2026-10-14 17:41:51 +03:00
JJenkx fecba5fafd feat(videodec2): retain VP9 picture metadata 2026-10-12 15:10:59 -04:00
muhzain05andClaude Opus 5.5 48919d01e4 fix(videodec2): answer picture info from the decoder that last wrote the buffer
sceVideodec2GetPictureInfo searched the live decoders in handle order and
returned the first one that had ever written the queried frame buffer. When
two decoders wrote the same address, the lower handle answered with stale
timestamps, a stale AVC decoder answered for an HEVC or VP9 picture, a stale
HEVC or VP9 decoder made an AVC query throw, and resetting or deleting the
decoder that wrote the buffer last exposed the older decoder's picture again.

Record the decoder that last published a picture into each frame buffer and
answer from that decoder only. Reset and Delete drop only the decoder's own
records, so another decoder's picture is never removed or brought back.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 04:06:54 -06:00
john.maiaandClaude Opus 5.5 f5293b64d2 feat(libSceVideodec2): decode HEVC and VP9
EVO-PLAYER (PPSA99039) creates resident AVC, HEVC and VP9 decoders at
start-up, and stopped at "Videodec2: unsupported codec" on the HEVC one.
Codec types 974921 (HEVC) and 2382845 (VP9) now open FFmpeg's HEVC and
VP9 decoders. HEVC input goes through the same Annex B conversion as
H.264 and VP9 frames are passed through; output stays 8-bit NV12, and a
frame deeper than 8 bits throws. Picture info throws for HEVC and VP9,
whose layouts differ from the AVC one.

Assisted by Claude Code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DwFnKjMxmwGDWiuYYf1v4D
2026-10-09 01:27:15 +01:00
Claude 121d9332b5 build(libs): strip the MinGW static runtime flags once for all libraries
Every library CMakeLists.txt ended with the same block removing -static,
-static-libgcc and -static-libstdc++ from CMAKE_EXE_LINKER_FLAGS on MinGW,
because core/libs/CMakeLists.txt only removed them after adding the library
directories. Remove them before the libc and library directories are added
so each directory inherits the stripped flags, and drop the 52 copies.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017pTZqAyVSZy2FZmaqakPHZ
2026-10-07 10:10:38 +00:00
Adrià FranchandClaude 803f1b0e71 feat(videodec2): implement sceVideodec2GetAvcPictureInfo
Co-Authored-By: Claude <[email protected]>
2026-10-06 14:11:24 +02:00
boykopovar 61ba4d661a refactor(cmake): place all test executables in build tests directory 2026-10-01 12:28:06 +03:00
boykopovar b22ede6c93 refactor(cmake): move some libs test definitions to local cmakelists 2026-10-01 12:21:46 +03:00
boykopovar 1e1f0562c6 refactor(videodec2): use shared ffmpeg-core submodule + remove black fallbacks 2026-09-30 17:41:49 +03:00
PacukaandClaude Opus 5.5 7ac2468621 build(videodec2): leave FFmpeg off by default on Windows
FFmpeg's configure runs in the found sh and writes MSYS paths into its
Makefile, which a native MinGW make cannot open (Windows CI: "No rule to
make target '/d/a/.../3rdparty/FFmpeg/Makefile'"). Windows builds keep
the black-picture fallback unless ANYPS5_ENABLE_FFMPEG=ON is set in an
MSYS2 environment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-30 17:31:00 +03:00
PacukaandClaude Opus 5.5 62cb92716a build(videodec2): build FFmpeg from a pinned submodule
Add FFmpeg n9.0.2 as the 3rdparty/FFmpeg submodule (shallow) and build
it with ExternalProject_Add through its own configure and make, instead
of using the system libraries from pkg-config.

Only avcodec, avutil and swscale are built, with the H.264 decoder as
the single component (--disable-everything, --disable-autodetect), as
static PIC archives linked into libSceVideodec2.prx with
--exclude-libs,ALL. Without nasm the x86 assembly is disabled.
ANYPS5_ENABLE_FFMPEG=OFF, or a missing sh/make, keeps the black-picture
fallback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-30 17:31:00 +03:00
PacukaandClaude Opus 5.5 a38ef6132f feat(videodec2): decode H.264 with FFmpeg
Adds libSceVideodec2. Access units (Annex B, or length-prefixed rewritten to
Annex B) are decoded by FFmpeg's H.264 decoder into the title's NV12 frame
buffers (256-byte pitch, chroma after the visible luma rows). Decode hands
out at most one picture per call, Flush drains the reordered ones, Reset
clears the decoder; timestamps and attached data travel with the picture.
FFmpeg is found through pkg-config and is optional: without it the decoders
return black pictures. guest_videodec2_tests checks the pictures of an
embedded stream against reference hashes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-30 17:30:58 +03:00