Repository navigation
feat(ajm): resample interleaved s16 PCM through codec 23 - #6841
Conversation
|
The codec-23 trace and repeated-block regression give this implementation a strong evidence trail. One integration item remains from the overlap report: #6040 inserts tests at the same |
|
Follow-up from checking the live base: this PR still records base |
|
Rebase handoff — rebased onto current Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
To pick it up: Head is |
Broken Sword - Shadow of the Templars: Reforged (PPSA21480) decodes its audio itself and uses AJM codec 23 only to resample interleaved s16 PCM from 44.1 to 48 kHz: every block initializes the instance with 0, 2, 44100, sets the ratio 0.91875 and decodes 235 frames into a 256-frame output. The run threw "AJM: decoding codec 23 is not implemented". A codec 23 run now consumes its whole input and emits every output frame whose position lies inside it, with the Catmull-Rom of the existing resampler. Cases the title does not show throw, among them a run after a resampled run without a new initialize.
922e5b7 to
3f5f849
Compare
|
Thanks @blawesom, I took your rebase. I applied @MarcZX100 both shared hunks are resolved: the codec 23 tests sit after #6040's Opus gapless-reset test in Focused tests on
The AJM code itself is unchanged from the head I ran Broken Sword with, so I didn't rerun the title or the full suite on this head. AI-assisted: yes (Claude Code) |
|
One malformed-input edge case in |
|
Checked the diff against the trace in #6671: codec 23 is handled as interleaved s16 PCM through the existing Catmull-Rom resampler, and every case the title does not show throws (other input formats, ratio change, gapless, empty/partial input, small output, extra run flags, init through |
What
Broken Sword - Shadow of the Templars: Reforged (PPSA21480) stops 11 to 15 s after start on current
main(#6671), 2 of 2 runs. These are theAPS5_TRACE_AJM=1lines asked for in #6671:What the title does with codec 23, measured with a local probe (not part of this PR):
.osaarchives hold Ogg Opus streams,music.vt7aholds Ogg Vorbis, and libopus 1.5.2 is linked intoeboot.bin.sceAjmBatchJobInitializewith the 12 bytes0, 2, 44100,sceAjmBatchJobSetResampleParameterswith 0.91875 (44100/48000), thensceAjmBatchJobDecodewith 940 input bytes and a 1024-byte output. 940 bytes are 235 interleaved stereos16frames and 1024 bytes are 256; 256 × 0.91875 = 235.2.So the title uses codec 23 as PCM input that only goes through the resampler, and this PR handles it that way:
s16; other formats throw.SIDEBAND_STREAM, and initialization throughsceAjmBatchJobControl.Why every frame is emitted rather than going through the streaming resampler of the other codecs: that resampler holds two frames back for the next run. With it the title received 254 frames per block and then submitted a second job for exactly the missing 8 bytes, after a new initialize and with the same 940 input bytes. With every frame emitted it submits one job per block, 187.5 per second (48000 / 256), and the output is as smooth across block joins as inside a block (median step 88 against 85, p99 882 against 858).
The MP3, ATRAC9, M4AAC and Opus paths are unchanged. The debt entry lists every value taken from this title and every assumption. #6672 records codec 23 as not implemented in the same debt file; with this PR that entry would no longer apply. The name
CODEC_PCMis mine, since no source names a codec 23 (shadPS4's PS4 header ends its codec list withMax = 23, as noted in #6671).Tested
Windows 11 (build 26300), WinLibs MinGW-w64 GCC 15.2.0 r7; Ubuntu 24.04 in WSL, GCC 13.3. Both on
main82ddae7 plus this commit.guest_ajmwith the newTestPcmResample: the title's batch sequence twice on the same instance, every output frame of a ramp and of a non-linear channel compared with an independent Catmull-Rom, nothing written past frame 256 of a 300-frame output, the passthrough at ratio 1 over two runs, and the throwing cases. Passes on Windows and Linux. It fails with the output one frame short, without the continuity check, and when the run fills the whole output (each mutation tried and reverted).guest_ajm_teardown(Linux): passes.tools/check_skips.py --job windowsexpects.--windows --registry: with this PR it no longer stops (runs of 122 s and 92 s with the final build, no error), the codec 23 jobs come one per block at 187.5 per second, and the sound plays correctly. WithAPS5_TRACE_AJM=1the sound stutters, because the per-job trace lines slow the title's audio thread; that is the trace, not the decoder.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 (none added).mdfiles or images added to the repository (attach them to this PR)Closes #6671