H.264: Cabac / Cavlc resolved once per process (upvalue), not per slice; AAC: SBR / PS required with the first SBR element (AacSbr chunk: an AAC-LC open compiles 55 KB, not 203 KB); m4a: Alac required for an ALAC track; chunked build: Vp8 / Vp8L and the Opus CELT encoder in chunks of their own; load check: AAC-LC and HE-AACv2 m4a opens
This commit is contained in:
1 parent
05a44e1193
commit
3f0a0df9c7
12 files changed
+4057
-3950
No files matched your search
+32
-15
@@ -272,7 +272,8 @@ HOT = [
|
||||
("MpegTs", ["containers/MpegTs", "containers/MpegEs", "containers/MpegPs"]),
|
||||
("Dct", ["codecs/image/Dct"]),
|
||||
("Jpeg", ["codecs/image/Jpeg"]),
|
||||
("Vp8", ["codecs/image/Vp8", "codecs/image/Vp8L"]),
|
||||
("Vp8", ["codecs/image/Vp8"]),
|
||||
("Vp8L", ["codecs/image/Vp8L"]),
|
||||
("Bcn", ["codecs/image/Bcn"]),
|
||||
("Png", ["image/png"]),
|
||||
("Deflate", ["codecs/compress/Deflate"]),
|
||||
@@ -281,8 +282,10 @@ HOT = [
|
||||
("Lzma", ["codecs/compress/Lzma"]),
|
||||
("Zstd", ["codecs/compress/Zstd"]),
|
||||
("Mpa", ["codecs/audio/Mpa"]),
|
||||
("OpusEncoder", ["codecs/audio/Opus/CeltEncoder"]),
|
||||
("Opus", ["codecs/audio/Opus"]),
|
||||
("Vorbis", ["codecs/audio/Vorbis"]),
|
||||
("AacSbr", ["codecs/audio/Aac/" + m for m in ("Sbr", "SbrBits", "SbrDct", "SbrHf", "SbrQmf", "SbrTables", "Ps")]),
|
||||
("Aac", ["codecs/audio/Aac"]),
|
||||
("Flac", ["codecs/audio/Flac"]),
|
||||
("Musepack", ["codecs/audio/Musepack"]),
|
||||
@@ -566,8 +569,8 @@ def detect_check(root, sources):
|
||||
|
||||
|
||||
# load_check: the first load of a format, each in a fresh VM, requires exactly the chunks listed (its own units and
|
||||
# what they use; a chunk that shows up here unasked is packed or required too eagerly). The H.264 cases read
|
||||
# tests/gen/h264_containers (skipped without the fixtures).
|
||||
# what they use; a chunk that shows up here unasked is packed or required too eagerly). The H.264 and AAC cases read
|
||||
# tests/gen (skipped without the fixtures).
|
||||
LOAD_PNG = bytes([137, 80, 78, 71, 13, 10, 26, 10]) + b"".join(
|
||||
struct.pack(">I", len(d)) + t + d + struct.pack(">I", zlib.crc32(t + d))
|
||||
for t, d in [(b"IHDR", struct.pack(">IIBBBBB", 16, 16, 8, 6, 0, 0, 0)),
|
||||
@@ -579,14 +582,30 @@ LOAD_CASES = [ # (name, Luau expression whose value is printed, expected value,
|
||||
'"' + "".join("\\%03d" % c for c in LOAD_PNG) + '"'), "16",
|
||||
["Detect", "Png", "Deflate", "core_Adler32", "core_Crc32", "core_Bits", "codecs_entropy_Huffman", "containers_Chunks"]),
|
||||
]
|
||||
H264_CASES = [("baseline.mp4", "H264Cavlc"), ("cabac_b.mp4", "H264Cabac")]
|
||||
LOAD_H264 = """(function()
|
||||
local Fx = require("../../../../tests/gen/h264_containers")
|
||||
for _, c in Fx do
|
||||
FIXTURE_CASES = [ # (fixture module, file, what opens it, the first value's field, its value, the chunks besides Detect)
|
||||
("h264_containers", "baseline.mp4", "video", "width", "176", [
|
||||
"video_mp4", "containers_IsoBmff", "containers_Demux", "codecs_video_Video", "codecs_image_Yuv", "H264",
|
||||
"H264Cavlc"]),
|
||||
("h264_containers", "cabac_b.mp4", "video", "width", "176", [
|
||||
"video_mp4", "containers_IsoBmff", "containers_Demux", "codecs_video_Video", "codecs_image_Yuv", "H264",
|
||||
"H264Cabac"]),
|
||||
("m4a_aac", "aac_stereo_128k.m4a", "audio", "n", "4096", [
|
||||
"audio_m4a", "codecs_audio_Pcm", "codecs_audio_Stream", "containers_IsoBmff", "Aac", "core_Bits",
|
||||
"codecs_audio_Mdct"]),
|
||||
("m4a_he", "he_aac_v2.m4a", "audio", "n", "4096", [
|
||||
"audio_m4a", "codecs_audio_Pcm", "codecs_audio_Stream", "containers_IsoBmff", "Aac", "core_Bits",
|
||||
"codecs_audio_Mdct", "AacSbr"]),
|
||||
]
|
||||
LOAD_FIXTURE = """(function()
|
||||
for _, c in require("../../../../tests/gen/%s") do
|
||||
if c.name == "%s" then
|
||||
local v = assert(F.video.open(buffer.fromstring(c.data)))
|
||||
local f: any = assert(v:nextFrame())
|
||||
return (f.image or f).width
|
||||
local d = assert(F.%s.open(buffer.fromstring(c.data)))
|
||||
if "%s" == "width" then
|
||||
local f: any = assert(d:nextFrame())
|
||||
return (f.image or f).width
|
||||
end
|
||||
local _, n = d:read(4096)
|
||||
return n
|
||||
end
|
||||
end
|
||||
return nil
|
||||
@@ -595,11 +614,9 @@ end)()"""
|
||||
|
||||
def load_check(d):
|
||||
cases = list(LOAD_CASES)
|
||||
if os.path.isfile(os.path.join(ROOT, "tests", "gen", "h264_containers.luau")):
|
||||
for name, coder in H264_CASES:
|
||||
cases.append(("h264 " + name, LOAD_H264 % name, "176", [
|
||||
"Detect", "video_mp4", "containers_IsoBmff", "containers_Demux", "codecs_video_Video",
|
||||
"codecs_image_Yuv", "H264", coder]))
|
||||
for mod, name, cat, field, want, chunks in FIXTURE_CASES:
|
||||
if os.path.isfile(os.path.join(ROOT, "tests", "gen", mod + ".luau")):
|
||||
cases.append((name, LOAD_FIXTURE % (mod, name, cat, field), want, ["Detect"] + chunks))
|
||||
bad = []
|
||||
for name, expr, want, allowed in cases:
|
||||
script = os.path.join(d, "load.luau")
|
||||
|
||||
Reference in new issue
Block a user