absorb: mp3 (audio/mp3 from mp3-luau c755bbf, minimp3 port): streaming Decoder + decode to Audio, sniff, ID3 tags in dec.tags (strings) / dec.id3; tests vs minimp3 refs + ffmpeg + lame streams, robust, tags, fuzz; bench lines (tools/bench.sh also builds the mp3 fixtures)
This commit is contained in:
1 parent
cdcb5b0b77
commit
8ea439a338
45 files changed
+3608
-2
No files matched your search
+18
-1
@@ -1,11 +1,13 @@
|
||||
-- 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) and tools/fixtures/png.py (1024 x 768 images).
|
||||
-- Fixtures: tools/fixtures/deflate.py (a 6 MB corpus), tools/fixtures/png.py (1024 x 768 images), tools/fixtures/mp3.py.
|
||||
local Deflate = require("@formats/codecs/Deflate")
|
||||
local Crc32 = require("@formats/core/Crc32")
|
||||
local Bytes = require("@formats/core/Bytes")
|
||||
local Png = require("@formats/image/png")
|
||||
local B = require("@tests/gen/deflate_bench")
|
||||
local PB = require("@tests/gen/png_bench")
|
||||
local Mp3 = require("@formats/audio/mp3")
|
||||
local MC = require("@tests/gen/mp3_cases")
|
||||
|
||||
local runtime = if (_G :: any).jit ~= nil then "luajit" else "luau"
|
||||
|
||||
@@ -18,6 +20,7 @@ local function bench(label: string, n: number, bytes: number, f: () -> ())
|
||||
dt = math.min(dt, os.clock() - t0)
|
||||
end
|
||||
print(string.format("%-8s %-30s %8.2f ms %7.1f MB/s", runtime, label, dt * 1000, bytes / dt / 1e6))
|
||||
return dt
|
||||
end
|
||||
|
||||
local z = buffer.fromstring(B.zlib)
|
||||
@@ -56,3 +59,17 @@ do
|
||||
Png.encode(img)
|
||||
end)
|
||||
end
|
||||
for _, name in { "l3_cbr128_js", "l3_vbr_v2_48k", "l2_192_st" } do
|
||||
for _, c in MC do
|
||||
if c.name == name then
|
||||
local b = buffer.fromstring(c.data)
|
||||
local dec = assert(Mp3.open(Bytes.reader(b)))
|
||||
local secs = dec.duration
|
||||
local dt = bench("mp3 decode " .. name, 5, dec.frames * dec.channels * 4, function()
|
||||
local d = assert(Mp3.open(Bytes.reader(b)))
|
||||
d:readAll()
|
||||
end)
|
||||
print(string.format("%-8s %-30s %8.0fx real time", runtime, "", secs / dt))
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user