tests/codecs (m-z): comments: specs only

This commit is contained in:
4DBug committed 2026-11-01 01:50:53 -05:00
1 parent 98b4ce533e
commit a6732d45f2
23 files changed
+46 -177

No files matched your search

+2 -6
View File
@@ -1,6 +1,5 @@
-- codecs/audio/Mdct tests: the FFT against a direct DFT for mixed-radix sizes, the forward / inverse MDCT and the DCT-IV
-- against their O(N^2) definitions (AAC, Vorbis and CELT sizes), perfect reconstruction (TDAC) with the sine, KBD and
-- Vorbis windows, window power complementarity, bad sizes. No fixtures (the definitions are the reference).
-- codecs/audio/Mdct tests: the FFT, MDCT and DCT-IV against their O(N^2) definitions, TDAC with every window.
-- No fixtures: the definitions are the reference.
local T = require("@tests/T")
local Mdct = require("@rosetta/codecs/audio/Mdct")
@@ -16,7 +15,6 @@ local function noise(n: number): { number }
return a
end
-- FFT vs DFT
for _, n in { 1, 2, 3, 4, 5, 6, 7, 8, 12, 15, 16, 30, 49, 60, 64, 120, 240, 480, 77 } do
local plan = Mdct.fft(n)
t:check(plan, "fft plan " .. n)
@@ -39,7 +37,6 @@ for _, n in { 1, 2, 3, 4, 5, 6, 7, 8, 12, 15, 16, 30, 49, 60, 64, 120, 240, 480,
t:check(err < 1e-9 * n, string.format("fft %d: max error %g", n, err))
end
-- MDCT / IMDCT vs the definitions
local maxErr = 0
for _, n in { 4, 8, 16, 64, 240, 256, 480, 1920, 2048 } do
local plan = Mdct.new(n) :: Mdct.Plan
@@ -127,7 +124,6 @@ do
t:check(e < 1e-10, "dct4 involution: " .. e)
end
-- bad sizes
t:check(Mdct.new(6) == nil and Mdct.new(0) == nil and Mdct.new(-8) == nil and Mdct.new(8.5) == nil and Mdct.new("x" :: any) == nil, "bad mdct sizes")
t:check(Mdct.fft(0) == nil and Mdct.window("nope", 8) == nil and Mdct.window("sine", 7) == nil, "bad fft sizes / windows")