Commit Graph
183 Commits
Author SHA1 Message Date
4DBug f6188764b8 ws-audio2: merge ws/audio2-lossless (WavPack, Monkey's Audio, TTA, ApeTag)
codecs/audio/Stream: both branches extended pull(): buffer pcm (adpcm) and scale / ints (lossless); combined.
2026-10-31 15:18:31 -05:00
4DBug 703af4cc71 ws-audio2: merge ws/audio2-adpcm (codecs/audio/Adpcm, Qoa; adx, vag, brstm/bcstm/bfstm, raw adpcm, qoa; wav/aiff/caf/xm ADPCM) 2026-10-31 15:10:09 -05:00
4DBug 085e385674 ws-audio2: TTA: codecs/audio/Tta (written from the TTA1 format description; no libtta / ffmpeg code) + audio/tta
TTA1 format 1, 8/16/24 bits, any channel count, header / seek table / frame CRC-32s, seeking, ID3v2 skipped, APEv2
tags; password-protected files -> UNSUPPORTED. 20 fixtures (ttaenc 3.4.1, the FATE inside.tta sample) bit-exact
against ttaenc -d. Branch-free filter steps (LuaJIT: no register-coalescing aborts, 7 -> 40 MB/s).
WavPack: the unary / gamma counts a byte at a time (LuaJIT traces). APE: the predictor rotations as single
assignments. docs/guide/audio.md: the lossless section (+ tools/fixtures/docs_lossless.py inputs) and the Formats
table.
2026-10-31 15:08:47 -05:00
4DBug 39da2f6648 ws-audio2: merge ws/audio2-lossy (Musepack SV7/SV8, AC-3, AudioWrap AC-3 hook) 2026-10-31 14:57:05 -05:00
4DBug 62aded60c0 ws-audio2: audio/ac3 sniffs E-AC-3 too (loading one says UNSUPPORTED, not an unknown format); fixture tidy 2026-10-31 14:52:41 -05:00
4DBug ae8ff9d6bf ws-audio2: Monkey's Audio: codecs/audio/Ape (port of the MAC SDK 13.28 decoder, BSD-3) + audio/ape
File versions 3.95+ (3.99+ verified; the 3.95-3.98 range-coder model is ported without a reference fixture), every
level (fast .. insane), 8/16/24/32-bit int and 32-bit float, 1-32 channels, special frames, frame CRCs, seeking,
APEv2 tags, ID3v2 in front. 35 fixtures (mac 13.28, the FATE luckynight sample) bit-exact against mac -d.
tests/audio/_lossless.luau: the per-fixture checks shared by the lossless format tests. tools/bench.luau: the
ws-audio2 lossless block.
2026-10-31 14:52:08 -05:00
4DBug 2d99b9924a ws-audio2: Musepack / AC-3 bench lines, docs/guide/audio.md section (+ tools/fixtures/docs_lossy.py inputs), AVI AC-3 track test 2026-10-31 14:48:22 -05:00
4DBug 41b72d9b8a ws-audio2: audio/ac3 + codecs/audio/Ac3: AC-3 decoding from ATSC A/52, AC-3 tracks of MKV / MP4 / TS / AVI
Written from the A/52:2018 specification (tables transcribed from it; no liba52 / ffmpeg code): every acmod with LFE,
coupling + phase flags, rematrixing, block switching, delta bit allocation, dither, CRC check, dynamic range off by
default (drc = 0 .. 1). E-AC-3 and bsid 9 / 10 are UNSUPPORTED. 101.8 - 108.6 dB SNR vs ffmpeg's float decode
(liba52's for block-switched streams: the packaged ffmpeg mis-decodes the first short transform).

Outside the folders: containers/AudioWrap passes ac3 tracks to audio/ac3 (one branch); a comment in
src/Formats/init.luau mentions it. The fixture clears the encoders' dithflags (positions from the new
Ac3 decoder field dec.blocks) so reference and decoder decode the same numbers.
2026-10-31 14:45:23 -05:00
4DBug d2c470013d ws-audio2: bench lines for AHX / HVL render; type fixes (no new diagnostics); Types.Module format comment lists ahx / hvl
Types.luau: comment only.
2026-10-31 14:42:03 -05:00
4DBug 5216cb29a1 ws-audio2: bench lines (IMA / DSP decode, QOA encode / decode) and the guide's game audio section 2026-10-31 14:41:11 -05:00
4DBug 9466c5f471 ws-audio2: music/xm decodes ModPlug ADPCM samples (were silence), through codecs/audio/Adpcm.modplug
Fixture: tools/fixtures/_tracker.py write_xm gains an optional per-sample "adpcm" payload (two lines, shared with
the tracker generators, backward compatible); a new xm case renders the same as openmpt123.
2026-10-31 14:37:23 -05:00
4DBug 2717292366 ws-audio2: AIFF-C and CAF ima4 (Apple IMA ADPCM) decode through codecs/audio/Adpcm
aiff: COMM counts ima4 packets; caf: ima4 through Adpcm/Decoder.blocks (exact seeking), and a constant-size
packet stream whose pakt lists no packets now uses bytesPerPacket (was 0 frames). Bit-exact with ffmpeg.
2026-10-31 14:34:28 -05:00
4DBug d3ea84bb57 ws-audio2: api renderMusic uses a Module's own render method for non-tracker engines (AHX / HVL); docs/guide/music.md: AHX / HVL and MIDI variants section, Formats rows (docs inputs: tools/fixtures/docs_chip.py)
src/Formats/init.luau: renderMusic: a kind "music" value whose format is not mod/s3m/xm/it and that has a render
method renders through it (a failed render's .err becomes the error). Backward compatible.
2026-10-31 14:32:05 -05:00
4DBug 71bb89763e merge master (ws/apifix) into ws/audio2-chip 2026-10-31 14:28:00 -05:00
4DBug a3e234cc0d ws-audio2: MUS, XMI, HMP / HMI (music/mus, music/xmi, music/hmp) -> Types.Midi through codecs/audio/MidiRender (merge, tempoBytes); event streams match wildmidi -x 2026-10-31 14:27:51 -05:00
4DBug 66c3819063 merge master (ws/apifix) 2026-10-31 14:26:53 -05:00
4DBug 5e64334e85 Merge branch 'master' into ws/audio2-adpcm 2026-10-31 14:26:41 -05:00
4DBug f765763537 ws-audio2: codecs/audio/Qoa and audio/qoa (QOA read / write, port of qoa.h, MIT)
Decode bit-exact with ffmpeg and qoa.h; encode byte-for-byte qoa.h's qoa_encode (fixtures compile the committed
qoa.h reference with nix gcc).
2026-10-31 14:26:33 -05:00
4DBug f6349219d8 Merge branch 'master' into ws/audio2-lossy 2026-10-31 14:26:22 -05:00
4DBug 5dfaaf7524 ws-audio2: audio/brstm (BRSTM / BCSTM / BFSTM read: DSP ADPCM, PCM16, PCM8, loops)
Bit-exact with vgmstream; forward seeks start from the ADPC / SEEK history. codecs/audio/Adpcm/Decoder.interleaved
also lays out block-interleaved PCM (s16be / s16le / s8); snapshots take precedence over a format's history table.
2026-10-31 14:22:46 -05:00
4DBug 967b91db91 ws-audio2: WavPack: codecs/audio/WavPack (port of WavPack 5.9.0's decoder, BSD) + audio/wavpack
Lossless and hybrid (lossy, and lossless with the .wvc via opts.correction / opts.resolve), 8-32 bit int (int32 modes,
wvx) and 32-bit float, 1-8+ channels, every decorrelation pass, joint stereo, cross decorrelation, noise shaping,
block CRCs; APEv2 tags; sample-accurate seeking. 58 fixtures (wavpack -f..-hhx6, ffmpeg) bit-exact against wvunpack.

codecs/audio/Stream (shared, backward compatible): Stream.packets takes optional spec.scale (read() writes pcm values
times scale) and spec.ints (adds dec:readInt for bit-exact integer reads).
2026-10-31 14:19:23 -05:00
4DBug fd9175883d ws-audio2: audio/adx (CRI ADX read / write, loops) and audio/vag (VAGp / VAGi / KVAG read, VAGp / VAGi write)
Bit-exact with vgmstream (ADX, PS-ADPCM) and ffmpeg (KVAG IMA); ADX and PS-ADPCM encoders in codecs/audio/Adpcm.
2026-10-31 14:17:57 -05:00
4DBug 22615b503e ws-audio2: audio/mpc + codecs/audio/Musepack: Musepack SV7 / SV8 decoding (libmpcdec r475 port, BSD)
Gapless (synthesis delay, SV8 leading silence, SV7 last frame length), seeking (SV8 by packet with one packet of
pre-roll: exact; SV7 by frame with 32 frames of pre-roll like libmpcdec), APEv2 tags via codecs/audio/ApeTag (merged
from ws/audio2-lossless), ID3v2 skipped. Fixtures build mpcenc / mppenc / a float libmpcdec dumper from the pinned
upstream tarballs through nix; 132-140 dB SNR vs libmpcdec float, 82.7 dB vs ffmpeg's s16 decode.
2026-10-31 14:14:29 -05:00
4DBug 5bbb4227c2 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 2026-10-31 14:14:11 -05:00
4DBug 363b14932f ws-audio2: codecs/audio/Adpcm (IMA / ima4 / IMA WAV / MS / ADX / PS-ADPCM / DSP decode, IMA + MS encode, Decoder layouts) and audio/adpcm (raw streams)
- codecs/audio/Adpcm: decoder kernels bit-exact with ffmpeg (IMA, ima4, MS) and vgmstream (ADX, PS-ADPCM, DSP);
  IMA nibble / IMA WAV / MS block encoders. Adpcm/Decoder: streaming Decoders over the shared layouts (channel
  interleaved frames, nibble streams, self-contained blocks) with exact seeking through state snapshots.
- audio/wav: its IMA / MS block decoders moved to codecs/audio/Adpcm (wav tests unchanged and green).
- codecs/audio/Stream (shared, small and backward compatible): pcm() may return a buffer of f32 (copied with
  buffer.copy) instead of a table.
- audio/adpcm: headerless ima / ima_wav / ms / ima_qt / psx streams by options; encode ima / ima_wav / ms.
- licenses: vgmstream (ISC).
2026-10-31 14:10:23 -05:00
4DBug 848e4bfff6 ws-audio2: AHX and HVL (music/ahx, music/hvl) over codecs/audio/Hively, a port of hvl2wav's replay.c (BSD-3): bit-exact vs hvl2wav 2026-10-31 14:09:29 -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 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 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 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 6b26845afe ws-cleanup: merge master (ws/h264) 2026-10-31 11:12:11 -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 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 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 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 2eaed46eea merge ws/video: containers mkv/avi/mp4/ts/ps/y4m (+writers), codecs Jpeg/Mpeg1/Vp8 inter/Video registry, AudioWrap, F.video.open 2026-10-31 10:22:17 -05:00
4DBug f00b838205 ws-video: bench.luau merge fix 2026-10-31 10:11:34 -05:00
4DBug 51eec67789 ws-video: merge ws/video-vp8 (final); F.open wraps images as videos only for category video (F.video.open); F.video.fromFrames for image sequences 2026-10-31 10:11:01 -05:00
4DBug 0c7b316998 ws-video-vp8: bench lines (VP8 decode fps 320x240 / 640x480, LuaJIT also with the host's trace limits), damaged inter frame pass in the test, type fix 2026-10-31 10:08:08 -05:00
4DBug 6fcf717214 ws-h264: tests (bit-exact vs ffmpeg, AVCC, NAL-at-a-time, unsupported, fuzz), bench lines; LuaJIT speedups (no table-allocating if-expressions, arithmetic bit reads, branch-free CABAC decisions, split MC filters) 2026-10-31 10:07:39 -05:00
4DBug b0b47007dc ws-video: merge ws/video-vp8 (VP8 inter frames) 2026-10-31 10:05:56 -05:00
4DBug 3dd0b59784 ws-video: bench block (whole pipeline fps for MJPEG AVI / MPEG-1 TS / VP8 WebM / Y4M at 320x240 and 640x480, y4m -> MJPEG AVI), docs/video.md (API, layers, how a codec plugs into the registry), NOTICE row for mpegts-luau 2026-10-31 10:05:09 -05:00
4DBug f2a4a33713 ws-video: video/mp4 (MP4 / MOV / 3GP on containers/IsoBmff: edit lists, fragments, dOps -> OpusHead, PCM entries, AAC priming as codec delay; writer: copied H.264 / HEVC / AV1 / MJPEG / AAC / ALAC / Opus / FLAC / MP3, MJPEG from frames, PCM in MOV, edit lists for B-frame / codec delays); IsoBmff Mux writes no empty DecoderSpecificInfo (ffmpeg refuses it); writer checks extended to MP4 / MOV / H.264 remux 2026-10-31 10:02:25 -05:00
4DBug 8d2deb13ab ws-video: writers checked by ffprobe / ffmpeg (tools/fixtures/videoenc.py + _video_encode.luau, tests/video/encode.luau); constant-rate output for AVI / Y4M shared in Source.constantRate (uneven GIF delays repeat frames) 2026-10-31 09:59:16 -05:00
4DBug bd06545e2e ws-video: MJPEG (codecs/Jpeg, yuv420p full range; encoder remaps limited-range frames) and MPEG-1 (codecs/Mpeg1, display reordering with the packet pts as tag) in the codec registry; VideoFrame times count from the demuxer's startTime (TS starts at 1.4 s); Matroska Vorbis keeps its codec delay; fixtures decode with -fps_mode passthrough 2026-10-31 09:57:26 -05:00
4DBug 17c00a15df merge ws/3d2 2026-10-31 09:55:41 -05:00
4DBug e53ad35620 ws-h264: codecs/H264 decoder (CAVLC + CABAC, I/P/B, 8x8, weighted, direct, deblock, DPB/POC/reorder); fixtures from libx264 vs ffmpeg 2026-10-31 09:53:41 -05:00