mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-30 12:25:49 +00:00
20 lines
5.4 KiB
Markdown
20 lines
5.4 KiB
Markdown
# libSceOpusSilkEnc technical debt
|
||
|
||
### Unknown function info
|
||
|
||
- [sceOpusSilkEncCancel, sceOpusSilkEncCtl, sceOpusSilkEncEncodeFloatWithPriority, sceOpusSilkEncEncodeFloatWithPriorityAndTimeout, sceOpusSilkEncEncodeWithPriority and sceOpusSilkEncEncodeWithPriorityAndTimeout](../../../core/libs/prx/libSceOpusSilkEnc/Export.cpp) (libSceOpusSilkEnc) - names and NIDs are present in the [PS5 3.20 export inventory](https://github.com/DNNDHH/PS5-3.20_Libs/blob/b2a77c09cd71c01f34c790cfbe98c751a13262ad/libSceOpusSilkEnc.c). The prototypes mirror the sibling encoder declarations and libopus's own ctl, priority and batch-id entry points, but the console's request codes, priority, timeout and batch semantics were not recovered. They throw through `NotImplemented_nid_no_patch`; this is not an ABI claim.
|
||
|
||
### Functional
|
||
|
||
- [libSceOpusSilkEnc](../../../core/libs/prx/libSceOpusSilkEnc/Export.cpp) is an AJM frontend on the console: apart from libc runtime support and `sceKernelUsleep` the module imports only `sceAjmi*` calls, Create runs `sceAjmiInstanceCreate` with codec 17 and the flags 0x9 mono or 0x11 stereo, `sceAjmiBatchJobControlBufferRa` with request 0x6001 over state +0x10 with size 0x4C and results at state +0xD0, then `sceAjmiBatchStartBuffer` and `sceAjmiBatchWait`, Encode hands the samples to `sceAjmiBatchJobRunBufferRa`, and Destroy calls `sceAjmiInstanceDestroy` [per module runs with stubbed AJM](https://github.com/boykopovar/AnyPS5/pull/10563#issuecomment-6412138282). Our encoders build libopus without AJM, so packets come from libopus and whether they equal the console's is unknown. Closes when: encoder packets are compared against console-produced ones or the library runs through our AJM
|
||
|
||
- [Create and CreateEx](../../../core/libs/prx/libSceOpusSilkEnc/Export.cpp) zero-fill the 752-byte state and write the word table [measured on the modules](https://github.com/boykopovar/AnyPS5/pull/10563#issuecomment-6412138282): the instance id at +0x00, this implementation's id because our AJM does not run, 8 × channels at +0x08, 0x800 at +0x10, rate at +0x14, channels at +0x18 and rate/50 at +0x58 and +0xE4, the bitrate at +0x1C and +0xDC with the per-rate per-channel table 12000/19000 to 51000/99000, the constants 0x44F, 0x5E0, 10, 0x3E8, 0xFFFFFC18 and 0x10, and the 0x17B2 marker at +0xE8. The console's live AJM may write further result bytes into +0xD0 and +0x11C. Closes when: a console run with live AJM settles those result bytes
|
||
|
||
- [Create and CreateEx](../../../core/libs/prx/libSceOpusSilkEnc/Export.cpp) replacement rule is this implementation's choice: a create over a marked state retires the encoder its instance id names before any state write or allocation, so a later failure cannot strand an entry the state no longer names; explicit libopus error branches leave the state zeroed, while make-unique throwing after setupState or a later registry insert throw leaves the filled state without a live encoder. The console behaviour for its own allocation failure after a create over a live state is unmeasured, and the tests cannot force our failure paths because the library is a shared module against libopus, which has no allocator hook, while a process-wide memory limit fails an unknown allocation first. Closes when: a deterministic allocation-failure injection or a console measurement of the failed replace exists
|
||
|
||
- [Encode and EncodeFloat](../../../core/libs/prx/libSceOpusSilkEnc/Export.cpp) refuse with the [measured codes](https://github.com/boykopovar/AnyPS5/pull/10563#issuecomment-6412138282): null state +0x01, null samples +0x02 before the state marker, a markerless state +0x15, null data +0x04 before the frame check and maxDataBytes 0 +0x05; maxDataBytes below zero is not refused and reaches our libopus backend, where a rejection throws. Frame sizes outside the durations 10, 20, 40 and 60 ms, the measured 480 to 2880 at 48000 with 120 and 240 refused, give +0x03; we scale the counts by rate while the module's rule for other rates is unmeasured. Closes when: the frame rule and the console outcome for a buffer AJM rejects are measured
|
||
|
||
- [sceOpusSilkEncEncodeFloat](../../../core/libs/prx/libSceOpusSilkEnc/Export.cpp) shares the CELT module's check order: null state, null samples, frame 0 and the marker, then the frame × channels × 4 byte stack reservation for the converted frame before its remaining checks, which kills the console module for negative frames [per the measured CELT run](https://github.com/boykopovar/AnyPS5/pull/10563#issuecomment-6412138282); our implementation throws once it exceeds 8 MiB instead, so the failure reports. The bound beyond the measured deaths is our host stack model, not a console measurement. Closes when: the console's stack behaviour for such frames is measured
|
||
|
||
- [Create, CreateEx, Destroy, GetSize, Terminate and Initialize](../../../core/libs/prx/libSceOpusSilkEnc/Export.cpp) refuse with base 0x81770000, the null pointer +0x01, the sample rate +0x0F, channels +0x0C, application +0x10, the marker in Destroy +0x15 and `Initialize(nullptr)` +0x18, all from the [firmware 13.42 export measurements](https://github.com/boykopovar/AnyPS5/pull/10563#issuecomment-6401539314); Destroy clears the marker and leaves the other bytes, GetSize returns 752 on channels 1 and 2 and refuses other counts with +0x0C. CreateEx context handling, duplicate initialization and termination with live encoders throw as the recovered decoder analogue does. Closes when: those paths are measured on the console
|