feat(opusdec): implement sceOpusDecCtl and sceOpusCeltDecCtl #9764
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9764"
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 hypermoist on 2026-10-22T13:28:15Z.
What
sceOpusDecCtlandsceOpusCeltDecCtlthrew. They takeopus_decoder_ctl-style requests: the module stores each value in the decoder state and sends it to AJM with the next decode. It uses the libopus backend from #8739, now onmain. It handles the requests and applies gain and phase inversion to libopus.The behaviour is not measured on a console. The request numbers match libopus's CTLs. @BunnyFl ran the firmware 13.42
libSceOpusDec.sprxandlibSceOpusCeltDec.sprxnatively on a PC with AJM stubbed (report); the checks, errors, initial values, stored values and reset below match it.RESET_STATEGAINPHASE_INVERSION_DISABLEDINBAND_FECCeltDec rejects 4012, 4013, 4050 and 4051 with +0xE.
The export reads its variadic arguments with the SysV
va_liston Windows, each with the type the caller passes: anintfor a setter, anint32_t*for a getter and two for request -1, and none for the reset and unknown requests. The handling is oneCtlinOpusDecoder.hppthat both modules share.Differences, listed in the new debt entries:
The code is written from the observed behaviour; nothing from the modules is copied.
Tested
New
guest_opus_dec_ctltest, run for both libraries. It checks:every error above and the order of the first two;
GET and SET round trips, the gain and flag bounds, and what reset clears and keeps;
that the PCM and final range match a plain libopus decoder over CELT-only stereo packets, before and after setting gain -1536 and disabling phase inversion, and that the gain changes the output;
that after a reset the output matches a fresh decoder.
request -1 writing 0 to both outputs before a decode, and 4050 set to 1 reading back as 1 and cleared by reset;
every request BunnyFl measured as +0xE, and the
INT32_MIN/INT32_MAXgain and phase inversion bounds.The test does not assert that the unsupported paths (request -1 after a decode, decoding with 4050 set) throw.
guest_opus_dec_ctl,guest_opus_decandguest_opus_celt_decpass. At8f2335b92fall sixctest -R opustests pass.f8018a068; not rerun since).tools/check_conventions.pyis clean. Overlap:#includeline in bothExport.cppfiles, line 16 oflibSceOpusDec/CMakeLists.txtand line 5 of both debt files, where each PR removes its own names. Merge order: #9752 first. Once #9752 lands I'll mergemainhere and resolve those lines.add_library_test. Whichever of the two lands second converts theguest_opus_dec_ctlregistration: if #6044 lands first, I'll mergemainhere and switch it.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)Assisted With AI: Yes. All tests were run locally on computer hardware (AMD Ryzen 5 5600G, 32 GB RAM, NVIDIA GeForce RTX 3060, CachyOS Linux 7.3, GCC 16.2), not on an actual console.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T14:47:40Z.
Review: DISMISSED
I found one blocker in the variadic argument bridge. The focused review and checks are summarized in the inline comment; the same extraction is duplicated in the CeltDec export.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T17:01:30Z.
Review: COMMENTED
Thanks for fixing the variadic argument-type mismatch. I verified the shared
ReadCtlArgumentsdispatch now reads promotedintsetters, typedint32_t*getters, both pointers for request-1, and consumes no argument for reset/unknown requests; both decoder exports use it. Current-main conventions, diff-check, and merge-tree pass. The author reports fresh Linux and WinLibs/Wine runs ofguest_opus_dec_ctl,guest_opus_dec, andguest_opus_celt_dec; hosted product builds are skipped, and I did not rerun them locally. The PR correctly declares dependency #8739 and documents the #9752 rebase coordination; no remaining blocker found in the reviewed change.Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-10-28T15:06:56Z.
Review: APPROVED
Approving head
8f2335b92f. I read the whole diff and re-ran itsExport.cppfiles andOpusDecoder.hpp(built with AnyPS5's libopus) next to firmware 13.42's decryptedlibSceOpusDec.sprxandlibSceOpusCeltDec.sprx, natively on a PC (not a console), same AJM stubs and fresh states as before. Three identical runs.SET 4050 1, reset, then GET 4051 returns 0 here as on the module.OpusDecoder.hpp(gain bound, phase-inversion code, unknown-request code, NULL-GET code, FEC bound) are each caught....WithPriorityAndTimeoutentry is back tomain's wording.Still not compared: decoding, so the gain and phase inversion effect on PCM, the final range after a decode and request -1 after a decode stay as the debt entry lists them.