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

+5 -1
View File
@@ -403,7 +403,11 @@ function Decoder.decodeMultistream(ms: MS, buf: buffer?, off: number, len: numbe
return if ret < 0 then ret else -3
end
frameSize = ret
if s < ms.coupled then
local nch = ms.channels
if ms.streams == 1 and nch <= 2 and ms.coupled == nch - 1 and ms.mapping[1] == 0 and (nch == 1 or ms.mapping[2] == 1) then
-- one stream in its own channel order: the copy is a block move
table.move(tmp, 1, frameSize * nch, pbase, pcm)
elseif s < ms.coupled then
copyOut(ms, s * 2, tmp, 0, 2, pcm, pbase, frameSize)
copyOut(ms, s * 2 + 1, tmp, 1, 2, pcm, pbase, frameSize)
else