tests/audio: comments: specs only
This commit is contained in:
1 parent
75ddfb4068
commit
0eec255bfb
30 files changed
+66
-244
No files matched your search
+1
-11
@@ -1,6 +1,4 @@
|
||||
-- audio/aiff tests: files written by ffmpeg and sox in every sample format (AIFF 8 / 12 / 16 / 24 / 32-bit, AIFF-C
|
||||
-- sowt / fl32 / fl64 / ulaw / alaw / ima4, 6 channels, text chunks) against ffmpeg's decode; streaming reads and seeks;
|
||||
-- our encoder's output for every sample format decoded by ffmpeg (fixture step) and by us; errors; fuzz.
|
||||
-- audio/aiff tests: AIFF / AIFF-C files written by ffmpeg and sox against ffmpeg's decode; our encoder's via ffmpeg.
|
||||
-- Fixtures: tools/fixtures/aiff.py.
|
||||
local T = require("@tests/T")
|
||||
local Aiff = require("@rosetta/audio/aiff")
|
||||
@@ -16,7 +14,6 @@ local t = T.suite("aiff")
|
||||
local function reader(s: string): Bytes.Reader
|
||||
return Bytes.reader(buffer.fromstring(s))
|
||||
end
|
||||
-- max |a - b| over n f32 samples (a at byte ao, b at byte bo)
|
||||
local function maxDiff(a: buffer, ao: number, b: buffer, bo: number, n: number): number
|
||||
local m = 0
|
||||
for i = 0, n - 1 do
|
||||
@@ -28,12 +25,10 @@ local function maxDiff(a: buffer, ao: number, b: buffer, bo: number, n: number):
|
||||
return m
|
||||
end
|
||||
|
||||
-- the contract
|
||||
t:eq(Aiff.name, "aiff", "name")
|
||||
t:eq(Aiff.category, "audio", "category")
|
||||
t:check(Aiff.caps.decode and Aiff.caps.encode and table.find(Aiff.extensions, "aif") ~= nil, "caps / extensions")
|
||||
|
||||
-- reference files: decode, stream, seek
|
||||
for _, c in Cases do
|
||||
local a, err = Aiff.decode(reader(c.data))
|
||||
t:check(a, c.name .. ": " .. tostring(err))
|
||||
@@ -63,7 +58,6 @@ for _, c in Cases do
|
||||
end
|
||||
t:note("%d reference files match ffmpeg", #Cases)
|
||||
|
||||
-- details of particular files
|
||||
local function case(name: string): any
|
||||
for _, c in Cases do
|
||||
if c.name == name then
|
||||
@@ -86,7 +80,6 @@ do
|
||||
t:check(s12.meta.source.bitDepth == 12 and maxDiff(s12.samples, 0, buffer.fromstring(s16.ref), 0, s16.frames * 2) < 1e-6, "12-bit sample size")
|
||||
local sw = Aiff.info(reader(case("ffmpeg-sowt").data))
|
||||
t:check(sw and sw.compression == "sowt" and sw.format == "s16le", "info: sowt")
|
||||
-- inside a bigger buffer
|
||||
local c = case("ffmpeg-s16be")
|
||||
local big = buffer.create(#c.data + 9)
|
||||
buffer.writestring(big, 5, c.data)
|
||||
@@ -114,7 +107,6 @@ for _, e in Enc do
|
||||
end
|
||||
t:note("%d encoder outputs read back by ffmpeg and by us", #Enc)
|
||||
|
||||
-- encoder: tags, odd sizes, errors
|
||||
do
|
||||
local a = Types.Audio.new(44100, 1, 3)
|
||||
buffer.writef32(a.samples, 0, 0.5)
|
||||
@@ -143,7 +135,6 @@ do
|
||||
t:eq(Aiff.sniff(reader("")), 0, "sniff nothing")
|
||||
end
|
||||
|
||||
-- errors
|
||||
do
|
||||
local _, e = Aiff.decode(reader("FORM\0\0\0\4WAVE"))
|
||||
t:check(e and e.code == Err.CORRUPT, "wrong FORM type: " .. tostring(e))
|
||||
@@ -160,7 +151,6 @@ do
|
||||
t:check(e4 and e4.code == Err.LIMIT, "maxFrames: LIMIT")
|
||||
end
|
||||
|
||||
-- fuzz
|
||||
do
|
||||
local samples = {}
|
||||
for i, c in Cases do
|
||||
|
||||
Reference in new issue
Block a user