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
@@ -10,7 +10,7 @@ _spec = importlib.util.spec_from_file_location("_audio", os.path.join(os.path.di
|
||||
A = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(A)
|
||||
|
||||
INPUTS = ["src/Formats/audio/aiff", "src/Formats/codecs/audio/Pcm"]
|
||||
INPUTS = ["src/Formats/audio/aiff", "src/Formats/codecs/audio/Pcm", "src/Formats/codecs/audio/Adpcm"]
|
||||
|
||||
|
||||
def ff(codec, src="{in}", extra=()):
|
||||
@@ -34,6 +34,8 @@ def generate(ctx):
|
||||
("sox-aiff-s16", "sox", ["sox", "{in}", "-t", "aiff", "{out}"]),
|
||||
("sox-aiff-s24-mono", "sox", ["sox", "{in_mono}", "-b", "24", "-t", "aiff", "{out}"]),
|
||||
("sox-aifc-s16", "sox", ["sox", "{in}", "-t", "aifc", "{out}"]),
|
||||
("ffmpeg-ima4", "ffmpeg", ff("adpcm_ima_qt")),
|
||||
("ffmpeg-ima4-mono", "ffmpeg", ff("adpcm_ima_qt", "{in_mono}")),
|
||||
]
|
||||
encodes = [
|
||||
("s16", "nil", 2),
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# CAF IMA4 fixtures (tools/fixtures.py): audio/caf's Apple IMA ADPCM (codecs/audio/Adpcm), written and decoded by ffmpeg.
|
||||
# tests/gen/caf_ima4.luau { name, data, rate, ch, ref (ffmpeg s16le) }
|
||||
import importlib.util, os
|
||||
|
||||
_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
def _load(name):
|
||||
spec = importlib.util.spec_from_file_location(name, os.path.join(_dir, name + ".py"))
|
||||
m = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(m)
|
||||
return m
|
||||
|
||||
|
||||
A = _load("_audio")
|
||||
D = _load("_adpcm")
|
||||
|
||||
INPUTS = ["src/Formats/codecs/audio/Adpcm", "src/Formats/audio/caf"]
|
||||
|
||||
|
||||
def generate(ctx):
|
||||
cases = []
|
||||
for name, kind, rate, ch, frames in (("ima4-stereo", "music", 44100, 2, 9000), ("ima4-mono", "sweep", 22050, 1, 4410)):
|
||||
sig = A.signal(kind, rate, ch, frames, seed=ch + 50)
|
||||
data = D.ffencode(ctx, A.wav(sig, rate, ch), ["-c:a", "adpcm_ima_qt"], "caf")
|
||||
cases.append(dict(name=name, data=data, rate=rate, ch=ch, ref=D.ffs16(ctx, data, "caf")))
|
||||
ctx.emit("caf_ima4", cases)
|
||||
Reference in new issue
Block a user