audio perf: range decoder skips the normalize call when not needed, Opus single-stream block copy, AudioOps peak branch-free

This commit is contained in:
4DBug committed 2026-11-01 19:42:40 -06:00
1 parent 64b0c75a53
commit 5e71837637
3 files changed
+32 -20

No files matched your search

+3 -2
View File
@@ -87,9 +87,10 @@ function AudioOps.peak(a: Types.Audio): (number?, { number } | Err.Err)
local pk = 0
for p = (c - 1) * 4, last + (c - 1) * 4, step do
local v = abs(readf32(s, p))
if v > pk then
pk = v
if v ~= v then
v = 0 -- NaN never counts
end
pk = max(pk, v) -- branch-free (LuaJIT)
end
per[c] = pk
end