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.
- codecs/video/Video/Pool: Images a decoder made, handed back and reused (only its own; fresh meta)
- H264 / Vp8 / Mpeg2 output Images come from a Pool; H264 / Vp8 decoder:release, VideoCodecDecoder.release
- Video.open: opts.reuse recycles the previous frame's Image at the next nextFrame; v:release(frame); the yuv Image
under an rgba / scaled frame (never seen by the caller) goes back to the codec at once
- tests/video/control.luau: yield hook (identical frames, H.264 / VP8 / MPEG-1, conversions), disposable packets in
every container, skipDisposable bit-exact at the right index, reuse identical and recycled, fuzz
- docs/guide/video.md: Skipping and reusing frames; docs/API.md
- H264: picture and grid allocations split between yield calls (a 1080p picture's tables are 1.6 M slots)
- Vp8: Decode.decodeFrame hook three times per macroblock row and once per loop filter row; Options.yield
- Yuv.toRgba / Yuv.scale: optional hook every 16 rows; imageToRgba / imageScale take an out Image and the hook
- Video.open passes opts.yield to the conversions, the VP8 and MPEG-1/2 decoders
- codecs/video/Video/Disposable: H.264 nal_ref_idc 0 (avcC length-prefixed / Annex B), VP8 frames refreshing no
reference; containers/Demux sets packet.disposable for h264 / vp8 tracks; Video.isDisposable(track, packet)
- skipDisposable: H.264 keeps skipped pictures in output order (pts pool / POC bookkeeping), VP8 applies the header
state then skips; receive() returns false for a skipped picture, VideoFrame.index counts it
- Types: Packet.disposable, VideoCodecDecoder.receive may return false
- tools/fixtures/videoctl.py: VP8 two temporal layers (IVF + WebM)
- 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.
New shared modules under codecs/audio/Aac: Sbr (bitstream, band tables,
delta decoding), SbrBits, SbrQmf (32-band analysis / 64-band synthesis QMF
through DCT-IV), SbrHf (HF generation and adjustment), Ps (baseline PS),
SbrTables (ISO tables, from syom 0.8.1, MIT). Explicit signalling enables
SBR at construction; implicit SBR / PS is found by Decoder:probe /
Aac.probeFrames. audio/aac and audio/m4a report the output rate and take
opts.sbr = false for the core only; m4a scales iTunSMPB by the media tick.
Outside the folder: containers/AudioWrap writes an AAC-LC ADTS header for
HE-AAC AudioSpecificConfigs (the decoder finds SBR in the stream); the api's
default openAudio hook forwards opts.sbr.
- 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