diff --git a/README.md b/README.md index 91c3499..24a8524 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# formats-luau +# rosetta Read, write and convert file formats in pure Luau, from one source tree that runs on **Roblox** (Luau, native code generation) and on **LuaJIT / LÖVE** (through `tools/build.py`). Every format of a category maps onto one standard type -(`src/Formats/Types.luau`): a PNG and a WebP both load as an `Image`, every audio format opens as the same streaming +(`src/Rosetta/Types.luau`): a PNG and a WebP both load as an `Image`, every audio format opens as the same streaming `Decoder`, every model format loads as a `Scene`. 174 formats: images (25), audio (21), video (11), 3D models (32), CAD (1), fonts (11), archives (31), data (11), @@ -12,7 +12,7 @@ vector graphics and tile maps (2), layered images (3), subtitles (3), music (20) walkthroughs. `tools/lint.sh` checks these counts against the registry. ```luau -local F = require(Formats) -- LuaJIT: require("formats"); luau CLI: require("@formats") +local F = require(Rosetta) -- LuaJIT: require("rosetta"); luau CLI: require("@rosetta") local img, err = F.load(src) -- src: buffer | string | path (hosts with files) if not img then print(tostring(err)) end -- errors are values: "png: CORRUPT at 0x21: bad filter type 7" local buf = F.save(img, nil, { format = "webp" }) -- a buffer; F.save(img, "out.webp") writes a file @@ -24,20 +24,20 @@ Nothing throws on bad data or bad arguments: every call returns `nil, err` (`err ## Install -**Roblox (Rojo).** `python3 -I tools/build.py roblox` writes `build/roblox/Formats` (requires turned into instance -paths); `default.project.json` mounts it, so `rojo build -o Formats.rbxm` (or `rojo serve`) gives a `Formats` -ModuleScript to put in ReplicatedStorage: `local F = require(game.ReplicatedStorage.Formats)`. There is no file system: +**Roblox (Rojo).** `python3 -I tools/build.py roblox` writes `build/roblox/Rosetta` (requires turned into instance +paths); `default.project.json` mounts it, so `rojo build -o Rosetta.rbxm` (or `rojo serve`) gives a `Rosetta` +ModuleScript to put in ReplicatedStorage: `local F = require(game.ReplicatedStorage.Rosetta)`. There is no file system: pass buffers or strings. `F.host.toEditableImage(img)` makes an EditableImage, `F.host.toEditableMesh(prim, page)` an EditableMesh (a merged triangle primitive split by `F.host.meshPages`). -**LuaJIT / LÖVE.** `python3 -I tools/build.py luajit` writes `build/luajit/formats/` (Lua 5.1 + LuaJIT FFI; the Luau -standard library pieces come from `formats/_compat.lua`). Copy the `formats` folder into the game (or put -`build/luajit/?.lua;build/luajit/?/init.lua` on `package.path`) and `local F = require("formats")`. Files load by path +**LuaJIT / LÖVE.** `python3 -I tools/build.py luajit` writes `build/luajit/rosetta/` (Lua 5.1 + LuaJIT FFI; the Luau +standard library pieces come from `rosetta/_compat.lua`). Copy the `rosetta` folder into the game (or put +`build/luajit/?.lua;build/luajit/?/init.lua` on `package.path`) and `local F = require("rosetta")`. Files load by path (`love.filesystem` under LÖVE, else `io.open`); `F.host.toImageData(img)`, `F.host.fromImageData(imageData)` and `F.host.toSoundData(audioOrDecoder)` bridge to LÖVE. `examples/love` is a runnable example and smoke test (`love examples/love` from the repo root after building). -**luau CLI.** `luau` with the `.luaurc` alias `@formats` runs `src/` directly (no file system). +**luau CLI.** `luau` with the `.luaurc` alias `@rosetta` runs `src/` directly (no file system). ## Quick start @@ -98,13 +98,13 @@ hands to formats (decodeImage / encodeImage / openAudio / plugins): [docs/API.md (OBJ `.mtl`, glTF `.bin` and textures) are found through `opts.resolve`, which the api fills in for paths. - **LuaJIT trace tuning.** On load the host raises LuaJIT's trace limits (`jit.opt.start("maxtrace=8000", "maxmcode=65536")`): the big decoders (Opus CELT, VP8, H.264, MPEG-1) outgrow the defaults and fall back to the - interpreter (2x or more slower). Set `_G.FORMATS_NO_JIT_TUNE = true` before requiring the library to leave the + interpreter (2x or more slower). Set `_G.ROSETTA_NO_JIT_TUNE = true` before requiring the library to leave the JIT settings alone. ## Layout ``` -src/Formats/ +src/Rosetta/ init.luau Registry.luau (generated) api: F.* ops/ editing on the standard types (ImageOps, MeshOps, LayerOps, AudioOps, ...) // formats: only what is specific to the format (parsing, mapping, writing) @@ -139,7 +139,7 @@ bash tools/test.sh png # one test (both runtimes), no lint bash tools/lint.sh # globals, types, headers, requires, native-throw, layers, deps, contract, DUP, docs bash tools/bench.sh # throughput on both runtimes (pin it: taskset -c 2 bash tools/bench.sh) python3 -I tools/build.py # build/roblox + build/luajit -python3 -I tools/gen_registry.py # src/Formats/Registry.luau + docs/FORMATS.md from the format folders +python3 -I tools/gen_registry.py # src/Rosetta/Registry.luau + docs/FORMATS.md from the format folders python3 -I tools/fixtures.py # tests/gen/*.luau from tools/fixtures/*.py (reference tools through nix) python3 -I tools/move.py codecs/image/Foo=codecs/video/Foo # move a module, rewriting every reference ``` diff --git a/docs/API.md b/docs/API.md index 15bccbb..a3ab44d 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1,7 +1,7 @@ -# formats-luau API +# rosetta API -`local F = require(Formats)` (Roblox: the ModuleScript; LuaJIT / LÖVE: `require("formats")`; luau CLI: -`require("@formats")`). Everything below is `src/Formats/init.luau` unless noted. Nothing throws on bad data or bad +`local F = require(Rosetta)` (Roblox: the ModuleScript; LuaJIT / LÖVE: `require("rosetta")`; luau CLI: +`require("@rosetta")`). Everything below is `src/Rosetta/init.luau` unless noted. Nothing throws on bad data or bad arguments: a failing call returns `nil, err` where `err` is a `core/Err` value (`err.code`, `err.message`, `err.offset`, `err.format`; `tostring(err)` prints `png: CORRUPT at 0x21: bad filter type 7`). @@ -97,7 +97,7 @@ A format never requires another format, so the api passes these to decoders / en ## Host -`F.host` (`src/Formats/host`): `name` (`"roblox"`, `"love"`, `"luajit"`, `"luau"`), `hasFiles`, `readFile`, +`F.host` (`src/Rosetta/host`): `name` (`"roblox"`, `"love"`, `"luajit"`, `"luau"`), `hasFiles`, `readFile`, `writeFile`, `exists`; Roblox `toEditableImage(img)`, `meshPages(prim, opts?)`, `pageData(prim, page, opts?)`, `toEditableMesh(prim, page?, opts?)` (a triangle primitive in pages of at most 20k triangles / 60k vertices, each an EditableMesh; see the Hosts section of the guide); LÖVE `toImageData(img)`, `fromImageData(imageData)`, @@ -105,7 +105,7 @@ EditableMesh; see the Hosts section of the guide); LÖVE `toImageData(img)`, `fr On LuaJIT the host raises the trace limits at load (`jit.opt.start("maxtrace=8000", "maxmcode=65536")`): the big decoders (CELT, VP8, H.264, MPEG-1) outgrow the defaults and fall back to the interpreter. Set -`_G.FORMATS_NO_JIT_TUNE = true` before requiring the library to leave the JIT settings alone. +`_G.ROSETTA_NO_JIT_TUNE = true` before requiring the library to leave the JIT settings alone. ## Also exported diff --git a/docs/FORMATS.md b/docs/FORMATS.md index 3cc3fe4..28c79e5 100644 --- a/docs/FORMATS.md +++ b/docs/FORMATS.md @@ -185,7 +185,7 @@ Codecs (layer 3, shared by formats; not loadable on their own), by domain: - **audio** - codecs/audio/Aac: AAC-LC decoder (ISO/IEC 14496-3 subpart 4, ISO/IEC 13818-7): the AudioSpecificConfig (with a program - codecs/audio/Ac3: AC-3 (Dolby Digital, ATSC A/52) syncframes: the syncinfo / BSI header, the CRC check, and the - - codecs/audio/Adpcm: the 4-bit ADPCM family, decode (and encode where it is cheap). New in formats-luau; the IMA and + - codecs/audio/Adpcm: the 4-bit ADPCM family, decode (and encode where it is cheap). New in rosetta; the IMA and - codecs/audio/Alac: Apple Lossless (ALAC) decoder and encoder, the codec inside m4a / mov / caf. A codec (layer 1). - codecs/audio/Ape: the Monkey's Audio codec (.ape). A codec (layer 3). Ported from the Monkey's Audio SDK 13.28 - codecs/audio/ApeTag: APEv1 / APEv2 tags (the tag block of Monkey's Audio, WavPack, Musepack, TTA, OptimFROG and @@ -268,4 +268,4 @@ Codecs (layer 3, shared by formats; not loadable on their own), by domain: - codecs/video/Mpeg1: the MPEG-1 video decoder (ISO/IEC 11172-2), which is codecs/video/Mpeg2 (an MPEG-2 decoder - codecs/video/Mpeg2: an MPEG-1 / MPEG-2 video decoder (ISO/IEC 11172-2, ISO/IEC 13818-2 Main profile). - codecs/video/Theora: a Theora video decoder (the Theora I specification, Xiph.Org), for Ogg (video/ogv) and Matroska - - codecs/video/Video: the video codec registry and the generic VideoDecoder. New in formats-luau. + - codecs/video/Video: the video codec registry and the generic VideoDecoder. New in rosetta. diff --git a/docs/STYLE.md b/docs/STYLE.md index e171387..437190f 100644 --- a/docs/STYLE.md +++ b/docs/STYLE.md @@ -1,4 +1,4 @@ -# formats-luau style guide +# rosetta style guide Every format looks the same: one folder, one contract, one test, one fixture generator, and the folder holds only what is specific to the format (section 2a). `bash tools/lint.sh` enforces most of what follows (the rule names in @@ -8,16 +8,16 @@ The reference implementation to copy is **PNG**: | What | Copy from | |---|---| -| Format contract (`init.luau`) | `src/Formats/image/png/init.luau` | -| Private hot submodules (`--!native`) | `src/Formats/image/png/Decode.luau`, `src/Formats/image/png/Encode.luau` | +| Format contract (`init.luau`) | `src/Rosetta/image/png/init.luau` | +| Private hot submodules (`--!native`) | `src/Rosetta/image/png/Decode.luau`, `src/Rosetta/image/png/Encode.luau` | | Test | `tests/image/png.luau` | | Fixture generator | `tools/fixtures/png.py` (a reference tool through nix: `tools/fixtures/_png_reference.py`) | -| A codec (layer 3) | `src/Formats/codecs/compress/Deflate/` + `tests/codecs/deflate.luau` + `tools/fixtures/deflate.py` | +| A codec (layer 3) | `src/Rosetta/codecs/compress/Deflate/` + `tests/codecs/deflate.luau` + `tools/fixtures/deflate.py` | ## 1. Layout and layers ``` -src/Formats/ +src/Rosetta/ init.luau Registry.luau (generated) api (layer 6) ops/ ops (layer 5.5) editing on the standard types (F.ops.image / mesh / layers / audio / music; ImageOps, ...) @@ -49,9 +49,9 @@ Nothing but the api requires `host/`: formats are pure functions of bytes. A cod (`codecs//`); `containers/` and `core/` are flat. Moving a module: `python3 -I tools/move.py old/Path=new/Path` rewrites every reference (requires, deps, headers, docs). -REQUIRE: every require is a string literal `require("@formats/")` (tests and tools may also use +REQUIRE: every require is a string literal `require("@rosetta/")` (tests and tools may also use `require("@tests/")`). No `script.X`, no `@self`, no relative paths, no computed requires: `tools/build.py` turns -these literals into Roblox instance paths and `require("formats.x.y")` for LuaJIT. `@formats/image/png` is the folder's +these literals into Roblox instance paths and `require("rosetta.x.y")` for LuaJIT. `@rosetta/image/png` is the folder's `init.luau`. DEPS: a format's `deps = { ... }` lists exactly the modules outside its folder that the folder requires. @@ -60,8 +60,8 @@ DEPS: a format's `deps = { ... }` lists exactly the modules outside its folder t ### Files ``` -src/Formats///init.luau the contract (interpreted: never --!native) -src/Formats///.luau hot code, --!native allowed (Decode, Encode, Huffman tables, ...) +src/Rosetta///init.luau the contract (interpreted: never --!native) +src/Rosetta///.luau hot code, --!native allowed (Decode, Encode, Huffman tables, ...) tests//.luau the test (both runtimes) tools/fixtures/.py fixture generator (reference tools via nix) -> tests/gen/_*.luau ``` @@ -73,7 +73,7 @@ tools/fixtures/.py fixture generator (reference tools v --!optimize 2 -- optional -- image/png/Decode: . . . ``` -The first comment line starts with the module path (`core/Bytes:`, `image/png:`, `image/png/Decode:`; `Formats:` for +The first comment line starts with the module path (`core/Bytes:`, `image/png:`, `image/png/Decode:`; `Rosetta:` for the root). A format's `init.luau` header says what is supported and what is not, and where it came from (spec, port, absorbed repo). @@ -86,10 +86,10 @@ contract are mandatory, the rest as needed): ### The contract ```luau -- ------------------------------------------------------------------------------------------------ requires -local Err = require("@formats/core/Err") -local Bytes = require("@formats/core/Bytes") -local Types = require("@formats/Types") -local Decode = require("@formats/image/qoi/Decode") +local Err = require("@rosetta/core/Err") +local Bytes = require("@rosetta/core/Bytes") +local Types = require("@rosetta/Types") +local Decode = require("@rosetta/image/qoi/Decode") -- ------------------------------------------------------------------------------------------------ contract local Qoi = { @@ -236,9 +236,9 @@ copying. ```luau -- image/qoi tests: . Fixtures: tools/fixtures/qoi.py. local T = require("@tests/T") -local Qoi = require("@formats/image/qoi") -local Bytes = require("@formats/core/Bytes") -local Crc32 = require("@formats/core/Crc32") +local Qoi = require("@rosetta/image/qoi") +local Bytes = require("@rosetta/core/Bytes") +local Crc32 = require("@rosetta/core/Crc32") local Fx = require("@tests/gen/qoi") -- written by tools/fixtures/qoi.py local t = T.suite("qoi") @@ -272,13 +272,13 @@ t:done() ## 4. Adding a format -1. `src/Formats///init.luau` from the template above (copy `image/png/init.luau`), private submodules +1. `src/Rosetta///init.luau` from the template above (copy `image/png/init.luau`), private submodules next to it. Use `core/Bytes` for parsing, `core/Bits` / `codecs/entropy/Huffman` for entropy coding, the shared modules of section 2a for everything generic, `Types` constructors for the result. 2. Shared code (a codec two formats need, a container) goes to `codecs//` or `containers/` instead, with its own test in `tests/codecs/` / `tests/containers/`. 3. `deps = { ... }` = the requires outside the folder. -4. `python3 -I tools/gen_registry.py` (regenerates `src/Formats/Registry.luau` and `docs/FORMATS.md`; never edit those +4. `python3 -I tools/gen_registry.py` (regenerates `src/Rosetta/Registry.luau` and `docs/FORMATS.md`; never edit those by hand; after a merge, just rerun it). 5. `tools/fixtures/.py` + `tests//.luau`. 6. `bash tools/test.sh ` while working (both runtimes), then `bash tools/test.sh` (everything + lint). @@ -296,7 +296,7 @@ making them (a missing `Bytes` method, a new `Types` field, a `Err` code). 2. Provenance: the module header says `Absorbed from ()` and what changed. 3. Licence: copy the repo's licence / NOTICE into `licenses/` (`licenses/-LICENSE.txt`) and add a line to `licenses/NOTICE.md`. Third-party ports keep their upstream licence text there too. -4. Requires: `if script then require(script.X) else require("@self/X")` becomes `require("@formats///X")`; +4. Requires: `if script then require(script.X) else require("@self/X")` becomes `require("@rosetta///X")`; injected dependencies (`require(Png)(Deflate)`) become direct requires of the codec. 5. Checksums / bit readers / Huffman tables the repo carries are replaced by `core/` ones when equivalent. 6. Wrap the public API in the contract: `sniff`, `decode(r: Reader, opts)` (reading from `r.buf` between `r.base` and @@ -317,7 +317,7 @@ cover what it cannot: `elseif` to `else if` before darklua. - **If-expression tables**: darklua lowers `if c then x else y` to `(c and {x} or {y})[1]` unless `x` is a literal. build.py turns it back into `(c and (x) or (y))` when `x` is provably not nil/false (numbers, strings, arithmetic). -- **Requires** become `require("formats.a.b")`; **stdlib names** come from `formats._compat` through locals injected on +- **Requires** become `require("rosetta.a.b")`; **stdlib names** come from `rosetta._compat` through locals injected on the first line of each module (only the ones used: LuaJIT allows 60 upvalues per function). - `string.format("%s", x)` with interpolation and `tostring` of floats print differently on LuaJIT (14 significant digits); never compare formatted floats in tests. diff --git a/docs/guide/README.md b/docs/guide/README.md index 9be9088..a4a0d77 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -1,6 +1,6 @@ -# formats-luau guide +# rosetta guide -formats-luau reads, writes and converts file formats in pure Luau. One source tree runs on Roblox, on LuaJIT / LÖVE +rosetta reads, writes and converts file formats in pure Luau. One source tree runs on Roblox, on LuaJIT / LÖVE and in the luau CLI. Each format maps onto the standard type of its category, so a PNG and a WebP both load as the same `Image`, and every audio format opens as the same streaming `Decoder`. @@ -44,15 +44,15 @@ as `F`, and its input files as variables such as `pngBytes` (a buffer) or `srtTe **Roblox (Rojo).** Build the Roblox tree, then let Rojo turn it into a model or sync it into Studio: ```sh -python3 -I tools/build.py roblox # writes build/roblox/Formats (requires become instance paths) -rojo build -o Formats.rbxm # default.project.json mounts build/roblox/Formats; or: rojo serve +python3 -I tools/build.py roblox # writes build/roblox/Rosetta (requires become instance paths) +rojo build -o Rosetta.rbxm # default.project.json mounts build/roblox/Rosetta; or: rojo serve ``` -Put the `Formats` ModuleScript somewhere both client and server can see it, for example ReplicatedStorage: +Put the `Rosetta` ModuleScript somewhere both client and server can see it, for example ReplicatedStorage: ```luau -local F = require(game:GetService("ReplicatedStorage").Formats) +local F = require(game:GetService("ReplicatedStorage").Rosetta) ``` Roblox has no file system: pass buffers or strings, for example from `HttpService:GetAsync` or a `buffer` you built. @@ -60,27 +60,27 @@ Roblox has no file system: pass buffers or strings, for example from `HttpServic **LuaJIT and LÖVE.** Build the Lua 5.1 tree: ```sh -python3 -I tools/build.py luajit # writes build/luajit/formats/ (plain Lua 5.1 + the LuaJIT FFI) +python3 -I tools/build.py luajit # writes build/luajit/rosetta/ (plain Lua 5.1 + the LuaJIT FFI) ``` -Then either copy `build/luajit/formats` into your game, or put the build on `package.path`: +Then either copy `build/luajit/rosetta` into your game, or put the build on `package.path`: ```lua package.path = "build/luajit/?.lua;build/luajit/?/init.lua;" .. package.path -local F = require("formats") +local F = require("rosetta") ``` The library carries its own copy of the Luau standard library pieces it uses (`buffer`, `bit32`, `utf8`, ...). -Your own code gets them as globals with `require("formats._compat").install()`, which is useful when you read the +Your own code gets them as globals with `require("rosetta._compat").install()`, which is useful when you read the pixel buffers yourself. [examples/love](../../examples/love/main.lua) is a runnable LÖVE example. -**luau CLI.** The repository's `.luaurc` defines the alias `@formats` for `src/Formats`, so a script run from the +**luau CLI.** The repository's `.luaurc` defines the alias `@rosetta` for `src/Rosetta`, so a script run from the repository root can require the sources directly. The CLI has no file system. ```luau -local F = require("@formats") +local F = require("@rosetta") ``` The runnable programs in [examples/](../../examples) work this way: `luau examples/image.luau`. @@ -336,7 +336,7 @@ and `toSoundData` turns an `Audio` or a `Decoder` (read to its end) into 16-bit ```lua -local F = require("formats") +local F = require("rosetta") local img = assert(F.load("sprite.png")) -- love.filesystem path local texture = love.graphics.newImage(F.host.toImageData(img)) local music = love.audio.newSource(F.host.toSoundData(F.audio.open("music.ogg")), "static") @@ -347,13 +347,13 @@ F.save(shot, "shot.png") -- to the save directory **LuaJIT trace limits.** When the library loads on LuaJIT it raises the JIT's trace limits (`jit.opt.start("maxtrace=8000", "maxmcode=65536")`). The big decoders (Opus CELT, VP8, H.264, MPEG-1) outgrow the -defaults and fall back to the interpreter, which is 2x or more slower. Set `FORMATS_NO_JIT_TUNE` before the first +defaults and fall back to the interpreter, which is 2x or more slower. Set `ROSETTA_NO_JIT_TUNE` before the first `require` to leave the JIT settings alone: ```lua -FORMATS_NO_JIT_TUNE = true -- a global, read once when the library loads -local F = require("formats") +ROSETTA_NO_JIT_TUNE = true -- a global, read once when the library loads +local F = require("rosetta") ``` ## Conventions diff --git a/docs/guide/archive.md b/docs/guide/archive.md index 217c1fe..acdaca3 100644 --- a/docs/guide/archive.md +++ b/docs/guide/archive.md @@ -150,10 +150,10 @@ local zip = F.format("zip").create() zip:add("assets/", nil) -- a directory zip:add("assets/hello.txt", "hello", { level = 9, mtime = 1767225600 }) zip:add("assets/raw.bin", buffer.create(1024), { method = "store" }) -local bytes = assert(F.save(zip, nil, { format = "zip", comment = "made by formats-luau" })) +local bytes = assert(F.save(zip, nil, { format = "zip", comment = "made by rosetta" })) local back = assert(F.archive.load(bytes)) -assert(#back:list() == 3 and back.meta.comment == "made by formats-luau") +assert(#back:list() == 3 and back.meta.comment == "made by rosetta") assert(back:list()[3].method == "store") assert(back:remove("assets/raw.bin") and #back:list() == 2) @@ -350,7 +350,7 @@ stored data); ARJ and Zoo are read only. ```luau local lzh = assert(F.archive.load(lzhBytes)) assert(lzh.format == "lha" and lzh:list()[1].method == "lh0") -- small files are stored -assert(buffer.tostring(assert(lzh:read("readme.txt"))) == "formats-luau retro archives\n") +assert(buffer.tostring(assert(lzh:read("readme.txt"))) == "rosetta retro archives\n") local arj = assert(F.archive.load(arjBytes)) assert(arj:read("src/main.c")) local zoo = assert(F.archive.load(zooBytes)) diff --git a/docs/guide/audio.md b/docs/guide/audio.md index 1168fc5..80389ec 100644 --- a/docs/guide/audio.md +++ b/docs/guide/audio.md @@ -8,7 +8,7 @@ used the same way. ```luau local song = assert(F.audio.load(flacBytes)) -- Audio: the whole file decoded print(song.sampleRate, song.channels, song.frames) -- 44100 2 44100 -print(song.tags.title, song.tags.artist) -- Docs Tone formats-luau +print(song.tags.title, song.tags.artist) -- Docs Tone rosetta local quieter = F.ops.audio.gainDb(song, -6) local mp3 = assert(F.save(quieter, nil, { format = "mp3", bitrate = 192000 })) -- a buffer assert(F.detect(mp3) == "mp3") @@ -225,7 +225,7 @@ source can be fed block by block: ```lua -local F = require("formats") +local F = require("rosetta") local sd = F.host.toSoundData(F.audio.load("music.flac")) -- whole file love.audio.newSource(sd):play() @@ -313,7 +313,7 @@ assert(wv.bitsPerSample == 16 and wv.lossless and wv.tags.title == "Docs Tone") local exact, n = wv:readInt(1024) -- i32 samples, as wvunpack writes them assert(n == 1024 and buffer.readi32(exact, 0) == 0) local ape = assert(F.audio.load(apeBytes)) -- any level, fast .. insane -assert(ape.meta.source.format == "ape" and ape.tags.artist == "formats-luau") +assert(ape.meta.source.format == "ape" and ape.tags.artist == "rosetta") local tta = assert(F.audio.open(ttaBytes)) tta:seek(0.5) assert(math.abs(tta:position() - 0.5) < 1e-6) diff --git a/docs/guide/cad.md b/docs/guide/cad.md index 9e7aa6e..1fc7a30 100644 --- a/docs/guide/cad.md +++ b/docs/guide/cad.md @@ -4,7 +4,7 @@ STEP files (ISO 10303-21, "Part 21": AP203, AP214, AP242 and any other schema) l its *entity graph*, every `#id = TYPE(...)` instance with its arguments, exactly as written. Reading and writing the graph is built in and lossless (parse, write, parse gives the same entities). -Turning the graph into solid geometry needs a B-rep kernel, which formats-luau does not include: B-rep bodies and +Turning the graph into solid geometry needs a B-rep kernel, which rosetta does not include: B-rep bodies and tessellated meshes come from a plug-in you inject as `F.plugins.brep` (for example brep-luau's modules). Without it, `F.cad.toBodies` / `fromBodies` / `tessellate` return `UNSUPPORTED` and everything else on this page still works. diff --git a/docs/guide/image.md b/docs/guide/image.md index 7d83d96..46d3463 100644 --- a/docs/guide/image.md +++ b/docs/guide/image.md @@ -277,7 +277,7 @@ An animated image also opens as a video (`F.video.open(gifBytes)`), and saves to ```luau -local F = require(game.ReplicatedStorage.Formats) +local F = require(game.ReplicatedStorage.Rosetta) local img = assert(F.image.load(pngBuffer)) -- e.g. from HttpService:GetAsync(...) local editable = assert(F.host.toEditableImage(img)) -- needs rgba8: F.ops.image.convert first otherwise local label = Instance.new("ImageLabel") @@ -286,7 +286,7 @@ label.ImageContent = Content.fromObject(editable) ```lua -local F = require("formats") +local F = require("rosetta") local img = assert(F.load("photo.png")) -- love.filesystem path local image = love.graphics.newImage(F.host.toImageData(img)) local back = F.host.fromImageData(love.image.newImageData("other.png")) -- ImageData -> rgba8 Image diff --git a/docs/guide/music.md b/docs/guide/music.md index a76dc50..d20a2f4 100644 --- a/docs/guide/music.md +++ b/docs/guide/music.md @@ -132,7 +132,7 @@ Its only use is as `opts.soundfont` when rendering MIDI. ```luau local bank = assert(F.music.load(sf2Bytes)) -assert(bank.kind == "soundfont" and bank.info.name == "formats-luau test bank") +assert(bank.kind == "soundfont" and bank.info.name == "rosetta test bank") for _, p in bank.presets do print(p.bank, p.preset, p.name) -- 0 0 Sine, ... end diff --git a/docs/guide/recipes.md b/docs/guide/recipes.md index d632022..0d1b064 100644 --- a/docs/guide/recipes.md +++ b/docs/guide/recipes.md @@ -77,7 +77,7 @@ end ```luau -local F = require(game:GetService("ReplicatedStorage").Formats) +local F = require(game:GetService("ReplicatedStorage").Rosetta) local bytes = game:GetService("HttpService"):GetAsync("https://example.com/cat.webp") local img = assert(F.image.load(bytes)) if img.format ~= "rgba8" then @@ -94,7 +94,7 @@ label.Parent = game:GetService("Players").LocalPlayer.PlayerGui:WaitForChild("Sc ```lua -local F = require("formats") +local F = require("rosetta") local image function love.load() local img = assert(F.load("cat.webp")) -- a love.filesystem path @@ -141,7 +141,7 @@ container calls them. ```luau for _, bytes in { flacBytes, mp3Bytes, oggBytes } do local dec = assert(F.audio.open(bytes)) -- open reads the headers only - assert(dec.tags.title == "Docs Tone" and dec.tags.artist == "formats-luau") + assert(dec.tags.title == "Docs Tone" and dec.tags.artist == "rosetta") print(string.format("%s - %s (%.1f s, %d Hz)", dec.tags.artist, dec.tags.title, dec.duration, dec.sampleRate)) end ``` diff --git a/docs/guide/roblox.md b/docs/guide/roblox.md index accab5a..85621d6 100644 --- a/docs/guide/roblox.md +++ b/docs/guide/roblox.md @@ -36,7 +36,7 @@ assert(F.detect(xml) == "rbxlx" and F.detect(placeBytes) == "rbxl") Property values keep the file's type, because a number alone could be an `Int32`, a `Float32` or an `Enum`. Arrays follow the argument order of the Roblox constructors, so `Vector3.new(table.unpack(v.value))` and `CFrame.new(table.unpack(v.value))` rebuild them in a game. The full list is in the header of -`src/Formats/codecs/model/Rbx/init.luau`: +`src/Rosetta/codecs/model/Rbx/init.luau`: - **Text and numbers:** `String`, `BinaryString`, `ProtectedString`, `ContentId`, `SharedString` are strings. `Bool`, `Int32`, `Int64`, `Float32`, `Float64`, `Enum`, `BrickColor`, `Faces` and `Axes` are numbers and booleans. diff --git a/docs/guide/scene.md b/docs/guide/scene.md index 666865a..40c3d7b 100644 --- a/docs/guide/scene.md +++ b/docs/guide/scene.md @@ -236,7 +236,7 @@ assert(not string.find(buffer.tostring(plain), "KHR_draco", 1, true)) ``` Raw `.drc` files (and Draco data inside other formats) go through the codec itself: -`require(Formats.codecs.model.Draco).decode(bytes)` returns `{ kind, numPoints, numFaces, indices, attributes }` with +`require(Rosetta.codecs.model.Draco).decode(bytes)` returns `{ kind, numPoints, numFaces, indices, attributes }` with each attribute's values per point (`name`, `uniqueId`, `components`, `type`, `normalized`, `data`). ## Editing: `F.ops.mesh` diff --git a/docs/video.md b/docs/video.md index 23d6e8e..326eb8b 100644 --- a/docs/video.md +++ b/docs/video.md @@ -39,13 +39,13 @@ another format): `F.video.open` / `F.load` set it; calling a video format's `ope ## Adding a codec (H.264, ...) -The registry is static (Roblox has no dynamic require): add an entry to `BUILTIN` in `src/Formats/codecs/video/Video/init.luau` +The registry is static (Roblox has no dynamic require): add an entry to `BUILTIN` in `src/Rosetta/codecs/video/Video/init.luau` with a `new` constructor that requires the codec lazily, or call `Video.register(entry)` at run time (`F.video.codecs.register`). ```luau { id = "h264", name = "H.264 / AVC", fourcc = { "avc1", "avc3", "H264", ... }, matroska = { "V_MPEG4/ISO/AVC" }, - new = function(track, opts) return require("@formats/codecs/video/H264").newVideoDecoder(track, opts) end } + new = function(track, opts) return require("@rosetta/codecs/video/H264").newVideoDecoder(track, opts) end } ``` `new(track, opts)` returns a `Types.VideoCodecDecoder`: diff --git a/licenses/LDRAW_COLOURS.txt b/licenses/LDRAW_COLOURS.txt index 69ac6f7..8648ed2 100644 --- a/licenses/LDRAW_COLOURS.txt +++ b/licenses/LDRAW_COLOURS.txt @@ -1,4 +1,4 @@ -LDraw colour table (src/Formats/model/ldraw/Colors.luau) +LDraw colour table (src/Rosetta/model/ldraw/Colors.luau) The built-in colour list of model/ldraw is the list of !COLOUR definitions of LDConfig.ldr from the LDraw.org Parts Library ("0 !LDRAW_ORG Configuration UPDATE 2025-05-20", Author: LDraw.org), reformatted (one line per colour, the diff --git a/licenses/NOTICE.md b/licenses/NOTICE.md index 08a718d..fb5e437 100644 --- a/licenses/NOTICE.md +++ b/licenses/NOTICE.md @@ -2,62 +2,62 @@ | Where | From | Licence | |---|---|---| -| `src/Formats/codecs/Deflate/` (Inflate, init), `src/Formats/core/Crc32.luau`, `src/Formats/core/Adler32.luau`, `src/Formats/core/Huffman.luau` (table builder) | deflate-luau 1.0.0 (same author), written from RFC 1950-1952 | no licence chosen yet; no third-party code: [deflate-luau-NOTICE.txt](deflate-luau-NOTICE.txt) | -| `src/Formats/image/png/` (init, Decode) | png-luau 1.0.0 (same author), written from the PNG specification | no licence chosen yet; no third-party code | -| `src/Formats/codecs/Brotli/Static.luau` (static dictionary, context lookup table, word transforms; generated by `tools/brotli_static.py`), `src/Formats/codecs/Brotli/Decode.luau` (written from RFC 7932, structure after the reference decoder) | google/brotli | MIT: [brotli-LICENSE.txt](brotli-LICENSE.txt) | -| `src/Formats/codecs/Lzma/`, `src/Formats/archive/xz/`, `src/Formats/archive/7z/` | written from the LZMA specification / LzmaSpec.cpp and 7zFormat.txt (LZMA SDK, Igor Pavlov), the xz file format specification and xz-embedded's BCJ filters (Lasse Collin) | all public domain: [lzma-xz-PUBLIC-DOMAIN.txt](lzma-xz-PUBLIC-DOMAIN.txt) | -| `src/Formats/codecs/TrueType/`, `src/Formats/codecs/Cff/` | stb_truetype 1.26 (Sean Barrett), via imgui-luau's `imstb_truetype.lua`; fixed and extended | MIT or public domain: [stb_truetype-LICENSE.txt](stb_truetype-LICENSE.txt) | -| `src/Formats/containers/Ogg/` (init, Page) | ogg-luau be9f604 (same author), written from RFC 3533 | no licence chosen yet; no third-party code | -| `src/Formats/audio/wav/`, `src/Formats/containers/Riff/` (the chunk walker) | wav-luau fd9a909 (same author), written from the RIFF / WAVE / RF64 (EBU Tech 3306) specifications | no licence chosen yet; no third-party code | -| `src/Formats/audio/mp3/` | mp3-luau c755bbf (same author), a port of minimp3 by lieff (https://github.com/lieff/minimp3) | minimp3: CC0 1.0, [minimp3-CC0.txt](minimp3-CC0.txt) | +| `src/Rosetta/codecs/Deflate/` (Inflate, init), `src/Rosetta/core/Crc32.luau`, `src/Rosetta/core/Adler32.luau`, `src/Rosetta/core/Huffman.luau` (table builder) | deflate-luau 1.0.0 (same author), written from RFC 1950-1952 | no licence chosen yet; no third-party code: [deflate-luau-NOTICE.txt](deflate-luau-NOTICE.txt) | +| `src/Rosetta/image/png/` (init, Decode) | png-luau 1.0.0 (same author), written from the PNG specification | no licence chosen yet; no third-party code | +| `src/Rosetta/codecs/Brotli/Static.luau` (static dictionary, context lookup table, word transforms; generated by `tools/brotli_static.py`), `src/Rosetta/codecs/Brotli/Decode.luau` (written from RFC 7932, structure after the reference decoder) | google/brotli | MIT: [brotli-LICENSE.txt](brotli-LICENSE.txt) | +| `src/Rosetta/codecs/Lzma/`, `src/Rosetta/archive/xz/`, `src/Rosetta/archive/7z/` | written from the LZMA specification / LzmaSpec.cpp and 7zFormat.txt (LZMA SDK, Igor Pavlov), the xz file format specification and xz-embedded's BCJ filters (Lasse Collin) | all public domain: [lzma-xz-PUBLIC-DOMAIN.txt](lzma-xz-PUBLIC-DOMAIN.txt) | +| `src/Rosetta/codecs/TrueType/`, `src/Rosetta/codecs/Cff/` | stb_truetype 1.26 (Sean Barrett), via imgui-luau's `imstb_truetype.lua`; fixed and extended | MIT or public domain: [stb_truetype-LICENSE.txt](stb_truetype-LICENSE.txt) | +| `src/Rosetta/containers/Ogg/` (init, Page) | ogg-luau be9f604 (same author), written from RFC 3533 | no licence chosen yet; no third-party code | +| `src/Rosetta/audio/wav/`, `src/Rosetta/containers/Riff/` (the chunk walker) | wav-luau fd9a909 (same author), written from the RIFF / WAVE / RF64 (EBU Tech 3306) specifications | no licence chosen yet; no third-party code | +| `src/Rosetta/audio/mp3/` | mp3-luau c755bbf (same author), a port of minimp3 by lieff (https://github.com/lieff/minimp3) | minimp3: CC0 1.0, [minimp3-CC0.txt](minimp3-CC0.txt) | | `tests/fixtures/mp3/` | made by ffmpeg (libmp3lame / mp2) from a synthetic signal; `*.ref` are minimp3 decodes of them | test data, no third-party content | -| `src/Formats/audio/opus/` (Decoder, Celt, Silk, Mdct, RangeDecoder, Packet, CeltTables, SilkTables) | opus-luau dd2b4e5 (same author): a port of the libopus 1.6 decoder (git bafd40dcbd50; tables generated from its sources); the stereo downmix weights follow opusfile | libopus BSD 3-clause (Xiph.Org, Skype, Octasic, J.-M. Valin, T. B. Terriberry, CSIRO, G. Maxwell, M. Borgerding, E. de Castro Lopo, Mozilla, Amazon), opusfile BSD 3-clause: [libopus-BSD.txt](libopus-BSD.txt) | -| `src/Formats/audio/vorbis/` (Setup, Codebook, Packet, Tables) | a Luau port of stb_vorbis 1.22 by Sean Barrett (https://github.com/nothings/stb): setup parsing, codebooks, floor 1, residues, coupling (the IMDCT is codecs/Mdct; the timing follows libvorbis / the spec) | public domain or MIT (dual): [stb_vorbis-LICENSE.txt](stb_vorbis-LICENSE.txt) | -| `src/Formats/audio/flac/` | flac-luau 7083d0d (same author), written from RFC 9639 | no licence chosen yet; no third-party code | -| `src/Formats/image/bmp/` | bmp-luau b86aed6 (same author), written from the Microsoft BMP documentation | no licence chosen yet; no third-party code | +| `src/Rosetta/audio/opus/` (Decoder, Celt, Silk, Mdct, RangeDecoder, Packet, CeltTables, SilkTables) | opus-luau dd2b4e5 (same author): a port of the libopus 1.6 decoder (git bafd40dcbd50; tables generated from its sources); the stereo downmix weights follow opusfile | libopus BSD 3-clause (Xiph.Org, Skype, Octasic, J.-M. Valin, T. B. Terriberry, CSIRO, G. Maxwell, M. Borgerding, E. de Castro Lopo, Mozilla, Amazon), opusfile BSD 3-clause: [libopus-BSD.txt](libopus-BSD.txt) | +| `src/Rosetta/audio/vorbis/` (Setup, Codebook, Packet, Tables) | a Luau port of stb_vorbis 1.22 by Sean Barrett (https://github.com/nothings/stb): setup parsing, codebooks, floor 1, residues, coupling (the IMDCT is codecs/Mdct; the timing follows libvorbis / the spec) | public domain or MIT (dual): [stb_vorbis-LICENSE.txt](stb_vorbis-LICENSE.txt) | +| `src/Rosetta/audio/flac/` | flac-luau 7083d0d (same author), written from RFC 9639 | no licence chosen yet; no third-party code | +| `src/Rosetta/image/bmp/` | bmp-luau b86aed6 (same author), written from the Microsoft BMP documentation | no licence chosen yet; no third-party code | | `tests/fixtures/bmpsuite/` | BMP Suite 2.8 by Jason Summers (generated images) | public domain: [bmpsuite-NOTICE.txt](bmpsuite-NOTICE.txt) | -| `src/Formats/containers/Zip/` (the reader), `src/Formats/archive/zip/` | zip-luau 121d4b0 (same author), written from PKWARE's APPNOTE.TXT 6.3 | no licence chosen yet; no third-party code | -| `src/Formats/audio/mp3/EncTables.luau` (ws-audio encoders) | PDMP3 by Krister Lagerström et al. (https://github.com/technosaurus/PDMP3): the ISO/IEC 11172-3 synthesis window and layer III Huffman trees | public domain (unlicense): [PDMP3-UNLICENSE.txt](PDMP3-UNLICENSE.txt) | -| `src/Formats/playlist/` (m3u, pls; xspf is new), `src/Formats/codecs/Url/`, `src/Formats/codecs/Text/` | playlist-luau 3fc7fd3 (same author), written from RFC 3986 / RFC 8216 | no licence chosen yet; no third-party code | -| `src/Formats/codecs/Jpeg/` (Decode, Scan, Color, Yuv; moved from image/jpeg), `src/Formats/codecs/Dct/` (inverse DCTs) | jpeg-luau 1.0 (same author); the IDCTs, upsampling, colour conversion and IDCT-size choice are Luau translations of libjpeg / libjpeg-turbo (jidctint.c, jidctred.c, jdsample.c, jdcolor.c, jdmaster.c) | IJG licence + libjpeg-turbo BSD: [libjpeg-turbo-LICENSE.md](libjpeg-turbo-LICENSE.md), [libjpeg-README.ijg](libjpeg-README.ijg). This software is based in part on the work of the Independent JPEG Group. | -| `src/Formats/codecs/Jpeg/Arith.luau`, `src/Formats/codecs/Jpeg/Encode.luau`, `src/Formats/codecs/Dct/` (forward DCT) | new; Luau translations of libjpeg-turbo 3.2 jdarith.c / jaricom.c (Guido Vollbeding), jccolor.c, jcsample.c, jccoefct.c, jfdctint.c, jcdctmgr.c, jchuff.c, jcphuff.c, jcparam.c | as above | -| `src/Formats/codecs/Mpeg1/` (init, Decoder, Vlc, Tables) | mpeg1-luau e2e2898 (same author), a port of jsmpeg's MPEG-1 video decoder (https://github.com/phoboslab/jsmpeg, src/mpeg1.js; the tables are generated from it) by Dominic Szablewski | MIT: [jsmpeg-MIT.txt](jsmpeg-MIT.txt) | -| `src/Formats/containers/MpegTs/` | mpegts-luau 6e16197 (same author), written from ISO/IEC 13818-1 | no licence chosen yet; no third-party code | -| `src/Formats/codecs/Aac/Tables.luau` | the Huffman codebooks, scalefactor band offsets and TNS limits of ISO/IEC 14496-3 (Annex 4.A), transcribed mechanically from FFmpeg's `libavcodec/aactab.c` (tables of the standard only; no FFmpeg code) | FFmpeg is LGPL-2.1-or-later; the tables are the standard's data | -| `src/Formats/codecs/Aac/`, `codecs/Alac/`, `codecs/Mdct/`, `containers/IsoBmff/`, `audio/m4a`, `audio/aac`, `audio/caf` | written for this library from ISO/IEC 14496-3 / 14496-12 / 23008-12, Apple's ALAC and CAF specifications | no third-party code | -| `src/Formats/audio/opus/CeltEncoder.luau`, `src/Formats/audio/opus/RangeEncoder.luau` | the encoder side of libopus 1.6 (celt_encoder.c, entenc.c, quant_bands.c, laplace.c, rate.c, bands.c, vq.c, cwrs.c), ported to mirror the absorbed decoder; analysis simplified (ws-m4a) | libopus BSD 3-clause: [libopus-BSD.txt](libopus-BSD.txt) | +| `src/Rosetta/containers/Zip/` (the reader), `src/Rosetta/archive/zip/` | zip-luau 121d4b0 (same author), written from PKWARE's APPNOTE.TXT 6.3 | no licence chosen yet; no third-party code | +| `src/Rosetta/audio/mp3/EncTables.luau` (ws-audio encoders) | PDMP3 by Krister Lagerström et al. (https://github.com/technosaurus/PDMP3): the ISO/IEC 11172-3 synthesis window and layer III Huffman trees | public domain (unlicense): [PDMP3-UNLICENSE.txt](PDMP3-UNLICENSE.txt) | +| `src/Rosetta/playlist/` (m3u, pls; xspf is new), `src/Rosetta/codecs/Url/`, `src/Rosetta/codecs/Text/` | playlist-luau 3fc7fd3 (same author), written from RFC 3986 / RFC 8216 | no licence chosen yet; no third-party code | +| `src/Rosetta/codecs/Jpeg/` (Decode, Scan, Color, Yuv; moved from image/jpeg), `src/Rosetta/codecs/Dct/` (inverse DCTs) | jpeg-luau 1.0 (same author); the IDCTs, upsampling, colour conversion and IDCT-size choice are Luau translations of libjpeg / libjpeg-turbo (jidctint.c, jidctred.c, jdsample.c, jdcolor.c, jdmaster.c) | IJG licence + libjpeg-turbo BSD: [libjpeg-turbo-LICENSE.md](libjpeg-turbo-LICENSE.md), [libjpeg-README.ijg](libjpeg-README.ijg). This software is based in part on the work of the Independent JPEG Group. | +| `src/Rosetta/codecs/Jpeg/Arith.luau`, `src/Rosetta/codecs/Jpeg/Encode.luau`, `src/Rosetta/codecs/Dct/` (forward DCT) | new; Luau translations of libjpeg-turbo 3.2 jdarith.c / jaricom.c (Guido Vollbeding), jccolor.c, jcsample.c, jccoefct.c, jfdctint.c, jcdctmgr.c, jchuff.c, jcphuff.c, jcparam.c | as above | +| `src/Rosetta/codecs/Mpeg1/` (init, Decoder, Vlc, Tables) | mpeg1-luau e2e2898 (same author), a port of jsmpeg's MPEG-1 video decoder (https://github.com/phoboslab/jsmpeg, src/mpeg1.js; the tables are generated from it) by Dominic Szablewski | MIT: [jsmpeg-MIT.txt](jsmpeg-MIT.txt) | +| `src/Rosetta/containers/MpegTs/` | mpegts-luau 6e16197 (same author), written from ISO/IEC 13818-1 | no licence chosen yet; no third-party code | +| `src/Rosetta/codecs/Aac/Tables.luau` | the Huffman codebooks, scalefactor band offsets and TNS limits of ISO/IEC 14496-3 (Annex 4.A), transcribed mechanically from FFmpeg's `libavcodec/aactab.c` (tables of the standard only; no FFmpeg code) | FFmpeg is LGPL-2.1-or-later; the tables are the standard's data | +| `src/Rosetta/codecs/Aac/`, `codecs/Alac/`, `codecs/Mdct/`, `containers/IsoBmff/`, `audio/m4a`, `audio/aac`, `audio/caf` | written for this library from ISO/IEC 14496-3 / 14496-12 / 23008-12, Apple's ALAC and CAF specifications | no third-party code | +| `src/Rosetta/audio/opus/CeltEncoder.luau`, `src/Rosetta/audio/opus/RangeEncoder.luau` | the encoder side of libopus 1.6 (celt_encoder.c, entenc.c, quant_bands.c, laplace.c, rate.c, bands.c, vq.c, cwrs.c), ported to mirror the absorbed decoder; analysis simplified (ws-m4a) | libopus BSD 3-clause: [libopus-BSD.txt](libopus-BSD.txt) | | `tests/fixtures/pngsuite/` | PngSuite by Willem van Schaik | [PngSuite-LICENSE.txt](PngSuite-LICENSE.txt) | | `tests/fixtures/vox/{chr_knight,chr_sword,deer,maze}.vox`, `tests/fixtures/vox/MagicaVoxel-file-format-vox*.txt` (the format spec) | ephtracy/voxel-model (MagicaVoxel sample models) | MIT: [voxel-model-LICENSE.txt](voxel-model-LICENSE.txt) | | `tests/fixtures/vox/ogt_*.vox` | jpaver/opengametools `demo/vox/` (files saved by MagicaVoxel 0.99.x) | MIT: [opengametools-LICENSE.txt](opengametools-LICENSE.txt) | | `tests/fixtures/gltf/` | KhronosGroup/glTF-Sample-Assets `Models/` (one LICENSE.md per model folder; `UnicodeTest` is `Unicode❤♻Test` renamed) | CC-BY-4.0 or CC0-1.0 per model, see each folder's LICENSE.md | -| `src/Formats/codecs/Vp8/` (Decode, Yuv, Tables), `src/Formats/codecs/Vp8L/Decode.luau`, `src/Formats/image/webp/` (Alpha unfilters, Anim.coalesce) | ports of libwebp 1.6.0 (Google): src/dec, src/dsp, src/utils, src/demux/anim_decode.c | BSD-3-Clause + patent grant: [libwebp-LICENSE.txt](libwebp-LICENSE.txt) | -| `src/Formats/codecs/Tracker/`, `src/Formats/music/{mod,s3m,xm,it}/` | written for this library from the format documents: ProTracker 2.3 effect docs, the XM specification (Mr.H / Triton) and FT2 behaviour notes, ST3 TECH.DOC (Sami Tammilehto / Future Crew), ITTECH.TXT (Jeffrey Lim); OpenMPT (libopenmpt, BSD) was used only as the reference player in the tests, and its documented playback quirks (mix levels, MOD panning, FT2 E6x / tremor / instrument behaviour) are matched | no third-party code | +| `src/Rosetta/codecs/Vp8/` (Decode, Yuv, Tables), `src/Rosetta/codecs/Vp8L/Decode.luau`, `src/Rosetta/image/webp/` (Alpha unfilters, Anim.coalesce) | ports of libwebp 1.6.0 (Google): src/dec, src/dsp, src/utils, src/demux/anim_decode.c | BSD-3-Clause + patent grant: [libwebp-LICENSE.txt](libwebp-LICENSE.txt) | +| `src/Rosetta/codecs/Tracker/`, `src/Rosetta/music/{mod,s3m,xm,it}/` | written for this library from the format documents: ProTracker 2.3 effect docs, the XM specification (Mr.H / Triton) and FT2 behaviour notes, ST3 TECH.DOC (Sami Tammilehto / Future Crew), ITTECH.TXT (Jeffrey Lim); OpenMPT (libopenmpt, BSD) was used only as the reference player in the tests, and its documented playback quirks (mix levels, MOD panning, FT2 E6x / tremor / instrument behaviour) are matched | no third-party code | | `tools/fixtures/{mod,s3m,xm,it}.py` test modules | generated by the fixture scripts (synthesized samples) | no third-party data | -| `src/Formats/codecs/SoundFont/` (Synth, the zone merging in Parse) | port of TinySoundFont v0.9 (tsf.h) by Bernhard Schelling, based on SFZero by Steve Folta | MIT: [TinySoundFont-LICENSE.txt](TinySoundFont-LICENSE.txt) | -| `src/Formats/codecs/Vp8/` inter frames (Decode: inter headers / modes / motion vectors / references, Predict, the inter tables in Tables) | Luau translations of libvpx 1.17 (WebM Project): vp8/decoder/decodeframe.c, decodemv.c, onyxd_if.c; vp8/common/findnearmv.c, reconinter.c, filter.c, vp8_loopfilter.c, entropymode.c, entropymv.c, modecont.c | BSD-3-Clause + patent grant: [libvpx-LICENSE.txt](libvpx-LICENSE.txt) | +| `src/Rosetta/codecs/SoundFont/` (Synth, the zone merging in Parse) | port of TinySoundFont v0.9 (tsf.h) by Bernhard Schelling, based on SFZero by Steve Folta | MIT: [TinySoundFont-LICENSE.txt](TinySoundFont-LICENSE.txt) | +| `src/Rosetta/codecs/Vp8/` inter frames (Decode: inter headers / modes / motion vectors / references, Predict, the inter tables in Tables) | Luau translations of libvpx 1.17 (WebM Project): vp8/decoder/decodeframe.c, decodemv.c, onyxd_if.c; vp8/common/findnearmv.c, reconinter.c, filter.c, vp8_loopfilter.c, entropymode.c, entropymv.c, modecont.c | BSD-3-Clause + patent grant: [libvpx-LICENSE.txt](libvpx-LICENSE.txt) | | `tests/fixtures/vp8video/vp80-*.ivf` | the VP8 test vectors of the libvpx test data (vp80-00-comprehensive-001..018 and others) | WebM Project, BSD-3-Clause + patent grant: [libvpx-LICENSE.txt](libvpx-LICENSE.txt) | -| `src/Formats/codecs/H264/` (Tables: CAVLC / CABAC / deblocking / scaling constant tables of ITU-T H.264, extracted from openh264 sources; the decoder itself is written from the spec) | openh264 2.x (Cisco) | BSD-2-Clause: [openh264-LICENSE.txt](openh264-LICENSE.txt) | -| `src/Formats/codecs/audio/Adpcm/` (the ADX coefficient derivation, PS-ADPCM / DSP / ADX decode details, followed for bit-exact output; the container layouts of audio/adx, audio/vag, audio/brstm) | vgmstream r2117 | ISC-style: [vgmstream-LICENSE.txt](vgmstream-LICENSE.txt) | -| `src/Formats/codecs/audio/Qoa/` (port of qoa.h: tables, LMS predictor, decoder, encoder); `tests/fixtures/qoa/qoa.h` (the reference, compiled at fixture time) | qoa.h (phoboslab/qoa, Dominic Szablewski) | MIT: [qoa-LICENSE.txt](qoa-LICENSE.txt) | -| `src/Formats/codecs/audio/Hively/` (Tables, Load, Player: the AHX / HVL loaders, waveform generator and replayer) | port of HivelyTracker hvl2wav replay.c 1.9 by Pete Gordon (Xeron/IRIS); `tests/gen/ahx_cases` / `hvl_cases` also embed songs from its Songs/ directory (fixture time, not committed) | BSD-3-Clause: [hivelytracker-LICENSE.txt](hivelytracker-LICENSE.txt) | -| `src/Formats/codecs/audio/Musepack/` (Decode, Tables, init: the SV7 / SV8 bitstream, Huffman tables, requantisation, synthesis, stream headers) | port of libmpcdec (musepack_src_r475, The Musepack Development Team) | BSD-3-Clause: [libmpcdec-BSD.txt](libmpcdec-BSD.txt) | -| `src/Formats/codecs/audio/WavPack/` (Block, Tables), `src/Formats/audio/wavpack/` | Luau port of the WavPack 5.9.0 decoder by David Bryant: unpack.c, read_words.c, unpack_floats.c, decorr_utils.c, entropy_utils.c (tables, wp_log2 / wp_exp2s), open_utils.c (metadata, block checksum) | BSD-3-Clause: [wavpack-LICENSE.txt](wavpack-LICENSE.txt) | -| `src/Formats/codecs/audio/Ape/` (Decode, init), `src/Formats/audio/ape/` | Luau port of the Monkey's Audio SDK 13.28 decoder by Matthew T. Ashland: UnBitArray.cpp / Old/UnBitArrayOld.cpp (range coder), NNFilter, NewPredictor.cpp, ScaledFirstOrderFilter.h, Prepare.cpp (Unprepare), APEDecompressCore.cpp, APEHeader.cpp, FloatTransform.cpp | BSD-3-Clause (since SDK v10): [monkeys-audio-LICENSE.txt](monkeys-audio-LICENSE.txt) | -| `src/Formats/music/{mtm,669,stm,ult,okt,med,ptm,far,umx}/`, `src/Formats/codecs/audio/Tracker/Load.luau` (loaders and effect conversions ported from OpenMPT's Load_*.cpp / ModCommand / UMXTools) | libopenmpt 0.8.9 (OpenMPT Project Developers, Olivier Lapicque) | BSD-3-Clause: [openmpt-LICENSE.txt](openmpt-LICENSE.txt) | -| `src/Formats/codecs/video/Dsp.luau` (the 8x8 IDCT: jrevdct.c translated to Luau, branch tree and constants unchanged) | IJG jrevdct.c as shipped in ffmpeg (libavcodec/jrevdct.c; IJG-licensed, not LGPL: ffmpeg's LICENSE.md) | IJG: [libjpeg-README.ijg](libjpeg-README.ijg). This software is based in part on the work of the Independent JPEG Group. | +| `src/Rosetta/codecs/H264/` (Tables: CAVLC / CABAC / deblocking / scaling constant tables of ITU-T H.264, extracted from openh264 sources; the decoder itself is written from the spec) | openh264 2.x (Cisco) | BSD-2-Clause: [openh264-LICENSE.txt](openh264-LICENSE.txt) | +| `src/Rosetta/codecs/audio/Adpcm/` (the ADX coefficient derivation, PS-ADPCM / DSP / ADX decode details, followed for bit-exact output; the container layouts of audio/adx, audio/vag, audio/brstm) | vgmstream r2117 | ISC-style: [vgmstream-LICENSE.txt](vgmstream-LICENSE.txt) | +| `src/Rosetta/codecs/audio/Qoa/` (port of qoa.h: tables, LMS predictor, decoder, encoder); `tests/fixtures/qoa/qoa.h` (the reference, compiled at fixture time) | qoa.h (phoboslab/qoa, Dominic Szablewski) | MIT: [qoa-LICENSE.txt](qoa-LICENSE.txt) | +| `src/Rosetta/codecs/audio/Hively/` (Tables, Load, Player: the AHX / HVL loaders, waveform generator and replayer) | port of HivelyTracker hvl2wav replay.c 1.9 by Pete Gordon (Xeron/IRIS); `tests/gen/ahx_cases` / `hvl_cases` also embed songs from its Songs/ directory (fixture time, not committed) | BSD-3-Clause: [hivelytracker-LICENSE.txt](hivelytracker-LICENSE.txt) | +| `src/Rosetta/codecs/audio/Musepack/` (Decode, Tables, init: the SV7 / SV8 bitstream, Huffman tables, requantisation, synthesis, stream headers) | port of libmpcdec (musepack_src_r475, The Musepack Development Team) | BSD-3-Clause: [libmpcdec-BSD.txt](libmpcdec-BSD.txt) | +| `src/Rosetta/codecs/audio/WavPack/` (Block, Tables), `src/Rosetta/audio/wavpack/` | Luau port of the WavPack 5.9.0 decoder by David Bryant: unpack.c, read_words.c, unpack_floats.c, decorr_utils.c, entropy_utils.c (tables, wp_log2 / wp_exp2s), open_utils.c (metadata, block checksum) | BSD-3-Clause: [wavpack-LICENSE.txt](wavpack-LICENSE.txt) | +| `src/Rosetta/codecs/audio/Ape/` (Decode, init), `src/Rosetta/audio/ape/` | Luau port of the Monkey's Audio SDK 13.28 decoder by Matthew T. Ashland: UnBitArray.cpp / Old/UnBitArrayOld.cpp (range coder), NNFilter, NewPredictor.cpp, ScaledFirstOrderFilter.h, Prepare.cpp (Unprepare), APEDecompressCore.cpp, APEHeader.cpp, FloatTransform.cpp | BSD-3-Clause (since SDK v10): [monkeys-audio-LICENSE.txt](monkeys-audio-LICENSE.txt) | +| `src/Rosetta/music/{mtm,669,stm,ult,okt,med,ptm,far,umx}/`, `src/Rosetta/codecs/audio/Tracker/Load.luau` (loaders and effect conversions ported from OpenMPT's Load_*.cpp / ModCommand / UMXTools) | libopenmpt 0.8.9 (OpenMPT Project Developers, Olivier Lapicque) | BSD-3-Clause: [openmpt-LICENSE.txt](openmpt-LICENSE.txt) | +| `src/Rosetta/codecs/video/Dsp.luau` (the 8x8 IDCT: jrevdct.c translated to Luau, branch tree and constants unchanged) | IJG jrevdct.c as shipped in ffmpeg (libavcodec/jrevdct.c; IJG-licensed, not LGPL: ffmpeg's LICENSE.md) | IJG: [libjpeg-README.ijg](libjpeg-README.ijg). This software is based in part on the work of the Independent JPEG Group. | | `tests/gen/h264_jvt` (downloaded at fixture time, not committed) | ITU-T H.264.1 / JVT conformance bitstreams (itu.int) | ITU-T test data | | `tests/gen/wad` (cut down from the nix freedoom package at fixture time, not committed) | Freedoom 0.13 (freedoom.github.io) | BSD-3-Clause: [freedoom-COPYING.txt](freedoom-COPYING.txt) | -| `src/Formats/codecs/compress/Explode.luau` (the PKWARE DCL code tables and bit order) | blast.c 1.3 (Mark Adler, zlib contrib) | zlib: [blast-LICENSE.txt](blast-LICENSE.txt) | -| `src/Formats/codecs/compress/Lzh/` (lh1 adaptive Huffman, lh4..lh7 block decoding, lzs / lz5) | lhasa 0.6.0 (Simon Howard) | ISC: [lhasa-LICENSE.txt](lhasa-LICENSE.txt) | +| `src/Rosetta/codecs/compress/Explode.luau` (the PKWARE DCL code tables and bit order) | blast.c 1.3 (Mark Adler, zlib contrib) | zlib: [blast-LICENSE.txt](blast-LICENSE.txt) | +| `src/Rosetta/codecs/compress/Lzh/` (lh1 adaptive Huffman, lh4..lh7 block decoding, lzs / lz5) | lhasa 0.6.0 (Simon Howard) | ISC: [lhasa-LICENSE.txt](lhasa-LICENSE.txt) | | `tests/gen/lha` (read from nixpkgs#lhasa.src at fixture time, not committed) | lhasa 0.6.0 test archives | ISC (lhasa) | -| `src/Formats/codecs/font/GlyphNames.luau` (glyph name -> Unicode table, StandardEncoding) | Adobe Glyph List For New Fonts 1.7 (via fontTools) | BSD-3-Clause: [agl-LICENSE.txt](agl-LICENSE.txt) | -| `src/Formats/codecs/compress/UnixCompress.luau` (the .Z format and the encoder's ratio check / CLEAR rule, read from compress.c; the code is new) | ncompress 5.0 | public domain (The Unlicense): [ncompress-UNLICENSE.txt](ncompress-UNLICENSE.txt) | -| `src/Formats/codecs/video/Theora/` (Header, Decoder) | a Luau port of the libtheora 1.2.0 decoder (Xiph.Org; decinfo.c, dequant.c, quant.c, huffdec.c, decode.c, state.c, idct.c, fragment.c) checked against the Theora I specification; the token storage is simplified (coefficients per fragment) and the post-processing is not ported | BSD 3-clause: [libtheora-BSD.txt](libtheora-BSD.txt) | -| `src/Formats/codecs/model/Draco/` | Luau port of the Draco 1.5.7 decoder (Google): compression/{decode, mesh, attributes, entropy, bit_coders, point_cloud}, mesh/corner_table, mesh/mesh_attribute_corner_table, core/{decoder_buffer, varint_decoding, math_utils}, attributes/attribute_{quantization,octahedron}_transform | Apache-2.0: [draco-LICENSE.txt](draco-LICENSE.txt) | -| `src/Formats/model/ldraw/Colors.luau` (the built-in colour table) | the !COLOUR list of LDConfig.ldr (LDraw.org Parts Library, UPDATE 2025-05-20), reformatted | CC BY 2.0 / CC BY 4.0: [LDRAW_COLOURS.txt](LDRAW_COLOURS.txt) | +| `src/Rosetta/codecs/font/GlyphNames.luau` (glyph name -> Unicode table, StandardEncoding) | Adobe Glyph List For New Fonts 1.7 (via fontTools) | BSD-3-Clause: [agl-LICENSE.txt](agl-LICENSE.txt) | +| `src/Rosetta/codecs/compress/UnixCompress.luau` (the .Z format and the encoder's ratio check / CLEAR rule, read from compress.c; the code is new) | ncompress 5.0 | public domain (The Unlicense): [ncompress-UNLICENSE.txt](ncompress-UNLICENSE.txt) | +| `src/Rosetta/codecs/video/Theora/` (Header, Decoder) | a Luau port of the libtheora 1.2.0 decoder (Xiph.Org; decinfo.c, dequant.c, quant.c, huffdec.c, decode.c, state.c, idct.c, fragment.c) checked against the Theora I specification; the token storage is simplified (coefficients per fragment) and the post-processing is not ported | BSD 3-clause: [libtheora-BSD.txt](libtheora-BSD.txt) | +| `src/Rosetta/codecs/model/Draco/` | Luau port of the Draco 1.5.7 decoder (Google): compression/{decode, mesh, attributes, entropy, bit_coders, point_cloud}, mesh/corner_table, mesh/mesh_attribute_corner_table, core/{decoder_buffer, varint_decoding, math_utils}, attributes/attribute_{quantization,octahedron}_transform | Apache-2.0: [draco-LICENSE.txt](draco-LICENSE.txt) | +| `src/Rosetta/model/ldraw/Colors.luau` (the built-in colour table) | the !COLOUR list of LDConfig.ldr (LDraw.org Parts Library, UPDATE 2025-05-20), reformatted | CC BY 2.0 / CC BY 4.0: [LDRAW_COLOURS.txt](LDRAW_COLOURS.txt) | | `tests/gen/ldraw_*` (read at fixture time from the nix store, not committed) | LDraw.org Parts Library parts and sample models (complete.zip, as packaged for nixpkgs' LeoCAD) | CC BY 2.0 / CC BY 4.0, test data | -| `src/Formats/codecs/image/Bcn/Decode.luau` (the BC1..BC7 block decoders and the BPTC tables; changed to follow the D3D11 rules) | Pillow 12 `src/libImaging/BcnDecode.c` | CC0 1.0: [pillow-bcn-CC0.txt](pillow-bcn-CC0.txt) | -| `src/Formats/image/exr/Piz.luau`, `src/Formats/image/exr/Codec.luau` (the PIZ Huffman / wavelet / LUT steps and the ZIP / RLE byte predictor, re-implemented in Luau after the OpenEXR algorithms) | OpenEXR 3.x (ImfPizCompressor, ImfHuf, ImfWav, ImfZip, ImfRle) | BSD-3-Clause: [openexr-LICENSE.md](openexr-LICENSE.md) | +| `src/Rosetta/codecs/image/Bcn/Decode.luau` (the BC1..BC7 block decoders and the BPTC tables; changed to follow the D3D11 rules) | Pillow 12 `src/libImaging/BcnDecode.c` | CC0 1.0: [pillow-bcn-CC0.txt](pillow-bcn-CC0.txt) | +| `src/Rosetta/image/exr/Piz.luau`, `src/Rosetta/image/exr/Codec.luau` (the PIZ Huffman / wavelet / LUT steps and the ZIP / RLE byte predictor, re-implemented in Luau after the OpenEXR algorithms) | OpenEXR 3.x (ImfPizCompressor, ImfHuf, ImfWav, ImfZip, ImfRle) | BSD-3-Clause: [openexr-LICENSE.md](openexr-LICENSE.md) | Ports of third-party code (minimp3, stb_vorbis, libopus, ...) add a row here and their upstream licence text in this folder (see docs/STYLE.md, "Absorbing an existing repo"). diff --git a/licenses/PDMP3-UNLICENSE.txt b/licenses/PDMP3-UNLICENSE.txt index abdbb5f..54cbb9d 100644 --- a/licenses/PDMP3-UNLICENSE.txt +++ b/licenses/PDMP3-UNLICENSE.txt @@ -1,5 +1,5 @@ PDMP3 (https://github.com/technosaurus/PDMP3), public domain decoder by Krister Lagerstrom et al. -Tables used in src/Formats/audio/mp3/EncTables.luau. +Tables used in src/Rosetta/audio/mp3/EncTables.luau. Public Domain (www.unlicense.org) This is free and unencumbered software released into the public domain. diff --git a/licenses/bmpsuite-NOTICE.txt b/licenses/bmpsuite-NOTICE.txt index a47b169..a721d9a 100644 --- a/licenses/bmpsuite-NOTICE.txt +++ b/licenses/bmpsuite-NOTICE.txt @@ -4,4 +4,4 @@ tests/fixtures/bmpsuite/ (g/, q/, b/ and the reference PNGs in ref/) come from t Image files generated by this program are in the public domain. Only the generated image files are included here (ref.txt, mapping files to their reference PNG, was written for -formats-luau from the suite's bmpsuite.html). +rosetta from the suite's bmpsuite.html). diff --git a/licenses/libmpcdec-BSD.txt b/licenses/libmpcdec-BSD.txt index 156247c..b1b1625 100644 --- a/licenses/libmpcdec-BSD.txt +++ b/licenses/libmpcdec-BSD.txt @@ -1,5 +1,5 @@ libmpcdec (musepack_src_r475, https://files.musepack.net/source/musepack_src_r475.tar.gz), ported to -src/Formats/codecs/audio/Musepack (Decode.luau, Tables.luau, init.luau): +src/Rosetta/codecs/audio/Musepack (Decode.luau, Tables.luau, init.luau): Copyright (c) 2005, The Musepack Development Team All rights reserved. diff --git a/licenses/stb_vorbis-LICENSE.txt b/licenses/stb_vorbis-LICENSE.txt index 6e4b8d2..f13a7a9 100644 --- a/licenses/stb_vorbis-LICENSE.txt +++ b/licenses/stb_vorbis-LICENSE.txt @@ -1,5 +1,5 @@ stb_vorbis.c v1.22 (https://github.com/nothings/stb), by Sean Barrett and contributors. -Ported to Luau in src/Formats/audio/vorbis/ (decoder). +Ported to Luau in src/Rosetta/audio/vorbis/ (decoder). This software is available under 2 licenses -- choose whichever you prefer. ------------------------------------------------------------------------------