ws-audio: merge ws/absorb (flac, bmp, zip)
This commit is contained in:
commit
3dfe1e2cdd
125 files changed
+4625
-2
No files matched your search
+31
-1
@@ -1,6 +1,7 @@
|
||||
-- Throughput (bash tools/bench.sh): codec MB/s under both runtimes. MB/s are of decompressed output, best of n runs.
|
||||
-- Fixtures: tools/fixtures/deflate.py (a 6 MB corpus), tools/fixtures/png.py (1024 x 768 images), tools/fixtures/mp3.py,
|
||||
-- tools/fixtures/opus.py (3 s stereo files; MB/s of f32 output, 48 kHz stereo f32 is 0.384 MB/s of real time).
|
||||
-- tools/fixtures/opus.py (3 s stereo files; MB/s of f32 output, 48 kHz stereo f32 is 0.384 MB/s of real time),
|
||||
-- tools/fixtures/flac.py; wav encodes / decodes a generated tone.
|
||||
local Deflate = require("@formats/codecs/Deflate")
|
||||
local Crc32 = require("@formats/core/Crc32")
|
||||
local Bytes = require("@formats/core/Bytes")
|
||||
@@ -13,6 +14,10 @@ local Opus = require("@formats/audio/opus")
|
||||
local OpusCelt = require("@tests/gen/opus_celt_st_128")
|
||||
local OpusSilk = require("@tests/gen/opus_silk_wb_st")
|
||||
local OpusHybrid = require("@tests/gen/opus_hybrid_st")
|
||||
local Flac = require("@formats/audio/flac")
|
||||
local FC = require("@tests/gen/flac_cases")
|
||||
local Wav = require("@formats/audio/wav")
|
||||
local Types = require("@formats/Types")
|
||||
|
||||
local runtime = if (_G :: any).jit ~= nil then "luajit" else "luau"
|
||||
|
||||
@@ -93,4 +98,29 @@ do
|
||||
Vorbis.decode(Bytes.reader(b))
|
||||
end)
|
||||
print(string.format("%-8s %-30s %8.0fx real time", runtime, "", VB.frames / VB.rate / dt))
|
||||
for _, name in { "s16_long", "s24_96k" } do
|
||||
for _, c in FC do
|
||||
if c.name == name then
|
||||
local b = buffer.fromstring(c.data)
|
||||
local dec = assert(Flac.open(Bytes.reader(b)))
|
||||
local secs = dec.duration
|
||||
local dt = bench("flac decode " .. name, 5, dec.frames * dec.channels * 4, function()
|
||||
Flac.decode(Bytes.reader(b))
|
||||
end)
|
||||
print(string.format("%-8s %-30s %8.0fx real time", runtime, "", secs / dt))
|
||||
end
|
||||
end
|
||||
end
|
||||
do
|
||||
local a = Types.Audio.new(44100, 2, 44100 * 10)
|
||||
for i = 0, 44100 * 20 - 1 do
|
||||
buffer.writef32(a.samples, i * 4, math.sin(i * 0.01) * 0.5)
|
||||
end
|
||||
bench("wav encode s16 (10 s stereo)", 5, buffer.len(a.samples), function()
|
||||
Wav.encode(a)
|
||||
end)
|
||||
local file = assert(Wav.encode(a))
|
||||
bench("wav decode s16 (10 s stereo)", 5, buffer.len(a.samples), function()
|
||||
Wav.decode(Bytes.reader(file))
|
||||
end)
|
||||
end
|
||||
Reference in new issue
Block a user