rename: src/Formats -> src/Rosetta, @formats -> @rosetta requires, build/luajit/rosetta + rosetta._compat, build/roblox/Rosetta, ROSETTA_* env/globals, writer vendor strings

This commit is contained in:
4DBug committed 2026-11-01 01:19:16 -05:00
1 parent 2956576d7f
commit 22ddcd78fa
941 files changed
+3364 -3364

No files matched your search

+126 -126
View File
@@ -3,22 +3,22 @@
-- tools/fixtures/opus.py (3 s stereo files; MB/s of f32 output, 48 kHz stereo f32 is 0.384 MB/s of real time),
-- tools/fixtures/flac.py; wav encodes / decodes a generated tone; zstd / brotli / bzip2 / lzma / lz4 (*_bench corpora), .Z (tools/fixtures/z.py), fonts
-- (glyphs per second), cab (LZX / MSZIP / Quantum), json / xml / yaml, jpeg / gif / tiff / qoi / tga / pnm / hdr and ImageOps.
local Deflate = require("@formats/codecs/compress/Deflate")
local Crc32 = require("@formats/core/Crc32")
local Bytes = require("@formats/core/Bytes")
local Png = require("@formats/image/png")
local Deflate = require("@rosetta/codecs/compress/Deflate")
local Crc32 = require("@rosetta/core/Crc32")
local Bytes = require("@rosetta/core/Bytes")
local Png = require("@rosetta/image/png")
local B = require("@tests/gen/deflate_bench")
local PB = require("@tests/gen/png_bench")
local Mp3 = require("@formats/audio/mp3")
local Mp3 = require("@rosetta/audio/mp3")
local MC = require("@tests/gen/mp3_cases")
local Opus = require("@formats/audio/opus")
local Opus = require("@rosetta/audio/opus")
local OpusCelt = require("@tests/gen/opus_celt_st_128")
local OpusSilk = require("@tests/gen/opus_silk_wb_st")
local OpusHybrid = require("@tests/gen/opus_hybrid_st")
local Flac = require("@formats/audio/flac")
local Flac = require("@rosetta/audio/flac")
local FC = require("@tests/gen/flac_cases")
local Wav = require("@formats/audio/wav")
local Types = require("@formats/Types")
local Wav = require("@rosetta/audio/wav")
local Types = require("@rosetta/Types")
local runtime = if (_G :: any).jit ~= nil then "luajit" else "luau"
@@ -105,7 +105,7 @@ for _, c in { { "celt 128k", OpusCelt }, { "silk wb", OpusSilk }, { "hybrid", Op
end
-- vorbis (ws-audio): 10 s of 44.1 kHz stereo music at oggenc -q 5 (tools/fixtures/vorbis.py)
do
local Vorbis = require("@formats/audio/vorbis")
local Vorbis = require("@rosetta/audio/vorbis")
local VB = require("@tests/gen/vorbis_bench")
local b = buffer.fromstring(VB.data)
local dt = bench("vorbis decode q5 (10 s st)", 3, VB.frames * VB.channels * 4, function()
@@ -141,7 +141,7 @@ do
end
-- flac encode (ws-audio): 10 s of 44.1 kHz stereo 16-bit (a synthetic two-tone signal with noise)
do
local Fl = require("@formats/audio/flac")
local Fl = require("@rosetta/audio/flac")
local n = 441000
local a = Types.Audio.new(44100, 2, n)
local seed = 1
@@ -160,7 +160,7 @@ do
end
-- mp3 / mp2 encode (ws-audio): 10 s of 44.1 kHz stereo tones
do
local M3 = require("@formats/audio/mp3")
local M3 = require("@rosetta/audio/mp3")
local n = 441000
local a = Types.Audio.new(44100, 2, n)
for i = 0, n - 1 do
@@ -176,7 +176,7 @@ do
end
-- vorbis encode (ws-audio): 10 s of 44.1 kHz stereo tones at quality 3
do
local Vb = require("@formats/audio/vorbis")
local Vb = require("@rosetta/audio/vorbis")
local n = 441000
local a = Types.Audio.new(44100, 2, n)
for i = 0, n - 1 do
@@ -189,7 +189,7 @@ do
print(string.format("%-8s %-30s %8.1fx real time", runtime, "", 10 / dt))
end
do
local Json = require("@formats/codecs/text/Json")
local Json = require("@rosetta/codecs/text/Json")
local JB = require("@tests/gen/json_bench")
local v = assert(Json.decode(JB.text))
assert(Json.encode(v) == JB.compact, "json bench mismatch")
@@ -204,7 +204,7 @@ do
end)
end
do
local Xml = require("@formats/codecs/text/Xml")
local Xml = require("@rosetta/codecs/text/Xml")
local XB = require("@tests/gen/xml_bench")
local doc = assert(Xml.decode(XB.text))
bench("xml decode (DOM)", 5, #XB.text, function()
@@ -221,7 +221,7 @@ end
-- ws-arch codecs: zstd, brotli, bzip2, xz / lzma
do
local Zstd = require("@formats/codecs/compress/Zstd")
local Zstd = require("@rosetta/codecs/compress/Zstd")
local ZB = require("@tests/gen/zstd_bench")
local z3, z19 = buffer.fromstring(ZB.data3), buffer.fromstring(ZB.data19)
local zo = assert(Zstd.decompress(z3))
@@ -237,7 +237,7 @@ do
end)
end
do
local Lz4 = require("@formats/codecs/compress/Lz4")
local Lz4 = require("@rosetta/codecs/compress/Lz4")
local LB = require("@tests/gen/lz4_bench")
local lz = buffer.fromstring(LB.data)
local raw = assert(Lz4.decompress(lz, nil, nil, LB.size))
@@ -251,10 +251,10 @@ do
end
-- ws-roblox: a model of 20000 parts (built here) through model/rbxm and model/rbxmx, and a .mesh decode
do
local Rbx = require("@formats/codecs/model/Rbx")
local Rbxm = require("@formats/model/rbxm")
local Rbxmx = require("@formats/model/rbxmx")
local RobloxMesh = require("@formats/model/robloxmesh")
local Rbx = require("@rosetta/codecs/model/Rbx")
local Rbxm = require("@rosetta/model/rbxm")
local Rbxmx = require("@rosetta/model/rbxmx")
local RobloxMesh = require("@rosetta/model/robloxmesh")
local tree = Rbx.tree()
local folder = Rbx.add(tree, Rbx.instance("Folder", "Parts"))
for i = 1, 20000 do
@@ -284,7 +284,7 @@ do
end)
end
do
local Brotli = require("@formats/codecs/compress/Brotli")
local Brotli = require("@rosetta/codecs/compress/Brotli")
local BB = require("@tests/gen/brotli_bench")
local bz = buffer.fromstring(BB.data)
local bout = assert(Brotli.decompress(bz))
@@ -294,7 +294,7 @@ do
end)
end
do
local Bzip2 = require("@formats/codecs/compress/Bzip2")
local Bzip2 = require("@rosetta/codecs/compress/Bzip2")
local BZ = require("@tests/gen/bzip2_bench")
local bz = buffer.fromstring(BZ.data)
bench("bzip2 decompress -9", 3, BZ.size, function()
@@ -302,7 +302,7 @@ do
end)
end
do
local Lz4F = require("@formats/archive/lz4")
local Lz4F = require("@rosetta/archive/lz4")
local LF = require("@tests/gen/lz4frame")
local LC = require("@tests/gen/lz4frame_corpora")
local frameData
@@ -320,7 +320,7 @@ do
end)
end
do
local UnixCompress = require("@formats/codecs/compress/UnixCompress")
local UnixCompress = require("@rosetta/codecs/compress/UnixCompress")
local ZC = require("@tests/gen/z")
local zc = ZC.cases[5] -- the 700 KB corpus, -b 16
local zb, zi = buffer.fromstring(zc.z), buffer.fromstring(zc.input)
@@ -332,7 +332,7 @@ do
end)
end
do
local Lzma = require("@formats/codecs/compress/Lzma")
local Lzma = require("@rosetta/codecs/compress/Lzma")
local LB = require("@tests/gen/lzma_bench")
local lx, la = buffer.fromstring(LB.xz), buffer.fromstring(LB.alone)
local lo = assert(Lzma.xz(lx))
@@ -347,7 +347,7 @@ end
-- fonts: outlines and rasterization (MB/s here = thousands of glyphs per second)
do
local Ttf = require("@formats/font/ttf")
local Ttf = require("@rosetta/font/ttf")
local FX = require("@tests/gen/fonts")
for _, c in FX.fonts do
if c.name == "Roboto-Medium" or c.name == "SourceSans3-Regular" then
@@ -370,7 +370,7 @@ do
end
end
do
local Yaml = require("@formats/data/yaml")
local Yaml = require("@rosetta/data/yaml")
local YB = require("@tests/gen/yaml_bench")
local yb = buffer.fromstring(YB.text)
local v = assert(Yaml.decode(Bytes.reader(yb)))
@@ -383,8 +383,8 @@ do
end
-- ------------------------------------------------------------------------------------------------ jpeg (ws-imgA)
do
local Jpeg = require("@formats/image/jpeg")
local Types = require("@formats/Types")
local Jpeg = require("@rosetta/image/jpeg")
local Types = require("@rosetta/Types")
local JB = require("@tests/gen/jpeg_bench")
for _, c in JB.files do
local b = buffer.fromstring(c.data)
@@ -408,9 +408,9 @@ do
end
-- ---------------------------------------------------------------------------------------- ws-imgA: gif + quantize
do
local Gif = require("@formats/image/gif")
local Quantize = require("@formats/codecs/image/Quantize")
local Types = require("@formats/Types")
local Gif = require("@rosetta/image/gif")
local Quantize = require("@rosetta/codecs/image/Quantize")
local Types = require("@rosetta/Types")
local GB = require("@tests/gen/gif_bench")
local still = buffer.fromstring(GB.still)
local anim = buffer.fromstring(GB.anim)
@@ -450,7 +450,7 @@ do
end
-- ------------------------------------------------------------------------------------------------ ops/ImageOps
do
local Ops = require("@formats/ops/ImageOps")
local Ops = require("@rosetta/ops/ImageOps")
local img = assert(Png.decode(Bytes.reader(buffer.fromstring(PB[1].data))))
local n = img.width * img.height * 4
bench("imageops resize 1/2 bilinear", 2, n, function()
@@ -478,8 +478,8 @@ do
end
-- ------------------------------------------------------------------------------------------------ image/tiff (ws-imgA)
do
local Tiff = require("@formats/image/tiff")
local Types = require("@formats/Types")
local Tiff = require("@rosetta/image/tiff")
local Types = require("@rosetta/Types")
local src = Types.Image.new(1024, 768)
for i = 0, 1024 * 768 - 1 do
local x, y = i % 1024, i // 1024
@@ -502,11 +502,11 @@ end
-- ------------------------------------------------------------------------------------------------ imgA-simple: qoi / tga / pnm / hdr
-- fixtures: tools/fixtures/qoi.py (tests/gen/qoi_bench.luau: run python3 -I tools/fixtures.py qoi first)
do
local Qoi = require("@formats/image/qoi")
local Tga = require("@formats/image/tga")
local Pnm = require("@formats/image/pnm")
local Hdr = require("@formats/image/hdr")
local Types = require("@formats/Types")
local Qoi = require("@rosetta/image/qoi")
local Tga = require("@rosetta/image/tga")
local Pnm = require("@rosetta/image/pnm")
local Hdr = require("@rosetta/image/hdr")
local Types = require("@rosetta/Types")
local QB = require("@tests/gen/qoi_bench")
local qd = buffer.fromstring(QB.data)
local n = QB.width * QB.height * 4
@@ -541,13 +541,13 @@ end
do
-- 3D (ws-3d): a 400 x 400 grid mesh (160k vertices, 318k triangles) through our own writers, then the readers; a
-- 128^3 noise voxel grid through VOX and greedy meshing
local Types = require("@formats/Types")
local MeshOps = require("@formats/ops/MeshOps")
local Gltf = require("@formats/model/gltf")
local Obj = require("@formats/model/obj")
local Stl = require("@formats/model/stl")
local Ply = require("@formats/model/ply")
local Vox = require("@formats/model/vox")
local Types = require("@rosetta/Types")
local MeshOps = require("@rosetta/ops/MeshOps")
local Gltf = require("@rosetta/model/gltf")
local Obj = require("@rosetta/model/obj")
local Stl = require("@rosetta/model/stl")
local Ply = require("@rosetta/model/ply")
local Vox = require("@rosetta/model/vox")
local N = 400
local pos = Types.Scene.accessor(nil, "f32", 3, N * N)
local uv = Types.Scene.accessor(nil, "f32", 2, N * N)
@@ -623,10 +623,10 @@ end
do
-- layered + vector (ws-vec): PSD decode / encode of 8 RGBA layers 1024 x 768, flatten (codecs/image/Blend), SVG
-- rasterize at 512 x 512 (codecs/image/Raster). No fixtures: the inputs are built here.
local Types = require("@formats/Types")
local Psd = require("@formats/layered/psd")
local LayerOps = require("@formats/ops/LayerOps")
local Svg = require("@formats/vector/svg")
local Types = require("@rosetta/Types")
local Psd = require("@rosetta/layered/psd")
local LayerOps = require("@rosetta/ops/LayerOps")
local Svg = require("@rosetta/vector/svg")
local W, H = 1024, 768
local doc = Types.Layered.new(W, H)
local modes = { "normal", "multiply", "screen", "overlay", "normal", "softLight", "difference", "normal" }
@@ -666,7 +666,7 @@ do
end)
end
do
local Webp = require("@formats/image/webp")
local Webp = require("@rosetta/image/webp")
local WB = require("@tests/gen/webp_bench")
local n = WB.width * WB.height * 4
local lossy, lossless = buffer.fromstring(WB.lossy), buffer.fromstring(WB.lossless)
@@ -685,7 +685,7 @@ do
end)
end
do
local Xml = require("@formats/codecs/text/Xml")
local Xml = require("@rosetta/codecs/text/Xml")
local XB = require("@tests/gen/xml_bench")
local doc = assert(Xml.decode(XB.text))
bench("xml decode (DOM)", 5, #XB.text, function()
@@ -702,9 +702,9 @@ end
-- ws-m4a: AAC-LC / ALAC decode and ALAC encode (MB/s of 16-bit PCM equivalent: frames * channels * 2), MDCT
do
local M4a = require("@formats/audio/m4a")
local Alac = require("@formats/codecs/audio/Alac")
local Mdct = require("@formats/codecs/audio/Mdct")
local M4a = require("@rosetta/audio/m4a")
local Alac = require("@rosetta/codecs/audio/Alac")
local Mdct = require("@rosetta/codecs/audio/Mdct")
local MA = require("@tests/gen/m4a_aac")
local ML = require("@tests/gen/m4a_alac")
local aac = buffer.fromstring(MA[1].data)
@@ -739,7 +739,7 @@ do
end)
end
do
local Opus = require("@formats/audio/opus")
local Opus = require("@rosetta/audio/opus")
local Cases = require("@tests/audio/_opus_cases")
local c = Cases.list[2]
local a = Cases.signal(c)
@@ -752,8 +752,8 @@ end
-- MIDI through the SoundFont synth (tools/fixtures/sf2.py's test song; tools/fixtures/midi.py's "song" through the
-- built-in waveform set): seconds of stereo 44.1 kHz audio rendered per second of CPU
do
local Midi = require("@formats/music/midi")
local Sf2 = require("@formats/music/sf2")
local Midi = require("@rosetta/music/midi")
local Sf2 = require("@rosetta/music/sf2")
local SF = require("@tests/gen/sf2_cases")
local MC = require("@tests/gen/midi_cases")
local sf = assert(Sf2.decode(Bytes.reader(buffer.fromstring(SF.sf2))))
@@ -786,8 +786,8 @@ do
end
-- the synth's per-voice cost: 32 sustained, filtered, looped voices (sf2 saw preset with a mod env) for 2 s
do
local SoundFont = require("@formats/codecs/audio/SoundFont")
local Sf2 = require("@formats/music/sf2")
local SoundFont = require("@rosetta/codecs/audio/SoundFont")
local Sf2 = require("@rosetta/music/sf2")
local SF = require("@tests/gen/sf2_cases")
local sf = assert(Sf2.decode(Bytes.reader(buffer.fromstring(SF.sf2))))
local frames = 88200
@@ -811,7 +811,7 @@ end
-- the tracker engine: 32 channels of looped samples (one note each, linear interpolation, volume ramps), and an
-- IT-style module with background voices (NNA continue) and resonant filters on every channel
do
local Tracker = require("@formats/codecs/audio/Tracker")
local Tracker = require("@rosetta/codecs/audio/Tracker")
local function song(format: string, filter: boolean): any
local m = Tracker.newModule(format, 32)
m.order = { 0 }
@@ -867,13 +867,13 @@ end
do
-- 3D (ws-3d): a 400 x 400 grid mesh (160k vertices, 318k triangles) through our own writers, then the readers; a
-- 128^3 noise voxel grid through VOX and greedy meshing
local Types = require("@formats/Types")
local MeshOps = require("@formats/ops/MeshOps")
local Gltf = require("@formats/model/gltf")
local Obj = require("@formats/model/obj")
local Stl = require("@formats/model/stl")
local Ply = require("@formats/model/ply")
local Vox = require("@formats/model/vox")
local Types = require("@rosetta/Types")
local MeshOps = require("@rosetta/ops/MeshOps")
local Gltf = require("@rosetta/model/gltf")
local Obj = require("@rosetta/model/obj")
local Stl = require("@rosetta/model/stl")
local Ply = require("@rosetta/model/ply")
local Vox = require("@rosetta/model/vox")
local N = 400
local pos = Types.Scene.accessor(nil, "f32", 3, N * N)
local uv = Types.Scene.accessor(nil, "f32", 2, N * N)
@@ -926,7 +926,7 @@ do
bench("ply binary decode (" .. buffer.len(ply) // 1000 .. " KB)", 5, buffer.len(ply), function()
Ply.decode(Bytes.reader(ply))
end)
local Fbx = require("@formats/model/fbx")
local Fbx = require("@rosetta/model/fbx")
local fbx = assert(Fbx.encode(scene))
bench("fbx binary decode (" .. buffer.len(fbx) // 1000 .. " KB)", 3, buffer.len(fbx), function()
Fbx.decode(Bytes.reader(fbx))
@@ -941,7 +941,7 @@ do
bench("fbx ascii decode (" .. buffer.len(fbxa) // 1000 .. " KB)", 2, buffer.len(fbxa), function()
Fbx.decode(Bytes.reader(fbxa))
end)
local ThreeMf = require("@formats/model/3mf")
local ThreeMf = require("@rosetta/model/3mf")
local tmf = assert(ThreeMf.encode(scene))
bench("3mf decode (" .. buffer.len(tmf) // 1000 .. " KB zipped)", 2, buffer.len(tmf), function()
ThreeMf.decode(Bytes.reader(tmf))
@@ -949,8 +949,8 @@ do
bench("3mf encode", 2, buffer.len(tmf), function()
ThreeMf.encode(scene)
end)
local Wrl = require("@formats/model/vrml")
local X3d = require("@formats/model/x3d")
local Wrl = require("@rosetta/model/vrml")
local X3d = require("@rosetta/model/x3d")
local wrl = assert(Wrl.encode(scene))
bench("vrml decode (" .. buffer.len(wrl) // 1000 .. " KB)", 2, buffer.len(wrl), function()
Wrl.decode(Bytes.reader(wrl))
@@ -984,7 +984,7 @@ do
end
do
-- STEP (tools/fixtures/step.py): the largest case, parse and write
local Step = require("@formats/cad/step")
local Step = require("@rosetta/cad/step")
local SC = require("@tests/gen/step_cases")
local big = SC[1]
for _, c in SC do
@@ -1003,10 +1003,10 @@ do
end
-- ------------------------------------------------------------------------------------------- ws-video-codecs: fps
do
local Jpeg = require("@formats/codecs/image/Jpeg")
local Mpeg1 = require("@formats/codecs/video/Mpeg1")
local Base64 = require("@formats/core/Base64")
local Types = require("@formats/Types")
local Jpeg = require("@rosetta/codecs/image/Jpeg")
local Mpeg1 = require("@rosetta/codecs/video/Mpeg1")
local Base64 = require("@rosetta/core/Base64")
local Types = require("@rosetta/Types")
local MB = require("@tests/gen/mjpeg_bench")
local M1 = require("@tests/gen/mpeg1_bench")
-- best of n runs of f (which handles `frames` frames): ms per frame and frames per second
@@ -1064,7 +1064,7 @@ do
end
-- ------------------------------------------------------------------------------------------- ws-video: containers
do
local F = require("@formats")
local F = require("@rosetta")
local VB = require("@tests/gen/videobench")
local function clock(n: number, f: () -> number): (number, number)
local frames = f()
@@ -1115,8 +1115,8 @@ end
do
-- VP8 video (codecs/image/Vp8, tools/fixtures/vp8video.py): whole IVF streams (libvpx, panning testsrc2) through one
-- decoder object; frames per second. On LuaJIT the library's host module raises the trace limits (maxtrace=8000,
-- see src/Formats/host/init.luau): the second pair of lines runs with them, as the api does.
local Vp8 = require("@formats/codecs/image/Vp8")
-- see src/Rosetta/host/init.luau): the second pair of lines runs with them, as the api does.
local Vp8 = require("@rosetta/codecs/image/Vp8")
local VB = require("@tests/gen/vp8video_bench")
local function run(tag: string)
for _, c in VB do
@@ -1149,7 +1149,7 @@ do
-- H.264 (codecs/video/H264): whole Annex B streams, frames per second (decode + the cropped yuv420p output copies). The
-- testsrc2 clips are easy (mostly static); the mandelbrot zooms move everywhere. LuaJIT runs twice: with its default
-- trace limits and with the ones host/init.luau sets (maxtrace=8000, maxmcode=65536).
local H264 = require("@formats/codecs/video/H264")
local H264 = require("@rosetta/codecs/video/H264")
local HB = require("@tests/gen/h264_bench")
local function run(tag: string)
for _, c in HB do
@@ -1171,7 +1171,7 @@ end
-- ws-arch2 archives: the LHA family (codecs/compress/Lzh) over tools/fixtures/lha.py archives (MB/s of output)
do
local Lha = require("@formats/archive/lha")
local Lha = require("@rosetta/archive/lha")
local LF = require("@tests/gen/lha")
for _, want in { "lha114i -h2 -5", "lha114i -h2 -7", "lengths/lh1-1m.lzh", "lengths/lz5-1m.lzs", "larc333/long.lzs" } do
for _, c in LF.cases do
@@ -1193,7 +1193,7 @@ end
-- ws-arch2 cabinets: LZX (codecs/compress/Lzx), Quantum (codecs/compress/Quantum) and MSZIP folders of
-- tools/fixtures/cab.py (MB/s of output; each run decodes the cabinet again, so the folder cache does not count)
do
local Cab = require("@formats/archive/cab")
local Cab = require("@rosetta/archive/cab")
local CF = require("@tests/gen/cab")
for _, kind in { "lzx", "quantum", "mszip" } do
local datas, total = {}, 0
@@ -1220,9 +1220,9 @@ do
-- game formats (ws-game): PKWARE DCL explode (StormLib's implode streams from tools/fixtures/mpq.py), reading every
-- file of a StormLib MPQ (MB/s of file data), Freedoom's MAP01 to a Scene (tools/fixtures/wad.py: sector
-- outlines, triangulation, walls; MB/s of map lumps), an MD2 with every frame as a morph target
local Explode = require("@formats/codecs/compress/Explode")
local Mpq = require("@formats/archive/mpq")
local Wad = require("@formats/archive/wad")
local Explode = require("@rosetta/codecs/compress/Explode")
local Mpq = require("@rosetta/archive/mpq")
local Wad = require("@rosetta/archive/wad")
local MQ = require("@tests/gen/mpq")
local WD = require("@tests/gen/wad")
for _, c in MQ.implode do
@@ -1261,7 +1261,7 @@ end
do
-- Draco (codecs/model/Draco): the Stanford bunny (35k points, 69k faces, Edgebreaker valence, normals) and a UV
-- sphere with seams; MB/s of decoded output (u32 indices + f32 attributes per point), plus triangles per second.
local Draco = require("@formats/codecs/model/Draco")
local Draco = require("@rosetta/codecs/model/Draco")
local DC = require("@tests/gen/draco_cases")
for _, c in DC do
if c.name == "enc/bunny_norm.obj.cl7" or c.name == "enc/uvsphere.obj.cl10" or c.name == "enc/uvsphere.obj.cl0" then
@@ -1281,10 +1281,10 @@ end
do
-- NBT / voxels (ws-voxel): a chunk-like NBT tree (24 sections with packed long arrays, 4000 entity-like compounds)
-- through codecs/text/Nbt (binary and SNBT), 1M packed 5-bit indices, a 64^3 Sponge schematic and Qubicle file
local Nbt = require("@formats/codecs/text/Nbt")
local Mc = require("@formats/codecs/model/Minecraft")
local Schematic = require("@formats/model/schematic")
local Qb = require("@formats/model/qb")
local Nbt = require("@rosetta/codecs/text/Nbt")
local Mc = require("@rosetta/codecs/model/Minecraft")
local Schematic = require("@rosetta/model/schematic")
local Qb = require("@rosetta/model/qb")
local sections = Nbt.list("compound")
for s = 1, 24 do
local pal = Nbt.list("compound")
@@ -1358,10 +1358,10 @@ do
end
-- ------------------------------------------------------------------------------------------- ws-video-codecs: fps
do
local Jpeg = require("@formats/codecs/image/Jpeg")
local Mpeg1 = require("@formats/codecs/video/Mpeg1")
local Base64 = require("@formats/core/Base64")
local Types = require("@formats/Types")
local Jpeg = require("@rosetta/codecs/image/Jpeg")
local Mpeg1 = require("@rosetta/codecs/video/Mpeg1")
local Base64 = require("@rosetta/core/Base64")
local Types = require("@rosetta/Types")
local MB = require("@tests/gen/mjpeg_bench")
local M1 = require("@tests/gen/mpeg1_bench")
-- best of n runs of f (which handles `frames` frames): ms per frame and frames per second
@@ -1439,9 +1439,9 @@ do
-- Theora (codecs/video/Theora): 320x240 clips, 50 frames, keyframe every 25: testsrc2 at 600 kbit/s (mostly static:
-- few coded blocks) and a mandelbrot zoom at 1200 kbit/s (every block coded, moving); decode alone and decode +
-- image() (the yuv420p copy every VideoDecoder frame makes)
local Theora = require("@formats/codecs/video/Theora")
local Ogg = require("@formats/containers/Ogg")
local Base64 = require("@formats/core/Base64")
local Theora = require("@rosetta/codecs/video/Theora")
local Ogg = require("@rosetta/containers/Ogg")
local Base64 = require("@rosetta/core/Base64")
local TB = require("@tests/gen/theora_bench")
local function run(tag: string)
for _, c in TB do
@@ -1478,7 +1478,7 @@ do
-- the legacy codecs (codecs/video/Legacy) through F.video.open, rgba8 frames out: ffmpeg's encoders at 320x240
-- (tools/fixtures/legacy.py), a 320x200 FLC (fli.py) and a 320x200 SMK4 (smk.py, textured: mostly FULL blocks);
-- frames per second of the whole decode (and the Smacker audio track, seconds of audio per second)
local F = require("@formats")
local F = require("@rosetta")
local LB = require("@tests/gen/legacy_bench")
local cases = table.clone(LB)
table.insert(cases, { name = "fli.flc", data = require("@tests/gen/fli_bench").data, width = 320, height = 200 })
@@ -1515,13 +1515,13 @@ end
do
-- 3D (ws-3d): a 400 x 400 grid mesh (160k vertices, 318k triangles) through our own writers, then the readers; a
-- 128^3 noise voxel grid through VOX and greedy meshing
local Types = require("@formats/Types")
local MeshOps = require("@formats/ops/MeshOps")
local Gltf = require("@formats/model/gltf")
local Obj = require("@formats/model/obj")
local Stl = require("@formats/model/stl")
local Ply = require("@formats/model/ply")
local Vox = require("@formats/model/vox")
local Types = require("@rosetta/Types")
local MeshOps = require("@rosetta/ops/MeshOps")
local Gltf = require("@rosetta/model/gltf")
local Obj = require("@rosetta/model/obj")
local Stl = require("@rosetta/model/stl")
local Ply = require("@rosetta/model/ply")
local Vox = require("@rosetta/model/vox")
local N = 400
local pos = Types.Scene.accessor(nil, "f32", 3, N * N)
local uv = Types.Scene.accessor(nil, "f32", 2, N * N)
@@ -1574,7 +1574,7 @@ do
bench("ply binary decode (" .. buffer.len(ply) // 1000 .. " KB)", 5, buffer.len(ply), function()
Ply.decode(Bytes.reader(ply))
end)
local Fbx = require("@formats/model/fbx")
local Fbx = require("@rosetta/model/fbx")
local fbx = assert(Fbx.encode(scene))
bench("fbx binary decode (" .. buffer.len(fbx) // 1000 .. " KB)", 3, buffer.len(fbx), function()
Fbx.decode(Bytes.reader(fbx))
@@ -1589,7 +1589,7 @@ do
bench("fbx ascii decode (" .. buffer.len(fbxa) // 1000 .. " KB)", 2, buffer.len(fbxa), function()
Fbx.decode(Bytes.reader(fbxa))
end)
local ThreeMf = require("@formats/model/3mf")
local ThreeMf = require("@rosetta/model/3mf")
local tmf = assert(ThreeMf.encode(scene))
bench("3mf decode (" .. buffer.len(tmf) // 1000 .. " KB zipped)", 2, buffer.len(tmf), function()
ThreeMf.decode(Bytes.reader(tmf))
@@ -1620,7 +1620,7 @@ end
do
-- textures (ws-tex): codecs/image/Bcn on a 256 x 256 image (tools/fixtures/bcn.py); MB/s of rgba8 output (decode)
-- or input (encode); BC6H of rgbaf32 output
local Bcn = require("@formats/codecs/image/Bcn")
local Bcn = require("@rosetta/codecs/image/Bcn")
local BB = require("@tests/gen/bcn_bench")
local w, h = BB.w, BB.h
local px = buffer.fromstring(BB.rgba)
@@ -1644,7 +1644,7 @@ end
do
-- OpenEXR (ws-tex): a 512 x 256 half RGBA image from the OpenEXR bindings (tools/fixtures/exr.py), ZIP and PIZ;
-- MB/s of rgbaf32 output; our ZIP encoder on the decoded floats
local Exr = require("@formats/image/exr")
local Exr = require("@rosetta/image/exr")
local EB = require("@tests/gen/exr_bench")
local n = 512 * 256 * 16
for _, k in { "zip", "piz" } do
@@ -1663,7 +1663,7 @@ do
-- the legacy codecs (codecs/video/Legacy) through F.video.open, rgba8 frames out: ffmpeg's encoders at 320x240
-- (tools/fixtures/legacy.py), a 320x200 FLC (fli.py) and a 320x200 SMK4 (smk.py, textured: mostly FULL blocks);
-- frames per second of the whole decode (and the Smacker audio track, seconds of audio per second)
local F = require("@formats")
local F = require("@rosetta")
local LB = require("@tests/gen/legacy_bench")
local cases = table.clone(LB)
table.insert(cases, { name = "fli.flc", data = require("@tests/gen/fli_bench").data, width = 320, height = 200 })
@@ -1701,7 +1701,7 @@ end
do
-- AHX / HVL (codecs/audio/Hively): a whole song rendered at 44.1 kHz (tools/fixtures/ahx.py karma.ahx, 3 s; hvl.py
-- the 6-channel demo with ring modulation); MB/s of stereo f32 output, and how many times faster than real time
local Ahx, Hvl = require("@formats/music/ahx"), require("@formats/music/hvl")
local Ahx, Hvl = require("@rosetta/music/ahx"), require("@rosetta/music/hvl")
local AC, HC = require("@tests/gen/ahx_cases"), require("@tests/gen/hvl_cases")
for _, spec in { { Ahx, AC, "karma.ahx", "ahx render karma (4 ch)" }, { Hvl, HC, "demo", "hvl render demo (6 ch)" } } do
for _, c in spec[2] do
@@ -1723,9 +1723,9 @@ do
-- Musepack (codecs/audio/Musepack) SV8 / SV7 and AC-3 5.1 (codecs/audio/Ac3): whole-file decodes, MB/s of f32 output
-- (tools/fixtures/mpc.py: 1.2 s of 44.1 kHz stereo at quality 5; tools/fixtures/ac3.py: 0.16 s of 48 kHz 5.1 at
-- 448 kbps, decoded 4 times per run)
local Mpc = require("@formats/audio/mpc")
local Mpc = require("@rosetta/audio/mpc")
local MpcFx = require("@tests/gen/mpc_cases")
local Ac3F = require("@formats/audio/ac3")
local Ac3F = require("@rosetta/audio/ac3")
local Ac3Fx = require("@tests/gen/ac3_cases")
for _, c in MpcFx do
if c.name == "sv8_q5_stereo" or c.name == "sv7_q5_stereo" then
@@ -1750,9 +1750,9 @@ end
do
-- codecs/audio/Adpcm (IMA nibble stream, Nintendo DSP frames, Flash ADPCM) and QOA decode / encode, over generated signals; MB/s
-- of f32 output (MB/s of input for the encoder)
local Adpcm = require("@formats/codecs/audio/Adpcm")
local QoaCodec = require("@formats/codecs/audio/Qoa")
local Qoa = require("@formats/audio/qoa")
local Adpcm = require("@rosetta/codecs/audio/Adpcm")
local QoaCodec = require("@rosetta/codecs/audio/Qoa")
local Qoa = require("@rosetta/audio/qoa")
local n = 44100 * 5
local sig = Types.Audio.new(44100, 2, n)
for i = 0, n - 1 do
@@ -1823,19 +1823,19 @@ do
mod.decode(Bytes.reader(b))
end)
end
local Wv = require("@formats/audio/wavpack")
local Wv = require("@rosetta/audio/wavpack")
for _, c in require("@tests/gen/wavpack_cases") do
if c.name == "s16_long" or c.name == "s16_hh" or c.name == "s24_hh" or c.name == "f32" or c.name == "hyb_b3" then
lossless("wavpack " .. c.name, Wv, c.data)
end
end
local ApeF = require("@formats/audio/ape")
local ApeF = require("@rosetta/audio/ape")
for _, c in require("@tests/gen/ape_cases") do
if c.name == "s16_long" or c.name == "s16_long_c4000" or c.name == "s16_c5000" or c.name == "s24" or c.name == "s16_c1000" then
lossless("ape " .. c.name, ApeF, c.data)
end
end
local TtaF = require("@formats/audio/tta")
local TtaF = require("@rosetta/audio/tta")
for _, c in require("@tests/gen/tta_cases") do
if c.name == "s16_long" or c.name == "s24" or c.name == "ch6" then
lossless("tta " .. c.name, TtaF, c.data)
@@ -1846,8 +1846,8 @@ end
do
-- the other tracker loaders on the shared engine: a 669 (Hz periods, auto slides) and an MMD1 (hold / decay
-- envelopes, instruments) from tools/fixtures/{669,med}.py, decoded and rendered at 44.1 kHz
local Six69 = require("@formats/music/669")
local Med = require("@formats/music/med")
local Six69 = require("@rosetta/music/669")
local Med = require("@rosetta/music/med")
local songs = { { Six69, require("@tests/gen/669_cases")[1].data }, { Med, require("@tests/gen/med_cases")[2].data } }
local best, frames = math.huge, 0
local out = buffer.create(4096 * 8)
@@ -1872,8 +1872,8 @@ end
do
-- H.263 / Sorenson Spark (codecs/video/H263, tools/fixtures/h263.py): CIF mandelbrot zooms (1 Mbit/s, an I picture
-- every 12), one picture per decode, planes only (frameImage copies excluded) and with the yuv420p Image copies
local H263 = require("@formats/codecs/video/H263")
local Base64 = require("@formats/core/Base64")
local H263 = require("@rosetta/codecs/video/H263")
local Base64 = require("@rosetta/core/Base64")
local HB = require("@tests/gen/h263_bench")
local function run(tag: string)
for _, c in HB do
+2 -2
View File
@@ -1,13 +1,13 @@
#!/usr/bin/env python3
# Brotli static data generator (python3 -I tools/brotli_static.py [brotli-source-dir]): writes
# src/Formats/codecs/compress/Brotli/Static.luau from the official brotli C sources (MIT; licenses/brotli-LICENSE.txt):
# src/Rosetta/codecs/compress/Brotli/Static.luau from the official brotli C sources (MIT; licenses/brotli-LICENSE.txt):
# the 122784-byte RFC 7932 static dictionary (c/common/dictionary_inc.h, stored deflated + base64), the context
# lookup table (c/common/context.c) and the 121 word transforms (c/common/transform.c).
# Without an argument the source comes from `nix build nixpkgs#brotli.src`.
import base64, os, re, subprocess, sys, zlib
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
OUT = os.path.join(ROOT, "src", "Formats", "codecs", "Brotli", "Static.luau")
OUT = os.path.join(ROOT, "src", "Rosetta", "codecs", "Brotli", "Static.luau")
def c_array(text, name):
+13 -13
View File
@@ -1,32 +1,32 @@
#!/usr/bin/env python3
# Build (python3 -I tools/build.py [roblox|luajit ...]): the two outputs of the one Luau source tree.
#
# build/roblox/Formats/... darklua convert_require (luau aliases -> Roblox instance paths). Types, --!native and
# build/roblox/Rosetta/... darklua convert_require (luau aliases -> Roblox instance paths). Types, --!native and
# @native are kept. Mounted by default.project.json (rojo build / rojo serve).
# build/luajit/formats/... plain Lua 5.1 for LuaJIT / LÖVE: darklua strips types, attributes (@native) and the
# Luau-only syntax, then the token passes below; requires become require("formats.a.b").
# build/luajit/rosetta/... plain Lua 5.1 for LuaJIT / LÖVE: darklua strips types, attributes (@native) and the
# Luau-only syntax, then the token passes below; requires become require("rosetta.a.b").
# build/luajit/tools/... tools/*.luau (bench), built the same way.
# build/luajit/tests/... the tests, built the same way (require("@tests/T") -> require("tests.T")); tests/gen
# fixture modules are copied as they are (plain string literals; darklua is slow on them).
#
# Load the LuaJIT output with package.path = "build/luajit/?.lua;build/luajit/?/init.lua;" .. package.path, then
# local F = require("formats").
# local F = require("rosetta").
#
# What darklua 0.19 cannot do, done here as token-level passes (lexer from imgui-luau tools/minify.py):
# 1. Generalized iteration (`for k, v in t do`): darklua has no rule for it. Every generic for whose iterator
# expression does not start with pairs / ipairs / next becomes `for k, v in __iter(expr) do` (compat's __iter:
# functions pass through with their state, arrays use ipairs, other tables next).
# 2. Luau stdlib names: each module gets, on its first line (line numbers stay the same), only the locals it uses of
# buffer, bit32, utf8, typeof, type, __iter from formats._compat (LuaJIT has a 60-upvalue limit per function).
# buffer, bit32, utf8, typeof, type, __iter from rosetta._compat (LuaJIT has a 60-upvalue limit per function).
# 3. If-expressions: darklua lowers `if c then a else b` to `(c and {a} or {b})[1]`, a table per evaluation. When
# `a` is provably not nil/false (a number or string literal, `#x`, or an arithmetic / concatenation expression
# at its top level) it becomes `(c and a or b)`.
# 4. Requires: `require("@formats/x/y")` -> `require("formats.x.y")`, `require("@tests/x")` -> `require("tests.x")`,
# 4. Requires: `require("@rosetta/x/y")` -> `require("rosetta.x.y")`, `require("@tests/x")` -> `require("tests.x")`,
# done on the source before darklua (string literals only; computed requires are not allowed in the library).
import json, os, re, shutil, subprocess, sys, tempfile
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SRC = os.path.join(ROOT, "src", "Formats")
SRC = os.path.join(ROOT, "src", "Rosetta")
TESTS = os.path.join(ROOT, "tests")
BUILD = os.path.join(ROOT, "build")
# darklua 0.19: $DARKLUA, else on PATH, else through nix
@@ -273,13 +273,13 @@ def pass_header(src):
names = [n for n in COMPAT_NAMES if n in used]
if not names:
return src
head = 'local __compat = require("formats._compat") local %s = %s ' % (
head = 'local __compat = require("rosetta._compat") local %s = %s ' % (
", ".join(names), ", ".join("__compat." + n for n in names))
return head + src
# ------------------------------------------------------------------------------------------------ requires
REQ = re.compile(r'require\(\s*"@(formats|tests)((?:/[\w.]+)*)"\s*\)')
REQ = re.compile(r'require\(\s*"@(rosetta|tests)((?:/[\w.]+)*)"\s*\)')
def luajit_requires(src):
@@ -329,7 +329,7 @@ def pass_reserved_children(src):
def build_roblox():
out = os.path.join(BUILD, "roblox", "Formats")
out = os.path.join(BUILD, "roblox", "Rosetta")
shutil.rmtree(os.path.join(BUILD, "roblox"), ignore_errors=True)
darklua(ROBLOX_RULES, os.path.relpath(SRC, ROOT), os.path.relpath(out, ROOT), ROOT)
for f in files(out):
@@ -345,7 +345,7 @@ def build_roblox():
def build_luajit_tree(src_root, out_root, skip_dirs=()):
"""src_root/**/*.luau -> out_root/**/*.lua through the require rewrite, darklua and the token passes."""
tmp = tempfile.mkdtemp(prefix="formats-build-")
tmp = tempfile.mkdtemp(prefix="rosetta-build-")
try:
stage = os.path.join(tmp, "in")
dl = os.path.join(tmp, "out")
@@ -381,7 +381,7 @@ def build_luajit_tree(src_root, out_root, skip_dirs=()):
def build_luajit():
base = os.path.join(BUILD, "luajit")
shutil.rmtree(base, ignore_errors=True)
out = os.path.join(base, "formats")
out = os.path.join(base, "rosetta")
n = build_luajit_tree(SRC, out)
shutil.copy(os.path.join(ROOT, "compat", "luajit.lua"), os.path.join(out, "_compat.lua"))
print("build: luajit %3d modules -> %s" % (n, os.path.relpath(out, ROOT)))
@@ -435,7 +435,7 @@ def selftest():
for a, want in els:
got = pass_elseif(a)
assert got == (want or a), (a, got)
assert luajit_requires('require("@formats/core/Bytes")') == 'require("formats.core.Bytes")'
assert luajit_requires('require("@rosetta/core/Bytes")') == 'require("rosetta.core.Bytes")'
els = [
("local x = if a then 1 elseif b then 2 elseif c then 3 else 4",
"local x = if a then 1 else if b then 2 else if c then 3 else 4"),
+1 -1
View File
@@ -136,7 +136,7 @@ def page_test(path):
continue
chunks.append({"line": line, "files": files, "code": code, "vars": set(VAR.findall(code))})
out = ["-- tests/docs/snippets/%s: GENERATED by tools/docs_check.py from %s - do not edit (edit the page)" % (name, rel),
'local F = require("@formats")',
'local F = require("@rosetta")',
'local DocT = require("@tests/T")',
'local DocIN = require("@tests/docs/snippets/_inputs")',
'local t = DocT.suite("docs/%s")' % name,
+1 -1
View File
@@ -10,7 +10,7 @@
# tests/gen/3ds_xcheck.luau { name, case? | gltf?, assimp }
import importlib.util, os
INPUTS = ["src/Formats/model/3ds", "tests/fixtures/gltf", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py",
INPUTS = ["src/Rosetta/model/3ds", "tests/fixtures/gltf", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py",
"tools/fixtures/_3ds_encode.luau"]
+1 -1
View File
@@ -9,7 +9,7 @@
# lib3mf / assimp / trimesh: { name, case, lib3mf, assimp, trimesh }
import importlib.util, json, os, subprocess, sys
INPUTS = ["src/Formats/model/3mf", "src/Formats/codecs/text/Xml", "src/Formats/containers/Zip",
INPUTS = ["src/Rosetta/model/3mf", "src/Rosetta/codecs/text/Xml", "src/Rosetta/containers/Zip",
"tools/fixtures/_3mf_reference.py", "tools/fixtures/_3mf_encode.luau", "tools/fixtures/_model_ref.py"]
MAX_SIZE = 500_000
+3 -3
View File
@@ -1,9 +1,9 @@
-- tools/fixtures/_3ds_encode: run by tools/fixtures/3ds.py (luau CLI, repo root): decodes every 3DS case and every
-- glTF sample model with our readers and writes them with our 3DS writer, printing "<file>\t<hex>" lines for assimp
-- to read back. Files: case_<i>.3ds, gltf_<i>.3ds.
local ThreeDs = require("@formats/model/3ds")
local Gltf = require("@formats/model/gltf")
local Bytes = require("@formats/core/Bytes")
local ThreeDs = require("@rosetta/model/3ds")
local Gltf = require("@rosetta/model/gltf")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/3ds_cases")
local Picks = require("@tests/gen/3ds_gltf")
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_3mf_encode: run by tools/fixtures/3mf.py (luau CLI, repo root): decodes every 3MF case that lib3mf
-- reads with our reader and encodes it with our writer, printing "rt_<case>.3mf\t<hex>" lines for the reference tools
-- (lib3mf, assimp, trimesh) to read back.
local ThreeMf = require("@formats/model/3mf")
local Bytes = require("@formats/core/Bytes")
local ThreeMf = require("@rosetta/model/3mf")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/3mf_cases")
local HEX = {}
+1 -1
View File
@@ -130,7 +130,7 @@ def psx_encode(samples, loop=None):
return bytes(out)
def vag(samples, rate, name=b"formats-luau", loop=None):
def vag(samples, rate, name=b"rosetta", loop=None):
data = psx_encode(s16(samples), loop)
head = b"VAGp" + struct.pack(">IIII", 0x20, 0, len(data), rate) + b"\0" * 12 + name[:16].ljust(16, b"\0")
return head + data
+1 -1
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_arch2_ours.luau: our archive writers' output for the reference tools to read (run by the ws-arch2
-- fixture generators through `luau tools/fixtures/_arch2_ours.luau -a <format> [<options as k=v,k=v>]`). Writes the
-- standard file set (the same names and bytes as _arch2.FILES) with the format's encoder and prints the file as hex.
local F = require("@formats")
local F = require("@rosetta")
local which, optstr = ...
local function content(n: number, seed: number): buffer
+6 -6
View File
@@ -218,13 +218,13 @@ def emit_signal(ctx, name, samples, rate, ch):
def encode_luau(ctx, module, sigmod, opts_lua="nil", source="audio"):
"""encode the emitted signal module `sigmod` with require("@formats/<module>").encode(audio, opts) in Luau; returns
"""encode the emitted signal module `sigmod` with require("@rosetta/<module>").encode(audio, opts) in Luau; returns
the encoded bytes. source = "decoder" feeds a streaming Decoder (codecs/audio/Pcm.audioDecoder) instead of the Audio."""
code = """
local S = require("@tests/gen/%s")
local Types = require("@formats/Types")
local Pcm = require("@formats/codecs/audio/Pcm")
local M = require("@formats/%s")
local Types = require("@rosetta/Types")
local Pcm = require("@rosetta/codecs/audio/Pcm")
local M = require("@rosetta/%s")
local a = Types.Audio.new(S.rate, S.channels, S.frames)
buffer.writestring(a.samples, 0, S.data)
local src: any = a
@@ -297,8 +297,8 @@ def encode_luau_many(ctx, module, jobs, sigmod):
-> [bytes]: one Luau run encodes them all (length-prefixed on stdout)"""
body = ['job("%s", %s)' % (name, opts) for name, opts in jobs]
code = """
local Types = require("@formats/Types")
local M = require("@formats/%s")
local Types = require("@rosetta/Types")
local M = require("@rosetta/%s")
local S = require("@tests/gen/%s")
local outs = {}
local function job(name, opts)
+3 -3
View File
@@ -2,9 +2,9 @@
-- tools/fixtures/bitmapfonts.py / psf.py after they wrote the source fonts to tests/gen/<src>.luau:
-- `luau _bitmapfonts_ours.luau -a <src> <format> [version]`): decodes each source font with its format, encodes it
-- with <format> (default bdf) and prints "<case> <hex>" lines.
local F = require("@formats")
local Bytes = require("@formats/core/Bytes")
local Deflate = require("@formats/codecs/compress/Deflate")
local F = require("@rosetta")
local Bytes = require("@rosetta/core/Bytes")
local Deflate = require("@rosetta/codecs/compress/Deflate")
local srcName, outFormat, version = ...
local Src = if srcName == "psf_src" then require("@tests/gen/psf_src") else require("@tests/gen/bitmapfonts_src")
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_dae_encode: run by tools/fixtures/dae.py (luau CLI, repo root): decodes every Collada case with our
-- reader and encodes it with our writer (rt_<case>.dae + its image files, and rt_<case>.zae for the first cases),
-- printing "<file>\t<hex>" lines for assimp to read back.
local Dae = require("@formats/model/dae")
local Bytes = require("@formats/core/Bytes")
local Dae = require("@rosetta/model/dae")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/dae_cases")
local HEX = {}
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_fbx_encode: run by tools/fixtures/fbx.py (luau CLI, repo root): decodes every FBX case with our
-- reader and writes it back with our writer (binary 7.4, and ASCII for every third case), printing "<file>\t<hex>"
-- lines for assimp and Blender to read back. Files: rt_<case>.fbx (binary), rt_<case>.a.fbx (ASCII).
local Fbx = require("@formats/model/fbx")
local Bytes = require("@formats/core/Bytes")
local Fbx = require("@rosetta/model/fbx")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/fbx_cases")
local HEX = {}
+1 -1
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_flv_encode: run by tools/fixtures/flv.py (luau, from the repo root) so ffprobe / ffmpeg can check our
-- FLV writer: remuxes FLV fixtures (tests/gen/flv_cases) and the MP4 / Matroska / MPEG-TS sources (tests/gen/flv_src)
-- and prints "<name> <source> <hex>" lines (or "<name> <source> ERR <message>").
local F = require("@formats")
local F = require("@rosetta")
local Cases = require("@tests/gen/flv_cases")
local Src = require("@tests/gen/flv_src")
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_gltf_encode: run by tools/fixtures/gltf.py (luau CLI, repo root): decodes every glTF case with our
-- reader and encodes it with our writer as .glb and as .gltf with an external .bin and image files, printing
-- "<file>\t<hex>" lines for the reference tools (assimp, trimesh) to read back. Files: rt_<case>.glb, rt_<case>.gltf.
local Gltf = require("@formats/model/gltf")
local Bytes = require("@formats/core/Bytes")
local Gltf = require("@rosetta/model/gltf")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/gltf_cases")
local HEX = {}
+3 -3
View File
@@ -1,9 +1,9 @@
-- tools/fixtures/_iqm_encode: run by tools/fixtures/iqm.py (luau CLI, repo root): writes mrfixit.iqm back through our
-- reader and writer, and every glTF pick through our writer, printing "<file>\t<hex>" lines for assimp and the
-- Python IQM reader. Files: rt_mrfixit.iqm, gltf_<name>.iqm.
local Iqm = require("@formats/model/iqm")
local Gltf = require("@formats/model/gltf")
local Bytes = require("@formats/core/Bytes")
local Iqm = require("@rosetta/model/iqm")
local Gltf = require("@rosetta/model/gltf")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/iqm_cases")
local Picks = require("@tests/gen/iqm_gltf")
+1 -1
View File
@@ -1,6 +1,6 @@
-- tools/fixtures/_lz4_encode.luau: run by tools/fixtures/lz4.py under the luau CLI: compresses every corpus of
-- tests/gen/lz4_corpora with codecs/compress/Lz4 and prints "<name> <hex>" lines for the reference to decompress.
local Lz4 = require("@formats/codecs/compress/Lz4")
local Lz4 = require("@rosetta/codecs/compress/Lz4")
local C = require("@tests/gen/lz4_corpora")
for name, data in C do
+1 -1
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_lz4frame_encode.luau: run by tools/fixtures/lz4frame.py under the luau CLI: writes every corpus of
-- tests/gen/lz4frame_corpora as LZ4 frames with archive/lz4 (several option sets) and prints "<name> <hex>" lines for
-- the lz4 tool to decompress.
local Lz4F = require("@formats/archive/lz4")
local Lz4F = require("@rosetta/archive/lz4")
local C = require("@tests/gen/lz4frame_corpora")
local sets = {
+2 -2
View File
@@ -2,8 +2,8 @@
-- our writers: encodes the test signal (tests/audio/_signal) to ALAC M4A (audio/m4a) and ALAC / PCM CAF (audio/caf)
-- and prints "<name> <hex>" lines. The tests re-encode and compare the CRC with the file ffmpeg validated.
local Signal = require("@tests/audio/_signal")
local M4a = require("@formats/audio/m4a")
local Caf = require("@formats/audio/caf")
local M4a = require("@rosetta/audio/m4a")
local Caf = require("@rosetta/audio/caf")
local function hex(b: buffer): string
local t = table.create(buffer.len(b))
+2 -2
View File
@@ -1,14 +1,14 @@
# MIDI reference cases (run by tools/fixtures/midi.py through ctx.python(["mido"], ...); not a generator itself).
# Builds Standard MIDI Files with python mido (formats 0 / 1 / 2, tempo changes, time / key signatures, running
# status, sysex, pitch bend, every channel message, a random stress file), saves them with mido, and prints JSON:
# per file the bytes, mido's parse in formats-luau's event shape and mido's lengths / message times.
# per file the bytes, mido's parse in rosetta's event shape and mido's lengths / message times.
import io, json, random, sys
import mido
from mido import Message, MetaMessage, MidiFile, MidiTrack
def ours(msg):
"""a mido message -> [type, channel, data, meta] in formats-luau's shape (data = raw bytes)"""
"""a mido message -> [type, channel, data, meta] in rosetta's shape (data = raw bytes)"""
t = msg.type
if msg.is_meta:
b = msg.bytes()
+3 -3
View File
@@ -1,9 +1,9 @@
-- tools/fixtures/_ms3d_encode: run by tools/fixtures/ms3d.py (luau CLI, repo root): decodes every MS3D case and every
-- glTF sample model with our readers and writes them with our MS3D writer, printing "<file>\t<hex>" lines for assimp
-- to read back. Files: case_<i>.ms3d, gltf_<i>.ms3d.
local Ms3d = require("@formats/model/ms3d")
local Gltf = require("@formats/model/gltf")
local Bytes = require("@formats/core/Bytes")
local Ms3d = require("@rosetta/model/ms3d")
local Gltf = require("@rosetta/model/gltf")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/ms3d_cases")
local Picks = require("@tests/gen/ms3d_gltf")
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_obj_encode: run by tools/fixtures/obj.py (luau CLI, repo root): decodes every OBJ case with our
-- reader, encodes it again with our writer and prints "<file>\t<hex>" lines (the OBJ, its .mtl, textures) for the
-- reference tools (assimp, trimesh) to read back.
local Obj = require("@formats/model/obj")
local Bytes = require("@formats/core/Bytes")
local Obj = require("@rosetta/model/obj")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/obj_cases")
local HEX = {}
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_off_encode.luau: run by tools/fixtures/off.py under the luau CLI (no file I/O): encodes the scenes of
-- tests/gen/off_scenes with each listed option set ("default" = {}, "plain" = no colours / normals / texcoords) and
-- prints "<scene>/<encoding> <hex>" lines, which the fixture step hands to trimesh, assimp and its own reader.
local Off = require("@formats/model/off")
local Types = require("@formats/Types")
local Off = require("@rosetta/model/off")
local Types = require("@rosetta/Types")
local Scenes = require("@tests/gen/off_scenes")
local function build(spec: any): Types.Scene
+1 -1
View File
@@ -1,6 +1,6 @@
-- tools/fixtures/_opus_encode: run by tools/fixtures/opus_celt.py (luau, from the repo root): encodes
-- tests/audio/_opus_cases with audio/opus's CELT encoder and prints "<name> <hex>" lines for opusdec / ffmpeg.
local Opus = require("@formats/audio/opus")
local Opus = require("@rosetta/audio/opus")
local Cases = require("@tests/audio/_opus_cases")
for _, c in Cases.list do
+8 -8
View File
@@ -1,9 +1,9 @@
-- tools/fixtures/_ours.luau: our encoders' output for the reference tools to read (run by tools/fixtures/*.py through
-- `luau tools/fixtures/_ours.luau -a <format>`). Prints one JSON object: { "data": hex of the encoded file, ... the
-- facts the python side checks the reference's reading against }.
local Types = require("@formats/Types")
local Crc32 = require("@formats/core/Crc32")
local LayerOps = require("@formats/ops/LayerOps")
local Types = require("@rosetta/Types")
local Crc32 = require("@rosetta/core/Crc32")
local LayerOps = require("@rosetta/ops/LayerOps")
local function hex(b: buffer): string
local t = table.create(buffer.len(b))
@@ -145,7 +145,7 @@ end
local which, arg = ...
if which == "psd" then
local Psd = require("@formats/layered/psd")
local Psd = require("@rosetta/layered/psd")
local doc = psdDoc()
local data = Psd.encode(doc) :: buffer
local flat = LayerOps.flatten(doc) :: Types.Image
@@ -156,7 +156,7 @@ if which == "psd" then
end
print(json({ data = hex(data), composite = Crc32.of(flat.pixels), layers = layers }))
elseif which == "aseprite" then
local Ase = require("@formats/layered/aseprite")
local Ase = require("@rosetta/layered/aseprite")
local doc = aseDoc()
local data = Ase.encode(doc) :: buffer
local frames = {}
@@ -165,15 +165,15 @@ elseif which == "aseprite" then
end
print(json({ data = hex(data), nframes = 3, frames = frames }))
elseif which == "tiled" then
local Tiled = require("@formats/vector/tiled")
local Tiled = require("@rosetta/vector/tiled")
local m = tiledMap()
local tmx = Tiled.encode(m, { format = "tmx" }) :: buffer
local tmj = Tiled.encode(m, { format = "tmj" }) :: buffer
print(json({ tmx = hex(tmx), tmj = hex(tmj) }))
elseif which == "svg" then
-- the SVG text given on the command line, decoded and written back by our encoder
local Svg = require("@formats/vector/svg")
local Bytes = require("@formats/core/Bytes")
local Svg = require("@rosetta/vector/svg")
local Bytes = require("@rosetta/core/Bytes")
local v = Svg.decode(Bytes.reader(buffer.fromstring(arg)))
local out = if v then Svg.encode(v) else nil
print(json({ svg = if out then buffer.tostring(out) else "" }))
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_ply_encode.luau: run by tools/fixtures/ply.py under the luau CLI (no file I/O): encodes the scenes of
-- tests/gen/ply_scenes in the three encodings and prints "<scene>/<encoding> <hex>" lines, which the fixture step
-- hands to plyfile and assimp.
local Ply = require("@formats/model/ply")
local Types = require("@formats/Types")
local Ply = require("@rosetta/model/ply")
local Types = require("@rosetta/Types")
local Scenes = require("@tests/gen/ply_scenes")
local function build(spec: any): Types.Scene
+3 -3
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/qb.py helper: our model/qb encoder's output for the reference reader there. Prints "<name>\t<hex>".
local Qb = require("@formats/model/qb")
local Bytes = require("@formats/core/Bytes")
local Types = require("@formats/Types")
local Qb = require("@rosetta/model/qb")
local Bytes = require("@rosetta/core/Bytes")
local Types = require("@rosetta/Types")
local Fx = require("@tests/gen/qb")
local function hex(b: buffer): string
+3 -3
View File
@@ -1,9 +1,9 @@
-- tools/fixtures/_rbx_encode.luau: run by tools/fixtures/rbxmx.py under the luau CLI: decodes every file of
-- tests/gen/rbx_files (model/rbxm or model/rbxmx) and writes it back with both encoders; prints
-- "<file>/rbxm <hex>" and "<file>/rbxmx <hex>" lines for lune to read.
local Rbxm = require("@formats/model/rbxm")
local Rbxmx = require("@formats/model/rbxmx")
local Bytes = require("@formats/core/Bytes")
local Rbxm = require("@rosetta/model/rbxm")
local Rbxmx = require("@rosetta/model/rbxmx")
local Bytes = require("@rosetta/core/Bytes")
local Fx = require("@tests/gen/rbx_files")
local function hex(b: buffer): string
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_robloxmesh_encode.luau: run by tools/fixtures/robloxmesh.py under the luau CLI: decodes every case of
-- tests/gen/robloxmesh and writes it back as versions 2.00 and 4.00; prints "<case>/<version> <hex>" lines for the
-- fixture's own reader.
local RobloxMesh = require("@formats/model/robloxmesh")
local Bytes = require("@formats/core/Bytes")
local RobloxMesh = require("@rosetta/model/robloxmesh")
local Bytes = require("@rosetta/core/Bytes")
local Fx = require("@tests/gen/robloxmesh")
local function hex(b: buffer): string
+3 -3
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/schematic.py helper: our model/schematic encoder's output for the reference readers (litemapy,
-- nbtlib). Prints "<name>\t<hex>" lines. Inputs: the decoded fixtures of tests/gen/schematic, plus grids built here.
local Schematic = require("@formats/model/schematic")
local Bytes = require("@formats/core/Bytes")
local Types = require("@formats/Types")
local Schematic = require("@rosetta/model/schematic")
local Bytes = require("@rosetta/core/Bytes")
local Types = require("@rosetta/Types")
local Fx = require("@tests/gen/schematic")
local function hex(b: buffer): string
+1 -1
View File
@@ -1,5 +1,5 @@
# Audio features of a WAV on stdin (run by tools/fixtures/sf2.py through ctx.python(["numpy"], ...); not a generator).
# tests/music/sf2.luau computes the same features from formats-luau's render and compares them:
# tests/music/sf2.luau computes the same features from rosetta's render and compares them:
# env RMS of the mono mix per 50 ms window (2205 frames)
# bands per 2 s segment: mean power in 24 log-spaced bands (60 Hz .. 16 kHz) of 2048-point Hann frames (hop 1024),
# in dB
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_smd_encode.luau: run by tools/fixtures/smd.py under the luau CLI: decodes the reference SMDs of
-- tests/gen/smd_src and writes them back with our encoder (bind pose; links; and the animation as an animation SMD),
-- printing "<name>\t<hex>" lines for assimp to read back.
local Smd = require("@formats/model/smd")
local Bytes = require("@formats/core/Bytes")
local Smd = require("@rosetta/model/smd")
local Bytes = require("@rosetta/core/Bytes")
local Src = require("@tests/gen/smd_src")
local function hex(b: buffer): string
+2 -2
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_step_encode: run by tools/fixtures/step.py (luau CLI, repo root): decodes every STEP case with our
-- reader and writes it back with our writer, printing "case_<i>.step\t<hex>" lines for OCCT (through gmsh) to read.
local Step = require("@formats/cad/step")
local Bytes = require("@formats/core/Bytes")
local Step = require("@rosetta/cad/step")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/step_cases")
local HEX = {}
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_stl_encode.luau: run by tools/fixtures/stl.py under the luau CLI (no file I/O): encodes the scenes of
-- tests/gen/stl_scenes with every encoding they list and prints "<scene>/<encoding> <hex>" lines, which the fixture
-- step hands to trimesh and assimp.
local Stl = require("@formats/model/stl")
local Types = require("@formats/Types")
local Stl = require("@rosetta/model/stl")
local Types = require("@rosetta/Types")
local Scenes = require("@tests/gen/stl_scenes")
local function acc(s: string, t: string, comps: number, count: number): Types.Accessor
+13 -13
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_tex_encode.luau: our texture encoders' output for the reference tools to read (run by
-- tools/fixtures/{dds,ktx,exr}.py as `luau tools/fixtures/_tex_encode.luau -a <format>`). Prints "name\thex" lines.
-- The source images are generated here (tools/fixtures/_tex_reference.py makes the same ones: source()).
local Types = require("@formats/Types")
local Types = require("@rosetta/Types")
local which = ({ ... } :: { string })[1] or "dds"
@@ -53,7 +53,7 @@ local function emit(name: string, b: buffer?, err: any?)
end
if which == "dds" then
local Dds = require("@formats/image/dds")
local Dds = require("@rosetta/image/dds")
local img = image(37, 23, "rgba8", 0)
for _, f in { "rgba8", "bgra8", "bc1", "bc3", "bc4", "bc5" } do
emit("ours_" .. f .. ".dds", Dds.encode(img, { pixelFormat = f :: any }))
@@ -75,7 +75,7 @@ if which == "dds" then
end
if which == "ktx" then
local Ktx = require("@formats/image/ktx")
local Ktx = require("@rosetta/image/ktx")
local img = image(37, 23, "rgba8", 0)
emit("ours_rgba8.ktx2", Ktx.encode(img))
emit("ours_rgba8_mips.ktx2", Ktx.encode(img, { mips = true }))
@@ -95,7 +95,7 @@ if which == "ktx" then
end
if which == "exr" then
local Exr = require("@formats/image/exr")
local Exr = require("@rosetta/image/exr")
local f = image(37, 23, "rgbaf32", 0, 4)
for _, c in { "none", "zips", "zip" } do
emit("ours_half_" .. c .. ".exr", Exr.encode(f, { compression = c :: any }))
@@ -131,17 +131,17 @@ local function few(): Types.Image
end
local function simple(): any
if which == "pcx" then
return require("@formats/image/pcx")
return require("@rosetta/image/pcx")
elseif which == "sgi" then
return require("@formats/image/sgi")
return require("@rosetta/image/sgi")
elseif which == "sunras" then
return require("@formats/image/sunras")
return require("@rosetta/image/sunras")
elseif which == "xbm" then
return require("@formats/image/xbm")
return require("@rosetta/image/xbm")
elseif which == "xpm" then
return require("@formats/image/xpm")
return require("@rosetta/image/xpm")
elseif which == "ilbm" then
return require("@formats/image/ilbm")
return require("@rosetta/image/ilbm")
end
return nil
end
@@ -159,7 +159,7 @@ end
if which == "icns" then
-- square icons 16 / 32 / 48 / 128 as RLE entries (no encodeImage hook here)
local Icns = require("@formats/image/icns")
local Icns = require("@rosetta/image/icns")
local base = image(128, 128, "rgba8", 1)
base.frames = {}
for i, s in { 16, 32, 48, 128 } do
@@ -171,8 +171,8 @@ end
if which == "ora" then
-- a layered document: background, an offset half-opaque multiply layer, a hidden one, a group with a screen layer
local Ora = require("@formats/layered/ora")
local Png = require("@formats/image/png")
local Ora = require("@rosetta/layered/ora")
local Png = require("@rosetta/image/png")
local doc = Types.Layered.new(40, 30)
local bg = Types.Layered.layer("background", image(40, 30, "rgba8", 0))
for i = 0, 40 * 30 - 1 do
+1 -1
View File
@@ -199,7 +199,7 @@ def write_xm(title, instruments, orders, patterns, channels, speed=6, tempo=125,
loop: (start, length, type 1|2) | None}], keymap: [96 sample indexes] | None, volenv: {points, sustain, loop:
(s, e)} | None, panenv: ..., fadeout, vib: (type, sweep, depth, rate)}];
patterns: [[row: [(note, ins, vol, fx, param)] * channels]] (note 97 = key off; vol = raw volume byte)"""
out = bytearray(b"Extended Module: " + name(title, 20) + b"\x1a" + name("formats-luau fixtures", 20))
out = bytearray(b"Extended Module: " + name(title, 20) + b"\x1a" + name("rosetta fixtures", 20))
out += struct.pack("<HIHHHHHHHH", 0x0104, 276, len(orders), restart, channels, len(patterns), len(instruments),
1 if linear else 0, speed, tempo)
out += bytes(orders) + b"\0" * (256 - len(orders))
+2 -2
View File
@@ -1,8 +1,8 @@
-- tools/fixtures/_usda_encode: run by tools/fixtures/usda.py (luau CLI, repo root): decodes every USDA case with our
-- reader and writes it back with our writer, printing "<file>\t<hex>" lines (case_<n>.usda + the texture files it
-- references) for OpenUSD (pxr) to read back.
local Usda = require("@formats/model/usda")
local Bytes = require("@formats/core/Bytes")
local Usda = require("@rosetta/model/usda")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/usda_cases")
local HEX = {}
+1 -1
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_video_encode: run by tools/fixtures/videoenc.py (luau, from the repo root) so ffprobe / ffmpeg can
-- check our video writers: remuxes and re-encodes the container fixtures (tests/gen/mkv_cases, avi_cases, mp4_cases) and the
-- animated GIF of tests/gen/videoenc_src, and prints "<name> <hex>" lines (or "<name> ERR <message>").
local F = require("@formats")
local F = require("@rosetta")
local Mkv = require("@tests/gen/mkv_cases")
local Avi = require("@tests/gen/avi_cases")
local Mp4 = require("@tests/gen/mp4_cases")
+1 -1
View File
@@ -1,7 +1,7 @@
-- tools/fixtures/_vpk_encode.luau: run by tools/fixtures/vpk.py under the luau CLI: writes the files of
-- tests/gen/vpk_src as VPK version 1 and 2 with our encoder and prints "<name>\t<hex>" lines for Python's vpk
-- package to read back (and verify the version 2 MD5s).
local Vpk = require("@formats/archive/vpk")
local Vpk = require("@rosetta/archive/vpk")
local Src = require("@tests/gen/vpk_src")
local function hex(b: buffer): string
+4 -4
View File
@@ -1,10 +1,10 @@
-- tools/fixtures/_vrml_encode: run by tools/fixtures/vrml.py and x3d.py (luau CLI, repo root): decodes every VRML /
-- X3D case and glTF sample with our readers and writes it back with our writers, printing "<file>\t<hex>" lines for
-- VTK (.wrl) and assimp (.x3d) to read back. Files: case_<i>.wrl, gltf_<i>.wrl, xcase_<i>.x3d, xgltf_<i>.x3d.
local Vrml = require("@formats/model/vrml")
local X3d = require("@formats/model/x3d")
local Gltf = require("@formats/model/gltf")
local Bytes = require("@formats/core/Bytes")
local Vrml = require("@rosetta/model/vrml")
local X3d = require("@rosetta/model/x3d")
local Gltf = require("@rosetta/model/gltf")
local Bytes = require("@rosetta/core/Bytes")
local Cases = require("@tests/gen/vrml_cases")
local GltfCases = require("@tests/gen/vrml_gltf")
local ok, X3dCases = pcall(require, "@tests/gen/x3d_cases")
+1 -1
View File
@@ -214,7 +214,7 @@ Transform { translation 6 0 0 children Shape { geometry Extrusion {
crossSection [ 1 1, 1 -1, -1 -1, -1 1, 1 1 ] spine [ 0 0 0, 0 1 0, 1 2 0, 2 2 0 ] scale [ 1 1, 0.5 0.5, 0.5 0.5, 1 1 ] } } }
""",
"feat_scene.wrl": """#VRML V2.0 utf8
WorldInfo { title "feature scene" info [ "made for formats-luau" ] }
WorldInfo { title "feature scene" info [ "made for rosetta" ] }
DEF Cam Viewpoint { position 0 1 8 orientation 0 1 0 0.3 fieldOfView 0.9 description "front" }
DEF Sun DirectionalLight { direction 0 -1 -1 intensity 0.8 color 1 1 0.9 }
DEF Bulb PointLight { location 1 2 3 radius 10 }
+4 -4
View File
@@ -2,10 +2,10 @@
-- (tests/gen/webp_src) with image/webp at several efforts and two animations, and prints one line per file:
-- "<name> <hex>" (stills: <source>_e<effort>_<exact|loose>) or "anim<k>:<crc>,<crc>,... <hex>" with the CRC-32 of each
-- canvas the input frames composite to (image/webp/Anim.composite), for dwebp / Pillow to check.
local Webp = require("@formats/image/webp")
local Anim = require("@formats/image/webp/Anim")
local Types = require("@formats/Types")
local Crc32 = require("@formats/core/Crc32")
local Webp = require("@rosetta/image/webp")
local Anim = require("@rosetta/image/webp/Anim")
local Types = require("@rosetta/Types")
local Crc32 = require("@rosetta/core/Crc32")
local Src = require("@tests/gen/webp_src")
local HEX = {}
+2 -2
View File
@@ -18,7 +18,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 = ["tools/fixtures/_audio.py", "src/Formats/codecs/audio/Ac3"]
INPUTS = ["tools/fixtures/_audio.py", "src/Rosetta/codecs/audio/Ac3"]
SECONDS = 0.15
DITHERED = ("stereo_44k", "aften_5.1_blksw")
NFCHANS = [2, 1, 2, 3, 3, 4, 4, 5]
@@ -72,7 +72,7 @@ def fix_crcs(f):
def undither(ctx, data):
"""clear every dithflag (after the blksw flags at each audio block's start) and fix the CRCs"""
code = """
local Ac3 = require("@formats/codecs/audio/Ac3")
local Ac3 = require("@rosetta/codecs/audio/Ac3")
local b = buffer.fromstring(%s)
local dec = Ac3.decoder()
local o, n = 0, buffer.len(b)
+1 -1
View File
@@ -27,7 +27,7 @@ def _load(name):
A = _load("_audio")
D = _load("_adpcm")
INPUTS = ["tools/fixtures/_adpcm.py", "src/Formats/codecs/audio/Adpcm", "src/Formats/audio/adpcm"]
INPUTS = ["tools/fixtures/_adpcm.py", "src/Rosetta/codecs/audio/Adpcm", "src/Rosetta/audio/adpcm"]
RATE = 22050
+1 -1
View File
@@ -20,7 +20,7 @@ def _load(name):
A = _load("_audio")
D = _load("_adpcm")
INPUTS = ["tools/fixtures/_adpcm.py", "src/Formats/codecs/audio/Adpcm", "src/Formats/audio/adx"]
INPUTS = ["tools/fixtures/_adpcm.py", "src/Rosetta/codecs/audio/Adpcm", "src/Rosetta/audio/adx"]
def loops(info):
+1 -1
View File
@@ -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", "src/Formats/codecs/audio/Adpcm"]
INPUTS = ["src/Rosetta/audio/aiff", "src/Rosetta/codecs/audio/Pcm", "src/Rosetta/codecs/audio/Adpcm"]
def ff(codec, src="{in}", extra=()):
+1 -1
View File
@@ -132,6 +132,6 @@ def generate(ctx):
case("seven_frames", 3000, frames=7, ch=1)
case("odd_len", 2000, frames=300001, rate=48000, seed=7, note="300001 frames: two APE frames")
case("rate37000", 2000, rate=37000, secs=0.2)
case("tags", 2000, tags={"Title": "Lossless Tone", "Artist": "formats-luau", "Year": "2026", "Track": "3"})
case("tags", 2000, tags={"Title": "Lossless Tone", "Artist": "rosetta", "Year": "2026", "Track": "3"})
fate("fate_lucky", "luckynight-partial.ape", cut=2)
ctx.emit("ape_cases", CASES)
+1 -1
View File
@@ -8,7 +8,7 @@
# rendered by LibreSprite, with our flatten of the same frames
import json, os, shutil, struct, subprocess, tempfile, zlib
INPUTS = ["src/Formats/layered/aseprite", "src/Formats/codecs/image/Blend.luau", "tools/fixtures/_ours.luau"]
INPUTS = ["src/Rosetta/layered/aseprite", "src/Rosetta/codecs/image/Blend.luau", "tools/fixtures/_ours.luau"]
def s(text):
+1 -1
View File
@@ -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/au", "src/Formats/codecs/audio/Pcm"]
INPUTS = ["src/Rosetta/audio/au", "src/Rosetta/codecs/audio/Pcm"]
def ff(codec, src="{in}", extra=()):
+2 -2
View File
@@ -13,8 +13,8 @@ _s = importlib.util.spec_from_file_location("_arch2", os.path.join(os.path.dirna
A = importlib.util.module_from_spec(_s)
_s.loader.exec_module(A)
INPUTS = ["tools/fixtures/_bitmapfonts_ref.py", "tools/fixtures/_bitmapfonts_ours.luau", "src/Formats/font/bdf", "src/Formats/font/pcf",
"src/Formats/font/fon"]
INPUTS = ["tools/fixtures/_bitmapfonts_ref.py", "tools/fixtures/_bitmapfonts_ours.luau", "src/Rosetta/font/bdf", "src/Rosetta/font/pcf",
"src/Rosetta/font/fon"]
CHARS = [32, 33, 48, 64, 65, 87, 103, 106, 113, 126, 0xE9, 0xF1, 0x416, 0x2588, 0x2192]
+1 -1
View File
@@ -17,7 +17,7 @@ def _load(name):
A = _load("_audio")
D = _load("_adpcm")
INPUTS = ["tools/fixtures/_adpcm.py", "src/Formats/codecs/audio/Adpcm", "src/Formats/audio/brstm"]
INPUTS = ["tools/fixtures/_adpcm.py", "src/Rosetta/codecs/audio/Adpcm", "src/Rosetta/audio/brstm"]
def generate(ctx):
+1 -1
View File
@@ -15,7 +15,7 @@ def _load(name):
A = _load("_audio")
D = _load("_adpcm")
INPUTS = ["src/Formats/codecs/audio/Adpcm", "src/Formats/audio/caf"]
INPUTS = ["src/Rosetta/codecs/audio/Adpcm", "src/Rosetta/audio/caf"]
def generate(ctx):
+1 -1
View File
@@ -10,7 +10,7 @@ _s = importlib.util.spec_from_file_location("_arch2", os.path.join(os.path.dirna
A = importlib.util.module_from_spec(_s)
_s.loader.exec_module(A)
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Formats/archive/d64"]
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Rosetta/archive/d64"]
PKG = ["vice"]
+1 -1
View File
@@ -8,7 +8,7 @@
# { name, case, assimp }
import importlib.util, os, re, subprocess
INPUTS = ["src/Formats/model/dae", "src/Formats/codecs/text/Xml", "tools/fixtures/_model_ref.py", "tools/fixtures/_dae_encode.luau",
INPUTS = ["src/Rosetta/model/dae", "src/Rosetta/codecs/text/Xml", "tools/fixtures/_model_ref.py", "tools/fixtures/_dae_encode.luau",
"tests/fixtures/gltf"]
+1 -1
View File
@@ -15,7 +15,7 @@ _spec = importlib.util.spec_from_file_location("_tex_reference", os.path.join(os
R = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(R)
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/dds", "src/Formats/codecs/image/Bcn", "src/Formats/codecs/image/Texture.luau"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/dds", "src/Rosetta/codecs/image/Bcn", "src/Rosetta/codecs/image/Texture.luau"]
BLOCK = {"bc1": 8, "bc2": 16, "bc3": 16, "bc4": 8, "bc5": 16, "bc6h": 16, "bc7": 16}
DXGI_BC = {70: "bc1", 71: "bc1", 72: "bc1", 73: "bc2", 74: "bc2", 75: "bc2", 76: "bc3", 77: "bc3", 78: "bc3", 79: "bc4",
+1 -1
View File
@@ -42,7 +42,7 @@ Ns 32
STEP = """ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('a point and a direction'),'2;1');
FILE_NAME('part.step','2026-10-31T12:00:00',('docs'),(''),'formats-luau docs','','');
FILE_NAME('part.step','2026-10-31T12:00:00',('docs'),(''),'rosetta docs','','');
FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }'));
ENDSEC;
DATA;
+1 -1
View File
@@ -32,7 +32,7 @@ def generate(ctx):
files = {}
tmp = A.tmpdir()
try:
tree = [("readme.txt", b"formats-luau retro archives\n"), ("src/main.c", b"int main(void) { return 0; }\n")]
tree = [("readme.txt", b"rosetta retro archives\n"), ("src/main.c", b"int main(void) { return 0; }\n")]
A.tree(tree, tmp)
files["notes.uu"] = A.tool(["sharutils"], ["uuencode", "readme.txt", "readme.txt"], cwd=tmp)
A.tool([], ["env", "NIXPKGS_ALLOW_UNFREE=1", "nix", "shell", "--impure", "nixpkgs#lha", "-c", "lha", "-a2o5q", "tree.lzh", "readme.txt", "src"], cwd=tmp)
+1 -1
View File
@@ -20,7 +20,7 @@ def generate(ctx):
files = {}
with tempfile.TemporaryDirectory() as d:
os.makedirs(os.path.join(d, "bin"))
for n, data in (("readme.txt", b"formats-luau cabinet\n" * 20), ("bin/tool.dll", bytes(range(256)) * 64)):
for n, data in (("readme.txt", b"rosetta cabinet\n" * 20), ("bin/tool.dll", bytes(range(256)) * 64)):
with open(os.path.join(d, n), "wb") as f:
f.write(data)
os.utime(os.path.join(d, n), (MTIME, MTIME))
+2 -2
View File
@@ -44,7 +44,7 @@ def generate(ctx):
tree = os.path.join(d, "tree")
os.makedirs(os.path.join(tree, "bin"))
with open(os.path.join(tree, "readme.txt"), "wb") as f:
f.write(b"formats-luau unix archives\n")
f.write(b"rosetta unix archives\n")
with open(os.path.join(tree, "bin", "run.sh"), "wb") as f:
f.write(b"#!/bin/sh\necho hi\n")
os.chmod(os.path.join(tree, "bin", "run.sh"), 0o755)
@@ -62,7 +62,7 @@ def generate(ctx):
t.add(os.path.join(tree, n), arcname=n)
files["src.tar.Z"] = subprocess.run(["nix", "shell", "nixpkgs#ncompress", "-c", "compress", "-c", "-f"], input=b.getvalue(),
capture_output=True, check=True).stdout
files["notes.txt.lz4"] = subprocess.run(["nix", "shell", "nixpkgs#lz4", "-c", "lz4", "-c"], input=b"formats-luau unix archives\n" * 8,
files["notes.txt.lz4"] = subprocess.run(["nix", "shell", "nixpkgs#lz4", "-c", "lz4", "-c"], input=b"rosetta unix archives\n" * 8,
capture_output=True, check=True).stdout
pkg = os.path.join(d, "pkg")
os.makedirs(os.path.join(pkg, "DEBIAN"))
+1 -1
View File
@@ -7,7 +7,7 @@ import importlib.util, io, os, plistlib, tarfile, tempfile, zipfile, datetime
INPUTS = ["tools/docs_check.py"]
MTIME = 1767225600 # 2026-01-01T00:00:00Z
README = b"formats-luau archive example\n" * 4
README = b"rosetta archive example\n" * 4
SCORES = "name,score,level\nada,1200,3\nbob,950,2\n\"lee, jr\",400,1\n"
CODE = r"""
import sys, json, msgpack, cbor2, datetime
+1 -1
View File
@@ -71,7 +71,7 @@ def generate(ctx):
wav = os.path.join(d, "tone.wav")
with open(wav, "wb") as f:
f.write(files["tone.wav"])
tags = ["-metadata", "title=Docs Tone", "-metadata", "artist=formats-luau", "-metadata", "album=Guide",
tags = ["-metadata", "title=Docs Tone", "-metadata", "artist=rosetta", "-metadata", "album=Guide",
"-metadata", "date=2026"]
for name, codec in (("tone.flac", ["-c:a", "flac"]), ("tone.mp3", ["-c:a", "libmp3lame", "-b:a", "128k"]),
("tone.ogg", ["-c:a", "libvorbis", "-q:a", "3"])):
+2 -2
View File
@@ -24,10 +24,10 @@ def generate(ctx):
wav = os.path.join(d, "tone.wav")
with open(wav, "wb") as f:
f.write(di.tone(44100, 1.0))
tags = ["-w", "Title=Docs Tone", "-w", "Artist=formats-luau"]
tags = ["-w", "Title=Docs Tone", "-w", "Artist=rosetta"]
ctx.nix("wavpack", ["wavpack", "-q", "-y", "-h"] + tags + [wav, "-o", os.path.join(d, "tone.wv")])
ctx.nix("wavpack", ["wavpack", "-q", "-y", "-b3", "-c"] + tags + [wav, "-o", os.path.join(d, "tone_hybrid.wv")])
ctx.nix("monkeys-audio", ["mac", wav, os.path.join(d, "tone.ape"), "-c2000", "-t", "Title=Docs Tone|Artist=formats-luau"])
ctx.nix("monkeys-audio", ["mac", wav, os.path.join(d, "tone.ape"), "-c2000", "-t", "Title=Docs Tone|Artist=rosetta"])
ctx.nix("ttaenc", ["ttaenc", "-e", wav, "-o", os.path.join(d, "tone.tta")])
for name in ("tone.wv", "tone_hybrid.wv", "tone_hybrid.wvc", "tone.ape", "tone.tta"):
files[name] = open(os.path.join(d, name), "rb").read()
+1 -1
View File
@@ -23,7 +23,7 @@ def generate(ctx):
with open(os.path.join(d, "tone.wav"), "wb") as f:
f.write(mpc.A.wav(st, rate, 2))
subprocess.run([os.path.join(mpc.tools(), "mpcenc"), "--silent", "--overwrite", "--quality", "4",
"--tag", "Title=Docs Tone", "--artist", "formats-luau", os.path.join(d, "tone.wav"),
"--tag", "Title=Docs Tone", "--artist", "rosetta", os.path.join(d, "tone.wav"),
os.path.join(d, "tone.mpc")], capture_output=True, check=True)
six = [0.2 * math.sin(2 * math.pi * (200 + 100 * c) * i / 48000) for i in range(24000) for c in range(6)]
with open(os.path.join(d, "six.raw"), "wb") as f:
+1 -1
View File
@@ -9,7 +9,7 @@
# tests/gen/exr_bench.luau a 512 x 256 half RGBA image in ZIP and PIZ
import os, shutil, subprocess, tempfile
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/exr"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/exr"]
WRITE = r'''
import OpenEXR, numpy as np, os, sys, json
+1 -1
View File
@@ -11,7 +11,7 @@ _s = importlib.util.spec_from_file_location("_arch2", os.path.join(os.path.dirna
A = importlib.util.module_from_spec(_s)
_s.loader.exec_module(A)
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Formats/containers/Fat.luau", "src/Formats/archive/fat"]
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Rosetta/containers/Fat.luau", "src/Rosetta/archive/fat"]
PKGS = ["dosfstools", "mtools"]
+1 -1
View File
@@ -10,7 +10,7 @@
# tests/gen/fbx_gltf.luau glTF sample models (tests/fixtures/gltf) for the writer round trips: { name, data, files }
import importlib.util, json, os, shutil, subprocess
INPUTS = ["src/Formats/model/fbx", "tests/fixtures/gltf", "src/Formats/codecs/compress/Deflate", "tools/fixtures/_model_ref.py",
INPUTS = ["src/Rosetta/model/fbx", "tests/fixtures/gltf", "src/Rosetta/codecs/compress/Deflate", "tools/fixtures/_model_ref.py",
"tools/fixtures/_fbx_blender.py", "tools/fixtures/_fbx_blender_stats.py", "tools/fixtures/_fbx_encode.luau"]
+1 -1
View File
@@ -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/flac", "src/Formats/codecs/audio/Pcm", "src/Formats/core/Md5.luau"]
INPUTS = ["src/Rosetta/audio/flac", "src/Rosetta/codecs/audio/Pcm", "src/Rosetta/core/Md5.luau"]
def pcm_bytes(samples, bits):
+1 -1
View File
@@ -12,7 +12,7 @@ _spec = importlib.util.spec_from_file_location("_video_helpers", os.path.join(os
V = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(V)
INPUTS = ["tools/fixtures/_video.py", "tools/fixtures/_flv_encode.luau", "src/Formats/video/flv", "src/Formats/codecs/video/Video"]
INPUTS = ["tools/fixtures/_video.py", "tools/fixtures/_flv_encode.luau", "src/Rosetta/video/flv", "src/Rosetta/codecs/video/Video"]
SRC = ["-f", "lavfi", "-i", "testsrc2=size=160x120:rate=12"]
+1 -1
View File
@@ -8,7 +8,7 @@
# by assimp and trimesh: { name, case, assimp, trimesh }
import importlib.util, json, os, struct
INPUTS = ["tests/fixtures/gltf", "src/Formats/model/gltf", "src/Formats/codecs/text/Json", "src/Formats/core/Base64",
INPUTS = ["tests/fixtures/gltf", "src/Rosetta/model/gltf", "src/Rosetta/codecs/text/Json", "src/Rosetta/core/Base64",
"tools/fixtures/_model_ref.py", "tools/fixtures/_gltf_encode.luau"]
+1 -1
View File
@@ -12,7 +12,7 @@ def _load(n):
return m
R, S, T = _load("_raster_ref"), _load("_simple"), _load("_tex_reference")
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/icns"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/icns"]
def extract(ctx, w, name):
+1 -1
View File
@@ -13,7 +13,7 @@ def _load(n):
return m
R, S = _load("_raster_ref"), _load("_simple")
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/ilbm"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/ilbm"]
def chunk(cid, data):
+1 -1
View File
@@ -8,7 +8,7 @@
# tests/gen/iqm_xcheck.luau { name, assimp, ref }
import importlib.util, os
INPUTS = ["src/Formats/model/iqm", "src/Formats/codecs/model", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py",
INPUTS = ["src/Rosetta/model/iqm", "src/Rosetta/codecs/model", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py",
"tools/fixtures/_iqm_reference.py", "tools/fixtures/_iqm_encode.luau", "tests/fixtures/gltf"]
+1 -1
View File
@@ -19,7 +19,7 @@ _spec2 = importlib.util.spec_from_file_location("_dds_fixture", os.path.join(_di
D = importlib.util.module_from_spec(_spec2)
_spec2.loader.exec_module(D)
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/ktx", "tools/fixtures/dds.py"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/ktx", "tools/fixtures/dds.py"]
def q8(v):
+1 -1
View File
@@ -258,7 +258,7 @@ TRI = """0 an uncertified triangle
# a brick: an outer box, an inner box turned inside out (INVERTNEXT), a mirrored stud box, an uncertified triangle
BRICK = """0 Test Brick 1 x 2
0 Name: testbrick.dat
0 Author: formats-luau
0 Author: rosetta
0 !LDRAW_ORG Unofficial_Part
0 BFC CERTIFY CCW
1 16 0 12 0 20 0 0 0 12 0 0 0 10 box.dat
+1 -1
View File
@@ -12,7 +12,7 @@ _s = importlib.util.spec_from_file_location("_arch2", os.path.join(os.path.dirna
A = importlib.util.module_from_spec(_s)
_s.loader.exec_module(A)
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Formats/archive/lha"]
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Rosetta/archive/lha"]
DIRS = ["lharc113", "larc333", "lha213", "lha255e", "lha_amiga_122", "lha_amiga_212", "lha_os9_211c", "lha_osk_201",
"lha_unix114i", "explzh_723", "lengths", "generated/lzs", "lha_x68k_213", "lh2_222", "lhmelt_16536"]
+1 -1
View File
@@ -12,7 +12,7 @@ def module(ctx, name):
return m
INPUTS = ["src/Formats/model/lwo", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py"]
INPUTS = ["src/Rosetta/model/lwo", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py"]
def generate(ctx):
+1 -1
View File
@@ -5,7 +5,7 @@
# tests/gen/lz4_bench.luau { size, crc, data (lz4 HC 9 block), raw }
import json, os, random, shutil, subprocess, zlib
INPUTS = ["src/Formats/codecs/compress/Lz4.luau", "tools/fixtures/_lz4_encode.luau"]
INPUTS = ["src/Rosetta/codecs/compress/Lz4.luau", "tools/fixtures/_lz4_encode.luau"]
REF = r"""
import json, sys, lz4.block
+1 -1
View File
@@ -6,7 +6,7 @@
# tests/gen/lz4frame_corpora.luau { [name] = bytes }
import os, shutil, struct, subprocess, tempfile
INPUTS = ["src/Formats/archive/lz4/init.luau", "src/Formats/codecs/compress/Lz4.luau", "src/Formats/codecs/compress/Xxh32.luau",
INPUTS = ["src/Rosetta/archive/lz4/init.luau", "src/Rosetta/codecs/compress/Lz4.luau", "src/Rosetta/codecs/compress/Xxh32.luau",
"tools/fixtures/_lz4frame_encode.luau"]
+1 -1
View File
@@ -16,7 +16,7 @@ _sig = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(_sig)
signal, pack, wav = _sig.signal, _sig.pack, _sig.wav
INPUTS = ["src/Formats/audio/m4a", "src/Formats/audio/caf", "src/Formats/codecs/audio/Alac", "src/Formats/containers/IsoBmff",
INPUTS = ["src/Rosetta/audio/m4a", "src/Rosetta/audio/caf", "src/Rosetta/codecs/audio/Alac", "src/Rosetta/containers/IsoBmff",
"tests/audio/_signal.luau", "tests/audio/_encode_cases.luau", "tools/fixtures/_m4a_encode.luau",
"tools/fixtures/_m4a_signal.py"]
PKGS = ["ffmpeg", "fdk-aac-encoder", "gpac"]
+2 -2
View File
@@ -12,8 +12,8 @@ _s = importlib.util.spec_from_file_location("_arch2", os.path.join(os.path.dirna
A = importlib.util.module_from_spec(_s)
_s.loader.exec_module(A)
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Formats/archive/binhex",
"src/Formats/archive/macbinary", "src/Formats/archive/applesingle", "src/Formats/containers/MacFile.luau"]
INPUTS = ["tools/fixtures/_arch2.py", "tools/fixtures/_arch2_ours.luau", "src/Rosetta/archive/binhex",
"src/Rosetta/archive/macbinary", "src/Rosetta/archive/applesingle", "src/Rosetta/containers/MacFile.luau"]
PKGS = ["hfsutils", "unar"]
MAC_EPOCH = 2082844800
+1 -1
View File
@@ -11,7 +11,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/mp3", "src/Formats/codecs/audio/Pcm"]
INPUTS = ["src/Rosetta/audio/mp3", "src/Rosetta/codecs/audio/Pcm"]
def generate(ctx):
+1 -1
View File
@@ -9,7 +9,7 @@
# tests/gen/ms3d_xcheck.luau { name, case? | gltf?, assimp }
import importlib.util, os
INPUTS = ["src/Formats/model/ms3d", "tests/fixtures/gltf", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py",
INPUTS = ["src/Rosetta/model/ms3d", "tests/fixtures/gltf", "tools/fixtures/_model_ref.py", "tools/fixtures/fbx.py",
"tools/fixtures/3ds.py", "tools/fixtures/_ms3d_encode.luau"]
+1 -1
View File
@@ -7,7 +7,7 @@
# and trimesh: { name, assimp, trimesh, want = the original's values }
import importlib.util, math, os, struct
INPUTS = ["src/Formats/model/obj", "tools/fixtures/_model_ref.py", "tools/fixtures/_obj_encode.luau"]
INPUTS = ["src/Rosetta/model/obj", "tools/fixtures/_model_ref.py", "tools/fixtures/_obj_encode.luau"]
def ref_module(ctx):
+1 -1
View File
@@ -9,7 +9,7 @@
# trimesh, assimp and a small reader here, as verdicts
import json, math, os, shutil, struct, subprocess, tempfile, zlib
INPUTS = ["src/Formats/model/off", "tools/fixtures/_off_reference.py", "tools/fixtures/_off_encode.luau"]
INPUTS = ["src/Rosetta/model/off", "tools/fixtures/_off_reference.py", "tools/fixtures/_off_encode.luau"]
def f32(x):
+1 -1
View File
@@ -5,7 +5,7 @@
# ffmpeg (decoded), ffmpegFrames, comments (opusinfo's user comments) } }
import os, re, shutil, subprocess, tempfile, zlib
INPUTS = ["src/Formats/audio/opus", "src/Formats/codecs/audio/Mdct", "src/Formats/containers/Ogg",
INPUTS = ["src/Rosetta/audio/opus", "src/Rosetta/codecs/audio/Mdct", "src/Rosetta/containers/Ogg",
"tests/audio/_opus_cases.luau", "tools/fixtures/_opus_encode.luau"]
+1 -1
View File
@@ -14,7 +14,7 @@ def _load(n):
return m
R, S, T = _load("_raster_ref"), _load("_simple"), _load("_tex_reference")
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/layered/ora"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/layered/ora"]
OPS = {"svg:src-over": "normal", "svg:multiply": "multiply", "svg:screen": "screen", "svg:overlay": "overlay", "svg:color-dodge": "colorDodge"}
+1 -1
View File
@@ -8,7 +8,7 @@ _spec = importlib.util.spec_from_file_location("_raster_ref", os.path.join(os.pa
R = importlib.util.module_from_spec(_spec)
_spec.loader.exec_module(R)
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/pcx"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/pcx"]
def ours(ctx, which):
+1 -1
View File
@@ -11,7 +11,7 @@
# plyfile and assimp, as verdicts
import json, math, os, shutil, struct, subprocess, tempfile
INPUTS = ["src/Formats/model/ply", "tools/fixtures/_ply_reference.py", "tools/fixtures/_ply_encode.luau"]
INPUTS = ["src/Rosetta/model/ply", "tools/fixtures/_ply_reference.py", "tools/fixtures/_ply_encode.luau"]
def f32(x):
+1 -1
View File
@@ -64,7 +64,7 @@ def encode(w, h, ct, depth, px, interlace, rng, plte=None, trns=None, filters=No
prev = row
z = zlib.compress(bytes(raw), level)
out = b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", struct.pack(">IIBBBBB", w, h, depth, ct, 0, 0, interlace))
out += chunk(b"tEXt", b"Comment\0made by formats-luau tools/fixtures/png.py")
out += chunk(b"tEXt", b"Comment\0made by rosetta tools/fixtures/png.py")
if plte:
out += chunk(b"PLTE", b"".join(bytes(c[:3]) for c in plte))
if trns is not None:
+1 -1
View File
@@ -8,7 +8,7 @@
# luau) read by psd-tools, compared with the layers and the flattened image we wrote.
import json, os, random, shutil, struct, subprocess, tempfile, zlib
INPUTS = ["src/Formats/layered/psd", "src/Formats/codecs/image/Blend.luau", "src/Formats/ops/LayerOps.luau", "tools/fixtures/_ours.luau"]
INPUTS = ["src/Rosetta/layered/psd", "src/Rosetta/codecs/image/Blend.luau", "src/Rosetta/ops/LayerOps.luau", "tools/fixtures/_ours.luau"]
BLEND = ["norm", "diss", "dark", "mul ", "idiv", "lbrn", "dkCl", "lite", "scrn", "div ", "lddg", "lgCl", "over", "sLit",
"hLit", "vLit", "lLit", "pLit", "hMix", "diff", "smud", "fsub", "fdiv", "hue ", "sat ", "colr", "lum "]
+1 -1
View File
@@ -11,7 +11,7 @@ _s = importlib.util.spec_from_file_location("_arch2", os.path.join(os.path.dirna
A = importlib.util.module_from_spec(_s)
_s.loader.exec_module(A)
INPUTS = ["tools/fixtures/_bitmapfonts_ours.luau", "src/Formats/font/psf"]
INPUTS = ["tools/fixtures/_bitmapfonts_ours.luau", "src/Rosetta/font/psf"]
def store(pkg):
+1 -1
View File
@@ -7,7 +7,7 @@
# ours = { [name] = { same fields as cases } } }
import importlib.util, os, pickle, struct, subprocess, zlib, random
INPUTS = ["src/Formats/model/qb", "tools/fixtures/_qb_encode.luau"]
INPUTS = ["src/Rosetta/model/qb", "tools/fixtures/_qb_encode.luau"]
_spec = importlib.util.spec_from_file_location("_model_ref", os.path.join(os.path.dirname(os.path.abspath(__file__)), "_model_ref.py"))
R = importlib.util.module_from_spec(_spec)
+1 -1
View File
@@ -18,7 +18,7 @@ def _load(name):
A = _load("_audio")
D = _load("_adpcm")
INPUTS = ["tests/fixtures/qoa", "src/Formats/codecs/audio/Qoa"]
INPUTS = ["tests/fixtures/qoa", "src/Rosetta/codecs/audio/Qoa"]
def generate(ctx):
+1 -1
View File
@@ -15,7 +15,7 @@
import json, math, os, random, shutil, struct, subprocess, tempfile
import xml.etree.ElementTree as ET
INPUTS = ["src/Formats/model/rbxm", "src/Formats/model/rbxmx", "src/Formats/codecs/model/Rbx", "tools/fixtures/_rbx_encode.luau"]
INPUTS = ["src/Rosetta/model/rbxm", "src/Rosetta/model/rbxmx", "src/Rosetta/codecs/model/Rbx", "tools/fixtures/_rbx_encode.luau"]
# ---------------------------------------------------------------------------------------------------- rojo projects
def cframe(pos, rows):
+1 -1
View File
@@ -9,7 +9,7 @@
# unsupported? } }, ours = { { name, ok, detail } } }
import json, math, os, random, shutil, struct, subprocess, zlib
INPUTS = ["src/Formats/model/robloxmesh", "tools/fixtures/_robloxmesh_encode.luau"]
INPUTS = ["src/Rosetta/model/robloxmesh", "tools/fixtures/_robloxmesh_encode.luau"]
def f32(x):
+2 -2
View File
@@ -10,7 +10,7 @@
# (tools/fixtures/_schematic_encode.luau) read back by litemapy / nbtlib
import importlib.util, os, pickle, subprocess, sys
INPUTS = ["src/Formats/model/schematic", "src/Formats/codecs/model/Minecraft", "src/Formats/codecs/text/Nbt", "tools/fixtures/_schematic_encode.luau"]
INPUTS = ["src/Rosetta/model/schematic", "src/Rosetta/codecs/model/Minecraft", "src/Rosetta/codecs/text/Nbt", "tools/fixtures/_schematic_encode.luau"]
_spec = importlib.util.spec_from_file_location("_model_ref", os.path.join(os.path.dirname(os.path.abspath(__file__)), "_model_ref.py"))
R = importlib.util.module_from_spec(_spec)
@@ -92,7 +92,7 @@ tmp = tempfile.mkdtemp()
main = Region(0, 0, 0, 6, 5, 4); fill(main, STATES)
neg = Region(10, 2, -3, -4, 3, -5); fill(neg, STATES[:6])
big = Region(-20, 0, 0, 7, 3, 5); fill(big, BIG)
sch = Schematic(name="Test", author="formats-luau", description="fixture", regions={"main": main, "neg": neg, "big": big})
sch = Schematic(name="Test", author="rosetta", description="fixture", regions={"main": main, "neg": neg, "big": big})
path = os.path.join(tmp, "t.litematic")
sch.save(path)
f = nbtlib.load(path)
+2 -2
View File
@@ -78,7 +78,7 @@ def build_sf2(with24):
if len(pcm24) % 2:
pcm24 += b"\x00"
info = lst(b"INFO", [chunk(b"ifil", struct.pack("<HH", 2, 4)), chunk(b"isng", zstr("EMU8000")),
chunk(b"INAM", zstr("formats-luau test bank")), chunk(b"ICMT", zstr("generated by tools/fixtures/sf2.py"))])
chunk(b"INAM", zstr("rosetta test bank")), chunk(b"ICMT", zstr("generated by tools/fixtures/sf2.py"))])
sd = [chunk(b"smpl", bytes(pcm))] + ([chunk(b"sm24", bytes(pcm24))] if with24 else [])
sdta = lst(b"sdta", sd)
@@ -143,7 +143,7 @@ def build_sf2(with24):
"samples": [{"name": h[0], "start": h[1], "stop": h[2], "loopStart": h[3], "loopEnd": h[4], "sampleRate": h[5],
"originalPitch": h[6], "pitchCorrection": h[7]} for h in headers],
"instruments": [n for n, _ in insts],
"info": {"name": "formats-luau test bank", "engine": "EMU8000", "version": "2.04"},
"info": {"name": "rosetta test bank", "engine": "EMU8000", "version": "2.04"},
# a few raw sample values (16-bit and 24-bit) for the sample decoding check
"values": [[i, struct.unpack_from("<h", pcm, i * 2)[0], pcm24[i]] for i in (0, 1, 25, 77, 5000 + 46 + 13, 20000)],
}
+1 -1
View File
@@ -11,7 +11,7 @@ def _load(n):
return m
R, S = _load("_raster_ref"), _load("_simple")
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Formats/image/sgi"]
INPUTS = ["tools/fixtures/_tex_encode.luau", "src/Rosetta/image/sgi"]
def generate(ctx):
+1 -1
View File
@@ -7,7 +7,7 @@
# tests/gen/smd.luau { cases = { { name, data, bones, frames, tris, materials, verts, assimp } }, ours = { [name] = assimp info } }
import importlib.util, json, math, os, shutil, struct, subprocess, tempfile
INPUTS = ["tools/fixtures/_quake_ref.py", "tools/fixtures/_smd_encode.luau", "src/Formats/model/smd"]
INPUTS = ["tools/fixtures/_quake_ref.py", "tools/fixtures/_smd_encode.luau", "src/Rosetta/model/smd"]
def mod(ctx, name):
Loaded 100 of 941 files, more files were not shown because too many files have changed in this diff. Show more