ws-cleanup: codecs/ grouped by domain; containers/Chunks, codecs/audio/Stream, codecs/image/Pixels, codecs/model/Mat4
C2, the hierarchy (tools/move.py, every reference rewritten mechanically): - codecs/compress: Deflate Lzma Zstd Brotli Bzip2 Lzw; codecs/entropy: Huffman (from core) RangeCoder; codecs/image: Jpeg Dct Vp8 Vp8L Yuv Quantize Raster Blend Pixels; codecs/audio: Mdct Aac Alac Pcm Resample VorbisComment Tracker SoundFont Stream; codecs/video: H264 Mpeg1 Video; codecs/text: Json Xml Text Url; codecs/font: TrueType Cff; codecs/model: MeshFlatten Mat4. containers/ stays flat; core/ keeps Bytes Bits Err Crc32 Adler32 Base64 Md5 Input Sniff. - LAYERS lint: codecs must sit in a domain folder; gen_registry lists codecs by domain (docs/FORMATS.md). - Checked: build.py both targets, rojo build of build/roblox, the full suite on both runtimes. C3, generic code out of format folders: - containers/Chunks (new): the chunked-file walker (RIFF / RIFX / IFF / PNG / CAF layouts: endianness, size first, trailer, padding, lenient missing pad, open-ended ids, size hooks). containers/Riff walks with it (RF64 ds64 through the resize hook); image/png, audio/aiff and audio/caf list their chunk handlers over it. - codecs/audio/Stream (new): Stream.packets, the packet-decoder Decoder (read / seek with pre-roll / position, priming and end trimming) that aac, caf and m4a each carried (~70 lines each). - codecs/image/Pixels: image/bmp/Pixels promoted (+ rgb555); image/ico's DIB decoder uses its row loops instead of its own (the AND mask / alpha rule stay ICO's). - codecs/model/Mat4 (new): matrices / quaternions / TRS shared by FBX (Xform keeps only the FBX transform model), Collada (Math keeps only <lookat> / <skew>) and USD (its matrix helpers and general 4x4 inverse); Mat4.mul is Types.Scene.mul. The Collada normal matrix is now the inverse transpose (it was the inverse; same result for the fixtures' bind shapes). - README rewritten (install for Rojo and LÖVE / LuaJIT, quick start per category, F.* and F.ops, host notes: FORMATS_NO_JIT_TUNE, paths, layout); docs/STYLE.md: the codec domains, "what belongs in a format folder" with the shared building blocks and the DUP rule, conventions (WAVE order, lower-case tags, loops, the api hooks decodeImage / encodeImage / openAudio / plugins / resolve, the codecs/video/Video registry), Err.from, the type baseline. New tests: tests/containers/chunks, tests/codecs/mat4. Type baseline 93. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
9c553b9d1a
commit
434a304315
283 files changed
+1877
-1660
No files matched your search
+21
-21
@@ -3,7 +3,7 @@
|
||||
-- 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 (*_bench corpora), fonts
|
||||
-- (glyphs per second), json / xml / yaml, jpeg / gif / tiff / qoi / tga / pnm / hdr and ImageOps.
|
||||
local Deflate = require("@formats/codecs/Deflate")
|
||||
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")
|
||||
@@ -189,7 +189,7 @@ do
|
||||
print(string.format("%-8s %-30s %8.1fx real time", runtime, "", 10 / dt))
|
||||
end
|
||||
do
|
||||
local Json = require("@formats/codecs/Json")
|
||||
local Json = require("@formats/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/Xml")
|
||||
local Xml = require("@formats/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/Zstd")
|
||||
local Zstd = require("@formats/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 Brotli = require("@formats/codecs/Brotli")
|
||||
local Brotli = require("@formats/codecs/compress/Brotli")
|
||||
local BB = require("@tests/gen/brotli_bench")
|
||||
local bz = buffer.fromstring(BB.data)
|
||||
local bout = assert(Brotli.decompress(bz))
|
||||
@@ -247,7 +247,7 @@ do
|
||||
end)
|
||||
end
|
||||
do
|
||||
local Bzip2 = require("@formats/codecs/Bzip2")
|
||||
local Bzip2 = require("@formats/codecs/compress/Bzip2")
|
||||
local BZ = require("@tests/gen/bzip2_bench")
|
||||
local bz = buffer.fromstring(BZ.data)
|
||||
bench("bzip2 decompress -9", 3, BZ.size, function()
|
||||
@@ -255,7 +255,7 @@ do
|
||||
end)
|
||||
end
|
||||
do
|
||||
local Lzma = require("@formats/codecs/Lzma")
|
||||
local Lzma = require("@formats/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))
|
||||
@@ -332,7 +332,7 @@ end
|
||||
-- ---------------------------------------------------------------------------------------- ws-imgA: gif + quantize
|
||||
do
|
||||
local Gif = require("@formats/image/gif")
|
||||
local Quantize = require("@formats/codecs/Quantize")
|
||||
local Quantize = require("@formats/codecs/image/Quantize")
|
||||
local Types = require("@formats/Types")
|
||||
local GB = require("@tests/gen/gif_bench")
|
||||
local still = buffer.fromstring(GB.still)
|
||||
@@ -544,8 +544,8 @@ do
|
||||
end)
|
||||
end
|
||||
do
|
||||
-- layered + vector (ws-vec): PSD decode / encode of 8 RGBA layers 1024 x 768, flatten (codecs/Blend), SVG
|
||||
-- rasterize at 512 x 512 (codecs/Raster). No fixtures: the inputs are built here.
|
||||
-- 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")
|
||||
@@ -608,7 +608,7 @@ do
|
||||
end)
|
||||
end
|
||||
do
|
||||
local Xml = require("@formats/codecs/Xml")
|
||||
local Xml = require("@formats/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()
|
||||
@@ -626,8 +626,8 @@ 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/Alac")
|
||||
local Mdct = require("@formats/codecs/Mdct")
|
||||
local Alac = require("@formats/codecs/audio/Alac")
|
||||
local Mdct = require("@formats/codecs/audio/Mdct")
|
||||
local MA = require("@tests/gen/m4a_aac")
|
||||
local ML = require("@tests/gen/m4a_alac")
|
||||
local aac = buffer.fromstring(MA[1].data)
|
||||
@@ -709,7 +709,7 @@ 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/SoundFont")
|
||||
local SoundFont = require("@formats/codecs/audio/SoundFont")
|
||||
local Sf2 = require("@formats/music/sf2")
|
||||
local SF = require("@tests/gen/sf2_cases")
|
||||
local sf = assert(Sf2.decode(Bytes.reader(buffer.fromstring(SF.sf2))))
|
||||
@@ -734,7 +734,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/Tracker")
|
||||
local Tracker = require("@formats/codecs/audio/Tracker")
|
||||
local function song(format: string, filter: boolean): any
|
||||
local m = Tracker.newModule(format, 32)
|
||||
m.order = { 0 }
|
||||
@@ -913,8 +913,8 @@ do
|
||||
end
|
||||
-- ------------------------------------------------------------------------------------------- ws-video-codecs: fps
|
||||
do
|
||||
local Jpeg = require("@formats/codecs/Jpeg")
|
||||
local Mpeg1 = require("@formats/codecs/Mpeg1")
|
||||
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 MB = require("@tests/gen/mjpeg_bench")
|
||||
@@ -1023,10 +1023,10 @@ do
|
||||
end
|
||||
-- ------------------------------------------------------------------------------------------- ws-video-vp8: fps
|
||||
do
|
||||
-- VP8 video (codecs/Vp8, tools/fixtures/vp8video.py): whole IVF streams (libvpx, panning testsrc2) through one
|
||||
-- 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/Vp8")
|
||||
local Vp8 = require("@formats/codecs/image/Vp8")
|
||||
local VB = require("@tests/gen/vp8video_bench")
|
||||
local function run(tag: string)
|
||||
for _, c in VB do
|
||||
@@ -1056,10 +1056,10 @@ do
|
||||
end
|
||||
end
|
||||
do
|
||||
-- H.264 (codecs/H264): whole Annex B streams, frames per second (decode + the cropped yuv420p output copies). The
|
||||
-- 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/H264")
|
||||
local H264 = require("@formats/codecs/video/H264")
|
||||
local HB = require("@tests/gen/h264_bench")
|
||||
local function run(tag: string)
|
||||
for _, c in HB do
|
||||
|
||||
Reference in new issue
Block a user