Commit Graph
250 Commits
Author SHA1 Message Date
4DBug 20ecf65df8 merge ws/video2-theora (Theora codec, ogv) 2026-10-31 15:22:40 -05:00
4DBugandClaude Opus 5.5 fbbfa943e8 ws-video2-theora: Theora MC average without type diagnostics (lint TYPES back to the baseline)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 15:01:19 -05:00
4DBugandClaude Opus 5.5 ca7bd64f85 ws-video2: mpeg2 test: field pictures written in random pieces
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:54:03 -05:00
4DBugandClaude Opus 5.5 f70fa346a2 ws-video2: docs/guide/video.md MPEG-2 section (tested snippet, tsBytes clip), formats table; docs/video.md layers
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:53:04 -05:00
4DBugandClaude Opus 5.5 8216b80512 ws-video2: MpegEs Picture type annotation (type baseline)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:51:14 -05:00
4DBugandClaude Opus 5.5 9444e83f45 ws-video2: MPEG-2 field-picture / concealment-vector fixtures (a syntax-level writer in tools/fixtures/mpeg2.py), bit-exact; LuaJIT-friendlier hot paths; mpeg2 bench line
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:50:27 -05:00
4DBugandClaude Opus 5.5 6a8cbaa8c0 ws-video2-theora: Theora speed (fused prediction + IDCT add, inlined token decode, table-driven tokens), bench lines, guide section
tools/bench.luau: a ws-video2-theora block (320x240 testsrc2 / mandelbrot, decode and
decode + image()). docs/guide/video.md: an Ogg Theora section (tested snippet; inputs
from the new tools/fixtures/docs_theora.py) and the formats / writers tables.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:43:22 -05:00
4DBugandClaude Opus 5.5 f90fcbb029 ws-video2: MPEG-1 tests bit-exact against ffmpeg -idct int (308 of 312 frames; 4 with concealed macroblocks)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:30:45 -05:00
4DBugandClaude Opus 5.5 e0b1f5710d ws-video2: MPEG-2 in MPEG-TS (0x02 / private 0x80), MPEG-PS, MKV, AVI, MP4 caps; tests/video/mpeg2.luau
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:28:11 -05:00
4DBug 7a67812d31 merge master (ws/apifix) into ws/video2 2026-10-31 14:26:00 -05:00
4DBugandClaude Opus 5.5 c33ffa7343 ws-video2: codecs/video/Mpeg2 (MPEG-1/2 core, Main profile, 4:2:2, field pictures, dual prime), bit-exact with ffmpeg -idct int
Mpeg1 is now the Mpeg2 module under its old name (core, tables and VLCs moved to Mpeg2/). Dsp.mc takes separate
source / destination strides; Dsp.edge emulates edges. containers/MpegEs: field-picture pairs are one access unit
(pictureStructure). Registry: mpeg1 and mpeg2 decode through Mpeg2.newVideoDecoder; more MPEG-2 FourCCs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:25:51 -05:00
4DBug 2f34e7b607 merge ws/apifix 2026-10-31 14:24:12 -05:00
4DBugandClaude Opus 5.5 7dd4d54546 ws-video2-theora: video/ogv, Ogg video (Theora + Vorbis / Opus / FLAC)
Demuxes every logical stream of the first Ogg group into containers/Demux:
Theora (frame times from granules, Xiph-laced headers as track.config, comment
tags in meta.tags), Vorbis / Opus / FLAC audio (headers in track.config) for the
api's openAudio hook; open = Video.open. Sniff claims only Ogg files with a Theora
BOS page. encode remuxes Theora (+ Vorbis / Opus pages from AudioWrap, interleaved
by time). codecs/video/Theora gains info / comment helpers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:22:39 -05:00
4DBugandClaude Opus 5.5 e423858c8e ws-video2-theora: codecs/video/Theora, a Theora decoder (port of libtheora 1.2.0, BSD)
Headers (identification, comment via VorbisComment, setup: loop-filter limits,
quant ranges -> dequant tables, the 80 Huffman trees as collapsed lookup tables),
intra / inter frames, coded SB / block flags, MB modes (8 alphabets), MVs (VLC /
CLC, last / prior, 4MV with per-format chroma averages, half / quarter-pel),
block qi, DCT tokens with EOB runs, DC prediction, the spec IDCT, loop filter,
golden / previous refs, 4:2:0 / 4:2:2 / 4:4:4, picture-region crop, empty-packet
dupes. Bit-exact with ffmpeg on every frame of 12 fixtures (tests/codecs/theora).

