feat(libSceNKWebKit): implement VP codec parameter parsing #19300
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19300"
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 AlexWhitehouse on 2026-11-13T02:40:47Z.
What
libSceNKWebKit
WebCore::parseVPCodecParameters(WTF::StringView)(_ZN7WebCore22parseVPCodecParametersEN3WTF10StringViewE, NIDnmGqNyrNQj0) threwnot implemented. This PR ports it from the PS5 WebKit tree the other NKWebKit ports use, 80f77e94:VP9Utilities.cpplines 37–276: the parser and its validation tables;VP9Utilities.hlines 107–119:VPCodecConfigurationRecordand its defaults;StringView.hlines 1047–1099:split, which skips empty components;StringToIntegerConversion.hlines 45–104:parseInteger<uint8_t>.The new
src/VPCodec.cppstarts with the notices ofVP9Utilities.cppandStringToIntegerConversion.h, andinclude/VPCodecExports.hppwith that ofVP9Utilities.h.Behaviour:
vp8orvp9, orvp8.0/vp9.0exactly, returns the defaults (profile 0, level 10, 8-bit, 4:2:0 colocated, BT.709, video range). Otherwise the name must bevp08orvp09, case-sensitively..with empty parts skipped. Each number is parsed as upstream'sparseInteger<uint8_t>: leading and trailing whitespace, an optional+, leading zeros, and nothing over 255.codecNameis a newWTF::Stringbuilt through the existingStringImpl::createexports, in the input's width.Stringat 0, then the eight one-byte fields at 8–15.std::optionalof it is 24 bytes with the engaged flag at 16. It isn't trivially destructible, so it's returned through a hidden pointer; theStringViewis passed by value.StringViewwith null data and a non-zero length throws.The stub and its
LegacyExports.hppdeclaration are removed. The older-callable-export counts drop from 2392 to 2391 and from 2161 to 2160 named. Debt entries record the unmeasured console ABI and layout, the splitting rule and the integer parsing rule.Tested
nkwebkit_vpcodec(core/libs/prx/libSceNKWebKit/tests/VPCodec.cpp) runs every case on 8-bit and UTF-16 input:vp8,vp9,vp8.0,vp9.0andvp8..., withvp8.00andvp8.0.rejected;vp08/vp09strings with each field's value checked;+, long runs of leading zeros, empty components, and rejected forms: missing fields, extra fields,-, hex, exponents, uppercase names, a non-ASCII code unit and a no-break space;codecName's contents, the disengaged result's flag at offset 16, and an empty view with null data.main, the test fails with_ZN7WebCore22parseVPCodecParametersEN3WTF10StringViewE not implemented;nkwebkit_vpcodec,nkwebkit_wtfandpublic_headerspass.nkwebkit_vpcodecandnkwebkit_wtfpass at d83a93b0b4, with no compiler warnings in the changed files. The branch was then rebased onto currentmainwithout conflicts, and both tests pass again on Linux.python3 tools/check_conventions.py --base origin/main: all checks passed.python3 tools/pr_overlap.py: no open PR implements this export, its NID or the new files. It couldn't compare 31 NKWebKit PRs automatically; I checked each diff by hand. They share onlyExport.cpp,LegacyExports.hpp,libSceNKWebKit.hppor the debt file's count lines. Whichever merges second recounts.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-13T02:46:02Z.
Review: COMMENTED
Reviewed VP codec parsing — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
2832c77b72a94355fea4ee643193d2e5e476715a(PR 19300, basemain).repo_read.pysearchandcat(about 10 calls).VPCodecExports.hpp,src/VPCodec.cpp,tests/VPCodec.cpp). Read only through their diff hunks:libSceNKWebKit.hpp,LegacyExports.hpp,Export.cppand the debt file.Export.cppand the debt file are excluded fromfiles/.Results
nkwebkit_vpcodecExport.cpporLegacyExports.hpptests/*.cppis globbed intonkwebkit_<name>_testsWtfStringAbi.hpp; not compiledFindings
Blocking
None.
Non-blocking
core/libs/prx/libSceNKWebKit/tests/VPCodec.cpp:111: the non-ASCII case passes length 12 fornonASCII, which holds 11 code units, so the NUL terminator is included. The input is still rejected at U+0100, but not for the reason the case names. Use 11.core/libs/prx/libSceNKWebKit/tests/VPCodec.cpp:109: no case checks the throw for null data with a non-zero length, whichsrc/VPCodec.cpp:367documents. Add one.core/libs/prx/libSceNKWebKit/src/VPCodec.cpp:99:ToStringWithoutCopyingcallsToString(), which copies throughStringImpl::create. The name is wrong. CallToString()atsrc/VPCodec.cpp:281and drop the wrapper.src/VPCodec.cpp:280has trailing whitespace, andsrc/VPCodec.cpp:285–287and314–315have runs of blank lines.Not verified
VP9Utilities.cpp,ASCIICType.h,StringToIntegerConversion.h). The cited upstream lines were not opened.std::invalid_argumentthe same way.To get this to a good state
Nothing is required. The non-blocking points above are optional.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-13T12:43:40Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
0c2f2049c0:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_vpcodec_testsbuilt cleanly.nkwebkit_vpcodec):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Generated withfooter from the description; the AI-assisted checkbox can stay.Looks Good To Me