tests/codecs (a-m): comments: specs only
This commit is contained in:
1 parent
a80299dce0
commit
5f7f6005f6
24 files changed
+46
-181
No files matched your search
+2
-13
@@ -1,9 +1,5 @@
|
||||
-- codecs/adpcm tests: every decoder kernel of codecs/audio/Adpcm against a reference decoder, bit-exact as s16
|
||||
-- (tools/fixtures/adpcm.py: ADX from ffmpeg and PS-ADPCM / DSP from our Python encoders decoded by vgmstream, Apple
|
||||
-- ima4 from ffmpeg, IMA nibble streams decoded by ffmpeg); ADX coefficients; the encoders (IMA nibbles, IMA WAV
|
||||
-- blocks, MS blocks) decoded back with a signal-to-noise floor; the Decoder layouts (seeking matches a straight
|
||||
-- read); Flash ADPCM by hand; a fuzz pass of random bytes through every kernel (ranges valid, contents random) and
|
||||
-- the layouts.
|
||||
-- codecs/adpcm tests: every kernel of codecs/audio/Adpcm bit-exact as s16 against a reference decoder, the encoders.
|
||||
-- Fixtures: tools/fixtures/adpcm.py (ADX and ima4 from ffmpeg; PS-ADPCM / DSP decoded by vgmstream).
|
||||
local T = require("@tests/T")
|
||||
local Adpcm = require("@rosetta/codecs/audio/Adpcm")
|
||||
local Decoder = require("@rosetta/codecs/audio/Adpcm/Decoder")
|
||||
@@ -12,7 +8,6 @@ local Sig = require("@tests/gen/adpcm_sig")
|
||||
|
||||
local t = T.suite("adpcm codec")
|
||||
|
||||
-- s16le reference vs interleaved f32: the count of differing samples and the first one
|
||||
local function compare(out: buffer, ref: string, count: number): (number, number)
|
||||
local r = buffer.fromstring(ref)
|
||||
local bad, first = 0, -1
|
||||
@@ -27,7 +22,6 @@ local function compare(out: buffer, ref: string, count: number): (number, number
|
||||
return bad, first
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ kernels
|
||||
for _, c in Cases do
|
||||
local src = buffer.fromstring(c.data)
|
||||
local ch, frames = c.ch, c.frames
|
||||
@@ -108,7 +102,6 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ encoders
|
||||
local function snr(x: buffer, y: buffer, count: number): number
|
||||
local sig, err = 0, 0
|
||||
for i = 0, count - 1 do
|
||||
@@ -123,7 +116,6 @@ end
|
||||
do
|
||||
local x = buffer.fromstring(Sig.data)
|
||||
local ch, n = Sig.channels, Sig.frames
|
||||
-- IMA nibbles, both nibble orders
|
||||
for _, hi in { true, false } do
|
||||
local raw = buffer.create((n * ch + 1) // 2)
|
||||
local st = buffer.create(8 * ch)
|
||||
@@ -139,7 +131,6 @@ do
|
||||
t:check(s > 20, string.format("ima encode (hi %s): %.1f dB", tostring(hi), s))
|
||||
t:check(buffer.readi32(st, 0) == buffer.readi32(ds, 0), "ima encoder and decoder end in the same state")
|
||||
end
|
||||
-- IMA WAV and MS blocks
|
||||
for _, kind in { "ima_wav", "ms" } do
|
||||
local ba = 512
|
||||
local spb = Decoder.blockFrames(kind, ba, ch) :: number
|
||||
@@ -174,7 +165,6 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ Decoder layouts
|
||||
local function readAll(dec: any, step: number): buffer
|
||||
local out = buffer.create(dec.frames * dec.channels * 4)
|
||||
local got = 0
|
||||
@@ -224,7 +214,6 @@ do
|
||||
t:eq(dec.frames, 3 * 4 * 28 + 28, "cut interleaved: the whole frames both channels have")
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ fuzz
|
||||
local samples = {}
|
||||
for _, c in Cases do
|
||||
table.insert(samples, c.data)
|
||||
|
||||
Reference in new issue
Block a user