feat(ngs2): implement the sampler and submixer peak meter #11354
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11354"
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 edubox on 2026-10-26T07:27:56Z.
What
Implement the sampler and submixer peak meter.
0x10000009and the submixer control0x20000005(16 bytes, detect type at offset 8).0x804A8093.num_peak_meter_blocksvalues per channel (1 to 256; otherwise0x804A8092). Peak mode stores the largest absolute sample of each grain, RMS mode the sum of squares.peak_heightthroughsceNgs2VoiceGetState: the largest channel peak, orsqrt(sum / (blocks * grain))for RMS, over the filled slots.Firmware 13.42 confirms the
peak_heightfield at offset 12 (peak 0.5 and RMS 0.353553 for alternating 16384/0 PCM) and that a sampler SETUP reset turns the meter off until it is enabled again. The submixer reset remains unmeasured and is recorded in the debt entry, together with the ring details that still follow fma-rc's 12.70 module reading.Tested
Linux, GCC 16.2.1. All 16
ngs2_*tests pass, includingTestPeakMeterandTestPeakMeterHistory:peak_heightin peak mode (0.5),0x804A8093,0x804A8092,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-26T07:30:25Z.
Review: COMMENTED
I reviewed the implementation against the linked 12.70 analysis and issue #8039's follow-up. That analysis supports the detect modes, block range, ring calculation and a linear
voicePeak, but its author explicitly says they have not determined which sampler state field receives that value. This PR writes it directly toNgs2SamplerVoiceState::peak_height(and the submixer field). The field name makes that mapping plausible, but the current evidence does not establish the firmware mapping; the Trails report in #8039 still identifies it as unresolved. Please add evidence for the output field/offset and read semantics, or document that mapping as an unverified assumption rather than presenting it as confirmed behavior.The new regression checks one rendered block for peak and RMS. It does not exercise the multi-block RMS average, ring eviction after the configured window, or the reset/retention behavior described in the implementation. Those cases would materially validate the main history logic.
Eligibility, conventions, intake and labels pass; hosted Build jobs are skipped by path policy. I attempted a local configure for an independent run, but it stopped because SDL2's CMake package is unavailable in this environment, so I did not run the reported 16-test suite. I’m leaving this as feedback rather than approval pending the evidence and focused coverage.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T09:14:23Z.
Review: CHANGES_REQUESTED
Reviewed exact head
7d136db8870a0cf2c6bc0e72aa18da5a231b45ebagainst current main8100e480f7d55e87afb5376b8f784bf17df0f75c.The new
TestPeakMeterHistoryaddresses the earlier coverage gap: it exercises multi-block RMS, circular eviction, and reset behavior. The debt entry now accurately labels thepeak_heightmapping as an assumption, rather than established firmware behavior. That disclosure is useful, but the implementation still writes the result into that field and asserts reset retains the detect type even though the PR says neither behavior is verified on PS5.AGENTS.mdrequires unknown behavior to throw and be recorded in debt. Please provide firmware/console evidence for the field mapping and reset semantics, or leave those behaviors unsupported until evidence establishes them; the test currently verifies the PR's assumptions, not console equivalence.The latest main has changed
Render.cpp,Voice.cpp,Ngs2Render.cpp, and the NGS2 debt file since the PR's merge basec3db979cd33a65a0a651f1e7ba7958137a961413. The merge preview is currently clean, but those shared-path changes were not in the reported test base. Please refresh onto current main, preserve both sets of changes, and rerun the focused NGS2 suite on that exact head.I also compared the current #11354 and #11315 heads with
git merge-tree: they still conflict inNgs2Internal.hpp,Rack.cpp,Render.cpp,Voice.cpp, anddocs/dev/debt/libSceNgs2.native.md. These appear to be separate changes, so the conflict does not itself prove a functional dependency; please coordinate landing order and retain both implementations, test changes and debt entries when resolving it. The PR currently saysDepends on: none.The author reports all 16
ngs2_*tests passing on this head. I did not independently rerun them; hosted eligibility, conventions, labels and report checks pass, and product/build test jobs are skipped by path policy. My earlier local attempt could not execute this NGS2 test binary because the host CPU preflight requires unsupported instructions.AI-assisted review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T09:33:25Z.
Review: DISMISSED
Re-reviewed exact head
05bb568fe73b994b5a2f3b5dabe665d47a83914eagainst currentmain4e43321bd6ceccdc1ae28568bbbc35d9a6446464. The branch is now current. The added history tests address the prior multi-block RMS, ring-eviction and reset-coverage gaps, and the author reports all 16ngs2_*tests passing on this exact head. Mypython3 -I tools/check_conventions.py --base upstream/main --head upstream/pr/11354andgit diff --check upstream/main...upstream/pr/11354also pass. I could not independently run the NGS2 binaries on this host: the earlier built test executable exits during its CPU-feature preflight because this Xeon lacks required instructions.The remaining blocker is the behavior the author confirmed is unverified: the 12.70 module reading does not identify the
peak_heightoutput field or its read semantics, and no PS5 measurement establishes that mapping or whether reset retains the detect type. The implementation nevertheless writesvoice.peakHeightto that field and the tests assert the assumed value and reset behavior. Recording the uncertainty in the debt file is transparent, but it does not make returning the assumed result conform toAGENTS.md's rule that unknown behavior remains unsupported. Please add firmware evidence for both behaviors, or leave the peak-meter output unsupported until they can be established.The exact-head pairwise merge preview with #11315 still conflicts in
Ngs2Internal.hpp,Rack.cpp,Render.cpp,Voice.cppand the NGS2 debt file. The changes are distinct; coordinate landing order and preserve both sets when resolving those conflicts.AI-assisted review.
Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-26T15:13:19Z.
Review: APPROVED
Reviewed
4e9ab12against035ac96. No actionable findings. The changed render paths maintain per-channel peak/RMS history, reset it when the detection mode changes, and validate sampler and submixer block counts. I builtngs2_render_tests,ngs2_custom_testsandngs2_voiceindex_testsin Release with WinLibs GCC 15.2.0; focused CTest passed all three (3 passed, 0 skipped, 0 failed). Review-only checks also confirmed both rack types accept the 256-block upper boundary and reject 257. The exact-head Actions run passed eligibility only; product build/test jobs were skipped. This independently validates the affected Windows/MinGW paths, not the full 16-test NGS2 suite or console firmware behavior.