tools/gen_registry.py now also writes src/Rosetta/Sniffs.luau: each format's sniff copied
(tools/sniff_extract.py) with the top-level locals, types and load-time loops it reaches;
requires outside core/ become proxies that require on first field access. 198 of 199
sniffs are copied (model/fbx reads Binary.MAGIC at load time: its module sniffs).
Registry entries gain sniff (0 copy, 1 copy reaching a codec / container, 2 module) and
variant (the module has variant(r)).
init.luau detect: the extension's formats first, then by sniff cost and registry order;
a sniff runs only while its cap (1, or LATE) could still win, ties to registry order, so
results equal the eager path. F.detect loads the winner only when it has variant().
tests/detect.luau: every copied sniff against its module's on samples of every fixture
module (tools/fixtures/detect.py), scores within 0..1, and F.detect against the eager
reference with no name, the right / wrong / unknown extension and per category.
Outside init / Registry / gen_registry: tools/fixtures.py (LAST generators run after
the others and rerun when their outputs change), tools/lint_rules.py (Sniffs is api
layer, skipped by DUP), docs/STYLE.md and docs/API.md notes, build/ regenerated.
- compat math.clamp is vararg: LuaJIT never starts a root trace at a vararg function but still inlines it. The plain
shim, called from interpreted code, collected aborted root traces until it was blacklisted, after which every trace
through it aborted: in one process, png (or anything earlier) left jpeg / webp / tiff / ImageOps 2-10x slower.
- Dct.fdctQuantize: branch-free quantiser and a divisor table (q * 8) from Jpeg.Encode; the sign branch among the column
pass's live values made LuaJIT retry side traces it could not compile (register coalescing) forever. Also faster
in luau -O2 (~5%) and native (~10%). Outputs unchanged.
- tools/bench_mixed.luau + bash tools/bench.sh mixed: core, audio, video, image in one LuaJIT process against the
per-codec benches, marking lines more than 1.3x slower mixed.
- codecs/video/Mpeg2/Decoder: coefficient loop keeps the bit position in a local and reads a 25-bit window with
one readu32 (no fifth byte); MPEG-1 oddification with bor; dequant shifts; tracks the highest coefficient so the
IDCT skips the zero rows; toRgba / toRgba422 through shifted-channel lookup tables (one rshift + one index per
channel, the alpha folded in), two rows per chroma row without a per-pixel branch
- codecs/video/Dsp: idct(blk, dst, off, stride, add, last?): pass 1 only over the rows up to last's, pass 2 with
the rows-4..7-zero branch tree when they are, fused with the put / add (rounding and the CLAMP offset in one
division); mc: an unrolled whole-sample copy for 8 / 16 wide blocks, the 4-tap case a column at a time reusing
each row's pair sums
- codecs/image/Yuv.toRgba: per-matrix luma table, shifted-channel clip tables, chroma once per 2x2
- codecs/video/H264: prediction scratch as buffers (put = u32 copy, bi-pred average four samples at a time),
whole-sample single-list blocks copied straight from the reference, implicit / identity weights routed to the
plain paths, 2-tap chroma when a fraction is 0 and the bilinear taps slide along the row, six-tap with two
multiplies; deblocking skips the inner edges of macroblocks with one motion and no luma coefficients
(S.flatTab) and finds equal motion before motionDiffers
- codecs/image/Vp8/Predict: six-tap filters with a sliding window (one read per sample)
- --!optimize 2 on every video codec / container module that lacked it (the bundles already force it)
- tools/bench_video.luau: the video fps lines on their own (sections, "once", "jitdefault"), more MPEG-1 clips
Entities as nodes (keys in extras, brushes as parsed), brushes through codecs/model/Brush, patchDef2 / patchDef3
through codecs/model/Patch, texture sizes from WAD2 / WAD3 / .wal / images; tested against ericw-tools qbsp.