Outside the folder: codecs/video/Video BUILTIN entry theora gets a decoder
(track.config = Xiph-laced headers, as Matroska's CodecPrivate);
licenses/libtheora-BSD.txt + NOTICE row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:16:35 -05:00
4DBugandClaude Opus 5.5 fb9fdc6618 ws-apifix: API.md / STYLE.md / README: music as audio, video as animated image, F.save extra files, variant(r), caps.extraFiles, F.music builder, bitrate in bit/s; type baseline 92
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:14:11 -05:00
4DBugandClaude Opus 5.5 a7d44451c4 ws-apifix: MP4 AAC length matches ffmpeg: the edit list's length (Track.playDuration) cuts the end padding as well as the priming (codecDelay); a 1 s clip decodes to 44100 frames, not 45056. AudioWrap.trim(dec, skip, length?); the MP4 writer keeps the edit length of copied audio. Video tests compare the whole decoded audio length with ffmpeg (not yet for Matroska)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:13:08 -05:00
4DBugandClaude Opus 5.5 51630729f6 ws-apifix: one bitrate unit: every encoder's bitrate option is bit/s (MP3 now too), values below 1000 are kbit/s (the old MP3 values keep working; Opus accepts them too); the MP3 Decoder's bitrate field is bit/s as the Decoder contract says (was kbit/s)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:06:51 -05:00
4DBugandClaude Opus 5.5 c4168d751f ws-apifix: type fixes (no new diagnostics)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:04:21 -05:00
4DBugandClaude Opus 5.5 2abada340b ws-apifix: an outline font saved as BMFont writes its pages (opts.files; without a destination F.save returns them as a third value { [page file] = PNG bytes }; caps.extraFiles); pages named after the destination
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:03:45 -05:00
4DBugandClaude Opus 5.5 4557a3c792 ws-apifix: videos save as animated images (F.save(video, gif | apng | webp), F.convert(avi, "gif"): frames / fps / maxFrames (300) / maxPixels (2^25)); VideoFrame.index restarts at the seek position; F.detect names WebM files "webm"
api: encoderFor finds image formats for a VideoDecoder, videoToImage() collects the frames; F.detect asks a
format's optional variant(r) for a more precise name (video/mkv: Mkv.variant, from Parse.docType).
codecs/video/Video: index after seek = round(pts * frameRate) + 1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 14:00:36 -05:00
4DBug 4767a63a50 ws-video2: Dsp header 2026-10-31 13:56:33 -05:00
4DBugandClaude Opus 5.5 d15fa26a43 ws-video2: codecs/video/Dsp (jrevdct IDCT bit-exact with ffmpeg -idct int, shared MC); Mpeg1 uses it
MPEG-1 decode is now bit-exact with ffmpeg -idct int (was ~0.6 MAE). ~5% slower on luau (1695 vs 1790 fps at 320x240).
The IJG jrevdct.c is IJG-licensed (ffmpeg LICENSE.md), credited in licenses/NOTICE.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:56:27 -05:00
4DBugandClaude Opus 5.5 4fb5c3a155 ws-apifix: music is audio (F.save / F.convert of a Module or Midi to an audio format renders it, render options from opts; F.audio.open / load render music bytes), F.music builder (ops/MusicOps: new, addPattern, setCell / getCell, addSample, addInstrument, note; also F.ops.music), MIDI writer writes track.name as a 0x03 event
api (init.luau): detectFor() falls back from audio to rendering music formats; encoderFor finds audio formats for
music values; renderMusic() through codecs/audio/Tracker or music/midi render.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:56:21 -05:00
4DBugandClaude Opus 5.5 90c5886f61 ws-apifix: F.ops.layers.flatten applies the mask of a passThrough group (codecs/image/Blend lerp takes a mask)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:50:05 -05:00
4DBug d3dbba500b merge ws/docs 2026-10-31 13:45:55 -05:00
4DBugandClaude Opus 5.5 b5d3d68dd3 ws-docs: examples/cad.luau: typed tables (no new type diagnostic)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:40:59 -05:00
4DBug 9ac7bf4278 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 e74aef06ee Merge branch 'ws/cleanup' into ws/docs 2026-10-31 13:25:13 -05:00
4DBugandClaude Opus 5.5 fd9684b903 ws-docs: guide pages cad, font, layered, music, playlist, subtitles, tilemap, video; runnable examples per category; README converting note
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:25:10 -05:00
4DBugandClaude Opus 5.5 790060d804 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.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:19:43 -05:00
4DBugandClaude Opus 5.5 66cf0c4a6b ws-docs: recipes: MIDI render, glTF to OBJ, vox greedy mesh, zip, CSV, SVG to PNG, TTF bake to BMFont, drawing text
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:18:01 -05:00
4DBugandClaude Opus 5.5 25782c9bfd ws-docs: guide pages archive, audio, data, image, scene, vector; recipes (first part); docs input generators
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:16:12 -05:00
4DBugandClaude Opus 5.5 08886d7052 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
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:09:04 -05:00
4DBugandClaude Opus 5.5 0a938830f3 ws-docs: tools/docs_check.py (guide snippets and examples become tests under both runtimes), docs inputs generator
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 13:05:43 -05:00
4DBugandClaude Opus 5.5 c4f6e2ca1c 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.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 12:47:02 -05:00
4DBugandClaude Opus 5.5 24c9ab27a3 ws-cleanup: MeshFlatten, Zip and the SVG style parser reuse Types.Scene.mul, Types.Date.civilFromDays, Raster.multiply
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 12:31:32 -05:00
4DBugandClaude Opus 5.5 9bcf061338 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.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 12:28:33 -05:00
4DBugandClaude Opus 5.5 434a304315 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]>
2026-10-31 12:25:03 -05:00
4DBugandClaude Opus 5.5 9c553b9d1a 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.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 12:00:59 -05:00
4DBugandClaude Opus 5.5 dca1130324 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.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 11:30:29 -05:00
4DBugandClaude Opus 5.5 b77660343a 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.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 11:30:29 -05:00
4DBug 5d7c223ab8 ws-cleanup: merge ws/cleanup-types (type annotations) 2026-10-31 11:27:42 -05:00
4DBug 5d12006666 ws-cleanup: merge master (ws/h264) 2026-10-31 11:12:11 -05:00
4DBugandClaude Opus 5.5 086b0a7ffd 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.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 11:06:04 -05:00
4DBug c8bc9f8fd9 merge ws/h264 2026-10-31 11:04:09 -05:00
4DBugandClaude Opus 5.5 9275838a62 ws-h264: speed note in the codec header (bench numbers, LuaJIT trace limits)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 11:03:34 -05:00
4DBugandClaude Opus 5.5 de2d615ec1 ws-cleanup: format headers say what is not supported (bz2, ass, srt)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 11:01:53 -05:00
4DBugandClaude Opus 5.5 fb2dd98db2 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.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 11:01:22 -05:00
4DBugandClaude Opus 5.5 9af7138b2e 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
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 11:00:25 -05:00
4DBugandClaude Opus 5.5 b0d0a99fec ws-cleanup-types: Types.VectorPath: declare the optional svg fields (group, clip, id, dashes, joins, caps, miter limit)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 11:00:25 -05:00