feat(libSceVideodec2): expose HEVC picture metadata #10959
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10959"
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 AZLisme on 2026-10-25T11:21:28Z.
What
Implement HEVC picture metadata from actual decoded-frame snapshots through the typed and generic getters, using the 184-byte, 75-field ABI from pinned SharpProspero. Parameter sets, VUI, profile/level, timing and presence flags follow the existing H.265 parser; delayed/flush pictures retain their own timestamps and metadata.
All four named picture getters now share the ordered argument contract reported by the firmware 13.42 emulator checks and the unsigned-size clarification. A null first destination returns
0x811D0102without touching the second. Otherwise both early four-byte validity/padding writes are guarded before either store, followed by the native pointer, structure-size, alignment, count and unsignedframeBufferSize > pictureCount * 0x400checks. Destination versions are checked afterward; the second version is read only for two pictures with a non-null second destination. Later reads observe aliases, and metadata reads/copies support unaligned destinations.Payload selection uses the owned decoded frame, without treating the caller's
codecTypeas an argument gate. Known single-picture HEVC184 and VP9 88 metadata remain supported with bounded whole-record write guards; H264 decode and pixel ordering are retained. The partial 56-byte AVC record receives the native structure-size error after the earlier checks. Other accepted payload versions, full native AVC tails, two-picture projections and foreign/untracked metadata remain explicitNotImplementedpaths in debt. The unnamed skip-size export is unchanged. No third-party dependency was added.#10913 merged as
8ebd28b1c6149bf87762463e60fc1c70bbbec0fd, fulfilling the agreed first landing. This PR’s preserving rebase6721b44a95ecbca7d58389242546a217dde317f7on74acfad65b3f0fd4eab653f3a3989d298fba1157retains the parent implementation, canonical API, active regression and debt alongside the owned metadata/caller changes. The declared #10913 dependency remains as fulfilled landing history; applicable new-head CI and maintainer re-review still gate this PR.The internal caller fix in
e27f5dbfea4415bdb3a170f5269e398e755a67c4keeps host-owned metadata retrieval separate from the guest argument contract.libSceVideodecDecode/Flush read PTS, attached data and crop from their emitted owned frame through the typed internal header helper.libSceVdecswretrieves the full 88-byte VP9 snapshot through a handle-and-buffer lookup with decoder/codec ownership checks, retaining the queued pixels until metadata is copied. A shared internal header replaces duplicate type declarations. The guest getter validation, payload selection, write guards, public API headers and unknown-payload throws are unchanged; the partial 56-byte AVC record is still rejected by the guest API. The existing AVC fixture now also checks attached-data association in display order.Internal snapshot cleanup now removes the unused crop accessor while retaining the shared crop type, normalizes the full typed VP9 snapshot size without reading destination capacity or changing the parser/cache, and removes the unreachable Vdecsw post-helper validity check. Handle, codec, buffer-ownership and parsing errors remain enforced; the public guest getter contract is unchanged.
Tested
Manual CI
40451431817, attempt 1, completed successfully for the ordered five-PR composition #109596721b44a95→ #10467bcd99084b4→ #1123508fa661766→ #114896ad4710217→ #11403758952517c, on frozen mainf5e3dc5e3b8202f7c214a224f4ac37c91181244a. This PR’s tested head is6721b44a95ecbca7d58389242546a217dde317f7.122014900395122014900488Both jobs passed
guest_hevc_metadata,guest_videodec,guest_videodec2,guest_videodec2_unimplemented,guest_vdecsw, all 65 public-header CTests andpatched_libraries; both skip validators passed. This qualifies the recorded five-PR Release composition, not this PR alone, later main, library-ASan or physical-console behavior. #10913’s actual first landing remains fulfilled; existing dependency/integration/review requirements are unchanged. Earlier entries retain their original scopes; the four-test contributor report below does not supplyguest_vdecswevidence.Contributor Windows report: BunnyFl reports exact head
6721b44a95ecbca7d58389242546a217dde317f7merged with main74acfad65b3f0fd4eab653f3a3989d298fba1157, on Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release,BUILD_TESTING=ON.guest_hevc_metadata,guest_videodec,guest_videodec2andguest_videodec2_unimplementedeach passed threectest -Vruns. This report covers those four tests and that composition. Applicable full CI and maintainer re-review remain required.Linux x86-64, Release, exact preserving head
6721b44a95ecbca7d58389242546a217dde317f7on frozen main74acfad65b3f0fd4eab653f3a3989d298fba1157, after #10913’s actual merge. The normal root CMake build and five existing decoder CTests pass 5/5, with zero failures/skips. The inherited discarded-frame flag regression and its active main invocation remain withinguest_videodec2; the parent APIs, fixture and debt are preserved.Fresh normal public-header checks pass 65/65 (691 compilation groups, 368 libraries / 12,368 exports), plus 7/7 focused C++ header units. The build produced 197 fresh objects: 153 required libc/kernel core, 34 vendor, five decoder and five fixture objects. The qualified artifacts are five PRXs, five fixture binaries and two fresh static archives.
Source/dependency inputs, generated artifacts and linkage were checked against the frozen source. The existing pinned source-built FFmpeg package and six linked FFmpeg archives were reverified and reused. One normal-root execution exited 0; no runtime repeat or old baseline rerun was needed. These results qualify this Linux decoder component only. New-head Windows, macOS, PS5, GPU and full-product CI were not run; older platform/full-CI results below retain their original scopes.
Earlier entries below retain their original source/base/platform scopes and former landing-status statements; they do not qualify this new head.
Earlier preserving rebase:
945cbaeb502b8e6f46c1f7820f41dc666b2303feonto exact mainf89559b4723285ee0f9d041d207408193fe85764. The only manual conflict was debt: the upstream #10091 PPSA02225 observation is retained verbatim once alongside all current gaps, without restoring obsolete HEVC-unimplemented claims. Production/test changes compose automatically; upstream’s generic Vdecsw getter and expanded cases are preserved, as are the native argument/ownership contract, typed VP9 snapshot and caller fixes. Fresh Linux GCC 16.2.1 Release builds of all three decoder PRXs and supporting libc/kernel/LibcInternal pass 5/5 focused tests with no skips, including upstream generic Vdecsw coverage. All 294 actual source/header inputs match the new head, including 274 core inputs matching the frozen base; 175 fresh objects and 11 artifacts are qualified. Existing pinned source-built FFmpeg/static dependencies were reverified and reused. Seven header units and the 368-library/12,234-export audit pass; conventions, whitespace and independent source-preservation review pass. This is new-head Linux component qualification; Windows and full maintainer CI have not been rerun for this rebase. The full run below qualifies its earlier e767/01cd batch only. #10913 remains first, followed by a preserving integration rebase and applicable checks/re-review.Earlier maintainer full Linux/Windows CI: run 40308797242, attempt 1 succeeded for exact
e7674114368f31cd341d4f43d6a2760529935d16in the ordered batch #9097, #11100, #10426, #10836, #10959 merged onto main01cd4a42df1359bfe568b03f967af487381ff61e, with each PR head checked before merging. Normal root Release builds and all five focused metadata/decoder/caller tests passed once on each platform, as did the public-header audit and all 64 header-compilation shards (65 header checks per platform); none of those focused or header checks skipped. Linux GCC 13.3.0 recorded 2,265 executed passes and 91 expected device-limit skips; Windows Server 2025 with WinLibs GCC 15.2.0 r7 recorded 1,649 passes and 811 expected GPU/display skips. Both skip validators passed. The overall run completed with six successful jobs and two conditional jobs skipped. This qualifies that exact batch/base, not latest main, macOS library runtime, or an updated #10913 composition. #10913 must still land first, followed by the preserving rebase and applicable checks/re-review.Earlier cleanup revision:
e7674114368f31cd341d4f43d6a2760529935d16, addressing the three internal findings. All 5/5 focused Linux tests pass through fresh builds of the three production decoder PRXs and five fixtures; 27 actual project inputs, 10 objects and eight binaries are bound to the commit with qualified frozen-401731067856core/static and pinned source-built FFmpeg dependencies. Two focused internal/shared-header composition units pass. The real VP9 fixture verifies canonical snapshot size, a trailing canary, all metadata fields and independently expected frame/timestamp/attachment associations. A single run of that new fixture against the exact qualified old83940ae6backend fails at the new size/boundary assertion; loader traces bind the old binary, and the unchanged layout plus cached-zero source establish the size-field cause. Independent source/runtime review passes. Conventions, whitespace and a static merge pass against main4e43321bd6ceccdc1ae28568bbbc35d9a6446464. Those isolated checks are Linux component qualification, separate from the maintainer batch above; they do not themselves qualify newer-main runtime or a new #10913 composition. The #10913-first landing and later preserving rebase/checks remain required.thuanquang separately confirms the earlier E27 caller fix: exact
e27f5dbfeamerged onto main14c99b52ac, Windows 11 26200, WinLibs GCC 15.2.0 r7 Release, all five focused tests in three rounds with no skips. That contributor report qualifies its exact earlier head/main/toolchain; Windows execution of the cleanup is established separately by the maintainer batch above.Earlier test-only revision:
83940ae67e6aa2318fa984897123f1d80a96983c, following the review request. Unknown-SEI and replacement-metadata projections no longer have to throw. The sibling generic unknown-SEI probe is optional too, so it cannot retain the same placeholder requirement. Exception-only byte guards remain, with fresh sentinels for each wrapper; defined native argument/read-only checks and all decode/reset/lifetime/metadata-immutability checks remain strict. OnlyGuestHevcMetadata.cppchanged, and the entire production PRX tree is identical to E27. All 5/5 focused Linux tests pass with no skips after fresh builds of the three actual production PRXs and five fixtures (10 fresh translation units, 27 Git-bound inputs; only the HEVC fixture input differs from E27). Qualified frozen-401731067856core/static and pinned source-built FFmpeg inputs were reverified. Independent source/runtime-evidence review passes. Conventions, whitespace and a static merge pass against main14c99b52ace303eef1667764670d1d1540140b3d. Headers are unchanged and retain their earlier audit scope. This is Linux component qualification; earlier E27 Windows and private #10913 results remain historical to their exact fixtures, not executions of this revised fixture. #10913 still lands first, followed by the preserving rebase and focused checks.Earlier caller-fix revision follows.
Earlier fixed revision:
e27f5dbfea4415bdb3a170f5269e398e755a67c4. The broader Linux check reproduces thuanquang's internal-caller regression report: unmodified D6 (d6fd16ec67d3) passes only 3/5 tests, withguest_videodecfailing “pictures out of display order” andguest_vdecswfailing “decoded picture has no VP9 picture info” under normal allocation. The fixed revision passes 5/5:guest_hevc_metadata,guest_videodec2,guest_videodec2_unimplemented,guest_videodecandguest_vdecsw. The original three-test scope missed these two internal callers.Linux x86-64, GCC 16.2.1, Release: all three actual modules (
libSceVideodec2,libSceVideodec,libSceVdecsw) and their five existing fixtures were built through their normal module CMake. The fixed build's 27 project inputs match the committed source; the reused runtime dependencies are qualified against frozen401731067856, including 270 core source/header inputs and 78 static-library inputs. Existing pinned source-built FFmpeg archives were reused after checking the 32 actual transitive headers and all seven archive hashes. This is isolated component validation, not newer-main or full-product runtime qualification.The expanded fixtures cover Decode/Flush display order, PTS and attached-data association for normal and cropped AVC, plus full VP9 timestamps, flags, dimensions, old-picture lifetime and reset behavior. All seven header composition units pass, including the three API headers, three umbrellas and their shared internal header; the public-header audit passes for 368 libraries/12,192 exports. Conventions and whitespace checks pass against refreshed main
9b197b6ce4583e64bf2427e6beb7270bcfa1528e; a static merge with that main is clean. This is a static check, separate from the frozen-base runtime qualification. Independent source/qualified-Linux peer review passes. The change comprises the three implementation files, one typed internal header and three added lines in the existing AVC fixture; it does not change guest APIs or the native argument contract.Paired native Windows validation now confirms the caller fix. In baseline run 40269232821, attempt 1, D6 passes three tests and fails
guest_videodec(display order) andguest_vdecsw(missing VP9 metadata) in both five-test runs; both CTest exits are 8 and the job remains failed. In fixed run 40270056504, attempt 1, E27 passes all five tests twice with no skips, both exits 0. Normal root Release configuration built all three production modules, libc/kernel and the five fixtures. The downloaded JUnit/log pairs, actual compile/link commands, artifact digests and source guards pass independent review: workflow-only740b6768has D6 as its sole parent, and7930b601has E27 as its sole parent. The fixedGuestVideodecfixture adds only three lines for attachment/display-order checking; the other four fixtures are byte-identical. Both separate hosted jobs report Windows Server 2025 / image20261021.278.1, MSYS2 UCRT64 GCC/G++ 16.2.0, CMake 4.4.4 and Release. Matching recorded versions do not establish the same physical host or compiler-binary hashes. This qualifies the exact D6 and E27 source trees with their runtime base at401731067856, not the reporter's WinLibs setup, other main revisions, an E27/#10913 composition, full-product behavior or physical PS5 execution.An updated private Linux composition now covers E27 and #10913
294ab651deabaa45146d16341a77f19378807160: true two-parent merge1dda4553d9b06abff5319a19dd05e5b9829de1c4, tree2dd45d9cf15f023f43d2322b249a27bb32c56e20. The only manual resolution combines both debt entries. It preserves the predecessor’s discarded-frame flag and active fixture checks, E27’s caller metadata/header changes and attachment-order assertion, and the unchanged public guest getter contract. Fresh builds of all three production PRXs and all five fixtures pass 5/5 with no skips; seven header units and the 368-library/12,192-export audit pass. All 4,497 tracked source files match the private Git tree; 27 actual project inputs, 10 fresh objects, eight binaries and the normal module CMake/helper paths are qualified, with independent source/runtime-evidence review passing. Existing core/runtime at401731067856and pinned source-built FFmpeg dependencies were reverified and reused. This is separate from standalone E27 Windows validation: the private union was not run on Windows, newer main or a physical console. #10913 must still land first, followed by the integration rebase and focused checks.Historical D6 evidence follows. Its three-test Linux and Windows results remain evidence for those three fixtures at D6, not validation of E27 or of the two newly included caller fixtures. The earlier private D6/#10913 composition likewise does not validate an E27/#10913 union; that integration still requires a rebase and focused checks after #10913 lands.
Contributor fix confirmation: wachi35676 reran exact head
d6fd16ec67d3merged onto main0f34ebb85on Windows with WinLibs GCC 15.2.0, Release.guest_hevc_metadata,guest_videodec2andguest_videodec2_unimplementedpassed all three runs. The reporter also observed no build warnings and confirmed theNOMINMAXredefinition was gone. This is attributed confirmation in the reporter's environment, separate from our exact-source MSYS2 CI below; it does not validate other main revisions, the private #10913 composition, full-product behavior or PS5 execution.Historical revision:
d6fd16ec67d3860984f3bbe746c2ce5a32930d20. Linux x86-64 Release with GCC 16.2.1; the actual library and all three focused fixtures were rebuilt through the module CMake. All 3/3 tests passed:Command:
ctest --test-dir build-post10005 --output-on-failure -Vin the isolated module build. Coverage includes all four wrappers, error precedence, exact early writes/canaries, aliases, both picture-count size boundaries, unsigned high-bit sizes, conditional second-version reads, real mapped guest writes, unaligned metadata, actual owned HEVC/VP9 projection, ownership/concurrency/lifetime, and H264 decode/NV12 pixel order. These historical results predate the latest optional SEI/replacement-probe changes described above.This run uses the branch's frozen
401731067856core: 164 compiled objects and 270 project source/header inputs were checked against that base and the final view; core artifact hashes and pinned third-party archive/source inputs were rechecked. Existing pinned source-built FFmpeg 7.1.1 archives were reused after checking 32 transitive headers and all seven archive hashes; FFmpeg was not rebuilt locally. The complete actual module/fixture input set matches the committed source. This is isolated module validation, without a packaged or NID-patched full-product claim.Public-header audit passes for 368 libraries/12,192 exports; three standalone header composition units compile with
-Werror. Conventions and committed whitespace checks pass with zero findings, and independent source/qualified-runtime peer review passes. The historical D6 revision merges cleanly with refreshedmainat0f34ebb85391, which is a static integration check rather than a current-main runtime run.The Windows report on the preceding
ab8a8e6f1018head by @wachi35676 covers its merge onto main90f918fa7, WinLibs GCC 15.2.0 Release:guest_videodec2andguest_videodec2_unimplementedpassed, whileguest_hevc_metadatafailed twice before any HEVC call becauseVirtualProtectcrossed separately mapped GuestArena views (ERROR_INVALID_ADDRESS, 487). The D6 fixture revision bounds each protection call to the committed region returned byVirtualQueryand guards the Windows macro definitions. The shared mapping, tracked permissions and all rejection/alias tests remain intact; production getter behavior is unchanged. A private source-extracted Win32 API model reproduces the old failure and passes seven boundary/failure cases with the fix. That model runs on Linux; actual Windows execution of D6 is recorded below.Historical D6 native Windows validation passed in run 40262980830, attempt 1: Windows Server 2025 Datacenter 10.0.26100, MSYS2 UCRT64 GCC/G++ 16.2.0, CMake 4.4.4, Ninja 1.13.2, Release. CI commit
2421b35868d7e0374c7c01d75ed05a8d47e1b290has this publishedd6fd16ec67d3860984f3bbe746c2ce5a32930d20as its sole parent and adds only the isolated workflow; the on-run provenance check verifies identical core/build inputs. The normal production module and core dependencies were built, and all 3/3 focused tests passed twice, with zero skips. Downloaded JUnit, both execution records per test, actual compile/link commands and normal Windows unwind/PATH helpers were checked; this includes the shared-view read-only and cross-boundary rejection cases. The normal pinned FFmpeg archives were downloaded, not rebuilt from source in this run. This qualifies the exact D6 sources on this Windows toolchain; it is not the reporter's WinLibs 15.2.0 environment or a newer-main/#10913 composition run.Historical private integration with #10913
294ab651deaband the D6d6fd16ec67d3head passed all 3/3 focused Linux tests, including the discarded-frame regression and the metadata/argument tests, at two-parent compositionb507a381fccca6992b235f10f2389ada231d3f32. Both histories and all source/test additions are preserved; only the debt append needed manual union, retaining both topics. The actual module and fixtures were freshly built using source-qualified frozen401731067856core dependencies and the pinned static packages described above; their actual inputs/artifact hashes, headers and static checks pass independent peer review. This private composition is not a current-main runtime or Windows result. The #10913-first landing order remains unchanged; this private composition is Linux-only.The native argument evidence is BunnyFl's firmware 13.42 native-code emulator report in PS5-process mode (module SHA256
5825514d06cee0b7fdc87de4f428065ff7c2b761b40443f95ee580e1be18776d); those native runs were not independently reproduced here. Native valid-metadata field equivalence, other firmware/process modes, physical PS5 hardware, macOS library runtime and packaged application/full-product runtime behavior remain unvalidated by these checks. The earlier-head Windows results are attributed above; the historical isolated native Windows result covers the exact D6 sources and Windows read-only cases, not E27. The private #10913 composition and other main combinations remain without Windows runtime proof here; the contributor confirmation is limited to the exact head/main pair stated above. The completed maintainer full Linux/Windows CI above covers its recorded batch only; the head resulting from the #10913-first integration rebase still needs applicable checks and maintainer re-review.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T12:07:44Z.
Review: CHANGES_REQUESTED
There are two issues to address before this is ready:
GuestArena::HostWriteand then write without checkingOpen()(in the generic HEVC branch aroundGetPictureInfo, the new typed getter, and their invalid-picture fallbacks). On Windows, the guard returns false for a read-only guest mapping; these paths still assign the structure/isValidand can fault instead of reporting the failed guest write. Please handle the failed open before mutating output, and add a regression using a valid read-only guest view for the typed getter and generic HEVC getter.git diff --check upstream/main...refs/review/10959reports a new blank line at EOF incore/libs/tests/GuestHevcMetadata.cpp:399; please remove it so the local whitespace check passes.I inspected the parser and ABI integration, including bounded RBSP/SEI reads, VPS/SPS/PPS selection, picture association, delayed output storage and typed-vs-generic getter behavior. Hosted eligibility, intake, conventions, labels and report checks pass; product build jobs were skipped. The author reports 3/3 focused Linux tests, but I have not independently run them. This review is limited by the two concrete issues above.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T13:25:35Z.
Review: APPROVED
Reviewed exact updated head
58e86995e54a9c7d77d7a2c0ef38c5e5b304b3ea. The generic and typed HEVC metadata paths now checkHostWrite::Open()before copying a valid structure or changingisValid; refusal follows the existing unsupported path. The added guest-arena test checks mapped output values, canaries, write-watch reporting, invalid-picture fallback writes, and (on Windows) a structure spanning into a read-only view with no partial output mutation. The trailing whitespace issue is also removed.I ran
python3 tools/check_conventions.py --base upstream/main --head HEADandgit diff --check upstream/main...HEAD; both pass. The author reports a clean library build and three focused Linux runtime tests with write-watch coverage. Windows rejection tests are present but were not run on the author's Linux host; hosted product CI is skipped. The two requested issues are addressed, with no remaining blocker found in scope.