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 <noreply@anthropic.com>
4.1 KiB
libSceVideodec2 technical debt
Unknown function info
- sceVideodec2GetAvcPictureInfo (libSceVideodec2) - runs the
sceVideodec2GetPictureInfobody (KytyPS5 binds both NIDs to one function; SharpProspero gives both the sameoutputInfo, first, secondsignature); the second (bottom field) picture info is never written, since only progressive H.264 output is modelled. prosper calls the AVC layout unestablished (no title observed calling it)
Functional
-
AVC parameter-set units (libSceVideodec2) - an H.264 access unit with no slice NAL (types 1 to 5), such as the sequence and picture parameter sets Twispero (PPSA99474) submits on their own before a stream's first slices, is kept and put in front of the next unit that has a slice, and
sceVideodec2Decodereturns 0 with no picture for it, since libavcodec refuses a packet without a slice. What the console returns for such a unit is not known. HEVC units of parameter sets alone are still passed to libavcodec as they are -
sceVideodec2CreateDecoder (libSceVideodec2) decodes HEVC (codec type 974921) and VP9 (2382845) through FFmpeg, besides H.264. The tags come from SharpProspero's
Videodec2CodecTypeand EVO-PLAYER-PS5'ssce_videodec2.h, which records them from hardware runs. HEVC input is converted from length-prefixed NAL units to Annex B as for H.264, and VP9 frames are passed through. Output is the same 8-bit NV12 for every codec; a decoder for HEVC Main10 or VP9 Profile 2 is created, but a frame deeper than 8 bits throws, since the console's 10-bit output layout is unknown, andQueryDecoderMemoryInforeports the 8-bit frame size for it.sceVideodec2GetPictureInfoandsceVideodec2GetAvcPictureInfothrow for HEVC and VP9 pictures, which use other layouts (SceVideodec2HevcPictureInfo,SceVideodec2Vp9PictureInfo), andsceVideodec2GetHevcPictureInfois not exported;sceVideodec2GetVp9PictureInfohas its own VP9 layout -
sceVideodec2GetVp9PictureInfo uses the 88-byte layout and two-pointer signature from SharpProspero Videodec2.cs. Frame metadata follows the VP9 specification, sections 5.26 and 6.2: profile, key/intra-only flags, bit depth, color space/range, coded/render dimensions and superframe count are retained per emitted buffer. Level is 0 because the elementary stream does not signal a level; the console value is unverified. Null pointers, undersized structures and querying another codec throw; console error codes and support for other structure sizes are unknown. Existing NV12 output rejects pictures deeper than 8 bits. Superframes are submitted as individual coded frames to keep each output associated with its input metadata.
-
sceVideodec2Decode after sceVideodec2Flush (libSceVideodec2) without
sceVideodec2Resetrestarts FFmpeg's decoder (avcodec_flush_buffers) and decodes the unit, where it threw before. TEKKEN DARK RESURRECTION (PPSA31371), which runs in Sony's PSP emulator, decodes after a flush without a reset (#7118), so the console accepts the call. Pictures the flush decoded but has not returned yet are returned before the new ones. What the console returns for them, and for a stream that continues across the flush without a new IDR picture, is not measured. -
sceVideodec2Decode (libSceVideodec2) and
sceVideodec2Flushoutput the coded picture, with the chroma plane after its luma rows, as the console does for 1080p H.264 and HEVC streams coded at 1920x1088. An HEVC or VP9 picture whose size is not a multiple of 16, such as HEVC coded at 1920x1080, is output at that size; whether the console pads it is unverified.sceVideodec2GetPictureInforeports no frame cropping