ws-polish: bench line for Flash ADPCM decode

This commit is contained in:
4DBug committed 2026-10-31 17:52:47 -05:00
1 parent 903507b23c
commit 9c10defad8
1 file changed
+13 -1
+13 -1
View File
@@ -1748,7 +1748,7 @@ do
end
-- ws-audio2: adpcm / qoa
do
-- codecs/audio/Adpcm (IMA nibble stream, Nintendo DSP frames) and QOA decode / encode, over generated signals; MB/s
-- codecs/audio/Adpcm (IMA nibble stream, Nintendo DSP frames, Flash ADPCM) and QOA decode / encode, over generated signals; MB/s
-- of f32 output (MB/s of input for the encoder)
local Adpcm = require("@formats/codecs/audio/Adpcm")
local QoaCodec = require("@formats/codecs/audio/Qoa")
@@ -1784,6 +1784,18 @@ do
bench("adpcm dsp decode", 5, frames * 14 * 4, function()
Adpcm.dsp(dsp, 0, frames * 14, coefs, 0, buffer.create(8), 0, out, 0, 1)
end)
-- Flash ADPCM: one mono packet of random 4-bit codes (the bit stream reader per code)
local swf = buffer.create(n // 2)
for i = 0, n // 2 - 1 do
seed = (seed * 1103515245 + 12345) % 2147483648
buffer.writeu8(swf, i, seed // 65536 % 256)
end
buffer.writeu8(swf, 0, 0x80 + buffer.readu8(swf, 0) % 64) -- code size 2 + 2 = 4 bits
local swfFrames = Adpcm.swfFrames(swf, 0, n // 2, 1)
local swfOut = buffer.create(swfFrames * 4)
bench("adpcm swf decode", 5, swfFrames * 4, function()
Adpcm.swf(swf, 0, n // 2, 1, swfOut, 0)
end)
-- QOA (stereo 44.1 kHz)
local file = assert(Qoa.encode(sig))
bench("qoa encode", 2, n * 2 * 4, function()