tests: HE-AAC against ffmpeg (ADTS, M4A explicit / implicit, TS, MP4, MKV; mono, stereo, 5.1, PS)

This commit is contained in:
4DBug committed 2026-11-02 00:25:02 -06:00
1 parent 686a1fbf86
commit 778502c54d
4 files changed
+304 -10

No files matched your search

+11 -9
View File
@@ -79,20 +79,22 @@ for _, c in Aac do
t:note("%s: %d ch %d Hz, %d frames, SNR %.1f dB vs ffmpeg", c.name, c.channels, c.rate, a.frames, s)
end
-- HE-AAC: the AAC-LC core at half the rate, SBR seen
-- HE-AAC: SBR output at the full rate (tests/audio/heaac.luau checks it against ffmpeg); opts.sbr = false: the core
for _, c in He do
if string.sub(c.name, -4) ~= ".m4a" then
continue
end
local dec, err = M4a.open(reader(c.data))
t:check(dec, c.name .. ": " .. tostring(err))
t:eq(dec.sampleRate, c.rate // 2, c.name .. ": core rate")
local b, n = dec:read(8192)
local e = 0
for i = 0, n * dec.channels - 1 do
e += buffer.readf32(b, i * 4) ^ 2
for _, sbr in { true, false } do
local dec, err = M4a.open(reader(c.data), { sbr = sbr })
t:check(dec, c.name .. ": " .. tostring(err))
t:eq(dec.sampleRate, if sbr then c.rate else c.rate // 2, c.name .. (if sbr then ": SBR rate" else ": core rate"))
local b, n = dec:read(8192)
local e = 0
for i = 0, n * dec.channels - 1 do
e += buffer.readf32(b, i * 4) ^ 2
end
t:check(n == 8192 and e > 1, c.name .. ": decodes (energy " .. e .. ")")
end
t:check(n == 8192 and e > 1, c.name .. ": the core decodes (energy " .. e .. ")")
end
do