- 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