ws-polish: bench line for Flash ADPCM decode
This commit is contained in:
1 parent
903507b23c
commit
9c10defad8
1 file changed
+13
-1
+13
-1
@@ -1748,7 +1748,7 @@ do
|
|||||||
end
|
end
|
||||||
-- ws-audio2: adpcm / qoa
|
-- ws-audio2: adpcm / qoa
|
||||||
do
|
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)
|
-- of f32 output (MB/s of input for the encoder)
|
||||||
local Adpcm = require("@formats/codecs/audio/Adpcm")
|
local Adpcm = require("@formats/codecs/audio/Adpcm")
|
||||||
local QoaCodec = require("@formats/codecs/audio/Qoa")
|
local QoaCodec = require("@formats/codecs/audio/Qoa")
|
||||||
@@ -1784,6 +1784,18 @@ do
|
|||||||
bench("adpcm dsp decode", 5, frames * 14 * 4, function()
|
bench("adpcm dsp decode", 5, frames * 14 * 4, function()
|
||||||
Adpcm.dsp(dsp, 0, frames * 14, coefs, 0, buffer.create(8), 0, out, 0, 1)
|
Adpcm.dsp(dsp, 0, frames * 14, coefs, 0, buffer.create(8), 0, out, 0, 1)
|
||||||
end)
|
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)
|
-- QOA (stereo 44.1 kHz)
|
||||||
local file = assert(Qoa.encode(sig))
|
local file = assert(Qoa.encode(sig))
|
||||||
bench("qoa encode", 2, n * 2 * 4, function()
|
bench("qoa encode", 2, n * 2 * 4, function()
|
||||||
|
|||||||
Reference in new issue
Block a user