Commit Graph
236 Commits
Author SHA1 Message Date
4DBug 29afbfb165 ws-arch2-unix: docs/guide/archive.md sections for cpio, ar / .deb, rpm, .Z / .lz4, ISO (inputs: tools/fixtures/docs_arch_unix.py); archive/cpio: variant option (default: the source's variant) 2026-10-31 14:56:18 -05:00
4DBug 411261470a ws-arch2-unix: archive/lz4 (LZ4 frame read: linked / independent blocks, block / content XXH32, content size, skippable + legacy frames, concatenation; write: independent blocks) on codecs/compress/Lz4 (merged from ws/roblox ba4b20e) + codecs/compress/Xxh32; containers/Archive.streamData (shared single-stream payload: buffer / one entry / tar of entries; used by z and lz4); tests vs the lz4 tool both ways; bench lines
containers/Archive: additive helper streamData (requires containers/Tar); nothing existing changes.
2026-10-31 14:40:26 -05:00
4DBug 197ddc561a ws-arch2-unix: containers/Iso9660 (volume descriptors, directory records, multi-extent, Joliet, Rock Ridge SUSP / RRIP incl. CE, NM, PX, PN, TF, SL, CL / RE relocation, El Torito catalog) + archive/iso, tests vs xorriso / genisoimage images, the source tree and pycdlib 2026-10-31 14:33:57 -05:00
4DBug 6eadacce64 ws-arch2-unix: codecs/compress/UnixCompress (.Z LZW decode + encode, bit-identical to ncompress 5.0: group padding on width changes / CLEAR, ratio-check clears) + archive/z (single-stream, .taz / .tZ -> .tar, writes ncompress's bytes), tests vs ncompress and gzip -d, bench lines 2026-10-31 14:23:51 -05:00
4DBug 8b94584d0f ws-arch2-unix: archive/rpm (lead, signature + main headers, file list from dirnames / basenames, payload gzip / bzip2 / xz / lzma / zstd / none decompressed lazily via codecs/compress, cpio via containers/Cpio; meta.rpm), tests vs rpmbuild / rpm -qp / rpm2cpio; containers/Cpio.TYPE_OF 2026-10-31 14:14:56 -05:00
4DBug 07f70f70d5 ws-arch2-unix: archive/ar (GNU / SysV long names + symbol tables, BSD #1/ names + __.SYMDEF; GNU / BSD writer) with .deb (meta.payload = data.tar.*, meta.control from control.tar.* via codecs/compress + containers/Tar), tests vs GNU ar (byte-identical), llvm-ar, bsdtar, dpkg-deb 2026-10-31 14:09:08 -05:00
4DBug a05199c34d ws-arch2-unix: containers/Cpio (newc / crc / odc / old binary both endians read; newc / crc / odc write; hard links, symlinks, devices) + archive/cpio (any Archive -> cpio), tests vs GNU cpio (byte-identical re-encode) and bsdtar 2026-10-31 14:02:43 -05:00
4DBug 8057a1a323 Merge commit 'ba4b20e' into ws/arch2-unix 2026-10-31 13:54:28 -05:00
4DBug 1ed25296ba ws-roblox: codecs/compress/Lz4 (LZ4 block decode + encode, decodeInto with history for linked blocks), tests vs python-lz4 both ways, bench line 2026-10-31 13:53:23 -05:00
4DBug 51117f9732 ws-arch2: groundwork: Types.BitmapStrike / BitmapGlyph + Font.bitmap (optional field), codecs/font/Bitmap (bitmap Font value, strike of any font, 1-bit row pack/unpack), api unwrap of meta.payload entries (a .deb loads as its data.tar.*; meta.container / meta.outer)
Types.luau: additive only (new optional Font field and two new types). init.luau: unwrap() also follows
meta.payload = <entry name> on non-stream archives; stream behaviour unchanged.
2026-10-31 13:51:09 -05:00
4DBug de4f14a343 merge ws/docs 2026-10-31 13:45:55 -05:00
4DBug 23e0c13f52 ws-docs: examples/cad.luau: typed tables (no new type diagnostic) 2026-10-31 13:40:59 -05:00
4DBug 1d21568af8 merge ws/cleanup: restructure C (codecs by domain, shared Chunks/Stream/Pixels/Sniff/Mat4, audio codecs out of format folders, DUP lint, type gate 93), dedup, consistency, F.ops, README 2026-10-31 13:32:16 -05:00
4DBug 3fde582f8c Merge branch 'ws/cleanup' into ws/docs 2026-10-31 13:25:13 -05:00
4DBug fca79bd858 ws-docs: guide pages cad, font, layered, music, playlist, subtitles, tilemap, video; runnable examples per category; README converting note 2026-10-31 13:25:10 -05:00
4DBug 7cfec05eeb ws-cleanup: Pcm.collect reads a known length in one call into the result (no copy); README links the guide
Measured in an A/B of the touched paths (best of 3-4, one core): LuaJIT wav decode through Pcm.drain was ~10%
slower than the old single read; now within noise.
2026-10-31 13:19:43 -05:00
4DBug db81f73acf ws-docs: recipes: MIDI render, glTF to OBJ, vox greedy mesh, zip, CSV, SVG to PNG, TTF bake to BMFont, drawing text 2026-10-31 13:18:01 -05:00
4DBug 0552f0ebf8 ws-docs: guide pages archive, audio, data, image, scene, vector; recipes (first part); docs input generators 2026-10-31 13:16:12 -05:00
4DBug 001e746305 ws-docs: docs/guide/README.md (installing, inputs, detection, errors, options, saving, converting, hosts); LÖVE example: SVG tile, GIF played as a video with a per-update decode budget 2026-10-31 13:09:04 -05:00
4DBug cdcbd76b9e ws-docs: tools/docs_check.py (guide snippets and examples become tests under both runtimes), docs inputs generator 2026-10-31 13:05:43 -05:00
4DBug 9941113b7b ws-cleanup: audio codecs out of the format folders (codecs/audio/Opus, Vorbis, Flac, Mpa)
The decoders / encoders are libraries, not the file format: audio/opus/{Celt, CeltTables, CeltEncoder, Mdct, Packet,
Silk, SilkTables, Decoder} -> codecs/audio/Opus; audio/vorbis/{Codebook, Packet, Setup, Tables} ->
codecs/audio/Vorbis; audio/flac/{Frame, Encode} -> codecs/audio/Flac; audio/mp3/{Core, Tables, Header, Encode2,
Encode3, EncTables, Analysis} -> codecs/audio/Mpa (tools/move.py; code unchanged). Each gets an index init.luau.
The format folders keep the file mapping: Ogg Opus / Ogg Vorbis (headers, granules, seeking, the Vorbis encoder's
Ogg writer), native / Ogg FLAC streams and metadata, ID3 / Xing / the MP3 frame index. docs: STYLE says a codec is
not the format. Full suite: 248 runs pass on both runtimes, lint green.
2026-10-31 12:47:02 -05:00
4DBug f5cf02026d ws-cleanup: MeshFlatten, Zip and the SVG style parser reuse Types.Scene.mul, Types.Date.civilFromDays, Raster.multiply 2026-10-31 12:31:32 -05:00
4DBug 44a599f00c ws-cleanup: codecs/compress/PackBits; UTF-16 and half floats from one place
- codecs/compress/PackBits (new, from image/tiff/Pixels): decode (lenient count + a clean flag for strict callers)
  and encode; image/tiff and layered/psd (which carried its own decoder) use it. tests/codecs/packbits.
- codecs/text/Text.utf16(buf, offset, length, bigEndian?): the UTF-16 -> UTF-8 conversion codecs/font/TrueType,
  archive/7z and layered/psd each wrote (lone surrogates -> U+FFFD everywhere now).
- image/tiff/Pixels and data/cbor use core/Bytes.half instead of their own float16 decoders.
2026-10-31 12:28:33 -05:00
4DBug 51b08575c4 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.
2026-10-31 12:25:03 -05:00
4DBug 763f4a7c04 ws-cleanup: shared plumbing: Err.from, core/Sniff, Pcm.drain, Bits.msbPut; DUP lint; tools/move.py
- core/Err.from(message, offset?, kind?): the private-submodule -> Err plumbing (a kind, or a 'code: ' prefix /
  'truncated' / 'past the end' in the message) that Brotli, Bzip2, Zstd, Jpeg, WOFF2, FBX, plist, msgpack and
  bmfont each wrote.
- core/Sniff (new): Sniff.text(r, n, trim?) (the start of a text file without its BOM), Sniff.dropBom(s),
  Sniff.magic(r, s); 13 text formats' sniff / decode BOM handling goes through it.
- codecs/Pcm.drain(dec, source?, maxFrames?): a format's decode() through its open(); the collect-the-Decoder
  loops of aac, aiff, au, caf, flac, m4a, mp3, opus, vorbis and wav are one call each.
- core/Bits.msbPut: the MSB-first bit writer the MP3 / MP2 / FLAC encoders each copied.
- tools/lint_rules.py DUP: a function body of 12+ code lines repeated token for token in another module fails.
- tools/move.py: moves a module and rewrites every reference (requires, deps, headers, fixture INPUTS, docs).
- tools/fixtures/zstd.py: the incompressible corpus is smaller (zstd.luau 15.1 -> 13.4 MB; every fixture module is
  now under 14.3 MB).
- tools/bench.luau: MPEG-1 also runs with the api's LuaJIT trace limits; the sections that compare tuned / default
  limits set them explicitly (jitTune), so the order of sections no longer leaks the tuning.
2026-10-31 12:00:59 -05:00
4DBug 3243404374 ws-cleanup: type diagnostics 1109 -> 94 unique; lint gate against tools/lint_types_baseline.txt
ws/cleanup-types (merged before) annotated Types, init, core, codecs, containers, ops, host and the formats;
this commit fixes the rest in the modules ws-cleanup added (AudioOps, Resample, Vorbis / FLAC / Opus encoders).
tools/lint.sh now counts unique diagnostics (the analyzer printed every required src module twice: master's
'2499' was 1109 unique) and fails when the count rises above tools/lint_types_baseline.txt (94);
LINT_TYPES_UPDATE=1 lowers it.
2026-10-31 11:30:29 -05:00
4DBug 8baa1f1388 ws-cleanup: compat math.clamp through math.min / math.max (LuaJIT)
The branchy compat clamp spawned side traces in hot loops: ~3.5x slower than min(max(x, lo), hi) in a
microbenchmark (NaN still passes through, as in Luau). MPEG-1 320x240 to rgba on LuaJIT (tuned traces):
2.92 -> 2.13 ms/frame.
2026-10-31 11:30:29 -05:00
4DBug 4478332a61 ws-cleanup: merge ws/cleanup-types (type annotations) 2026-10-31 11:27:42 -05:00
4DBug 6b26845afe ws-cleanup: merge master (ws/h264) 2026-10-31 11:12:11 -05:00
4DBug 45bb5f9b95 ws-cleanup: F.ops facade (image / mesh / layers / audio / vector.rasterize) and ops/AudioOps
- F.ops in init.luau, loaded on first use: F.ops.image (ImageOps), F.ops.mesh (MeshOps), F.ops.layers (LayerOps),
  F.ops.audio (new ops/AudioOps), F.ops.vector.rasterize (the vector/svg renderer for any Vector, through F.format).
- ops/AudioOps: toAudio / fromDecoder (Audio from a Decoder via codecs/Pcm), gain / gainDb / normalize, peak / rms,
  remix / downmix / upmix (WAVE-layout matrices, BS.775 coefficients normalised against clipping), resample
  (codecs/Resample), trim, concat and mix (inputs converted to the first one's rate and channels), fade.
- tests/ops/audioops (39 checks, both runtimes); docs/API.md (new): the F.* API, F.ops, hooks, host.
2026-10-31 11:06:04 -05:00
4DBug 8fc0f8a4d8 merge ws/h264 2026-10-31 11:04:09 -05:00
4DBug 06a756212b ws-h264: speed note in the codec header (bench numbers, LuaJIT trace limits) 2026-10-31 11:03:34 -05:00
4DBug ec0e826cee ws-cleanup: format headers say what is not supported (bz2, ass, srt) 2026-10-31 11:01:53 -05:00
4DBug c0eafd29a5 ws-cleanup: consistency (lower-case tags, WAVE channel order, loops = play count, Err messages, caps)
- Audio tags keys are lower case everywhere (Types.Tags): FLAC no longer returns TITLE / ARTIST (the raw fields stay
  in meta.source.comments; also for Vorbis and Opus); Vorbis / Opus / FLAC read and write tags through
  codecs/VorbisComment (TRACKNUMBER -> track, DISCNUMBER -> disc, DESCRIPTION -> comment); MP3 albumArtist ->
  albumartist and year -> date (ID3 TYER / TDRC, ID3v1); RIFF INFO / CAF / MP4 freeform names are lower-cased (MP4
  writes iTunSMPB / iTunNORM back in their usual spelling; m4a reads tags.itunsmpb).
- Channel order: Vorbis (and Opus mapping family 1) decode to WAVE order like FLAC / WAV / AAC (both used to return
  the Vorbis order); the Vorbis encoder takes WAVE order and writes Vorbis order. Pcm.WAVE_FROM_VORBIS / Pcm.reorder;
  Vorbis.packetDecoder gives pd.order. Tests reorder oggdec's / opusdec's raw (Vorbis-order) references.
- img.loops is the play count in GIF, APNG and WebP (they already agreed; Types / WebP docs said "loop count");
  tests/api round-trips loops 0 / 1 / 3 through all three.
- Err: messages without the format name (png / midi encoders said "png encode: ..."); codecs/Bzip2 and codecs/Zstd
  check arguments through Bytes.span.
- caps: mp3 encodeLayers = { 2, 3 }, opus encodeChannels = 2.
2026-10-31 11:01:22 -05:00
4DBug f459b2dcdf ws-cleanup-types: archive, audio, data, font, image, layered, music, playlist, subtitle, vector, video: annotations, casts, one value per re-assignment where the solver loses the type 2026-10-31 11:00:25 -05:00
4DBug dc98aec2ec ws-cleanup-types: Types.VectorPath: declare the optional svg fields (group, clip, id, dashes, joins, caps, miter limit) 2026-10-31 11:00:25 -05:00
4DBug 139441a37b ws-cleanup-types: image/pnm, model/*: type lookup tables, table.create results and literals; casts for known values 2026-10-31 10:59:11 -05:00
4DBug f784b4eb9b ws-cleanup: shared helpers instead of copies (CRCs, codec arguments, utf8char, keyLess / isArray)
A sweep for duplicated function bodies, CRC tables and base64 across src/Formats:
- core/Crc32.msb / MSB_TABLE: the MSB-first 0x04C11DB7 CRC-32 that containers/Ogg (Page + Mux), containers/MpegTs
  and codecs/Bzip2 each built (test vectors CRC-32/MPEG-2 and /BZIP2 in tests/core/bytes).
- audio/flac/Encode uses audio/flac/Frame's CRC-8 / CRC-16 tables (Frame.crc8 added) instead of its own copy.
- core/Bytes.toBuffer / Bytes.span: the (buffer | string, offset, length) argument checking codecs/Deflate,
  codecs/Lzma and codecs/Brotli each carried.
- codecs/Text.utf8char: one copy instead of four (codecs/Json, codecs/Xml, data/yaml, data/toml).
- Types.keyLess / Types.isArray (small additions to Types, backward compatible): data/msgpack, data/cbor and
  data/yaml/Emit had identical copies.
- playlist/pls: dead copies of m3u's attributes / extinf removed.
Left on purpose: per-codec bit readers / writers in hot loops (STYLE.md: inner loops keep their own bit buffers),
same-folder helpers (Alac signExtend, Vorbis ilog), Zip's DOS-date civil() (a different epoch helper).
2026-10-31 10:58:31 -05:00
4DBug 7c15b02354 ws-cleanup-types: codecs/Aac: type the built Config 2026-10-31 10:55:22 -05:00
4DBug 39dbde13b7 ws-cleanup-types: TrueType names, mp3 index, aac options, imageops test: annotations 2026-10-31 10:54:51 -05:00
4DBug 7271e6e3fa ws-h264: F.video.open end to end on MP4 / MKV / TS / AVI / raw H.264 (bit-exact vs ffmpeg), display-order pts from the sorted packet times; JVT conformance test (48 streams bit-exact vs JM yuv, 4 refused); video/mp4 writer: a video edit list plays every frame (the B-frame delay no longer cut 2 frames off the end); tests tune LuaJIT through host 2026-10-31 10:53:34 -05:00
4DBug 6a8a8abce2 ws-cleanup-types: codecs: type table.create results, string-keyed tables and multi-assigned locals 2026-10-31 10:52:04 -05:00
4DBug 7169f2cc2c ws-cleanup: codecs/Resample, codecs/RangeCoder; Opus / MP3 / MP2 encoders resample through it
- codecs/Resample (new): Kaiser-windowed sinc resampler, polyphase (exact phases when to / gcd <= 4096, else 4096
  interpolated phases), quality low / medium / high (8 / 16 / 32 zero crossings), streaming (new / process / flush),
  whole buffer (Resample.buffer) and a codecs/Pcm source wrapper (Resample.source). tests/codecs/resample: SNR
  87 dB (44.1 -> 48 kHz, medium) .. 108 dB (high), alias rejection, streamed = whole, identity.
- audio/opus/Encode: input through codecs/Pcm (Pcm.source + collect) and codecs/Resample instead of its private
  resampler and Decoder loop; tags through codecs/VorbisComment.
- audio/mp3 encode: rates the layer cannot hold are resampled to the next rate up (opts.sampleRate picks one,
  opts.resampleQuality); was Err.ARG "no resampling".
- codecs/RangeCoder/{Decoder,Encoder}: the RFC 6716 range coder moved out of audio/opus (same code, no speed change).
- audio/opus/Mdct stays private: routing CELT through codecs/Mdct measured 2-3x slower CELT decoding and different
  output bits (documented in its header).
- (this commit also carries the Opus side of the tags / channel order consistency: codecs/VorbisComment for OpusTags,
  meta.source.comments, mapping family 1 decoded to WAVE channel order with Pcm.reorder / Pcm.WAVE_FROM_VORBIS.)
2026-10-31 10:50:56 -05:00
4DBug 4f2ceec735 ws-cleanup: one base64 (core/Base64)
core/Base64 takes over codecs/Base64's API (encode(buf | string, { url, pad, wrap }, offset, length), decode of both
alphabets, decodeDataUri, dataUri) plus line wrapping (opts.wrap) for plist; codecs/Base64 is removed and glTF /
DAE require core/Base64. The private copies in data/plist (Base64.luau), data/yaml (Parse / Emit) and codecs/Brotli
(the static tables) are gone. tests/codecs/base64 merged into tests/core/base64.
2026-10-31 10:50:40 -05:00
4DBug cfe325dcf8 ws-cleanup-types: containers, ops: type the tables and locals the solver cannot infer 2026-10-31 10:46:15 -05:00
4DBug f209801579 ws-cleanup-types: Types, api, host: honest annotations; return the full annotated value count 2026-10-31 10:43:19 -05:00
4DBug 59a0352ca6 examples/love: LÖVE smoke test / example (LuaJIT build): fixtures + image / audio round trips through love.graphics / love.audio; FORMATS_SMOKE=1 xvfb-run love examples/love 2026-10-31 10:36:24 -05:00
4DBug 84101d919e ws-h264: merge master 2026-10-31 10:29:56 -05:00
4DBug d4486dccce ws-h264: merge ws/video; codecs/Video registers h264 (avc1/avc3/H264/... FourCCs, V_MPEG4/ISO/AVC) via H264.newVideoDecoder; video/h264 raw Annex B format (demux by access unit, copy-writer from MP4/MKV samples); MMCO 5 resets frame_num (JVT MR2/MR4/MR5); meta.yuv from the VUI 2026-10-31 10:29:56 -05:00
4DBug 52a34f50ed merge ws/video: resolve init.luau (openAudio + plugins hooks, cad and video facades) 2026-10-31 10:22:56 -05:00