ws-audio2: AIFF-C and CAF ima4 (Apple IMA ADPCM) decode through codecs/audio/Adpcm
aiff: COMM counts ima4 packets; caf: ima4 through Adpcm/Decoder.blocks (exact seeking), and a constant-size packet stream whose pakt lists no packets now uses bytesPerPacket (was 0 frames). Bit-exact with ffmpeg.
This commit is contained in:
1 parent
3f6823cbe5
commit
2717292366
7 files changed
+99
-17
No files matched your search
@@ -1,5 +1,5 @@
|
||||
-- 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, 6 channels, text chunks) against ffmpeg's decode; streaming reads and seeks;
|
||||
-- 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.
|
||||
-- Fixtures: tools/fixtures/aiff.py.
|
||||
local T = require("@tests/T")
|
||||
@@ -149,9 +149,11 @@ do
|
||||
t:check(e and e.code == Err.CORRUPT, "wrong FORM type: " .. tostring(e))
|
||||
local c = case("ffmpeg-fl32").data
|
||||
local p = string.find(c, "fl32", 1, true) :: number
|
||||
local ima = string.sub(c, 1, p - 1) .. "ima4" .. string.sub(c, p + 4)
|
||||
local _, e2 = Aiff.decode(reader(ima))
|
||||
t:check(e2 and e2.code == Err.UNSUPPORTED, "ima4: UNSUPPORTED: " .. tostring(e2))
|
||||
local mac = string.sub(c, 1, p - 1) .. "MAC3" .. string.sub(c, p + 4)
|
||||
local _, e2 = Aiff.decode(reader(mac))
|
||||
t:check(e2 and e2.code == Err.UNSUPPORTED, "MAC3: UNSUPPORTED: " .. tostring(e2))
|
||||
local i4 = Aiff.decode(reader(case("ffmpeg-ima4").data)) :: any
|
||||
t:check(i4.meta.source.compression == "ima4" and i4.frames % 64 == 0, "ima4 meta / whole packets")
|
||||
local _, e3 = Aiff.decode(reader(string.sub(c, 1, 30)))
|
||||
t:check(e3 and (e3.code == Err.TRUNCATED or e3.code == Err.CORRUPT), "cut in COMM: " .. tostring(e3))
|
||||
local _, e4 = Aiff.decode(reader(case("ffmpeg-s16be").data), { maxFrames = 10 })
|
||||
|
||||
@@ -174,4 +174,16 @@ do
|
||||
end, samples, { mutations = 30 })
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ IMA4
|
||||
do
|
||||
local H = require("@tests/audio/_adpcm")
|
||||
local Ima4 = require("@tests/gen/caf_ima4")
|
||||
for _, c in Ima4 do
|
||||
H.check(t, Caf, c)
|
||||
local a = Caf.decode(Bytes.reader(buffer.fromstring(c.data))) :: any
|
||||
t:eq(a.meta.source.codec, "ima4", c.name .. ": codec")
|
||||
end
|
||||
t:note("%d IMA4 files bit-exact with ffmpeg", #Ima4)
|
||||
end
|
||||
|
||||
t:done()
|
||||
Reference in new issue
Block a user