diff --git a/build/Rosetta.luau b/build/Rosetta.luau index e0739fc..03921ec 100644 --- a/build/Rosetta.luau +++ b/build/Rosetta.luau @@ -35,10 +35,6 @@ local Bytes = __include("core/Bytes") local Input = __include("core/Input") local Types = __include("Types") local Registry = __include("Registry") -local Video = __include("codecs/video/Video") -local AudioWrap = __include("containers/AudioWrap") -local Rbx = __include("codecs/model/Rbx") -local ImageOps = __include("ops/ImageOps") local host = __include("host") local F = {} @@ -47,7 +43,6 @@ F.version = "0.1.0" F.Err = Err F.Types = Types F.Bytes = Bytes -F.Rbx = Rbx F.null = Types.null F.host = host F.plugins = {} :: { [string]: any } -- injected optional dependencies (plugins.brep for cad/step) @@ -366,7 +361,7 @@ end -- api hooks (a format never requires another format): opts.decodeImage / encodeImage, opts.plugins, opts.decodeModule, -- opts.openAudio (containers/AudioWrap: PCM -> WAV, Opus / Vorbis -> Ogg, AAC -> ADTS, MP3 / FLAC / AC-3 as they are) local function openAudio(demuxer: any, track: any, sbr: boolean?): (any, Err.Err?) - local buf, fmt, err = AudioWrap.wrap(demuxer, track) + local buf, fmt, err = __include("containers/AudioWrap").wrap(demuxer, track) if not buf then return nil, err end @@ -378,7 +373,7 @@ local function openAudio(demuxer: any, track: any, sbr: boolean?): (any, Err.Err local skip = if type(track.codecDelay) == "number" and track.codecDelay > 0 then math.floor(track.codecDelay * dec.sampleRate + 0.5) else 0 local length = if type(track.playDuration) == "number" and track.playDuration > 0 then math.floor(track.playDuration * dec.sampleRate + 0.5) else nil if skip > 0 or length then - dec = AudioWrap.trim(dec, skip, length) + dec = __include("containers/AudioWrap").trim(dec, skip, length) end end return dec, oerr @@ -558,7 +553,7 @@ local function videoToImage(v: any, o: Options): (any, Err.Err?) if #images == 0 then return nil, Err.new(Err.ARG, "save: the video has no frames") end - local img, ierr = ImageOps.fromFrames(images, delays) + local img, ierr = __include("ops/ImageOps").fromFrames(images, delays) if not img then return nil, ierr end @@ -844,7 +839,7 @@ F.video.fromImage = function(img: any, opts: Options?): (any, Err.Err?) end local frames, delays = { img }, { 0.1 } if type(img.frames) == "table" and #img.frames > 0 then - local list, cerr = ImageOps.coalesce(img) + local list, cerr = __include("ops/ImageOps").coalesce(img) if not list then return nil, cerr end @@ -854,19 +849,18 @@ F.video.fromImage = function(img: any, opts: Options?): (any, Err.Err?) delays[i] = if type(f.delay) == "number" and f.delay > 0 then f.delay else 0.1 end elseif img.format ~= "rgba8" and img.format ~= "yuv420p" then - local c, cerr = ImageOps.convert(img, "rgba8") + local c, cerr = __include("ops/ImageOps").convert(img, "rgba8") if not c then return nil, cerr end frames = { c } end local src = type(img.meta) == "table" and img.meta.source - return Video.fromFrames(frames, delays, { format = type(src) == "table" and src.format or "image", loops = img.loops, meta = img.meta }) + return __include("codecs/video/Video").fromFrames(frames, delays, { format = type(src) == "table" and src.format or "image", loops = img.loops, meta = img.meta }) end F.video.fromFrames = function(images: any, delays: any?, opts: Options?): (any, Err.Err?) - return Video.fromFrames(images, delays, opts) + return __include("codecs/video/Video").fromFrames(images, delays, opts) end -F.video.codecs = Video F.model.loadTextures = function(scene: any, opts: Options?): (any, { [number]: Err.Err }) local errs: { [number]: Err.Err } = {} @@ -895,7 +889,7 @@ end local OPS: { [string]: () -> any } = { image = function() - return ImageOps + return __include("ops/ImageOps") end, mesh = function() return __include("ops/MeshOps") @@ -940,6 +934,28 @@ F.ops = setmetatable({}, { end, }) :: any +-- F.Rbx (codecs/model/Rbx), F.video.codecs (codecs/video/Video): required on first use +setmetatable(F, { + __index = function(t: any, k: string): any + if k == "Rbx" then + local m = __include("codecs/model/Rbx") + rawset(t, k, m) + return m + end + return nil + end, +}) +setmetatable(F.video, { + __index = function(t: any, k: string): any + if k == "codecs" then + local m = __include("codecs/video/Video") + rawset(t, k, m) + return m + end + return nil + end, +}) + return F end __FILES["Registry"] = function() diff --git a/build/Rosetta.luau.linemap.json b/build/Rosetta.luau.linemap.json index a8cc13c..61abb02 100644 --- a/build/Rosetta.luau.linemap.json +++ b/build/Rosetta.luau.linemap.json @@ -1,623 +1,623 @@ [ [29, "src/Rosetta/init.luau"], -[946, "src/Rosetta/Registry.luau"], -[3563, "src/Rosetta/Sniffs.luau"], -[7773, "src/Rosetta/Types.luau"], -[8890, "src/Rosetta/archive/7z/init.luau"], -[9275, "src/Rosetta/archive/7z/Header.luau"], -[9802, "src/Rosetta/archive/adf/init.luau"], -[10084, "src/Rosetta/archive/applesingle/init.luau"], -[10270, "src/Rosetta/archive/ar/init.luau"], -[10673, "src/Rosetta/archive/arj/init.luau"], -[10883, "src/Rosetta/archive/binhex/init.luau"], -[11132, "src/Rosetta/archive/br/init.luau"], -[11207, "src/Rosetta/archive/bz2/init.luau"], -[11271, "src/Rosetta/archive/cab/init.luau"], -[11684, "src/Rosetta/archive/cab/Sum.luau"], -[11725, "src/Rosetta/archive/cpio/init.luau"], -[11893, "src/Rosetta/archive/d64/init.luau"], -[12307, "src/Rosetta/archive/fat/init.luau"], -[12429, "src/Rosetta/archive/grp/init.luau"], -[12543, "src/Rosetta/archive/gzip/init.luau"], -[12728, "src/Rosetta/archive/iso/init.luau"], -[12800, "src/Rosetta/archive/lha/init.luau"], -[13225, "src/Rosetta/archive/lz4/init.luau"], -[13569, "src/Rosetta/archive/macbinary/init.luau"], -[13767, "src/Rosetta/archive/mpq/init.luau"], -[14173, "src/Rosetta/archive/mpq/Crypt.luau"], -[14238, "src/Rosetta/archive/pak/init.luau"], -[14372, "src/Rosetta/archive/rpm/init.luau"], -[14696, "src/Rosetta/archive/tar/init.luau"], -[14814, "src/Rosetta/archive/unitypackage/init.luau"], -[15050, "src/Rosetta/archive/uu/init.luau"], -[15320, "src/Rosetta/archive/vpk/init.luau"], -[15631, "src/Rosetta/archive/vswap/init.luau"], -[15901, "src/Rosetta/archive/wad/init.luau"], -[16355, "src/Rosetta/archive/wad/Picture.luau"], -[16457, "src/Rosetta/archive/wad2/init.luau"], -[16739, "src/Rosetta/archive/xz/init.luau"], -[16839, "src/Rosetta/archive/yenc/init.luau"], -[17111, "src/Rosetta/archive/z/init.luau"], -[17207, "src/Rosetta/archive/zip/init.luau"], -[17426, "src/Rosetta/archive/zoo/init.luau"], -[17622, "src/Rosetta/archive/zst/init.luau"], -[17686, "src/Rosetta/audio/aac/init.luau"], -[17899, "src/Rosetta/audio/ac3/init.luau"], -[18046, "src/Rosetta/audio/adpcm/init.luau"], -[18192, "src/Rosetta/audio/adx/init.luau"], -[18424, "src/Rosetta/audio/aiff/init.luau"], -[18816, "src/Rosetta/audio/ape/init.luau"], -[18945, "src/Rosetta/audio/au/init.luau"], -[19107, "src/Rosetta/audio/brstm/init.luau"], -[19399, "src/Rosetta/audio/caf/init.luau"], -[20066, "src/Rosetta/audio/flac/init.luau"], -[20215, "src/Rosetta/audio/flac/Meta.luau"], -[20437, "src/Rosetta/audio/flac/Stream.luau"], -[20807, "src/Rosetta/audio/m4a/init.luau"], -[21150, "src/Rosetta/audio/mp3/init.luau"], -[21411, "src/Rosetta/audio/mp3/Index.luau"], -[21602, "src/Rosetta/audio/mp3/Stream.luau"], -[21829, "src/Rosetta/audio/mp3/Tags.luau"], -[22141, "src/Rosetta/audio/mpc/init.luau"], -[22236, "src/Rosetta/audio/opus/init.luau"], -[22615, "src/Rosetta/audio/opus/Encode.luau"], -[22727, "src/Rosetta/audio/qoa/init.luau"], -[22908, "src/Rosetta/audio/tta/init.luau"], -[23027, "src/Rosetta/audio/vag/init.luau"], -[23251, "src/Rosetta/audio/voc/init.luau"], -[23527, "src/Rosetta/audio/vorbis/init.luau"], -[23982, "src/Rosetta/audio/vorbis/Encode.luau"], -[24795, "src/Rosetta/audio/wav/init.luau"], -[25416, "src/Rosetta/audio/wav/Codecs.luau"], -[25595, "src/Rosetta/audio/wavpack/init.luau"], -[25803, "src/Rosetta/cad/step/init.luau"], -[26185, "src/Rosetta/cad/step/Brep.luau"], -[26420, "src/Rosetta/cad/step/Parse.luau"], -[26977, "src/Rosetta/cad/step/Write.luau"], -[27225, "src/Rosetta/codecs/audio/Aac/init.luau"], -[27633, "src/Rosetta/codecs/audio/Aac/Decode.luau"], -[28609, "src/Rosetta/codecs/audio/Aac/Ps.luau"], -[29199, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], -[30266, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], -[30385, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], -[31627, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], -[32119, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], -[32236, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], -[32649, "src/Rosetta/codecs/audio/Aac/Tables.luau"], -[32985, "src/Rosetta/codecs/audio/Ac3/init.luau"], -[33145, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], -[34030, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], -[34132, "src/Rosetta/codecs/audio/Adpcm/init.luau"], -[34886, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], -[35189, "src/Rosetta/codecs/audio/Alac/init.luau"], -[35424, "src/Rosetta/codecs/audio/Alac/Decode.luau"], -[35843, "src/Rosetta/codecs/audio/Alac/Encode.luau"], -[36255, "src/Rosetta/codecs/audio/Ape/init.luau"], -[36471, "src/Rosetta/codecs/audio/Ape/Decode.luau"], -[37232, "src/Rosetta/codecs/audio/ApeTag.luau"], -[37330, "src/Rosetta/codecs/audio/Flac/init.luau"], -[37342, "src/Rosetta/codecs/audio/Flac/Encode.luau"], -[38291, "src/Rosetta/codecs/audio/Flac/Frame.luau"], -[38911, "src/Rosetta/codecs/audio/Hively/init.luau"], -[39108, "src/Rosetta/codecs/audio/Hively/Load.luau"], -[39358, "src/Rosetta/codecs/audio/Hively/Player.luau"], -[40317, "src/Rosetta/codecs/audio/Hively/Tables.luau"], -[40537, "src/Rosetta/codecs/audio/Mdct/init.luau"], -[40757, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], -[41011, "src/Rosetta/codecs/audio/MidiRender.luau"], -[41358, "src/Rosetta/codecs/audio/Mpa/init.luau"], -[41373, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], -[41432, "src/Rosetta/codecs/audio/Mpa/Core.luau"], -[43090, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], -[43383, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], -[43768, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], -[44409, "src/Rosetta/codecs/audio/Mpa/Header.luau"], -[44550, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], -[44777, "src/Rosetta/codecs/audio/Musepack/init.luau"], -[45123, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], -[46017, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], -[46396, "src/Rosetta/codecs/audio/Opus/init.luau"], -[46411, "src/Rosetta/codecs/audio/Opus/Celt.luau"], -[48283, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], -[49348, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], -[49409, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], -[49873, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], -[50224, "src/Rosetta/codecs/audio/Opus/Packet.luau"], -[50457, "src/Rosetta/codecs/audio/Opus/Silk.luau"], -[52499, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], -[52873, "src/Rosetta/codecs/audio/Pcm/init.luau"], -[53137, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], -[53434, "src/Rosetta/codecs/audio/Qoa/init.luau"], -[53716, "src/Rosetta/codecs/audio/Resample/init.luau"], -[54111, "src/Rosetta/codecs/audio/SoundFont/init.luau"], -[54166, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], -[54310, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], -[54824, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], -[55623, "src/Rosetta/codecs/audio/Stream.luau"], -[55785, "src/Rosetta/codecs/audio/Tracker/init.luau"], -[56268, "src/Rosetta/codecs/audio/Tracker/Load.luau"], -[56547, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], -[56794, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], -[56923, "src/Rosetta/codecs/audio/Tracker/Player.luau"], -[58912, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], -[59029, "src/Rosetta/codecs/audio/Tta/init.luau"], -[59147, "src/Rosetta/codecs/audio/Tta/Decode.luau"], -[59399, "src/Rosetta/codecs/audio/Vorbis/init.luau"], -[59413, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], -[59797, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], -[60370, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], -[60792, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], -[60832, "src/Rosetta/codecs/audio/VorbisComment.luau"], -[60885, "src/Rosetta/codecs/audio/WavPack/init.luau"], -[61108, "src/Rosetta/codecs/audio/WavPack/Block.luau"], -[62563, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], -[62626, "src/Rosetta/codecs/compress/Brotli/init.luau"], -[62725, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], -[63710, "src/Rosetta/codecs/compress/Brotli/Static.luau"], -[64578, "src/Rosetta/codecs/compress/Bzip2/init.luau"], -[64622, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], -[65135, "src/Rosetta/codecs/compress/Deflate/init.luau"], -[65548, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], -[66030, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], -[66551, "src/Rosetta/codecs/compress/Explode.luau"], -[66747, "src/Rosetta/codecs/compress/Lz4.luau"], -[67016, "src/Rosetta/codecs/compress/Lzh/init.luau"], -[67620, "src/Rosetta/codecs/compress/Lzma/init.luau"], -[68160, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], -[68227, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], -[68700, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], -[68876, "src/Rosetta/codecs/compress/Lzw/init.luau"], -[69144, "src/Rosetta/codecs/compress/Lzx.luau"], -[69578, "src/Rosetta/codecs/compress/PackBits.luau"], -[69668, "src/Rosetta/codecs/compress/Quantum.luau"], -[69905, "src/Rosetta/codecs/compress/UnixCompress.luau"], -[70209, "src/Rosetta/codecs/compress/Xxh32.luau"], -[70278, "src/Rosetta/codecs/compress/Zstd/init.luau"], -[70335, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], -[71319, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], -[71471, "src/Rosetta/codecs/entropy/Huffman.luau"], -[71758, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], -[71769, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], -[71990, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], -[72234, "src/Rosetta/codecs/font/Bitmap.luau"], -[72435, "src/Rosetta/codecs/font/Cff/init.luau"], -[73076, "src/Rosetta/codecs/font/GlyphNames.luau"], -[73226, "src/Rosetta/codecs/font/TrueType/init.luau"], -[73540, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], -[73932, "src/Rosetta/codecs/font/TrueType/Tables.luau"], -[74434, "src/Rosetta/codecs/image/Bcn/init.luau"], -[74541, "src/Rosetta/codecs/image/Bcn/Decode.luau"], -[75025, "src/Rosetta/codecs/image/Bcn/Encode.luau"], -[75454, "src/Rosetta/codecs/image/Blend.luau"], -[75833, "src/Rosetta/codecs/image/Dct/init.luau"], -[76328, "src/Rosetta/codecs/image/Etc.luau"], -[76626, "src/Rosetta/codecs/image/Half.luau"], -[76695, "src/Rosetta/codecs/image/Jpeg/init.luau"], -[77049, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], -[77457, "src/Rosetta/codecs/image/Jpeg/Color.luau"], -[77822, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], -[78587, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], -[79468, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], -[79945, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], -[80023, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], -[80090, "src/Rosetta/codecs/image/Miptex.luau"], -[80390, "src/Rosetta/codecs/image/Pixels.luau"], -[80710, "src/Rosetta/codecs/image/Quantize/init.luau"], -[81171, "src/Rosetta/codecs/image/Raster.luau"], -[81868, "src/Rosetta/codecs/image/Texel.luau"], -[82241, "src/Rosetta/codecs/image/Texture.luau"], -[82386, "src/Rosetta/codecs/image/Vp8/init.luau"], -[82528, "src/Rosetta/codecs/image/Vp8/Decode.luau"], -[84508, "src/Rosetta/codecs/image/Vp8/Predict.luau"], -[84771, "src/Rosetta/codecs/image/Vp8/Tables.luau"], -[85021, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], -[85163, "src/Rosetta/codecs/image/Vp8L/init.luau"], -[85267, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], -[86207, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], -[87159, "src/Rosetta/codecs/image/Yuv.luau"], -[87480, "src/Rosetta/codecs/model/Brush.luau"], -[88120, "src/Rosetta/codecs/model/Displacement.luau"], -[88269, "src/Rosetta/codecs/model/DoomMap/init.luau"], -[88714, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], -[88964, "src/Rosetta/codecs/model/Draco/init.luau"], -[89296, "src/Rosetta/codecs/model/Draco/Attributes.luau"], -[89765, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], -[90954, "src/Rosetta/codecs/model/Draco/Int64.luau"], -[91103, "src/Rosetta/codecs/model/Draco/KdTree.luau"], -[91462, "src/Rosetta/codecs/model/Draco/Predict.luau"], -[92424, "src/Rosetta/codecs/model/Draco/Reader.luau"], -[92898, "src/Rosetta/codecs/model/Mat4.luau"], -[93157, "src/Rosetta/codecs/model/MeshFlatten.luau"], -[93685, "src/Rosetta/codecs/model/Minecraft/init.luau"], -[94237, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], -[94316, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], -[94423, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], -[94629, "src/Rosetta/codecs/model/Patch.luau"], -[94753, "src/Rosetta/codecs/model/Polygon.luau"], -[94987, "src/Rosetta/codecs/model/Rbx/init.luau"], -[95224, "src/Rosetta/codecs/model/Rbx/Binary.luau"], -[95978, "src/Rosetta/codecs/model/Rig.luau"], -[96221, "src/Rosetta/codecs/model/Sampler.luau"], -[96381, "src/Rosetta/codecs/model/SourceAnim.luau"], -[96602, "src/Rosetta/codecs/model/Vrml/init.luau"], -[96750, "src/Rosetta/codecs/model/Vrml/Build.luau"], -[97324, "src/Rosetta/codecs/model/Vrml/Fields.luau"], -[97487, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], -[98236, "src/Rosetta/codecs/model/Vrml/Parse.luau"], -[98758, "src/Rosetta/codecs/model/Vrml/Write.luau"], -[99485, "src/Rosetta/codecs/model/Vrml/Xml.luau"], -[99717, "src/Rosetta/codecs/text/GodotVariant.luau"], -[100376, "src/Rosetta/codecs/text/Json/init.luau"], -[100645, "src/Rosetta/codecs/text/Json/Decode.luau"], -[101080, "src/Rosetta/codecs/text/Json/Encode.luau"], -[101425, "src/Rosetta/codecs/text/KeyValues/init.luau"], -[101995, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], -[102301, "src/Rosetta/codecs/text/Lexer/init.luau"], -[102433, "src/Rosetta/codecs/text/Nbt/init.luau"], -[102786, "src/Rosetta/codecs/text/Nbt/Binary.luau"], -[103478, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], -[104118, "src/Rosetta/codecs/text/Nbt/Value.luau"], -[104356, "src/Rosetta/codecs/text/Text/init.luau"], -[104447, "src/Rosetta/codecs/text/Url/init.luau"], -[104652, "src/Rosetta/codecs/text/Xml/init.luau"], -[105102, "src/Rosetta/codecs/text/Xml/Parse.luau"], -[105906, "src/Rosetta/codecs/video/Dsp.luau"], -[106744, "src/Rosetta/codecs/video/H263/init.luau"], -[106901, "src/Rosetta/codecs/video/H263/Decoder.luau"], -[107759, "src/Rosetta/codecs/video/H263/Tables.luau"], -[107963, "src/Rosetta/codecs/video/H264/init.luau"], -[108353, "src/Rosetta/codecs/video/H264/Bitstream.luau"], -[108628, "src/Rosetta/codecs/video/H264/Cabac.luau"], -[109759, "src/Rosetta/codecs/video/H264/Cavlc.luau"], -[110527, "src/Rosetta/codecs/video/H264/Deblock.luau"], -[110789, "src/Rosetta/codecs/video/H264/Decoder.luau"], -[111855, "src/Rosetta/codecs/video/H264/Inter.luau"], -[112181, "src/Rosetta/codecs/video/H264/Intra.luau"], -[112588, "src/Rosetta/codecs/video/H264/Mb.luau"], -[113542, "src/Rosetta/codecs/video/H264/Params.luau"], -[113990, "src/Rosetta/codecs/video/H264/Slice.luau"], -[114242, "src/Rosetta/codecs/video/H264/Tables.luau"], -[114284, "src/Rosetta/codecs/video/H264/Transform.luau"], -[114449, "src/Rosetta/codecs/video/Legacy/init.luau"], -[114648, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], -[114945, "src/Rosetta/codecs/video/Legacy/Flic.luau"], -[115312, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], -[115430, "src/Rosetta/codecs/video/Legacy/Picture.luau"], -[115538, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], -[115811, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], -[116206, "src/Rosetta/codecs/video/Legacy/Smc.luau"], -[116383, "src/Rosetta/codecs/video/Mpeg1/init.luau"], -[116396, "src/Rosetta/codecs/video/Mpeg2/init.luau"], -[116770, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], -[118297, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], -[118437, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], -[118576, "src/Rosetta/codecs/video/Theora/init.luau"], -[118840, "src/Rosetta/codecs/video/Theora/Decoder.luau"], -[120104, "src/Rosetta/codecs/video/Theora/Header.luau"], -[120468, "src/Rosetta/codecs/video/Video/init.luau"], -[121083, "src/Rosetta/codecs/video/Video/Disposable.luau"], -[121294, "src/Rosetta/codecs/video/Video/Pool.luau"], -[121346, "src/Rosetta/codecs/video/Video/Source.luau"], -[121632, "src/Rosetta/containers/Archive.luau"], -[121899, "src/Rosetta/containers/AudioWrap.luau"], -[122409, "src/Rosetta/containers/Avi/init.luau"], -[122962, "src/Rosetta/containers/Blend.luau"], -[123701, "src/Rosetta/containers/Chunks.luau"], -[123836, "src/Rosetta/containers/Cpio.luau"], -[124264, "src/Rosetta/containers/Demux.luau"], -[124550, "src/Rosetta/containers/Ebml/init.luau"], -[124864, "src/Rosetta/containers/Fat.luau"], -[125552, "src/Rosetta/containers/Iso9660.luau"], -[126057, "src/Rosetta/containers/IsoBmff/init.luau"], -[126228, "src/Rosetta/containers/IsoBmff/Box.luau"], -[126417, "src/Rosetta/containers/IsoBmff/Demux.luau"], -[127263, "src/Rosetta/containers/IsoBmff/Meta.luau"], -[127785, "src/Rosetta/containers/IsoBmff/Mux.luau"], -[128302, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], -[128420, "src/Rosetta/containers/MacFile.luau"], -[128569, "src/Rosetta/containers/MpegEs.luau"], -[128736, "src/Rosetta/containers/MpegPs/init.luau"], -[128957, "src/Rosetta/containers/MpegTs/init.luau"], -[129750, "src/Rosetta/containers/Ogg/init.luau"], -[130175, "src/Rosetta/containers/Ogg/Mux.luau"], -[130364, "src/Rosetta/containers/Ogg/Page.luau"], -[130530, "src/Rosetta/containers/Riff/init.luau"], -[130847, "src/Rosetta/containers/Tar.luau"], -[131261, "src/Rosetta/containers/Zip/init.luau"], -[131893, "src/Rosetta/core/Adler32.luau"], -[131953, "src/Rosetta/core/Base64.luau"], -[132181, "src/Rosetta/core/Bits.luau"], -[132474, "src/Rosetta/core/Bytes.luau"], -[133001, "src/Rosetta/core/Crc16.luau"], -[133053, "src/Rosetta/core/Crc32.luau"], -[133204, "src/Rosetta/core/Err.luau"], -[133286, "src/Rosetta/core/Input.luau"], -[133362, "src/Rosetta/core/Md5.luau"], -[133520, "src/Rosetta/core/Sniff.luau"], -[133549, "src/Rosetta/data/cbor/init.luau"], -[133648, "src/Rosetta/data/cbor/Codec.luau"], -[134217, "src/Rosetta/data/csv/init.luau"], -[134529, "src/Rosetta/data/ini/init.luau"], -[134775, "src/Rosetta/data/json/init.luau"], -[134867, "src/Rosetta/data/msgpack/init.luau"], -[134956, "src/Rosetta/data/msgpack/Codec.luau"], -[135398, "src/Rosetta/data/nbt/init.luau"], -[135457, "src/Rosetta/data/plist/init.luau"], -[135763, "src/Rosetta/data/plist/Binary.luau"], -[136030, "src/Rosetta/data/q3shader/init.luau"], -[136269, "src/Rosetta/data/q3skin/init.luau"], -[136365, "src/Rosetta/data/snbt/init.luau"], -[136428, "src/Rosetta/data/toml/init.luau"], -[136495, "src/Rosetta/data/toml/Decode.luau"], -[137123, "src/Rosetta/data/toml/Encode.luau"], -[137332, "src/Rosetta/data/tres/init.luau"], -[137477, "src/Rosetta/data/vdf/init.luau"], -[137578, "src/Rosetta/data/xml/init.luau"], -[137634, "src/Rosetta/data/yaml/init.luau"], -[137707, "src/Rosetta/data/yaml/Emit.luau"], -[137997, "src/Rosetta/data/yaml/Parse.luau"], -[139290, "src/Rosetta/font/bdf/init.luau"], -[139579, "src/Rosetta/font/bmfont/init.luau"], -[140006, "src/Rosetta/font/bmfont/Parse.luau"], -[140459, "src/Rosetta/font/eot/init.luau"], -[140691, "src/Rosetta/font/fon/init.luau"], -[140974, "src/Rosetta/font/hershey/init.luau"], -[141169, "src/Rosetta/font/pcf/init.luau"], -[141449, "src/Rosetta/font/psf/init.luau"], -[141769, "src/Rosetta/font/ttf/init.luau"], -[141820, "src/Rosetta/font/type1/init.luau"], -[142179, "src/Rosetta/font/type1/Charstring.luau"], -[142457, "src/Rosetta/font/woff/init.luau"], -[142589, "src/Rosetta/font/woff2/init.luau"], -[142646, "src/Rosetta/font/woff2/Rebuild.luau"], -[143186, "src/Rosetta/host/init.luau"], -[143231, "src/Rosetta/host/Love.luau"], -[143374, "src/Rosetta/host/LuaJIT.luau"], -[143424, "src/Rosetta/host/Luau.luau"], -[143447, "src/Rosetta/host/Roblox.luau"], -[143806, "src/Rosetta/image/ani/init.luau"], -[143986, "src/Rosetta/image/art/init.luau"], -[144474, "src/Rosetta/image/blp/init.luau"], -[144732, "src/Rosetta/image/bmp/init.luau"], -[145147, "src/Rosetta/image/dds/init.luau"], -[145630, "src/Rosetta/image/exr/init.luau"], -[146390, "src/Rosetta/image/exr/Codec.luau"], -[146501, "src/Rosetta/image/exr/Piz.luau"], -[146858, "src/Rosetta/image/gif/init.luau"], -[147374, "src/Rosetta/image/gif/Decode.luau"], -[147450, "src/Rosetta/image/hdr/init.luau"], -[147679, "src/Rosetta/image/hdr/Codec.luau"], -[147890, "src/Rosetta/image/icns/init.luau"], -[148221, "src/Rosetta/image/ico/init.luau"], -[148498, "src/Rosetta/image/ico/Dib.luau"], -[148593, "src/Rosetta/image/ilbm/init.luau"], -[148912, "src/Rosetta/image/jpeg/init.luau"], -[149071, "src/Rosetta/image/ktx/init.luau"], -[149731, "src/Rosetta/image/lmp/init.luau"], -[149864, "src/Rosetta/image/pcx/init.luau"], -[150128, "src/Rosetta/image/png/init.luau"], -[150763, "src/Rosetta/image/png/Apng.luau"], -[150843, "src/Rosetta/image/png/Decode.luau"], -[151388, "src/Rosetta/image/png/Encode.luau"], -[151591, "src/Rosetta/image/pnm/init.luau"], -[151969, "src/Rosetta/image/pnm/Codec.luau"], -[152246, "src/Rosetta/image/qoi/init.luau"], -[152368, "src/Rosetta/image/qoi/Codec.luau"], -[152525, "src/Rosetta/image/sgi/init.luau"], -[152810, "src/Rosetta/image/spr/init.luau"], -[153123, "src/Rosetta/image/sunras/init.luau"], -[153369, "src/Rosetta/image/tga/init.luau"], -[153639, "src/Rosetta/image/tga/Codec.luau"], -[153839, "src/Rosetta/image/tiff/init.luau"], -[154666, "src/Rosetta/image/tiff/Pixels.luau"], -[155056, "src/Rosetta/image/tim/init.luau"], -[155298, "src/Rosetta/image/vtf/init.luau"], -[155533, "src/Rosetta/image/webp/init.luau"], -[156143, "src/Rosetta/image/webp/Alpha.luau"], -[156219, "src/Rosetta/image/webp/Anim.luau"], -[156374, "src/Rosetta/image/xbm/init.luau"], -[156535, "src/Rosetta/image/xpm/init.luau"], -[156803, "src/Rosetta/image/xpm/Names.luau"], -[156859, "src/Rosetta/layered/aseprite/init.luau"], -[157597, "src/Rosetta/layered/ora/init.luau"], -[157884, "src/Rosetta/layered/psd/init.luau"], -[158619, "src/Rosetta/layered/psd/Channels.luau"], -[158971, "src/Rosetta/model/3ds/init.luau"], -[159054, "src/Rosetta/model/3ds/Build.luau"], -[159701, "src/Rosetta/model/3ds/Read.luau"], -[160197, "src/Rosetta/model/3ds/Write.luau"], -[161002, "src/Rosetta/model/3mf/init.luau"], -[161084, "src/Rosetta/model/3mf/Read.luau"], -[161672, "src/Rosetta/model/3mf/Write.luau"], -[162077, "src/Rosetta/model/ase/init.luau"], -[162200, "src/Rosetta/model/ase/Build.luau"], -[162774, "src/Rosetta/model/ase/Parse.luau"], -[162843, "src/Rosetta/model/ase/Write.luau"], -[163306, "src/Rosetta/model/b3d/init.luau"], -[163361, "src/Rosetta/model/b3d/Read.luau"], -[163932, "src/Rosetta/model/blend/init.luau"], -[164032, "src/Rosetta/model/blend/Anim.luau"], -[164561, "src/Rosetta/model/blend/Armature.luau"], -[165097, "src/Rosetta/model/blend/Driver.luau"], -[165272, "src/Rosetta/model/blend/Material.luau"], -[165624, "src/Rosetta/model/blend/Mesh.luau"], -[166312, "src/Rosetta/model/blend/Normals.luau"], -[166473, "src/Rosetta/model/blend/Prim.luau"], -[166980, "src/Rosetta/model/blend/Read.luau"], -[168068, "src/Rosetta/model/bsp/init.luau"], -[168259, "src/Rosetta/model/bsp/Lightmap.luau"], -[168325, "src/Rosetta/model/bsp/Quake.luau"], -[168714, "src/Rosetta/model/bsp/Quake3.luau"], -[168943, "src/Rosetta/model/bsp/Tree.luau"], -[169331, "src/Rosetta/model/buildmap/init.luau"], -[169603, "src/Rosetta/model/buildmap/Geometry.luau"], -[170006, "src/Rosetta/model/d3map/init.luau"], -[170288, "src/Rosetta/model/d3map/Parse.luau"], -[170486, "src/Rosetta/model/dae/init.luau"], -[170675, "src/Rosetta/model/dae/Math.luau"], -[170722, "src/Rosetta/model/dae/Read.luau"], -[172572, "src/Rosetta/model/dae/Write.luau"], -[172941, "src/Rosetta/model/fbx/init.luau"], -[173089, "src/Rosetta/model/fbx/Ascii.luau"], -[173359, "src/Rosetta/model/fbx/Binary.luau"], -[173814, "src/Rosetta/model/fbx/Read.luau"], -[175176, "src/Rosetta/model/fbx/Write.luau"], -[176161, "src/Rosetta/model/fbx/Xform.luau"], -[176202, "src/Rosetta/model/gltf/init.luau"], -[176439, "src/Rosetta/model/gltf/Pack.luau"], -[176508, "src/Rosetta/model/gltf/Read.luau"], -[177249, "src/Rosetta/model/gltf/Write.luau"], -[177935, "src/Rosetta/model/godot/init.luau"], -[178026, "src/Rosetta/model/godot/Build.luau"], -[178568, "src/Rosetta/model/godot/Primitives.luau"], -[178843, "src/Rosetta/model/godot/Surface.luau"], -[179328, "src/Rosetta/model/godot/Write.luau"], -[179657, "src/Rosetta/model/iqm/init.luau"], -[179733, "src/Rosetta/model/iqm/Read.luau"], -[180088, "src/Rosetta/model/iqm/Write.luau"], -[180775, "src/Rosetta/model/ldraw/init.luau"], -[180853, "src/Rosetta/model/ldraw/Colors.luau"], -[181171, "src/Rosetta/model/ldraw/Read.luau"], -[181748, "src/Rosetta/model/lwo/init.luau"], -[181824, "src/Rosetta/model/lwo/Build.luau"], -[182286, "src/Rosetta/model/lwo/Parse.luau"], -[182829, "src/Rosetta/model/map/init.luau"], -[183146, "src/Rosetta/model/map/Build.luau"], -[183390, "src/Rosetta/model/map/Parse.luau"], -[183775, "src/Rosetta/model/map/Write.luau"], -[183921, "src/Rosetta/model/mca/init.luau"], -[184263, "src/Rosetta/model/mca/Chunk.luau"], -[184396, "src/Rosetta/model/mca/Lz4Block.luau"], -[184466, "src/Rosetta/model/md2/init.luau"], -[184665, "src/Rosetta/model/md3/init.luau"], -[184893, "src/Rosetta/model/md5/init.luau"], -[184974, "src/Rosetta/model/md5/Read.luau"], -[185407, "src/Rosetta/model/mdl/init.luau"], -[185489, "src/Rosetta/model/mdl/HalfLife.luau"], -[185793, "src/Rosetta/model/mdl/Quake.luau"], -[186011, "src/Rosetta/model/ms3d/init.luau"], -[186083, "src/Rosetta/model/ms3d/Read.luau"], -[186529, "src/Rosetta/model/ms3d/Write.luau"], -[186998, "src/Rosetta/model/obj/init.luau"], -[187816, "src/Rosetta/model/obj/Mtl.luau"], -[188104, "src/Rosetta/model/off/init.luau"], -[188566, "src/Rosetta/model/ply/init.luau"], -[189671, "src/Rosetta/model/ply/Binary.luau"], -[189872, "src/Rosetta/model/pmx/init.luau"], -[189941, "src/Rosetta/model/pmx/Build.luau"], -[190237, "src/Rosetta/model/pmx/Pmd.luau"], -[190572, "src/Rosetta/model/pmx/Read.luau"], -[190976, "src/Rosetta/model/proc/init.luau"], -[191358, "src/Rosetta/model/qb/init.luau"], -[191751, "src/Rosetta/model/rbxm/init.luau"], -[192344, "src/Rosetta/model/rbxmx/init.luau"], -[193020, "src/Rosetta/model/robloxmesh/init.luau"], -[193679, "src/Rosetta/model/robloxmesh/Parse.luau"], -[194136, "src/Rosetta/model/robloxmesh/Write.luau"], -[194245, "src/Rosetta/model/schematic/init.luau"], -[194566, "src/Rosetta/model/schematic/Common.luau"], -[194686, "src/Rosetta/model/schematic/Litematic.luau"], -[194897, "src/Rosetta/model/schematic/Mcedit.luau"], -[195141, "src/Rosetta/model/schematic/Sponge.luau"], -[195270, "src/Rosetta/model/smd/init.luau"], -[195337, "src/Rosetta/model/smd/Read.luau"], -[195606, "src/Rosetta/model/smd/Write.luau"], -[195849, "src/Rosetta/model/sourcemdl/init.luau"], -[196020, "src/Rosetta/model/sourcemdl/Build.luau"], -[196450, "src/Rosetta/model/sourcemdl/Material.luau"], -[196611, "src/Rosetta/model/sourcemdl/Mdl.luau"], -[197138, "src/Rosetta/model/sourcemdl/Phy.luau"], -[197261, "src/Rosetta/model/sourcemdl/Vtx.luau"], -[197443, "src/Rosetta/model/sourcemdl/Vvd.luau"], -[197537, "src/Rosetta/model/stl/init.luau"], -[197987, "src/Rosetta/model/stl/Decode.luau"], -[198061, "src/Rosetta/model/t3d/init.luau"], -[198155, "src/Rosetta/model/t3d/Build.luau"], -[198560, "src/Rosetta/model/t3d/Parse.luau"], -[198728, "src/Rosetta/model/udmf/init.luau"], -[198811, "src/Rosetta/model/usda/init.luau"], -[199020, "src/Rosetta/model/usda/Build.luau"], -[200298, "src/Rosetta/model/usda/Parse.luau"], -[201096, "src/Rosetta/model/usda/Write.luau"], -[201913, "src/Rosetta/model/vbsp/init.luau"], -[202359, "src/Rosetta/model/vbsp/Faces.luau"], -[202583, "src/Rosetta/model/vbsp/Props.luau"], -[202675, "src/Rosetta/model/vmf/init.luau"], -[203000, "src/Rosetta/model/vmf/Build.luau"], -[203424, "src/Rosetta/model/vox/init.luau"], -[204310, "src/Rosetta/model/vox/Grid.luau"], -[204367, "src/Rosetta/model/vrml/init.luau"], -[204433, "src/Rosetta/model/x/init.luau"], -[204563, "src/Rosetta/model/x/Build.luau"], -[205126, "src/Rosetta/model/x/Parse.luau"], -[205423, "src/Rosetta/model/x3d/init.luau"], -[205501, "src/Rosetta/music/669/init.luau"], -[205708, "src/Rosetta/music/ahx/init.luau"], -[205760, "src/Rosetta/music/far/init.luau"], -[205990, "src/Rosetta/music/hmp/init.luau"], -[206255, "src/Rosetta/music/hvl/init.luau"], -[206307, "src/Rosetta/music/it/init.luau"], -[206726, "src/Rosetta/music/it/Itsex.luau"], -[206843, "src/Rosetta/music/med/init.luau"], -[207491, "src/Rosetta/music/midi/init.luau"], -[207635, "src/Rosetta/music/midi/Smf.luau"], -[208047, "src/Rosetta/music/mod/init.luau"], -[208401, "src/Rosetta/music/mtm/init.luau"], -[208624, "src/Rosetta/music/mus/init.luau"], -[208782, "src/Rosetta/music/okt/init.luau"], -[209064, "src/Rosetta/music/ptm/init.luau"], -[209287, "src/Rosetta/music/s3m/init.luau"], -[209524, "src/Rosetta/music/sf2/init.luau"], -[209568, "src/Rosetta/music/stm/init.luau"], -[209800, "src/Rosetta/music/ult/init.luau"], -[210105, "src/Rosetta/music/umx/init.luau"], -[210322, "src/Rosetta/music/xm/init.luau"], -[210884, "src/Rosetta/music/xmi/init.luau"], -[211093, "src/Rosetta/ops/AudioOps.luau"], -[211572, "src/Rosetta/ops/ImageOps/init.luau"], -[212220, "src/Rosetta/ops/ImageOps/Kernels.luau"], -[212860, "src/Rosetta/ops/LayerOps.luau"], -[212953, "src/Rosetta/ops/MeshOps/init.luau"], -[214093, "src/Rosetta/ops/MeshOps/Greedy.luau"], -[214260, "src/Rosetta/ops/MusicOps.luau"], -[214609, "src/Rosetta/playlist/m3u/init.luau"], -[214962, "src/Rosetta/playlist/pls/init.luau"], -[215140, "src/Rosetta/playlist/xspf/init.luau"], -[215343, "src/Rosetta/subtitle/ass/init.luau"], -[215787, "src/Rosetta/subtitle/srt/init.luau"], -[215960, "src/Rosetta/subtitle/vtt/init.luau"], -[216163, "src/Rosetta/vector/gamemaps/init.luau"], -[216350, "src/Rosetta/vector/gamemaps/Expand.luau"], -[216447, "src/Rosetta/vector/ldtk/init.luau"], -[216539, "src/Rosetta/vector/ldtk/Read.luau"], -[216875, "src/Rosetta/vector/ldtk/Write.luau"], -[217523, "src/Rosetta/vector/ogmo/init.luau"], -[217642, "src/Rosetta/vector/ogmo/Read.luau"], -[218047, "src/Rosetta/vector/ogmo/Write.luau"], -[218401, "src/Rosetta/vector/svg/init.luau"], -[218487, "src/Rosetta/vector/svg/Parse.luau"], -[219233, "src/Rosetta/vector/svg/PathData.luau"], -[219601, "src/Rosetta/vector/svg/Render.luau"], -[220018, "src/Rosetta/vector/svg/Style.luau"], -[220390, "src/Rosetta/vector/svg/Write.luau"], -[220590, "src/Rosetta/vector/tiled/init.luau"], -[220770, "src/Rosetta/vector/tiled/Data.luau"], -[220921, "src/Rosetta/vector/tiled/Tmj.luau"], -[221552, "src/Rosetta/vector/tiled/Tmx.luau"], -[222164, "src/Rosetta/video/avi/init.luau"], -[222458, "src/Rosetta/video/fli/init.luau"], -[222609, "src/Rosetta/video/flv/init.luau"], -[222993, "src/Rosetta/video/flv/Amf.luau"], -[223151, "src/Rosetta/video/flv/Mux.luau"], -[223432, "src/Rosetta/video/h264/init.luau"], -[223571, "src/Rosetta/video/mkv/init.luau"], -[223727, "src/Rosetta/video/mkv/Mux.luau"], -[224006, "src/Rosetta/video/mkv/Parse.luau"], -[224727, "src/Rosetta/video/mp4/init.luau"], -[225055, "src/Rosetta/video/mpegps/init.luau"], -[225242, "src/Rosetta/video/mpegts/init.luau"], -[225488, "src/Rosetta/video/ogv/init.luau"], -[225883, "src/Rosetta/video/smk/init.luau"], -[226192, "src/Rosetta/video/smk/Audio.luau"], -[226312, "src/Rosetta/video/y4m/init.luau"] +[962, "src/Rosetta/Registry.luau"], +[3579, "src/Rosetta/Sniffs.luau"], +[7789, "src/Rosetta/Types.luau"], +[8906, "src/Rosetta/archive/7z/init.luau"], +[9291, "src/Rosetta/archive/7z/Header.luau"], +[9818, "src/Rosetta/archive/adf/init.luau"], +[10100, "src/Rosetta/archive/applesingle/init.luau"], +[10286, "src/Rosetta/archive/ar/init.luau"], +[10689, "src/Rosetta/archive/arj/init.luau"], +[10899, "src/Rosetta/archive/binhex/init.luau"], +[11148, "src/Rosetta/archive/br/init.luau"], +[11223, "src/Rosetta/archive/bz2/init.luau"], +[11287, "src/Rosetta/archive/cab/init.luau"], +[11700, "src/Rosetta/archive/cab/Sum.luau"], +[11741, "src/Rosetta/archive/cpio/init.luau"], +[11909, "src/Rosetta/archive/d64/init.luau"], +[12323, "src/Rosetta/archive/fat/init.luau"], +[12445, "src/Rosetta/archive/grp/init.luau"], +[12559, "src/Rosetta/archive/gzip/init.luau"], +[12744, "src/Rosetta/archive/iso/init.luau"], +[12816, "src/Rosetta/archive/lha/init.luau"], +[13241, "src/Rosetta/archive/lz4/init.luau"], +[13585, "src/Rosetta/archive/macbinary/init.luau"], +[13783, "src/Rosetta/archive/mpq/init.luau"], +[14189, "src/Rosetta/archive/mpq/Crypt.luau"], +[14254, "src/Rosetta/archive/pak/init.luau"], +[14388, "src/Rosetta/archive/rpm/init.luau"], +[14712, "src/Rosetta/archive/tar/init.luau"], +[14830, "src/Rosetta/archive/unitypackage/init.luau"], +[15066, "src/Rosetta/archive/uu/init.luau"], +[15336, "src/Rosetta/archive/vpk/init.luau"], +[15647, "src/Rosetta/archive/vswap/init.luau"], +[15917, "src/Rosetta/archive/wad/init.luau"], +[16371, "src/Rosetta/archive/wad/Picture.luau"], +[16473, "src/Rosetta/archive/wad2/init.luau"], +[16755, "src/Rosetta/archive/xz/init.luau"], +[16855, "src/Rosetta/archive/yenc/init.luau"], +[17127, "src/Rosetta/archive/z/init.luau"], +[17223, "src/Rosetta/archive/zip/init.luau"], +[17442, "src/Rosetta/archive/zoo/init.luau"], +[17638, "src/Rosetta/archive/zst/init.luau"], +[17702, "src/Rosetta/audio/aac/init.luau"], +[17915, "src/Rosetta/audio/ac3/init.luau"], +[18062, "src/Rosetta/audio/adpcm/init.luau"], +[18208, "src/Rosetta/audio/adx/init.luau"], +[18440, "src/Rosetta/audio/aiff/init.luau"], +[18832, "src/Rosetta/audio/ape/init.luau"], +[18961, "src/Rosetta/audio/au/init.luau"], +[19123, "src/Rosetta/audio/brstm/init.luau"], +[19415, "src/Rosetta/audio/caf/init.luau"], +[20082, "src/Rosetta/audio/flac/init.luau"], +[20231, "src/Rosetta/audio/flac/Meta.luau"], +[20453, "src/Rosetta/audio/flac/Stream.luau"], +[20823, "src/Rosetta/audio/m4a/init.luau"], +[21166, "src/Rosetta/audio/mp3/init.luau"], +[21427, "src/Rosetta/audio/mp3/Index.luau"], +[21618, "src/Rosetta/audio/mp3/Stream.luau"], +[21845, "src/Rosetta/audio/mp3/Tags.luau"], +[22157, "src/Rosetta/audio/mpc/init.luau"], +[22252, "src/Rosetta/audio/opus/init.luau"], +[22631, "src/Rosetta/audio/opus/Encode.luau"], +[22743, "src/Rosetta/audio/qoa/init.luau"], +[22924, "src/Rosetta/audio/tta/init.luau"], +[23043, "src/Rosetta/audio/vag/init.luau"], +[23267, "src/Rosetta/audio/voc/init.luau"], +[23543, "src/Rosetta/audio/vorbis/init.luau"], +[23998, "src/Rosetta/audio/vorbis/Encode.luau"], +[24811, "src/Rosetta/audio/wav/init.luau"], +[25432, "src/Rosetta/audio/wav/Codecs.luau"], +[25611, "src/Rosetta/audio/wavpack/init.luau"], +[25819, "src/Rosetta/cad/step/init.luau"], +[26201, "src/Rosetta/cad/step/Brep.luau"], +[26436, "src/Rosetta/cad/step/Parse.luau"], +[26993, "src/Rosetta/cad/step/Write.luau"], +[27241, "src/Rosetta/codecs/audio/Aac/init.luau"], +[27649, "src/Rosetta/codecs/audio/Aac/Decode.luau"], +[28625, "src/Rosetta/codecs/audio/Aac/Ps.luau"], +[29215, "src/Rosetta/codecs/audio/Aac/Sbr.luau"], +[30282, "src/Rosetta/codecs/audio/Aac/SbrBits.luau"], +[30401, "src/Rosetta/codecs/audio/Aac/SbrDct.luau"], +[31643, "src/Rosetta/codecs/audio/Aac/SbrHf.luau"], +[32135, "src/Rosetta/codecs/audio/Aac/SbrQmf.luau"], +[32252, "src/Rosetta/codecs/audio/Aac/SbrTables.luau"], +[32665, "src/Rosetta/codecs/audio/Aac/Tables.luau"], +[33001, "src/Rosetta/codecs/audio/Ac3/init.luau"], +[33161, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], +[34046, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], +[34148, "src/Rosetta/codecs/audio/Adpcm/init.luau"], +[34902, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], +[35205, "src/Rosetta/codecs/audio/Alac/init.luau"], +[35440, "src/Rosetta/codecs/audio/Alac/Decode.luau"], +[35859, "src/Rosetta/codecs/audio/Alac/Encode.luau"], +[36271, "src/Rosetta/codecs/audio/Ape/init.luau"], +[36487, "src/Rosetta/codecs/audio/Ape/Decode.luau"], +[37248, "src/Rosetta/codecs/audio/ApeTag.luau"], +[37346, "src/Rosetta/codecs/audio/Flac/init.luau"], +[37358, "src/Rosetta/codecs/audio/Flac/Encode.luau"], +[38307, "src/Rosetta/codecs/audio/Flac/Frame.luau"], +[38927, "src/Rosetta/codecs/audio/Hively/init.luau"], +[39124, "src/Rosetta/codecs/audio/Hively/Load.luau"], +[39374, "src/Rosetta/codecs/audio/Hively/Player.luau"], +[40333, "src/Rosetta/codecs/audio/Hively/Tables.luau"], +[40553, "src/Rosetta/codecs/audio/Mdct/init.luau"], +[40773, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], +[41027, "src/Rosetta/codecs/audio/MidiRender.luau"], +[41374, "src/Rosetta/codecs/audio/Mpa/init.luau"], +[41389, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], +[41448, "src/Rosetta/codecs/audio/Mpa/Core.luau"], +[43106, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], +[43399, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], +[43784, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], +[44425, "src/Rosetta/codecs/audio/Mpa/Header.luau"], +[44566, "src/Rosetta/codecs/audio/Mpa/Tables.luau"], +[44793, "src/Rosetta/codecs/audio/Musepack/init.luau"], +[45139, "src/Rosetta/codecs/audio/Musepack/Decode.luau"], +[46033, "src/Rosetta/codecs/audio/Musepack/Tables.luau"], +[46412, "src/Rosetta/codecs/audio/Opus/init.luau"], +[46427, "src/Rosetta/codecs/audio/Opus/Celt.luau"], +[48299, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], +[49364, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], +[49425, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], +[49889, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], +[50240, "src/Rosetta/codecs/audio/Opus/Packet.luau"], +[50473, "src/Rosetta/codecs/audio/Opus/Silk.luau"], +[52515, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"], +[52889, "src/Rosetta/codecs/audio/Pcm/init.luau"], +[53153, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], +[53450, "src/Rosetta/codecs/audio/Qoa/init.luau"], +[53732, "src/Rosetta/codecs/audio/Resample/init.luau"], +[54127, "src/Rosetta/codecs/audio/SoundFont/init.luau"], +[54182, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], +[54326, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], +[54840, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"], +[55639, "src/Rosetta/codecs/audio/Stream.luau"], +[55801, "src/Rosetta/codecs/audio/Tracker/init.luau"], +[56284, "src/Rosetta/codecs/audio/Tracker/Load.luau"], +[56563, "src/Rosetta/codecs/audio/Tracker/Mixer.luau"], +[56810, "src/Rosetta/codecs/audio/Tracker/Pcm.luau"], +[56939, "src/Rosetta/codecs/audio/Tracker/Player.luau"], +[58928, "src/Rosetta/codecs/audio/Tracker/Tables.luau"], +[59045, "src/Rosetta/codecs/audio/Tta/init.luau"], +[59163, "src/Rosetta/codecs/audio/Tta/Decode.luau"], +[59415, "src/Rosetta/codecs/audio/Vorbis/init.luau"], +[59429, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], +[59813, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], +[60386, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], +[60808, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"], +[60848, "src/Rosetta/codecs/audio/VorbisComment.luau"], +[60901, "src/Rosetta/codecs/audio/WavPack/init.luau"], +[61124, "src/Rosetta/codecs/audio/WavPack/Block.luau"], +[62579, "src/Rosetta/codecs/audio/WavPack/Tables.luau"], +[62642, "src/Rosetta/codecs/compress/Brotli/init.luau"], +[62741, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], +[63726, "src/Rosetta/codecs/compress/Brotli/Static.luau"], +[64594, "src/Rosetta/codecs/compress/Bzip2/init.luau"], +[64638, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], +[65151, "src/Rosetta/codecs/compress/Deflate/init.luau"], +[65564, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], +[66046, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"], +[66567, "src/Rosetta/codecs/compress/Explode.luau"], +[66763, "src/Rosetta/codecs/compress/Lz4.luau"], +[67032, "src/Rosetta/codecs/compress/Lzh/init.luau"], +[67636, "src/Rosetta/codecs/compress/Lzma/init.luau"], +[68176, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], +[68243, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], +[68716, "src/Rosetta/codecs/compress/Lzma/Filters.luau"], +[68892, "src/Rosetta/codecs/compress/Lzw/init.luau"], +[69160, "src/Rosetta/codecs/compress/Lzx.luau"], +[69594, "src/Rosetta/codecs/compress/PackBits.luau"], +[69684, "src/Rosetta/codecs/compress/Quantum.luau"], +[69921, "src/Rosetta/codecs/compress/UnixCompress.luau"], +[70225, "src/Rosetta/codecs/compress/Xxh32.luau"], +[70294, "src/Rosetta/codecs/compress/Zstd/init.luau"], +[70351, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], +[71335, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"], +[71487, "src/Rosetta/codecs/entropy/Huffman.luau"], +[71774, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], +[71785, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], +[72006, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"], +[72250, "src/Rosetta/codecs/font/Bitmap.luau"], +[72451, "src/Rosetta/codecs/font/Cff/init.luau"], +[73092, "src/Rosetta/codecs/font/GlyphNames.luau"], +[73242, "src/Rosetta/codecs/font/TrueType/init.luau"], +[73556, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], +[73948, "src/Rosetta/codecs/font/TrueType/Tables.luau"], +[74450, "src/Rosetta/codecs/image/Bcn/init.luau"], +[74557, "src/Rosetta/codecs/image/Bcn/Decode.luau"], +[75041, "src/Rosetta/codecs/image/Bcn/Encode.luau"], +[75470, "src/Rosetta/codecs/image/Blend.luau"], +[75849, "src/Rosetta/codecs/image/Dct/init.luau"], +[76344, "src/Rosetta/codecs/image/Etc.luau"], +[76642, "src/Rosetta/codecs/image/Half.luau"], +[76711, "src/Rosetta/codecs/image/Jpeg/init.luau"], +[77065, "src/Rosetta/codecs/image/Jpeg/Arith.luau"], +[77473, "src/Rosetta/codecs/image/Jpeg/Color.luau"], +[77838, "src/Rosetta/codecs/image/Jpeg/Decode.luau"], +[78603, "src/Rosetta/codecs/image/Jpeg/Encode.luau"], +[79484, "src/Rosetta/codecs/image/Jpeg/Scan.luau"], +[79961, "src/Rosetta/codecs/image/Jpeg/Tables.luau"], +[80039, "src/Rosetta/codecs/image/Jpeg/Yuv.luau"], +[80106, "src/Rosetta/codecs/image/Miptex.luau"], +[80406, "src/Rosetta/codecs/image/Pixels.luau"], +[80726, "src/Rosetta/codecs/image/Quantize/init.luau"], +[81187, "src/Rosetta/codecs/image/Raster.luau"], +[81884, "src/Rosetta/codecs/image/Texel.luau"], +[82257, "src/Rosetta/codecs/image/Texture.luau"], +[82402, "src/Rosetta/codecs/image/Vp8/init.luau"], +[82544, "src/Rosetta/codecs/image/Vp8/Decode.luau"], +[84524, "src/Rosetta/codecs/image/Vp8/Predict.luau"], +[84787, "src/Rosetta/codecs/image/Vp8/Tables.luau"], +[85037, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], +[85179, "src/Rosetta/codecs/image/Vp8L/init.luau"], +[85283, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], +[86223, "src/Rosetta/codecs/image/Vp8L/Encode.luau"], +[87175, "src/Rosetta/codecs/image/Yuv.luau"], +[87496, "src/Rosetta/codecs/model/Brush.luau"], +[88136, "src/Rosetta/codecs/model/Displacement.luau"], +[88285, "src/Rosetta/codecs/model/DoomMap/init.luau"], +[88730, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], +[88980, "src/Rosetta/codecs/model/Draco/init.luau"], +[89312, "src/Rosetta/codecs/model/Draco/Attributes.luau"], +[89781, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], +[90970, "src/Rosetta/codecs/model/Draco/Int64.luau"], +[91119, "src/Rosetta/codecs/model/Draco/KdTree.luau"], +[91478, "src/Rosetta/codecs/model/Draco/Predict.luau"], +[92440, "src/Rosetta/codecs/model/Draco/Reader.luau"], +[92914, "src/Rosetta/codecs/model/Mat4.luau"], +[93173, "src/Rosetta/codecs/model/MeshFlatten.luau"], +[93701, "src/Rosetta/codecs/model/Minecraft/init.luau"], +[94253, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], +[94332, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], +[94439, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], +[94645, "src/Rosetta/codecs/model/Patch.luau"], +[94769, "src/Rosetta/codecs/model/Polygon.luau"], +[95003, "src/Rosetta/codecs/model/Rbx/init.luau"], +[95240, "src/Rosetta/codecs/model/Rbx/Binary.luau"], +[95994, "src/Rosetta/codecs/model/Rig.luau"], +[96237, "src/Rosetta/codecs/model/Sampler.luau"], +[96397, "src/Rosetta/codecs/model/SourceAnim.luau"], +[96618, "src/Rosetta/codecs/model/Vrml/init.luau"], +[96766, "src/Rosetta/codecs/model/Vrml/Build.luau"], +[97340, "src/Rosetta/codecs/model/Vrml/Fields.luau"], +[97503, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], +[98252, "src/Rosetta/codecs/model/Vrml/Parse.luau"], +[98774, "src/Rosetta/codecs/model/Vrml/Write.luau"], +[99501, "src/Rosetta/codecs/model/Vrml/Xml.luau"], +[99733, "src/Rosetta/codecs/text/GodotVariant.luau"], +[100392, "src/Rosetta/codecs/text/Json/init.luau"], +[100661, "src/Rosetta/codecs/text/Json/Decode.luau"], +[101096, "src/Rosetta/codecs/text/Json/Encode.luau"], +[101441, "src/Rosetta/codecs/text/KeyValues/init.luau"], +[102011, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], +[102317, "src/Rosetta/codecs/text/Lexer/init.luau"], +[102449, "src/Rosetta/codecs/text/Nbt/init.luau"], +[102802, "src/Rosetta/codecs/text/Nbt/Binary.luau"], +[103494, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], +[104134, "src/Rosetta/codecs/text/Nbt/Value.luau"], +[104372, "src/Rosetta/codecs/text/Text/init.luau"], +[104463, "src/Rosetta/codecs/text/Url/init.luau"], +[104668, "src/Rosetta/codecs/text/Xml/init.luau"], +[105118, "src/Rosetta/codecs/text/Xml/Parse.luau"], +[105922, "src/Rosetta/codecs/video/Dsp.luau"], +[106760, "src/Rosetta/codecs/video/H263/init.luau"], +[106917, "src/Rosetta/codecs/video/H263/Decoder.luau"], +[107775, "src/Rosetta/codecs/video/H263/Tables.luau"], +[107979, "src/Rosetta/codecs/video/H264/init.luau"], +[108369, "src/Rosetta/codecs/video/H264/Bitstream.luau"], +[108644, "src/Rosetta/codecs/video/H264/Cabac.luau"], +[109775, "src/Rosetta/codecs/video/H264/Cavlc.luau"], +[110543, "src/Rosetta/codecs/video/H264/Deblock.luau"], +[110805, "src/Rosetta/codecs/video/H264/Decoder.luau"], +[111871, "src/Rosetta/codecs/video/H264/Inter.luau"], +[112197, "src/Rosetta/codecs/video/H264/Intra.luau"], +[112604, "src/Rosetta/codecs/video/H264/Mb.luau"], +[113558, "src/Rosetta/codecs/video/H264/Params.luau"], +[114006, "src/Rosetta/codecs/video/H264/Slice.luau"], +[114258, "src/Rosetta/codecs/video/H264/Tables.luau"], +[114300, "src/Rosetta/codecs/video/H264/Transform.luau"], +[114465, "src/Rosetta/codecs/video/Legacy/init.luau"], +[114664, "src/Rosetta/codecs/video/Legacy/Cinepak.luau"], +[114961, "src/Rosetta/codecs/video/Legacy/Flic.luau"], +[115328, "src/Rosetta/codecs/video/Legacy/Msvideo1.luau"], +[115446, "src/Rosetta/codecs/video/Legacy/Picture.luau"], +[115554, "src/Rosetta/codecs/video/Legacy/QtRle.luau"], +[115827, "src/Rosetta/codecs/video/Legacy/Smacker.luau"], +[116222, "src/Rosetta/codecs/video/Legacy/Smc.luau"], +[116399, "src/Rosetta/codecs/video/Mpeg1/init.luau"], +[116412, "src/Rosetta/codecs/video/Mpeg2/init.luau"], +[116786, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], +[118313, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], +[118453, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"], +[118592, "src/Rosetta/codecs/video/Theora/init.luau"], +[118856, "src/Rosetta/codecs/video/Theora/Decoder.luau"], +[120120, "src/Rosetta/codecs/video/Theora/Header.luau"], +[120484, "src/Rosetta/codecs/video/Video/init.luau"], +[121099, "src/Rosetta/codecs/video/Video/Disposable.luau"], +[121310, "src/Rosetta/codecs/video/Video/Pool.luau"], +[121362, "src/Rosetta/codecs/video/Video/Source.luau"], +[121648, "src/Rosetta/containers/Archive.luau"], +[121915, "src/Rosetta/containers/AudioWrap.luau"], +[122425, "src/Rosetta/containers/Avi/init.luau"], +[122978, "src/Rosetta/containers/Blend.luau"], +[123717, "src/Rosetta/containers/Chunks.luau"], +[123852, "src/Rosetta/containers/Cpio.luau"], +[124280, "src/Rosetta/containers/Demux.luau"], +[124566, "src/Rosetta/containers/Ebml/init.luau"], +[124880, "src/Rosetta/containers/Fat.luau"], +[125568, "src/Rosetta/containers/Iso9660.luau"], +[126073, "src/Rosetta/containers/IsoBmff/init.luau"], +[126244, "src/Rosetta/containers/IsoBmff/Box.luau"], +[126433, "src/Rosetta/containers/IsoBmff/Demux.luau"], +[127279, "src/Rosetta/containers/IsoBmff/Meta.luau"], +[127801, "src/Rosetta/containers/IsoBmff/Mux.luau"], +[128318, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], +[128436, "src/Rosetta/containers/MacFile.luau"], +[128585, "src/Rosetta/containers/MpegEs.luau"], +[128752, "src/Rosetta/containers/MpegPs/init.luau"], +[128973, "src/Rosetta/containers/MpegTs/init.luau"], +[129766, "src/Rosetta/containers/Ogg/init.luau"], +[130191, "src/Rosetta/containers/Ogg/Mux.luau"], +[130380, "src/Rosetta/containers/Ogg/Page.luau"], +[130546, "src/Rosetta/containers/Riff/init.luau"], +[130863, "src/Rosetta/containers/Tar.luau"], +[131277, "src/Rosetta/containers/Zip/init.luau"], +[131909, "src/Rosetta/core/Adler32.luau"], +[131969, "src/Rosetta/core/Base64.luau"], +[132197, "src/Rosetta/core/Bits.luau"], +[132490, "src/Rosetta/core/Bytes.luau"], +[133017, "src/Rosetta/core/Crc16.luau"], +[133069, "src/Rosetta/core/Crc32.luau"], +[133220, "src/Rosetta/core/Err.luau"], +[133302, "src/Rosetta/core/Input.luau"], +[133378, "src/Rosetta/core/Md5.luau"], +[133536, "src/Rosetta/core/Sniff.luau"], +[133565, "src/Rosetta/data/cbor/init.luau"], +[133664, "src/Rosetta/data/cbor/Codec.luau"], +[134233, "src/Rosetta/data/csv/init.luau"], +[134545, "src/Rosetta/data/ini/init.luau"], +[134791, "src/Rosetta/data/json/init.luau"], +[134883, "src/Rosetta/data/msgpack/init.luau"], +[134972, "src/Rosetta/data/msgpack/Codec.luau"], +[135414, "src/Rosetta/data/nbt/init.luau"], +[135473, "src/Rosetta/data/plist/init.luau"], +[135779, "src/Rosetta/data/plist/Binary.luau"], +[136046, "src/Rosetta/data/q3shader/init.luau"], +[136285, "src/Rosetta/data/q3skin/init.luau"], +[136381, "src/Rosetta/data/snbt/init.luau"], +[136444, "src/Rosetta/data/toml/init.luau"], +[136511, "src/Rosetta/data/toml/Decode.luau"], +[137139, "src/Rosetta/data/toml/Encode.luau"], +[137348, "src/Rosetta/data/tres/init.luau"], +[137493, "src/Rosetta/data/vdf/init.luau"], +[137594, "src/Rosetta/data/xml/init.luau"], +[137650, "src/Rosetta/data/yaml/init.luau"], +[137723, "src/Rosetta/data/yaml/Emit.luau"], +[138013, "src/Rosetta/data/yaml/Parse.luau"], +[139306, "src/Rosetta/font/bdf/init.luau"], +[139595, "src/Rosetta/font/bmfont/init.luau"], +[140022, "src/Rosetta/font/bmfont/Parse.luau"], +[140475, "src/Rosetta/font/eot/init.luau"], +[140707, "src/Rosetta/font/fon/init.luau"], +[140990, "src/Rosetta/font/hershey/init.luau"], +[141185, "src/Rosetta/font/pcf/init.luau"], +[141465, "src/Rosetta/font/psf/init.luau"], +[141785, "src/Rosetta/font/ttf/init.luau"], +[141836, "src/Rosetta/font/type1/init.luau"], +[142195, "src/Rosetta/font/type1/Charstring.luau"], +[142473, "src/Rosetta/font/woff/init.luau"], +[142605, "src/Rosetta/font/woff2/init.luau"], +[142662, "src/Rosetta/font/woff2/Rebuild.luau"], +[143202, "src/Rosetta/host/init.luau"], +[143247, "src/Rosetta/host/Love.luau"], +[143390, "src/Rosetta/host/LuaJIT.luau"], +[143440, "src/Rosetta/host/Luau.luau"], +[143463, "src/Rosetta/host/Roblox.luau"], +[143822, "src/Rosetta/image/ani/init.luau"], +[144002, "src/Rosetta/image/art/init.luau"], +[144490, "src/Rosetta/image/blp/init.luau"], +[144748, "src/Rosetta/image/bmp/init.luau"], +[145163, "src/Rosetta/image/dds/init.luau"], +[145646, "src/Rosetta/image/exr/init.luau"], +[146406, "src/Rosetta/image/exr/Codec.luau"], +[146517, "src/Rosetta/image/exr/Piz.luau"], +[146874, "src/Rosetta/image/gif/init.luau"], +[147390, "src/Rosetta/image/gif/Decode.luau"], +[147466, "src/Rosetta/image/hdr/init.luau"], +[147695, "src/Rosetta/image/hdr/Codec.luau"], +[147906, "src/Rosetta/image/icns/init.luau"], +[148237, "src/Rosetta/image/ico/init.luau"], +[148514, "src/Rosetta/image/ico/Dib.luau"], +[148609, "src/Rosetta/image/ilbm/init.luau"], +[148928, "src/Rosetta/image/jpeg/init.luau"], +[149087, "src/Rosetta/image/ktx/init.luau"], +[149747, "src/Rosetta/image/lmp/init.luau"], +[149880, "src/Rosetta/image/pcx/init.luau"], +[150144, "src/Rosetta/image/png/init.luau"], +[150779, "src/Rosetta/image/png/Apng.luau"], +[150859, "src/Rosetta/image/png/Decode.luau"], +[151404, "src/Rosetta/image/png/Encode.luau"], +[151607, "src/Rosetta/image/pnm/init.luau"], +[151985, "src/Rosetta/image/pnm/Codec.luau"], +[152262, "src/Rosetta/image/qoi/init.luau"], +[152384, "src/Rosetta/image/qoi/Codec.luau"], +[152541, "src/Rosetta/image/sgi/init.luau"], +[152826, "src/Rosetta/image/spr/init.luau"], +[153139, "src/Rosetta/image/sunras/init.luau"], +[153385, "src/Rosetta/image/tga/init.luau"], +[153655, "src/Rosetta/image/tga/Codec.luau"], +[153855, "src/Rosetta/image/tiff/init.luau"], +[154682, "src/Rosetta/image/tiff/Pixels.luau"], +[155072, "src/Rosetta/image/tim/init.luau"], +[155314, "src/Rosetta/image/vtf/init.luau"], +[155549, "src/Rosetta/image/webp/init.luau"], +[156159, "src/Rosetta/image/webp/Alpha.luau"], +[156235, "src/Rosetta/image/webp/Anim.luau"], +[156390, "src/Rosetta/image/xbm/init.luau"], +[156551, "src/Rosetta/image/xpm/init.luau"], +[156819, "src/Rosetta/image/xpm/Names.luau"], +[156875, "src/Rosetta/layered/aseprite/init.luau"], +[157613, "src/Rosetta/layered/ora/init.luau"], +[157900, "src/Rosetta/layered/psd/init.luau"], +[158635, "src/Rosetta/layered/psd/Channels.luau"], +[158987, "src/Rosetta/model/3ds/init.luau"], +[159070, "src/Rosetta/model/3ds/Build.luau"], +[159717, "src/Rosetta/model/3ds/Read.luau"], +[160213, "src/Rosetta/model/3ds/Write.luau"], +[161018, "src/Rosetta/model/3mf/init.luau"], +[161100, "src/Rosetta/model/3mf/Read.luau"], +[161688, "src/Rosetta/model/3mf/Write.luau"], +[162093, "src/Rosetta/model/ase/init.luau"], +[162216, "src/Rosetta/model/ase/Build.luau"], +[162790, "src/Rosetta/model/ase/Parse.luau"], +[162859, "src/Rosetta/model/ase/Write.luau"], +[163322, "src/Rosetta/model/b3d/init.luau"], +[163377, "src/Rosetta/model/b3d/Read.luau"], +[163948, "src/Rosetta/model/blend/init.luau"], +[164048, "src/Rosetta/model/blend/Anim.luau"], +[164577, "src/Rosetta/model/blend/Armature.luau"], +[165113, "src/Rosetta/model/blend/Driver.luau"], +[165288, "src/Rosetta/model/blend/Material.luau"], +[165640, "src/Rosetta/model/blend/Mesh.luau"], +[166328, "src/Rosetta/model/blend/Normals.luau"], +[166489, "src/Rosetta/model/blend/Prim.luau"], +[166996, "src/Rosetta/model/blend/Read.luau"], +[168084, "src/Rosetta/model/bsp/init.luau"], +[168275, "src/Rosetta/model/bsp/Lightmap.luau"], +[168341, "src/Rosetta/model/bsp/Quake.luau"], +[168730, "src/Rosetta/model/bsp/Quake3.luau"], +[168959, "src/Rosetta/model/bsp/Tree.luau"], +[169347, "src/Rosetta/model/buildmap/init.luau"], +[169619, "src/Rosetta/model/buildmap/Geometry.luau"], +[170022, "src/Rosetta/model/d3map/init.luau"], +[170304, "src/Rosetta/model/d3map/Parse.luau"], +[170502, "src/Rosetta/model/dae/init.luau"], +[170691, "src/Rosetta/model/dae/Math.luau"], +[170738, "src/Rosetta/model/dae/Read.luau"], +[172588, "src/Rosetta/model/dae/Write.luau"], +[172957, "src/Rosetta/model/fbx/init.luau"], +[173105, "src/Rosetta/model/fbx/Ascii.luau"], +[173375, "src/Rosetta/model/fbx/Binary.luau"], +[173830, "src/Rosetta/model/fbx/Read.luau"], +[175192, "src/Rosetta/model/fbx/Write.luau"], +[176177, "src/Rosetta/model/fbx/Xform.luau"], +[176218, "src/Rosetta/model/gltf/init.luau"], +[176455, "src/Rosetta/model/gltf/Pack.luau"], +[176524, "src/Rosetta/model/gltf/Read.luau"], +[177265, "src/Rosetta/model/gltf/Write.luau"], +[177951, "src/Rosetta/model/godot/init.luau"], +[178042, "src/Rosetta/model/godot/Build.luau"], +[178584, "src/Rosetta/model/godot/Primitives.luau"], +[178859, "src/Rosetta/model/godot/Surface.luau"], +[179344, "src/Rosetta/model/godot/Write.luau"], +[179673, "src/Rosetta/model/iqm/init.luau"], +[179749, "src/Rosetta/model/iqm/Read.luau"], +[180104, "src/Rosetta/model/iqm/Write.luau"], +[180791, "src/Rosetta/model/ldraw/init.luau"], +[180869, "src/Rosetta/model/ldraw/Colors.luau"], +[181187, "src/Rosetta/model/ldraw/Read.luau"], +[181764, "src/Rosetta/model/lwo/init.luau"], +[181840, "src/Rosetta/model/lwo/Build.luau"], +[182302, "src/Rosetta/model/lwo/Parse.luau"], +[182845, "src/Rosetta/model/map/init.luau"], +[183162, "src/Rosetta/model/map/Build.luau"], +[183406, "src/Rosetta/model/map/Parse.luau"], +[183791, "src/Rosetta/model/map/Write.luau"], +[183937, "src/Rosetta/model/mca/init.luau"], +[184279, "src/Rosetta/model/mca/Chunk.luau"], +[184412, "src/Rosetta/model/mca/Lz4Block.luau"], +[184482, "src/Rosetta/model/md2/init.luau"], +[184681, "src/Rosetta/model/md3/init.luau"], +[184909, "src/Rosetta/model/md5/init.luau"], +[184990, "src/Rosetta/model/md5/Read.luau"], +[185423, "src/Rosetta/model/mdl/init.luau"], +[185505, "src/Rosetta/model/mdl/HalfLife.luau"], +[185809, "src/Rosetta/model/mdl/Quake.luau"], +[186027, "src/Rosetta/model/ms3d/init.luau"], +[186099, "src/Rosetta/model/ms3d/Read.luau"], +[186545, "src/Rosetta/model/ms3d/Write.luau"], +[187014, "src/Rosetta/model/obj/init.luau"], +[187832, "src/Rosetta/model/obj/Mtl.luau"], +[188120, "src/Rosetta/model/off/init.luau"], +[188582, "src/Rosetta/model/ply/init.luau"], +[189687, "src/Rosetta/model/ply/Binary.luau"], +[189888, "src/Rosetta/model/pmx/init.luau"], +[189957, "src/Rosetta/model/pmx/Build.luau"], +[190253, "src/Rosetta/model/pmx/Pmd.luau"], +[190588, "src/Rosetta/model/pmx/Read.luau"], +[190992, "src/Rosetta/model/proc/init.luau"], +[191374, "src/Rosetta/model/qb/init.luau"], +[191767, "src/Rosetta/model/rbxm/init.luau"], +[192360, "src/Rosetta/model/rbxmx/init.luau"], +[193036, "src/Rosetta/model/robloxmesh/init.luau"], +[193695, "src/Rosetta/model/robloxmesh/Parse.luau"], +[194152, "src/Rosetta/model/robloxmesh/Write.luau"], +[194261, "src/Rosetta/model/schematic/init.luau"], +[194582, "src/Rosetta/model/schematic/Common.luau"], +[194702, "src/Rosetta/model/schematic/Litematic.luau"], +[194913, "src/Rosetta/model/schematic/Mcedit.luau"], +[195157, "src/Rosetta/model/schematic/Sponge.luau"], +[195286, "src/Rosetta/model/smd/init.luau"], +[195353, "src/Rosetta/model/smd/Read.luau"], +[195622, "src/Rosetta/model/smd/Write.luau"], +[195865, "src/Rosetta/model/sourcemdl/init.luau"], +[196036, "src/Rosetta/model/sourcemdl/Build.luau"], +[196466, "src/Rosetta/model/sourcemdl/Material.luau"], +[196627, "src/Rosetta/model/sourcemdl/Mdl.luau"], +[197154, "src/Rosetta/model/sourcemdl/Phy.luau"], +[197277, "src/Rosetta/model/sourcemdl/Vtx.luau"], +[197459, "src/Rosetta/model/sourcemdl/Vvd.luau"], +[197553, "src/Rosetta/model/stl/init.luau"], +[198003, "src/Rosetta/model/stl/Decode.luau"], +[198077, "src/Rosetta/model/t3d/init.luau"], +[198171, "src/Rosetta/model/t3d/Build.luau"], +[198576, "src/Rosetta/model/t3d/Parse.luau"], +[198744, "src/Rosetta/model/udmf/init.luau"], +[198827, "src/Rosetta/model/usda/init.luau"], +[199036, "src/Rosetta/model/usda/Build.luau"], +[200314, "src/Rosetta/model/usda/Parse.luau"], +[201112, "src/Rosetta/model/usda/Write.luau"], +[201929, "src/Rosetta/model/vbsp/init.luau"], +[202375, "src/Rosetta/model/vbsp/Faces.luau"], +[202599, "src/Rosetta/model/vbsp/Props.luau"], +[202691, "src/Rosetta/model/vmf/init.luau"], +[203016, "src/Rosetta/model/vmf/Build.luau"], +[203440, "src/Rosetta/model/vox/init.luau"], +[204326, "src/Rosetta/model/vox/Grid.luau"], +[204383, "src/Rosetta/model/vrml/init.luau"], +[204449, "src/Rosetta/model/x/init.luau"], +[204579, "src/Rosetta/model/x/Build.luau"], +[205142, "src/Rosetta/model/x/Parse.luau"], +[205439, "src/Rosetta/model/x3d/init.luau"], +[205517, "src/Rosetta/music/669/init.luau"], +[205724, "src/Rosetta/music/ahx/init.luau"], +[205776, "src/Rosetta/music/far/init.luau"], +[206006, "src/Rosetta/music/hmp/init.luau"], +[206271, "src/Rosetta/music/hvl/init.luau"], +[206323, "src/Rosetta/music/it/init.luau"], +[206742, "src/Rosetta/music/it/Itsex.luau"], +[206859, "src/Rosetta/music/med/init.luau"], +[207507, "src/Rosetta/music/midi/init.luau"], +[207651, "src/Rosetta/music/midi/Smf.luau"], +[208063, "src/Rosetta/music/mod/init.luau"], +[208417, "src/Rosetta/music/mtm/init.luau"], +[208640, "src/Rosetta/music/mus/init.luau"], +[208798, "src/Rosetta/music/okt/init.luau"], +[209080, "src/Rosetta/music/ptm/init.luau"], +[209303, "src/Rosetta/music/s3m/init.luau"], +[209540, "src/Rosetta/music/sf2/init.luau"], +[209584, "src/Rosetta/music/stm/init.luau"], +[209816, "src/Rosetta/music/ult/init.luau"], +[210121, "src/Rosetta/music/umx/init.luau"], +[210338, "src/Rosetta/music/xm/init.luau"], +[210900, "src/Rosetta/music/xmi/init.luau"], +[211109, "src/Rosetta/ops/AudioOps.luau"], +[211588, "src/Rosetta/ops/ImageOps/init.luau"], +[212236, "src/Rosetta/ops/ImageOps/Kernels.luau"], +[212876, "src/Rosetta/ops/LayerOps.luau"], +[212969, "src/Rosetta/ops/MeshOps/init.luau"], +[214109, "src/Rosetta/ops/MeshOps/Greedy.luau"], +[214276, "src/Rosetta/ops/MusicOps.luau"], +[214625, "src/Rosetta/playlist/m3u/init.luau"], +[214978, "src/Rosetta/playlist/pls/init.luau"], +[215156, "src/Rosetta/playlist/xspf/init.luau"], +[215359, "src/Rosetta/subtitle/ass/init.luau"], +[215803, "src/Rosetta/subtitle/srt/init.luau"], +[215976, "src/Rosetta/subtitle/vtt/init.luau"], +[216179, "src/Rosetta/vector/gamemaps/init.luau"], +[216366, "src/Rosetta/vector/gamemaps/Expand.luau"], +[216463, "src/Rosetta/vector/ldtk/init.luau"], +[216555, "src/Rosetta/vector/ldtk/Read.luau"], +[216891, "src/Rosetta/vector/ldtk/Write.luau"], +[217539, "src/Rosetta/vector/ogmo/init.luau"], +[217658, "src/Rosetta/vector/ogmo/Read.luau"], +[218063, "src/Rosetta/vector/ogmo/Write.luau"], +[218417, "src/Rosetta/vector/svg/init.luau"], +[218503, "src/Rosetta/vector/svg/Parse.luau"], +[219249, "src/Rosetta/vector/svg/PathData.luau"], +[219617, "src/Rosetta/vector/svg/Render.luau"], +[220034, "src/Rosetta/vector/svg/Style.luau"], +[220406, "src/Rosetta/vector/svg/Write.luau"], +[220606, "src/Rosetta/vector/tiled/init.luau"], +[220786, "src/Rosetta/vector/tiled/Data.luau"], +[220937, "src/Rosetta/vector/tiled/Tmj.luau"], +[221568, "src/Rosetta/vector/tiled/Tmx.luau"], +[222180, "src/Rosetta/video/avi/init.luau"], +[222474, "src/Rosetta/video/fli/init.luau"], +[222625, "src/Rosetta/video/flv/init.luau"], +[223009, "src/Rosetta/video/flv/Amf.luau"], +[223167, "src/Rosetta/video/flv/Mux.luau"], +[223448, "src/Rosetta/video/h264/init.luau"], +[223587, "src/Rosetta/video/mkv/init.luau"], +[223743, "src/Rosetta/video/mkv/Mux.luau"], +[224022, "src/Rosetta/video/mkv/Parse.luau"], +[224743, "src/Rosetta/video/mp4/init.luau"], +[225071, "src/Rosetta/video/mpegps/init.luau"], +[225258, "src/Rosetta/video/mpegts/init.luau"], +[225504, "src/Rosetta/video/ogv/init.luau"], +[225899, "src/Rosetta/video/smk/init.luau"], +[226208, "src/Rosetta/video/smk/Audio.luau"], +[226328, "src/Rosetta/video/y4m/init.luau"] ] diff --git a/build/Rosetta.rbxm b/build/Rosetta.rbxm index 04ce008..f265cc1 100644 Binary files a/build/Rosetta.rbxm and b/build/Rosetta.rbxm differ diff --git a/build/Rosetta.rbxm.linemap.json b/build/Rosetta.rbxm.linemap.json index dfe52c5..60b0d09 100644 --- a/build/Rosetta.rbxm.linemap.json +++ b/build/Rosetta.rbxm.linemap.json @@ -1,6 +1,5 @@ { -"Core_1": [[8, "src/Rosetta/init.luau"], [925, "src/Rosetta/Registry.luau"], [3542, "src/Rosetta/Types.luau"], [4659, "src/Rosetta/codecs/audio/Adpcm/init.luau"], [5413, "src/Rosetta/codecs/image/Yuv.luau"], [5734, "src/Rosetta/codecs/model/Rbx/init.luau"], [5971, "src/Rosetta/codecs/video/Video/init.luau"], [6586, "src/Rosetta/codecs/video/Video/Disposable.luau"], [6797, "src/Rosetta/codecs/video/Video/Pool.luau"], [6849, "src/Rosetta/containers/AudioWrap.luau"], [7359, "src/Rosetta/containers/Ogg/Mux.luau"]], -"Core_2": [[8, "src/Rosetta/core/Bytes.luau"], [535, "src/Rosetta/core/Crc32.luau"], [686, "src/Rosetta/core/Err.luau"], [768, "src/Rosetta/core/Input.luau"], [844, "src/Rosetta/host/init.luau"], [889, "src/Rosetta/ops/ImageOps/init.luau"], [1537, "src/Rosetta/ops/ImageOps/Kernels.luau"]], +"Core": [[8, "src/Rosetta/init.luau"], [941, "src/Rosetta/Registry.luau"], [3558, "src/Rosetta/Types.luau"], [4675, "src/Rosetta/core/Bytes.luau"], [5202, "src/Rosetta/core/Err.luau"], [5284, "src/Rosetta/core/Input.luau"], [5360, "src/Rosetta/host/init.luau"]], "Detect": [[8, "src/Rosetta/Sniffs.luau"], [4218, "src/Rosetta/core/Bits.luau"], [4511, "src/Rosetta/core/Crc16.luau"], [4563, "src/Rosetta/core/Sniff.luau"]], "Mpeg2": [[8, "src/Rosetta/codecs/video/Dsp.luau"], [846, "src/Rosetta/codecs/video/Mpeg1/init.luau"], [859, "src/Rosetta/codecs/video/Mpeg2/init.luau"], [1233, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], [2760, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], [2900, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"]], "H263": [[8, "src/Rosetta/codecs/video/H263/init.luau"], [165, "src/Rosetta/codecs/video/H263/Decoder.luau"], [1023, "src/Rosetta/codecs/video/H263/Tables.luau"]], @@ -28,37 +27,160 @@ "Hively": [[8, "src/Rosetta/codecs/audio/Hively/init.luau"], [205, "src/Rosetta/codecs/audio/Hively/Load.luau"], [455, "src/Rosetta/codecs/audio/Hively/Player.luau"], [1414, "src/Rosetta/codecs/audio/Hively/Tables.luau"]], "SoundFont": [[8, "src/Rosetta/codecs/audio/SoundFont/init.luau"], [63, "src/Rosetta/codecs/audio/SoundFont/Fallback.luau"], [207, "src/Rosetta/codecs/audio/SoundFont/Parse.luau"], [721, "src/Rosetta/codecs/audio/SoundFont/Synth.luau"]], "Draco": [[8, "src/Rosetta/codecs/model/Draco/init.luau"], [340, "src/Rosetta/codecs/model/Draco/Attributes.luau"], [809, "src/Rosetta/codecs/model/Draco/Connectivity.luau"], [1998, "src/Rosetta/codecs/model/Draco/Int64.luau"], [2147, "src/Rosetta/codecs/model/Draco/KdTree.luau"], [2506, "src/Rosetta/codecs/model/Draco/Predict.luau"], [3468, "src/Rosetta/codecs/model/Draco/Reader.luau"]], -"archive_1": [[8, "src/Rosetta/archive/7z/init.luau"], [393, "src/Rosetta/archive/7z/Header.luau"], [920, "src/Rosetta/archive/adf/init.luau"], [1202, "src/Rosetta/archive/applesingle/init.luau"], [1388, "src/Rosetta/archive/ar/init.luau"], [1791, "src/Rosetta/archive/arj/init.luau"], [2001, "src/Rosetta/archive/binhex/init.luau"], [2250, "src/Rosetta/archive/br/init.luau"], [2325, "src/Rosetta/archive/bz2/init.luau"], [2389, "src/Rosetta/archive/cab/init.luau"], [2802, "src/Rosetta/archive/cab/Sum.luau"], [2843, "src/Rosetta/archive/cpio/init.luau"], [3011, "src/Rosetta/archive/d64/init.luau"], [3425, "src/Rosetta/archive/fat/init.luau"], [3547, "src/Rosetta/archive/grp/init.luau"], [3661, "src/Rosetta/archive/gzip/init.luau"], [3846, "src/Rosetta/archive/iso/init.luau"], [3918, "src/Rosetta/archive/lha/init.luau"], [4343, "src/Rosetta/archive/lz4/init.luau"], [4687, "src/Rosetta/archive/macbinary/init.luau"], [4885, "src/Rosetta/archive/mpq/init.luau"], [5291, "src/Rosetta/archive/mpq/Crypt.luau"], [5356, "src/Rosetta/archive/pak/init.luau"], [5490, "src/Rosetta/archive/rpm/init.luau"], [5814, "src/Rosetta/archive/tar/init.luau"], [5932, "src/Rosetta/archive/unitypackage/init.luau"], [6168, "src/Rosetta/archive/uu/init.luau"], [6438, "src/Rosetta/archive/vpk/init.luau"], [6749, "src/Rosetta/archive/vswap/init.luau"], [7019, "src/Rosetta/archive/wad/init.luau"], [7473, "src/Rosetta/archive/wad/Picture.luau"], [7575, "src/Rosetta/archive/wad2/init.luau"], [7857, "src/Rosetta/archive/xz/init.luau"]], -"archive_2": [[8, "src/Rosetta/archive/yenc/init.luau"], [280, "src/Rosetta/archive/z/init.luau"], [376, "src/Rosetta/archive/zip/init.luau"], [595, "src/Rosetta/archive/zoo/init.luau"], [791, "src/Rosetta/archive/zst/init.luau"]], -"audio": [[8, "src/Rosetta/audio/aac/init.luau"], [221, "src/Rosetta/audio/ac3/init.luau"], [368, "src/Rosetta/audio/adpcm/init.luau"], [514, "src/Rosetta/audio/adx/init.luau"], [746, "src/Rosetta/audio/aiff/init.luau"], [1138, "src/Rosetta/audio/ape/init.luau"], [1267, "src/Rosetta/audio/au/init.luau"], [1429, "src/Rosetta/audio/brstm/init.luau"], [1721, "src/Rosetta/audio/caf/init.luau"], [2388, "src/Rosetta/audio/flac/init.luau"], [2537, "src/Rosetta/audio/flac/Meta.luau"], [2759, "src/Rosetta/audio/flac/Stream.luau"], [3129, "src/Rosetta/audio/m4a/init.luau"], [3472, "src/Rosetta/audio/mp3/init.luau"], [3733, "src/Rosetta/audio/mp3/Index.luau"], [3924, "src/Rosetta/audio/mp3/Stream.luau"], [4151, "src/Rosetta/audio/mp3/Tags.luau"], [4463, "src/Rosetta/audio/mpc/init.luau"], [4558, "src/Rosetta/audio/opus/init.luau"], [4937, "src/Rosetta/audio/opus/Encode.luau"], [5049, "src/Rosetta/audio/qoa/init.luau"], [5230, "src/Rosetta/audio/tta/init.luau"], [5349, "src/Rosetta/audio/vag/init.luau"], [5573, "src/Rosetta/audio/voc/init.luau"], [5849, "src/Rosetta/audio/vorbis/init.luau"], [6304, "src/Rosetta/audio/vorbis/Encode.luau"], [7117, "src/Rosetta/audio/wav/init.luau"], [7738, "src/Rosetta/audio/wav/Codecs.luau"], [7917, "src/Rosetta/audio/wavpack/init.luau"]], -"cad": [[8, "src/Rosetta/cad/step/init.luau"], [390, "src/Rosetta/cad/step/Brep.luau"], [625, "src/Rosetta/cad/step/Parse.luau"], [1182, "src/Rosetta/cad/step/Write.luau"]], -"codecs_audio": [[8, "src/Rosetta/codecs/audio/Ac3/init.luau"], [168, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], [1053, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], [1155, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], [1458, "src/Rosetta/codecs/audio/Alac/init.luau"], [1693, "src/Rosetta/codecs/audio/Alac/Decode.luau"], [2112, "src/Rosetta/codecs/audio/Alac/Encode.luau"], [2524, "src/Rosetta/codecs/audio/Ape/init.luau"], [2740, "src/Rosetta/codecs/audio/Ape/Decode.luau"], [3501, "src/Rosetta/codecs/audio/ApeTag.luau"], [3599, "src/Rosetta/codecs/audio/Mdct/init.luau"], [3819, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], [4073, "src/Rosetta/codecs/audio/MidiRender.luau"], [4420, "src/Rosetta/codecs/audio/Pcm/init.luau"], [4684, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], [4981, "src/Rosetta/codecs/audio/Qoa/init.luau"], [5263, "src/Rosetta/codecs/audio/Resample/init.luau"], [5658, "src/Rosetta/codecs/audio/Stream.luau"], [5820, "src/Rosetta/codecs/audio/Tta/init.luau"], [5938, "src/Rosetta/codecs/audio/Tta/Decode.luau"], [6190, "src/Rosetta/codecs/audio/VorbisComment.luau"]], -"codecs_compress": [[8, "src/Rosetta/codecs/compress/Bzip2/init.luau"], [52, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], [565, "src/Rosetta/codecs/compress/Explode.luau"], [761, "src/Rosetta/codecs/compress/Lz4.luau"], [1030, "src/Rosetta/codecs/compress/Lzh/init.luau"], [1634, "src/Rosetta/codecs/compress/Lzw/init.luau"], [1902, "src/Rosetta/codecs/compress/Lzx.luau"], [2336, "src/Rosetta/codecs/compress/PackBits.luau"], [2426, "src/Rosetta/codecs/compress/Quantum.luau"], [2663, "src/Rosetta/codecs/compress/UnixCompress.luau"], [2967, "src/Rosetta/codecs/compress/Xxh32.luau"]], -"codecs_entropy": [[8, "src/Rosetta/codecs/entropy/Huffman.luau"], [295, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], [306, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], [527, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"]], -"codecs_font": [[8, "src/Rosetta/codecs/font/Bitmap.luau"], [209, "src/Rosetta/codecs/font/Cff/init.luau"], [850, "src/Rosetta/codecs/font/GlyphNames.luau"], [1000, "src/Rosetta/codecs/font/TrueType/init.luau"], [1314, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], [1706, "src/Rosetta/codecs/font/TrueType/Tables.luau"]], -"codecs_image": [[8, "src/Rosetta/codecs/image/Blend.luau"], [387, "src/Rosetta/codecs/image/Etc.luau"], [685, "src/Rosetta/codecs/image/Half.luau"], [754, "src/Rosetta/codecs/image/Miptex.luau"], [1054, "src/Rosetta/codecs/image/Pixels.luau"], [1374, "src/Rosetta/codecs/image/Quantize/init.luau"], [1835, "src/Rosetta/codecs/image/Raster.luau"], [2532, "src/Rosetta/codecs/image/Texel.luau"], [2905, "src/Rosetta/codecs/image/Texture.luau"]], -"codecs_model": [[8, "src/Rosetta/codecs/model/Brush.luau"], [648, "src/Rosetta/codecs/model/Displacement.luau"], [797, "src/Rosetta/codecs/model/DoomMap/init.luau"], [1242, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], [1492, "src/Rosetta/codecs/model/Mat4.luau"], [1751, "src/Rosetta/codecs/model/MeshFlatten.luau"], [2279, "src/Rosetta/codecs/model/Minecraft/init.luau"], [2831, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], [2910, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], [3017, "src/Rosetta/codecs/model/Minecraft/Packed.luau"], [3223, "src/Rosetta/codecs/model/Patch.luau"], [3347, "src/Rosetta/codecs/model/Polygon.luau"], [3581, "src/Rosetta/codecs/model/Rbx/Binary.luau"], [4335, "src/Rosetta/codecs/model/Rig.luau"], [4578, "src/Rosetta/codecs/model/Sampler.luau"], [4738, "src/Rosetta/codecs/model/SourceAnim.luau"], [4959, "src/Rosetta/codecs/model/Vrml/init.luau"], [5107, "src/Rosetta/codecs/model/Vrml/Build.luau"], [5681, "src/Rosetta/codecs/model/Vrml/Fields.luau"], [5844, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], [6593, "src/Rosetta/codecs/model/Vrml/Parse.luau"], [7115, "src/Rosetta/codecs/model/Vrml/Write.luau"], [7842, "src/Rosetta/codecs/model/Vrml/Xml.luau"]], -"codecs_text": [[8, "src/Rosetta/codecs/text/GodotVariant.luau"], [667, "src/Rosetta/codecs/text/Json/init.luau"], [936, "src/Rosetta/codecs/text/Json/Decode.luau"], [1371, "src/Rosetta/codecs/text/Json/Encode.luau"], [1716, "src/Rosetta/codecs/text/KeyValues/init.luau"], [2286, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], [2592, "src/Rosetta/codecs/text/Lexer/init.luau"], [2724, "src/Rosetta/codecs/text/Nbt/init.luau"], [3077, "src/Rosetta/codecs/text/Nbt/Binary.luau"], [3769, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], [4409, "src/Rosetta/codecs/text/Nbt/Value.luau"], [4647, "src/Rosetta/codecs/text/Text/init.luau"], [4738, "src/Rosetta/codecs/text/Url/init.luau"], [4943, "src/Rosetta/codecs/text/Xml/init.luau"], [5393, "src/Rosetta/codecs/text/Xml/Parse.luau"]], -"codecs_video": [[8, "src/Rosetta/codecs/video/Video/Source.luau"]], -"containers": [[8, "src/Rosetta/containers/Archive.luau"], [275, "src/Rosetta/containers/Avi/init.luau"], [828, "src/Rosetta/containers/Blend.luau"], [1567, "src/Rosetta/containers/Chunks.luau"], [1702, "src/Rosetta/containers/Cpio.luau"], [2130, "src/Rosetta/containers/Demux.luau"], [2416, "src/Rosetta/containers/Ebml/init.luau"], [2730, "src/Rosetta/containers/Fat.luau"], [3418, "src/Rosetta/containers/Iso9660.luau"], [3923, "src/Rosetta/containers/IsoBmff/init.luau"], [4094, "src/Rosetta/containers/IsoBmff/Box.luau"], [4283, "src/Rosetta/containers/IsoBmff/Demux.luau"], [5129, "src/Rosetta/containers/IsoBmff/Meta.luau"], [5651, "src/Rosetta/containers/IsoBmff/Mux.luau"], [6168, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], [6286, "src/Rosetta/containers/MacFile.luau"], [6435, "src/Rosetta/containers/Ogg/init.luau"], [6860, "src/Rosetta/containers/Ogg/Page.luau"], [7026, "src/Rosetta/containers/Riff/init.luau"], [7343, "src/Rosetta/containers/Tar.luau"], [7757, "src/Rosetta/containers/Zip/init.luau"]], -"core": [[8, "src/Rosetta/core/Adler32.luau"], [68, "src/Rosetta/core/Base64.luau"], [296, "src/Rosetta/core/Md5.luau"]], -"data": [[8, "src/Rosetta/data/cbor/init.luau"], [107, "src/Rosetta/data/cbor/Codec.luau"], [676, "src/Rosetta/data/csv/init.luau"], [988, "src/Rosetta/data/ini/init.luau"], [1234, "src/Rosetta/data/json/init.luau"], [1326, "src/Rosetta/data/msgpack/init.luau"], [1415, "src/Rosetta/data/msgpack/Codec.luau"], [1857, "src/Rosetta/data/nbt/init.luau"], [1916, "src/Rosetta/data/plist/init.luau"], [2222, "src/Rosetta/data/plist/Binary.luau"], [2489, "src/Rosetta/data/q3shader/init.luau"], [2728, "src/Rosetta/data/q3skin/init.luau"], [2824, "src/Rosetta/data/snbt/init.luau"], [2887, "src/Rosetta/data/toml/init.luau"], [2954, "src/Rosetta/data/toml/Decode.luau"], [3582, "src/Rosetta/data/toml/Encode.luau"], [3791, "src/Rosetta/data/tres/init.luau"], [3936, "src/Rosetta/data/vdf/init.luau"], [4037, "src/Rosetta/data/xml/init.luau"], [4093, "src/Rosetta/data/yaml/init.luau"], [4166, "src/Rosetta/data/yaml/Emit.luau"], [4456, "src/Rosetta/data/yaml/Parse.luau"]], -"font": [[8, "src/Rosetta/font/bdf/init.luau"], [297, "src/Rosetta/font/bmfont/init.luau"], [724, "src/Rosetta/font/bmfont/Parse.luau"], [1177, "src/Rosetta/font/eot/init.luau"], [1409, "src/Rosetta/font/fon/init.luau"], [1692, "src/Rosetta/font/hershey/init.luau"], [1887, "src/Rosetta/font/pcf/init.luau"], [2167, "src/Rosetta/font/psf/init.luau"], [2487, "src/Rosetta/font/ttf/init.luau"], [2538, "src/Rosetta/font/type1/init.luau"], [2897, "src/Rosetta/font/type1/Charstring.luau"], [3175, "src/Rosetta/font/woff/init.luau"], [3307, "src/Rosetta/font/woff2/init.luau"], [3364, "src/Rosetta/font/woff2/Rebuild.luau"]], -"host": [[8, "src/Rosetta/host/Love.luau"], [151, "src/Rosetta/host/LuaJIT.luau"], [201, "src/Rosetta/host/Luau.luau"], [224, "src/Rosetta/host/Roblox.luau"]], -"image_1": [[8, "src/Rosetta/image/ani/init.luau"], [188, "src/Rosetta/image/art/init.luau"], [676, "src/Rosetta/image/blp/init.luau"], [934, "src/Rosetta/image/bmp/init.luau"], [1349, "src/Rosetta/image/dds/init.luau"], [1832, "src/Rosetta/image/exr/init.luau"], [2592, "src/Rosetta/image/exr/Codec.luau"], [2703, "src/Rosetta/image/exr/Piz.luau"], [3060, "src/Rosetta/image/gif/init.luau"], [3576, "src/Rosetta/image/gif/Decode.luau"], [3652, "src/Rosetta/image/hdr/init.luau"], [3881, "src/Rosetta/image/hdr/Codec.luau"], [4092, "src/Rosetta/image/icns/init.luau"], [4423, "src/Rosetta/image/ico/init.luau"], [4700, "src/Rosetta/image/ico/Dib.luau"], [4795, "src/Rosetta/image/ilbm/init.luau"], [5114, "src/Rosetta/image/jpeg/init.luau"], [5273, "src/Rosetta/image/ktx/init.luau"], [5933, "src/Rosetta/image/lmp/init.luau"], [6066, "src/Rosetta/image/pcx/init.luau"], [6330, "src/Rosetta/image/pnm/init.luau"], [6708, "src/Rosetta/image/pnm/Codec.luau"], [6985, "src/Rosetta/image/qoi/init.luau"], [7107, "src/Rosetta/image/qoi/Codec.luau"], [7264, "src/Rosetta/image/sgi/init.luau"]], -"image_2": [[8, "src/Rosetta/image/spr/init.luau"], [321, "src/Rosetta/image/sunras/init.luau"], [567, "src/Rosetta/image/tga/init.luau"], [837, "src/Rosetta/image/tga/Codec.luau"], [1037, "src/Rosetta/image/tiff/init.luau"], [1864, "src/Rosetta/image/tiff/Pixels.luau"], [2254, "src/Rosetta/image/tim/init.luau"], [2496, "src/Rosetta/image/vtf/init.luau"], [2731, "src/Rosetta/image/webp/init.luau"], [3341, "src/Rosetta/image/webp/Alpha.luau"], [3417, "src/Rosetta/image/webp/Anim.luau"], [3572, "src/Rosetta/image/xbm/init.luau"], [3733, "src/Rosetta/image/xpm/init.luau"], [4001, "src/Rosetta/image/xpm/Names.luau"]], -"layered": [[8, "src/Rosetta/layered/aseprite/init.luau"], [746, "src/Rosetta/layered/ora/init.luau"], [1033, "src/Rosetta/layered/psd/init.luau"], [1768, "src/Rosetta/layered/psd/Channels.luau"]], -"model_1": [[8, "src/Rosetta/model/3ds/init.luau"], [91, "src/Rosetta/model/3ds/Build.luau"], [738, "src/Rosetta/model/3ds/Read.luau"], [1234, "src/Rosetta/model/3ds/Write.luau"], [2039, "src/Rosetta/model/3mf/init.luau"], [2121, "src/Rosetta/model/3mf/Read.luau"], [2709, "src/Rosetta/model/3mf/Write.luau"], [3114, "src/Rosetta/model/ase/init.luau"], [3237, "src/Rosetta/model/ase/Build.luau"], [3811, "src/Rosetta/model/ase/Parse.luau"], [3880, "src/Rosetta/model/ase/Write.luau"], [4343, "src/Rosetta/model/b3d/init.luau"], [4398, "src/Rosetta/model/b3d/Read.luau"], [4969, "src/Rosetta/model/blend/init.luau"], [5069, "src/Rosetta/model/blend/Anim.luau"], [5598, "src/Rosetta/model/blend/Armature.luau"], [6134, "src/Rosetta/model/blend/Driver.luau"], [6309, "src/Rosetta/model/blend/Material.luau"], [6661, "src/Rosetta/model/blend/Mesh.luau"]], -"model_2": [[8, "src/Rosetta/model/blend/Normals.luau"], [169, "src/Rosetta/model/blend/Prim.luau"], [676, "src/Rosetta/model/blend/Read.luau"], [1764, "src/Rosetta/model/bsp/init.luau"], [1955, "src/Rosetta/model/bsp/Lightmap.luau"], [2021, "src/Rosetta/model/bsp/Quake.luau"], [2410, "src/Rosetta/model/bsp/Quake3.luau"], [2639, "src/Rosetta/model/bsp/Tree.luau"], [3027, "src/Rosetta/model/buildmap/init.luau"], [3299, "src/Rosetta/model/buildmap/Geometry.luau"], [3702, "src/Rosetta/model/d3map/init.luau"], [3984, "src/Rosetta/model/d3map/Parse.luau"], [4182, "src/Rosetta/model/dae/init.luau"], [4371, "src/Rosetta/model/dae/Math.luau"], [4418, "src/Rosetta/model/dae/Read.luau"], [6268, "src/Rosetta/model/dae/Write.luau"], [6637, "src/Rosetta/model/fbx/init.luau"], [6785, "src/Rosetta/model/fbx/Ascii.luau"], [7055, "src/Rosetta/model/fbx/Binary.luau"]], -"model_3": [[8, "src/Rosetta/model/fbx/Read.luau"], [1370, "src/Rosetta/model/fbx/Write.luau"], [2355, "src/Rosetta/model/fbx/Xform.luau"], [2396, "src/Rosetta/model/gltf/init.luau"], [2633, "src/Rosetta/model/gltf/Pack.luau"], [2702, "src/Rosetta/model/gltf/Read.luau"], [3443, "src/Rosetta/model/gltf/Write.luau"], [4129, "src/Rosetta/model/godot/init.luau"], [4220, "src/Rosetta/model/godot/Build.luau"], [4762, "src/Rosetta/model/godot/Primitives.luau"], [5037, "src/Rosetta/model/godot/Surface.luau"], [5522, "src/Rosetta/model/godot/Write.luau"], [5851, "src/Rosetta/model/iqm/init.luau"], [5927, "src/Rosetta/model/iqm/Read.luau"], [6282, "src/Rosetta/model/iqm/Write.luau"], [6969, "src/Rosetta/model/ldraw/init.luau"], [7047, "src/Rosetta/model/ldraw/Colors.luau"]], -"model_4": [[8, "src/Rosetta/model/ldraw/Read.luau"], [585, "src/Rosetta/model/lwo/init.luau"], [661, "src/Rosetta/model/lwo/Build.luau"], [1123, "src/Rosetta/model/lwo/Parse.luau"], [1666, "src/Rosetta/model/map/init.luau"], [1983, "src/Rosetta/model/map/Build.luau"], [2227, "src/Rosetta/model/map/Parse.luau"], [2612, "src/Rosetta/model/map/Write.luau"], [2758, "src/Rosetta/model/mca/init.luau"], [3100, "src/Rosetta/model/mca/Chunk.luau"], [3233, "src/Rosetta/model/mca/Lz4Block.luau"], [3303, "src/Rosetta/model/md2/init.luau"], [3502, "src/Rosetta/model/md3/init.luau"], [3730, "src/Rosetta/model/md5/init.luau"], [3811, "src/Rosetta/model/md5/Read.luau"], [4244, "src/Rosetta/model/mdl/init.luau"], [4326, "src/Rosetta/model/mdl/HalfLife.luau"], [4630, "src/Rosetta/model/mdl/Quake.luau"], [4848, "src/Rosetta/model/ms3d/init.luau"], [4920, "src/Rosetta/model/ms3d/Read.luau"], [5366, "src/Rosetta/model/ms3d/Write.luau"], [5835, "src/Rosetta/model/obj/init.luau"], [6653, "src/Rosetta/model/obj/Mtl.luau"], [6941, "src/Rosetta/model/off/init.luau"]], -"model_5": [[8, "src/Rosetta/model/ply/init.luau"], [1113, "src/Rosetta/model/ply/Binary.luau"], [1314, "src/Rosetta/model/pmx/init.luau"], [1383, "src/Rosetta/model/pmx/Build.luau"], [1679, "src/Rosetta/model/pmx/Pmd.luau"], [2014, "src/Rosetta/model/pmx/Read.luau"], [2418, "src/Rosetta/model/proc/init.luau"], [2800, "src/Rosetta/model/qb/init.luau"], [3193, "src/Rosetta/model/rbxm/init.luau"], [3786, "src/Rosetta/model/rbxmx/init.luau"], [4462, "src/Rosetta/model/robloxmesh/init.luau"], [5121, "src/Rosetta/model/robloxmesh/Parse.luau"], [5578, "src/Rosetta/model/robloxmesh/Write.luau"], [5687, "src/Rosetta/model/schematic/init.luau"], [6008, "src/Rosetta/model/schematic/Common.luau"], [6128, "src/Rosetta/model/schematic/Litematic.luau"], [6339, "src/Rosetta/model/schematic/Mcedit.luau"], [6583, "src/Rosetta/model/schematic/Sponge.luau"], [6712, "src/Rosetta/model/smd/init.luau"], [6779, "src/Rosetta/model/smd/Read.luau"], [7048, "src/Rosetta/model/smd/Write.luau"], [7291, "src/Rosetta/model/sourcemdl/init.luau"], [7462, "src/Rosetta/model/sourcemdl/Build.luau"], [7892, "src/Rosetta/model/sourcemdl/Material.luau"]], -"model_6": [[8, "src/Rosetta/model/sourcemdl/Mdl.luau"], [535, "src/Rosetta/model/sourcemdl/Phy.luau"], [658, "src/Rosetta/model/sourcemdl/Vtx.luau"], [840, "src/Rosetta/model/sourcemdl/Vvd.luau"], [934, "src/Rosetta/model/stl/init.luau"], [1384, "src/Rosetta/model/stl/Decode.luau"], [1458, "src/Rosetta/model/t3d/init.luau"], [1552, "src/Rosetta/model/t3d/Build.luau"], [1957, "src/Rosetta/model/t3d/Parse.luau"], [2125, "src/Rosetta/model/udmf/init.luau"], [2208, "src/Rosetta/model/usda/init.luau"], [2417, "src/Rosetta/model/usda/Build.luau"], [3695, "src/Rosetta/model/usda/Parse.luau"], [4493, "src/Rosetta/model/usda/Write.luau"], [5310, "src/Rosetta/model/vbsp/init.luau"], [5756, "src/Rosetta/model/vbsp/Faces.luau"], [5980, "src/Rosetta/model/vbsp/Props.luau"], [6072, "src/Rosetta/model/vmf/init.luau"], [6397, "src/Rosetta/model/vmf/Build.luau"], [6821, "src/Rosetta/model/vox/init.luau"], [7707, "src/Rosetta/model/vox/Grid.luau"], [7764, "src/Rosetta/model/vrml/init.luau"], [7830, "src/Rosetta/model/x/init.luau"]], -"model_7": [[8, "src/Rosetta/model/x/Build.luau"], [571, "src/Rosetta/model/x/Parse.luau"], [868, "src/Rosetta/model/x3d/init.luau"]], -"music": [[8, "src/Rosetta/music/669/init.luau"], [215, "src/Rosetta/music/ahx/init.luau"], [267, "src/Rosetta/music/far/init.luau"], [497, "src/Rosetta/music/hmp/init.luau"], [762, "src/Rosetta/music/hvl/init.luau"], [814, "src/Rosetta/music/it/init.luau"], [1233, "src/Rosetta/music/it/Itsex.luau"], [1350, "src/Rosetta/music/med/init.luau"], [1998, "src/Rosetta/music/midi/init.luau"], [2142, "src/Rosetta/music/midi/Smf.luau"], [2554, "src/Rosetta/music/mod/init.luau"], [2908, "src/Rosetta/music/mtm/init.luau"], [3131, "src/Rosetta/music/mus/init.luau"], [3289, "src/Rosetta/music/okt/init.luau"], [3571, "src/Rosetta/music/ptm/init.luau"], [3794, "src/Rosetta/music/s3m/init.luau"], [4031, "src/Rosetta/music/sf2/init.luau"], [4075, "src/Rosetta/music/stm/init.luau"], [4307, "src/Rosetta/music/ult/init.luau"], [4612, "src/Rosetta/music/umx/init.luau"], [4829, "src/Rosetta/music/xm/init.luau"], [5391, "src/Rosetta/music/xmi/init.luau"]], -"ops": [[8, "src/Rosetta/ops/AudioOps.luau"], [487, "src/Rosetta/ops/LayerOps.luau"], [580, "src/Rosetta/ops/MeshOps/init.luau"], [1720, "src/Rosetta/ops/MeshOps/Greedy.luau"], [1887, "src/Rosetta/ops/MusicOps.luau"]], -"playlist": [[8, "src/Rosetta/playlist/m3u/init.luau"], [361, "src/Rosetta/playlist/pls/init.luau"], [539, "src/Rosetta/playlist/xspf/init.luau"]], -"subtitle": [[8, "src/Rosetta/subtitle/ass/init.luau"], [452, "src/Rosetta/subtitle/srt/init.luau"], [625, "src/Rosetta/subtitle/vtt/init.luau"]], -"vector": [[8, "src/Rosetta/vector/gamemaps/init.luau"], [195, "src/Rosetta/vector/gamemaps/Expand.luau"], [292, "src/Rosetta/vector/ldtk/init.luau"], [384, "src/Rosetta/vector/ldtk/Read.luau"], [720, "src/Rosetta/vector/ldtk/Write.luau"], [1368, "src/Rosetta/vector/ogmo/init.luau"], [1487, "src/Rosetta/vector/ogmo/Read.luau"], [1892, "src/Rosetta/vector/ogmo/Write.luau"], [2246, "src/Rosetta/vector/svg/init.luau"], [2332, "src/Rosetta/vector/svg/Parse.luau"], [3078, "src/Rosetta/vector/svg/PathData.luau"], [3446, "src/Rosetta/vector/svg/Render.luau"], [3863, "src/Rosetta/vector/svg/Style.luau"], [4235, "src/Rosetta/vector/svg/Write.luau"], [4435, "src/Rosetta/vector/tiled/init.luau"], [4615, "src/Rosetta/vector/tiled/Data.luau"], [4766, "src/Rosetta/vector/tiled/Tmj.luau"], [5397, "src/Rosetta/vector/tiled/Tmx.luau"]], -"video": [[8, "src/Rosetta/video/avi/init.luau"], [302, "src/Rosetta/video/fli/init.luau"], [453, "src/Rosetta/video/flv/init.luau"], [837, "src/Rosetta/video/flv/Amf.luau"], [995, "src/Rosetta/video/flv/Mux.luau"], [1276, "src/Rosetta/video/h264/init.luau"], [1415, "src/Rosetta/video/mkv/init.luau"], [1571, "src/Rosetta/video/mkv/Mux.luau"], [1850, "src/Rosetta/video/mkv/Parse.luau"], [2571, "src/Rosetta/video/mp4/init.luau"], [2899, "src/Rosetta/video/mpegps/init.luau"], [3086, "src/Rosetta/video/mpegts/init.luau"], [3332, "src/Rosetta/video/ogv/init.luau"], [3727, "src/Rosetta/video/smk/init.luau"], [4036, "src/Rosetta/video/smk/Audio.luau"], [4156, "src/Rosetta/video/y4m/init.luau"]] +"archive_7z": [[8, "src/Rosetta/archive/7z/init.luau"], [393, "src/Rosetta/archive/7z/Header.luau"], [920, "src/Rosetta/archive/adf/init.luau"]], +"archive_applesingle": [[8, "src/Rosetta/archive/applesingle/init.luau"], [194, "src/Rosetta/archive/ar/init.luau"], [597, "src/Rosetta/archive/arj/init.luau"]], +"archive_binhex": [[8, "src/Rosetta/archive/binhex/init.luau"], [257, "src/Rosetta/archive/br/init.luau"], [332, "src/Rosetta/archive/bz2/init.luau"], [396, "src/Rosetta/archive/cab/init.luau"], [809, "src/Rosetta/archive/cab/Sum.luau"], [850, "src/Rosetta/archive/cpio/init.luau"]], +"archive_d64": [[8, "src/Rosetta/archive/d64/init.luau"], [422, "src/Rosetta/archive/fat/init.luau"], [544, "src/Rosetta/archive/grp/init.luau"], [658, "src/Rosetta/archive/gzip/init.luau"], [843, "src/Rosetta/archive/iso/init.luau"]], +"archive_lha": [[8, "src/Rosetta/archive/lha/init.luau"], [433, "src/Rosetta/archive/lz4/init.luau"], [777, "src/Rosetta/archive/macbinary/init.luau"]], +"archive_mpq": [[8, "src/Rosetta/archive/mpq/init.luau"], [414, "src/Rosetta/archive/mpq/Crypt.luau"], [479, "src/Rosetta/archive/pak/init.luau"], [613, "src/Rosetta/archive/rpm/init.luau"]], +"archive_tar": [[8, "src/Rosetta/archive/tar/init.luau"], [126, "src/Rosetta/archive/unitypackage/init.luau"], [362, "src/Rosetta/archive/uu/init.luau"], [632, "src/Rosetta/archive/vpk/init.luau"]], +"archive_vswap": [[8, "src/Rosetta/archive/vswap/init.luau"], [278, "src/Rosetta/archive/wad/init.luau"], [732, "src/Rosetta/archive/wad/Picture.luau"]], +"archive_wad2": [[8, "src/Rosetta/archive/wad2/init.luau"], [290, "src/Rosetta/archive/xz/init.luau"], [390, "src/Rosetta/archive/yenc/init.luau"], [662, "src/Rosetta/archive/z/init.luau"], [758, "src/Rosetta/archive/zip/init.luau"]], +"archive_zoo": [[8, "src/Rosetta/archive/zoo/init.luau"], [204, "src/Rosetta/archive/zst/init.luau"]], +"audio_aac": [[8, "src/Rosetta/audio/aac/init.luau"], [221, "src/Rosetta/audio/ac3/init.luau"], [368, "src/Rosetta/audio/adpcm/init.luau"], [514, "src/Rosetta/audio/adx/init.luau"]], +"audio_aiff": [[8, "src/Rosetta/audio/aiff/init.luau"], [400, "src/Rosetta/audio/ape/init.luau"], [529, "src/Rosetta/audio/au/init.luau"], [691, "src/Rosetta/audio/brstm/init.luau"]], +"audio_caf": [[8, "src/Rosetta/audio/caf/init.luau"]], +"audio_flac": [[8, "src/Rosetta/audio/flac/init.luau"], [157, "src/Rosetta/audio/flac/Meta.luau"], [379, "src/Rosetta/audio/flac/Stream.luau"], [749, "src/Rosetta/audio/m4a/init.luau"]], +"audio_mp3": [[8, "src/Rosetta/audio/mp3/init.luau"], [269, "src/Rosetta/audio/mp3/Index.luau"], [460, "src/Rosetta/audio/mp3/Stream.luau"], [687, "src/Rosetta/audio/mp3/Tags.luau"]], +"audio_mpc": [[8, "src/Rosetta/audio/mpc/init.luau"], [103, "src/Rosetta/audio/opus/init.luau"], [482, "src/Rosetta/audio/opus/Encode.luau"], [594, "src/Rosetta/audio/qoa/init.luau"], [775, "src/Rosetta/audio/tta/init.luau"]], +"audio_vag": [[8, "src/Rosetta/audio/vag/init.luau"], [232, "src/Rosetta/audio/voc/init.luau"]], +"audio_vorbis": [[8, "src/Rosetta/audio/vorbis/init.luau"], [463, "src/Rosetta/audio/vorbis/Encode.luau"]], +"audio_wav": [[8, "src/Rosetta/audio/wav/init.luau"], [629, "src/Rosetta/audio/wav/Codecs.luau"], [808, "src/Rosetta/audio/wavpack/init.luau"]], +"cad_step": [[8, "src/Rosetta/cad/step/init.luau"], [390, "src/Rosetta/cad/step/Brep.luau"], [625, "src/Rosetta/cad/step/Parse.luau"], [1182, "src/Rosetta/cad/step/Write.luau"]], +"codecs_audio_Ac3": [[8, "src/Rosetta/codecs/audio/Ac3/init.luau"], [168, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], [1053, "src/Rosetta/codecs/audio/Ac3/Tables.luau"]], +"codecs_audio_Adpcm": [[8, "src/Rosetta/codecs/audio/Adpcm/init.luau"], [762, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"]], +"codecs_audio_Alac": [[8, "src/Rosetta/codecs/audio/Alac/init.luau"], [243, "src/Rosetta/codecs/audio/Alac/Decode.luau"], [662, "src/Rosetta/codecs/audio/Alac/Encode.luau"]], +"codecs_audio_Ape": [[8, "src/Rosetta/codecs/audio/Ape/init.luau"], [224, "src/Rosetta/codecs/audio/Ape/Decode.luau"], [985, "src/Rosetta/codecs/audio/ApeTag.luau"]], +"codecs_audio_Mdct": [[8, "src/Rosetta/codecs/audio/Mdct/init.luau"], [228, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], [482, "src/Rosetta/codecs/audio/MidiRender.luau"]], +"codecs_audio_Pcm": [[8, "src/Rosetta/codecs/audio/Pcm/init.luau"], [272, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], [569, "src/Rosetta/codecs/audio/Qoa/init.luau"]], +"codecs_audio_Resample": [[8, "src/Rosetta/codecs/audio/Resample/init.luau"], [403, "src/Rosetta/codecs/audio/Stream.luau"], [565, "src/Rosetta/codecs/audio/Tta/init.luau"], [683, "src/Rosetta/codecs/audio/Tta/Decode.luau"], [935, "src/Rosetta/codecs/audio/VorbisComment.luau"]], +"codecs_compress_Bzip2": [[8, "src/Rosetta/codecs/compress/Bzip2/init.luau"], [52, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], [565, "src/Rosetta/codecs/compress/Explode.luau"], [761, "src/Rosetta/codecs/compress/Lz4.luau"]], +"codecs_compress_Lzh": [[8, "src/Rosetta/codecs/compress/Lzh/init.luau"], [612, "src/Rosetta/codecs/compress/Lzw/init.luau"], [880, "src/Rosetta/codecs/compress/Lzx.luau"]], +"codecs_compress_PackBits": [[8, "src/Rosetta/codecs/compress/PackBits.luau"], [98, "src/Rosetta/codecs/compress/Quantum.luau"], [335, "src/Rosetta/codecs/compress/UnixCompress.luau"], [639, "src/Rosetta/codecs/compress/Xxh32.luau"]], +"codecs_entropy_Huffman": [[8, "src/Rosetta/codecs/entropy/Huffman.luau"], [295, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], [306, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], [527, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.luau"]], +"codecs_font_Bitmap": [[8, "src/Rosetta/codecs/font/Bitmap.luau"], [209, "src/Rosetta/codecs/font/Cff/init.luau"], [850, "src/Rosetta/codecs/font/GlyphNames.luau"]], +"codecs_font_TrueType": [[8, "src/Rosetta/codecs/font/TrueType/init.luau"], [322, "src/Rosetta/codecs/font/TrueType/Glyf.luau"], [714, "src/Rosetta/codecs/font/TrueType/Tables.luau"]], +"codecs_image_Blend": [[8, "src/Rosetta/codecs/image/Blend.luau"], [387, "src/Rosetta/codecs/image/Etc.luau"], [685, "src/Rosetta/codecs/image/Half.luau"]], +"codecs_image_Miptex": [[8, "src/Rosetta/codecs/image/Miptex.luau"], [308, "src/Rosetta/codecs/image/Pixels.luau"]], +"codecs_image_Quantize": [[8, "src/Rosetta/codecs/image/Quantize/init.luau"]], +"codecs_image_Raster": [[8, "src/Rosetta/codecs/image/Raster.luau"]], +"codecs_image_Texel": [[8, "src/Rosetta/codecs/image/Texel.luau"], [381, "src/Rosetta/codecs/image/Texture.luau"], [526, "src/Rosetta/codecs/image/Yuv.luau"]], +"codecs_model_Brush": [[8, "src/Rosetta/codecs/model/Brush.luau"], [648, "src/Rosetta/codecs/model/Displacement.luau"]], +"codecs_model_DoomMap": [[8, "src/Rosetta/codecs/model/DoomMap/init.luau"], [453, "src/Rosetta/codecs/model/DoomMap/Udmf.luau"], [703, "src/Rosetta/codecs/model/Mat4.luau"]], +"codecs_model_MeshFlatten": [[8, "src/Rosetta/codecs/model/MeshFlatten.luau"]], +"codecs_model_Minecraft": [[8, "src/Rosetta/codecs/model/Minecraft/init.luau"], [560, "src/Rosetta/codecs/model/Minecraft/Colors.luau"], [639, "src/Rosetta/codecs/model/Minecraft/Legacy.luau"], [746, "src/Rosetta/codecs/model/Minecraft/Packed.luau"]], +"codecs_model_Patch": [[8, "src/Rosetta/codecs/model/Patch.luau"], [132, "src/Rosetta/codecs/model/Polygon.luau"]], +"codecs_model_Rbx": [[8, "src/Rosetta/codecs/model/Rbx/init.luau"], [245, "src/Rosetta/codecs/model/Rbx/Binary.luau"]], +"codecs_model_Rig": [[8, "src/Rosetta/codecs/model/Rig.luau"], [251, "src/Rosetta/codecs/model/Sampler.luau"], [411, "src/Rosetta/codecs/model/SourceAnim.luau"]], +"codecs_model_Vrml": [[8, "src/Rosetta/codecs/model/Vrml/init.luau"], [156, "src/Rosetta/codecs/model/Vrml/Build.luau"], [730, "src/Rosetta/codecs/model/Vrml/Fields.luau"], [893, "src/Rosetta/codecs/model/Vrml/Geometry.luau"], [1642, "src/Rosetta/codecs/model/Vrml/Parse.luau"], [2164, "src/Rosetta/codecs/model/Vrml/Write.luau"], [2891, "src/Rosetta/codecs/model/Vrml/Xml.luau"]], +"codecs_text_GodotVariant": [[8, "src/Rosetta/codecs/text/GodotVariant.luau"]], +"codecs_text_Json": [[8, "src/Rosetta/codecs/text/Json/init.luau"], [277, "src/Rosetta/codecs/text/Json/Decode.luau"], [712, "src/Rosetta/codecs/text/Json/Encode.luau"]], +"codecs_text_KeyValues": [[8, "src/Rosetta/codecs/text/KeyValues/init.luau"], [578, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], [884, "src/Rosetta/codecs/text/Lexer/init.luau"]], +"codecs_text_Nbt": [[8, "src/Rosetta/codecs/text/Nbt/init.luau"], [361, "src/Rosetta/codecs/text/Nbt/Binary.luau"], [1053, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], [1693, "src/Rosetta/codecs/text/Nbt/Value.luau"]], +"codecs_text_Text": [[8, "src/Rosetta/codecs/text/Text/init.luau"], [99, "src/Rosetta/codecs/text/Url/init.luau"]], +"codecs_text_Xml": [[8, "src/Rosetta/codecs/text/Xml/init.luau"], [458, "src/Rosetta/codecs/text/Xml/Parse.luau"]], +"codecs_video_Video": [[8, "src/Rosetta/codecs/video/Video/init.luau"], [623, "src/Rosetta/codecs/video/Video/Disposable.luau"], [834, "src/Rosetta/codecs/video/Video/Pool.luau"], [886, "src/Rosetta/codecs/video/Video/Source.luau"]], +"containers_Archive": [[8, "src/Rosetta/containers/Archive.luau"], [275, "src/Rosetta/containers/AudioWrap.luau"]], +"containers_Avi": [[8, "src/Rosetta/containers/Avi/init.luau"]], +"containers_Blend": [[8, "src/Rosetta/containers/Blend.luau"], [747, "src/Rosetta/containers/Chunks.luau"]], +"containers_Cpio": [[8, "src/Rosetta/containers/Cpio.luau"], [436, "src/Rosetta/containers/Demux.luau"], [722, "src/Rosetta/containers/Ebml/init.luau"]], +"containers_Fat": [[8, "src/Rosetta/containers/Fat.luau"]], +"containers_Iso9660": [[8, "src/Rosetta/containers/Iso9660.luau"]], +"containers_IsoBmff": [[8, "src/Rosetta/containers/IsoBmff/init.luau"], [179, "src/Rosetta/containers/IsoBmff/Box.luau"], [368, "src/Rosetta/containers/IsoBmff/Demux.luau"], [1214, "src/Rosetta/containers/IsoBmff/Meta.luau"], [1736, "src/Rosetta/containers/IsoBmff/Mux.luau"], [2253, "src/Rosetta/containers/IsoBmff/QtPalette.luau"]], +"containers_MacFile": [[8, "src/Rosetta/containers/MacFile.luau"], [157, "src/Rosetta/containers/Ogg/init.luau"], [582, "src/Rosetta/containers/Ogg/Mux.luau"], [771, "src/Rosetta/containers/Ogg/Page.luau"]], +"containers_Riff": [[8, "src/Rosetta/containers/Riff/init.luau"], [325, "src/Rosetta/containers/Tar.luau"]], +"containers_Zip": [[8, "src/Rosetta/containers/Zip/init.luau"]], +"core_Adler32": [[8, "src/Rosetta/core/Adler32.luau"], [68, "src/Rosetta/core/Base64.luau"], [296, "src/Rosetta/core/Crc32.luau"], [447, "src/Rosetta/core/Md5.luau"]], +"data_cbor": [[8, "src/Rosetta/data/cbor/init.luau"], [107, "src/Rosetta/data/cbor/Codec.luau"], [676, "src/Rosetta/data/csv/init.luau"]], +"data_ini": [[8, "src/Rosetta/data/ini/init.luau"], [254, "src/Rosetta/data/json/init.luau"], [346, "src/Rosetta/data/msgpack/init.luau"], [435, "src/Rosetta/data/msgpack/Codec.luau"], [877, "src/Rosetta/data/nbt/init.luau"]], +"data_plist": [[8, "src/Rosetta/data/plist/init.luau"], [314, "src/Rosetta/data/plist/Binary.luau"], [581, "src/Rosetta/data/q3shader/init.luau"], [820, "src/Rosetta/data/q3skin/init.luau"], [916, "src/Rosetta/data/snbt/init.luau"]], +"data_toml": [[8, "src/Rosetta/data/toml/init.luau"], [75, "src/Rosetta/data/toml/Decode.luau"], [703, "src/Rosetta/data/toml/Encode.luau"], [912, "src/Rosetta/data/tres/init.luau"], [1057, "src/Rosetta/data/vdf/init.luau"]], +"data_xml": [[8, "src/Rosetta/data/xml/init.luau"]], +"data_yaml": [[8, "src/Rosetta/data/yaml/init.luau"], [81, "src/Rosetta/data/yaml/Emit.luau"], [371, "src/Rosetta/data/yaml/Parse.luau"]], +"font_bdf": [[8, "src/Rosetta/font/bdf/init.luau"]], +"font_bmfont": [[8, "src/Rosetta/font/bmfont/init.luau"], [435, "src/Rosetta/font/bmfont/Parse.luau"], [888, "src/Rosetta/font/eot/init.luau"]], +"font_fon": [[8, "src/Rosetta/font/fon/init.luau"], [291, "src/Rosetta/font/hershey/init.luau"], [486, "src/Rosetta/font/pcf/init.luau"]], +"font_psf": [[8, "src/Rosetta/font/psf/init.luau"], [328, "src/Rosetta/font/ttf/init.luau"], [379, "src/Rosetta/font/type1/init.luau"], [738, "src/Rosetta/font/type1/Charstring.luau"]], +"font_woff": [[8, "src/Rosetta/font/woff/init.luau"], [140, "src/Rosetta/font/woff2/init.luau"], [197, "src/Rosetta/font/woff2/Rebuild.luau"]], +"host_Love": [[8, "src/Rosetta/host/Love.luau"], [151, "src/Rosetta/host/LuaJIT.luau"], [201, "src/Rosetta/host/Luau.luau"], [224, "src/Rosetta/host/Roblox.luau"]], +"image_ani": [[8, "src/Rosetta/image/ani/init.luau"], [188, "src/Rosetta/image/art/init.luau"], [676, "src/Rosetta/image/blp/init.luau"]], +"image_bmp": [[8, "src/Rosetta/image/bmp/init.luau"], [423, "src/Rosetta/image/dds/init.luau"]], +"image_exr": [[8, "src/Rosetta/image/exr/init.luau"], [768, "src/Rosetta/image/exr/Codec.luau"], [879, "src/Rosetta/image/exr/Piz.luau"]], +"image_gif": [[8, "src/Rosetta/image/gif/init.luau"], [524, "src/Rosetta/image/gif/Decode.luau"], [600, "src/Rosetta/image/hdr/init.luau"], [829, "src/Rosetta/image/hdr/Codec.luau"]], +"image_icns": [[8, "src/Rosetta/image/icns/init.luau"], [339, "src/Rosetta/image/ico/init.luau"], [616, "src/Rosetta/image/ico/Dib.luau"]], +"image_ilbm": [[8, "src/Rosetta/image/ilbm/init.luau"], [327, "src/Rosetta/image/jpeg/init.luau"]], +"image_ktx": [[8, "src/Rosetta/image/ktx/init.luau"], [668, "src/Rosetta/image/lmp/init.luau"]], +"image_pcx": [[8, "src/Rosetta/image/pcx/init.luau"], [272, "src/Rosetta/image/pnm/init.luau"], [650, "src/Rosetta/image/pnm/Codec.luau"]], +"image_qoi": [[8, "src/Rosetta/image/qoi/init.luau"], [130, "src/Rosetta/image/qoi/Codec.luau"], [287, "src/Rosetta/image/sgi/init.luau"], [572, "src/Rosetta/image/spr/init.luau"]], +"image_sunras": [[8, "src/Rosetta/image/sunras/init.luau"], [254, "src/Rosetta/image/tga/init.luau"], [524, "src/Rosetta/image/tga/Codec.luau"]], +"image_tiff": [[8, "src/Rosetta/image/tiff/init.luau"], [835, "src/Rosetta/image/tiff/Pixels.luau"]], +"image_tim": [[8, "src/Rosetta/image/tim/init.luau"], [250, "src/Rosetta/image/vtf/init.luau"]], +"image_webp": [[8, "src/Rosetta/image/webp/init.luau"], [618, "src/Rosetta/image/webp/Alpha.luau"], [694, "src/Rosetta/image/webp/Anim.luau"], [849, "src/Rosetta/image/xbm/init.luau"]], +"image_xpm": [[8, "src/Rosetta/image/xpm/init.luau"], [276, "src/Rosetta/image/xpm/Names.luau"]], +"layered_aseprite": [[8, "src/Rosetta/layered/aseprite/init.luau"]], +"layered_ora": [[8, "src/Rosetta/layered/ora/init.luau"]], +"layered_psd": [[8, "src/Rosetta/layered/psd/init.luau"], [743, "src/Rosetta/layered/psd/Channels.luau"]], +"model_3ds": [[8, "src/Rosetta/model/3ds/init.luau"], [91, "src/Rosetta/model/3ds/Build.luau"], [738, "src/Rosetta/model/3ds/Read.luau"], [1234, "src/Rosetta/model/3ds/Write.luau"]], +"model_3mf": [[8, "src/Rosetta/model/3mf/init.luau"], [90, "src/Rosetta/model/3mf/Read.luau"], [678, "src/Rosetta/model/3mf/Write.luau"]], +"model_ase": [[8, "src/Rosetta/model/ase/init.luau"], [131, "src/Rosetta/model/ase/Build.luau"], [705, "src/Rosetta/model/ase/Parse.luau"], [774, "src/Rosetta/model/ase/Write.luau"]], +"model_b3d": [[8, "src/Rosetta/model/b3d/init.luau"], [63, "src/Rosetta/model/b3d/Read.luau"]], +"model_blend": [[8, "src/Rosetta/model/blend/init.luau"], [108, "src/Rosetta/model/blend/Anim.luau"], [637, "src/Rosetta/model/blend/Armature.luau"], [1173, "src/Rosetta/model/blend/Driver.luau"], [1348, "src/Rosetta/model/blend/Material.luau"], [1700, "src/Rosetta/model/blend/Mesh.luau"], [2388, "src/Rosetta/model/blend/Normals.luau"], [2549, "src/Rosetta/model/blend/Prim.luau"], [3056, "src/Rosetta/model/blend/Read.luau"]], +"model_bsp": [[8, "src/Rosetta/model/bsp/init.luau"], [199, "src/Rosetta/model/bsp/Lightmap.luau"], [265, "src/Rosetta/model/bsp/Quake.luau"], [654, "src/Rosetta/model/bsp/Quake3.luau"], [883, "src/Rosetta/model/bsp/Tree.luau"]], +"model_buildmap": [[8, "src/Rosetta/model/buildmap/init.luau"], [280, "src/Rosetta/model/buildmap/Geometry.luau"]], +"model_d3map": [[8, "src/Rosetta/model/d3map/init.luau"], [290, "src/Rosetta/model/d3map/Parse.luau"]], +"model_dae": [[8, "src/Rosetta/model/dae/init.luau"], [197, "src/Rosetta/model/dae/Math.luau"], [244, "src/Rosetta/model/dae/Read.luau"], [2094, "src/Rosetta/model/dae/Write.luau"]], +"model_fbx": [[8, "src/Rosetta/model/fbx/init.luau"], [156, "src/Rosetta/model/fbx/Ascii.luau"], [426, "src/Rosetta/model/fbx/Binary.luau"], [881, "src/Rosetta/model/fbx/Read.luau"], [2243, "src/Rosetta/model/fbx/Write.luau"], [3228, "src/Rosetta/model/fbx/Xform.luau"]], +"model_gltf": [[8, "src/Rosetta/model/gltf/init.luau"], [245, "src/Rosetta/model/gltf/Pack.luau"], [314, "src/Rosetta/model/gltf/Read.luau"], [1055, "src/Rosetta/model/gltf/Write.luau"]], +"model_godot": [[8, "src/Rosetta/model/godot/init.luau"], [99, "src/Rosetta/model/godot/Build.luau"], [641, "src/Rosetta/model/godot/Primitives.luau"], [916, "src/Rosetta/model/godot/Surface.luau"], [1401, "src/Rosetta/model/godot/Write.luau"]], +"model_iqm": [[8, "src/Rosetta/model/iqm/init.luau"], [84, "src/Rosetta/model/iqm/Read.luau"], [439, "src/Rosetta/model/iqm/Write.luau"]], +"model_ldraw": [[8, "src/Rosetta/model/ldraw/init.luau"], [86, "src/Rosetta/model/ldraw/Colors.luau"], [404, "src/Rosetta/model/ldraw/Read.luau"]], +"model_lwo": [[8, "src/Rosetta/model/lwo/init.luau"], [84, "src/Rosetta/model/lwo/Build.luau"], [546, "src/Rosetta/model/lwo/Parse.luau"]], +"model_map": [[8, "src/Rosetta/model/map/init.luau"], [325, "src/Rosetta/model/map/Build.luau"], [569, "src/Rosetta/model/map/Parse.luau"], [954, "src/Rosetta/model/map/Write.luau"]], +"model_mca": [[8, "src/Rosetta/model/mca/init.luau"], [350, "src/Rosetta/model/mca/Chunk.luau"], [483, "src/Rosetta/model/mca/Lz4Block.luau"], [553, "src/Rosetta/model/md2/init.luau"]], +"model_md3": [[8, "src/Rosetta/model/md3/init.luau"], [236, "src/Rosetta/model/md5/init.luau"], [317, "src/Rosetta/model/md5/Read.luau"]], +"model_mdl": [[8, "src/Rosetta/model/mdl/init.luau"], [90, "src/Rosetta/model/mdl/HalfLife.luau"], [394, "src/Rosetta/model/mdl/Quake.luau"]], +"model_ms3d": [[8, "src/Rosetta/model/ms3d/init.luau"], [80, "src/Rosetta/model/ms3d/Read.luau"], [526, "src/Rosetta/model/ms3d/Write.luau"]], +"model_obj": [[8, "src/Rosetta/model/obj/init.luau"], [826, "src/Rosetta/model/obj/Mtl.luau"]], +"model_off": [[8, "src/Rosetta/model/off/init.luau"]], +"model_ply": [[8, "src/Rosetta/model/ply/init.luau"], [1113, "src/Rosetta/model/ply/Binary.luau"]], +"model_pmx": [[8, "src/Rosetta/model/pmx/init.luau"], [77, "src/Rosetta/model/pmx/Build.luau"], [373, "src/Rosetta/model/pmx/Pmd.luau"], [708, "src/Rosetta/model/pmx/Read.luau"]], +"model_proc": [[8, "src/Rosetta/model/proc/init.luau"], [390, "src/Rosetta/model/qb/init.luau"]], +"model_rbxm": [[8, "src/Rosetta/model/rbxm/init.luau"]], +"model_rbxmx": [[8, "src/Rosetta/model/rbxmx/init.luau"]], +"model_robloxmesh": [[8, "src/Rosetta/model/robloxmesh/init.luau"], [667, "src/Rosetta/model/robloxmesh/Parse.luau"], [1124, "src/Rosetta/model/robloxmesh/Write.luau"]], +"model_schematic": [[8, "src/Rosetta/model/schematic/init.luau"], [329, "src/Rosetta/model/schematic/Common.luau"], [449, "src/Rosetta/model/schematic/Litematic.luau"], [660, "src/Rosetta/model/schematic/Mcedit.luau"], [904, "src/Rosetta/model/schematic/Sponge.luau"]], +"model_smd": [[8, "src/Rosetta/model/smd/init.luau"], [75, "src/Rosetta/model/smd/Read.luau"], [344, "src/Rosetta/model/smd/Write.luau"]], +"model_sourcemdl": [[8, "src/Rosetta/model/sourcemdl/init.luau"], [179, "src/Rosetta/model/sourcemdl/Build.luau"], [609, "src/Rosetta/model/sourcemdl/Material.luau"], [770, "src/Rosetta/model/sourcemdl/Mdl.luau"], [1297, "src/Rosetta/model/sourcemdl/Phy.luau"], [1420, "src/Rosetta/model/sourcemdl/Vtx.luau"], [1602, "src/Rosetta/model/sourcemdl/Vvd.luau"]], +"model_stl": [[8, "src/Rosetta/model/stl/init.luau"], [458, "src/Rosetta/model/stl/Decode.luau"]], +"model_t3d": [[8, "src/Rosetta/model/t3d/init.luau"], [102, "src/Rosetta/model/t3d/Build.luau"], [507, "src/Rosetta/model/t3d/Parse.luau"], [675, "src/Rosetta/model/udmf/init.luau"]], +"model_usda": [[8, "src/Rosetta/model/usda/init.luau"], [217, "src/Rosetta/model/usda/Build.luau"], [1495, "src/Rosetta/model/usda/Parse.luau"], [2293, "src/Rosetta/model/usda/Write.luau"]], +"model_vbsp": [[8, "src/Rosetta/model/vbsp/init.luau"], [454, "src/Rosetta/model/vbsp/Faces.luau"], [678, "src/Rosetta/model/vbsp/Props.luau"]], +"model_vmf": [[8, "src/Rosetta/model/vmf/init.luau"], [333, "src/Rosetta/model/vmf/Build.luau"]], +"model_vox": [[8, "src/Rosetta/model/vox/init.luau"], [894, "src/Rosetta/model/vox/Grid.luau"], [951, "src/Rosetta/model/vrml/init.luau"]], +"model_x": [[8, "src/Rosetta/model/x/init.luau"], [138, "src/Rosetta/model/x/Build.luau"], [701, "src/Rosetta/model/x/Parse.luau"]], +"model_x3d": [[8, "src/Rosetta/model/x3d/init.luau"]], +"music_669": [[8, "src/Rosetta/music/669/init.luau"], [215, "src/Rosetta/music/ahx/init.luau"], [267, "src/Rosetta/music/far/init.luau"], [497, "src/Rosetta/music/hmp/init.luau"], [762, "src/Rosetta/music/hvl/init.luau"]], +"music_it": [[8, "src/Rosetta/music/it/init.luau"], [427, "src/Rosetta/music/it/Itsex.luau"]], +"music_med": [[8, "src/Rosetta/music/med/init.luau"]], +"music_midi": [[8, "src/Rosetta/music/midi/init.luau"], [152, "src/Rosetta/music/midi/Smf.luau"], [564, "src/Rosetta/music/mod/init.luau"]], +"music_mtm": [[8, "src/Rosetta/music/mtm/init.luau"], [231, "src/Rosetta/music/mus/init.luau"], [389, "src/Rosetta/music/okt/init.luau"], [671, "src/Rosetta/music/ptm/init.luau"]], +"music_s3m": [[8, "src/Rosetta/music/s3m/init.luau"], [245, "src/Rosetta/music/sf2/init.luau"], [289, "src/Rosetta/music/stm/init.luau"], [521, "src/Rosetta/music/ult/init.luau"], [826, "src/Rosetta/music/umx/init.luau"]], +"music_xm": [[8, "src/Rosetta/music/xm/init.luau"], [570, "src/Rosetta/music/xmi/init.luau"]], +"ops_AudioOps": [[8, "src/Rosetta/ops/AudioOps.luau"]], +"ops_ImageOps": [[8, "src/Rosetta/ops/ImageOps/init.luau"], [656, "src/Rosetta/ops/ImageOps/Kernels.luau"]], +"ops_LayerOps": [[8, "src/Rosetta/ops/LayerOps.luau"]], +"ops_MeshOps": [[8, "src/Rosetta/ops/MeshOps/init.luau"], [1148, "src/Rosetta/ops/MeshOps/Greedy.luau"]], +"ops_MusicOps": [[8, "src/Rosetta/ops/MusicOps.luau"]], +"playlist_m3u": [[8, "src/Rosetta/playlist/m3u/init.luau"], [361, "src/Rosetta/playlist/pls/init.luau"], [539, "src/Rosetta/playlist/xspf/init.luau"]], +"subtitle_ass": [[8, "src/Rosetta/subtitle/ass/init.luau"], [452, "src/Rosetta/subtitle/srt/init.luau"], [625, "src/Rosetta/subtitle/vtt/init.luau"]], +"vector_gamemaps": [[8, "src/Rosetta/vector/gamemaps/init.luau"], [195, "src/Rosetta/vector/gamemaps/Expand.luau"]], +"vector_ldtk": [[8, "src/Rosetta/vector/ldtk/init.luau"], [100, "src/Rosetta/vector/ldtk/Read.luau"], [436, "src/Rosetta/vector/ldtk/Write.luau"]], +"vector_ogmo": [[8, "src/Rosetta/vector/ogmo/init.luau"], [127, "src/Rosetta/vector/ogmo/Read.luau"], [532, "src/Rosetta/vector/ogmo/Write.luau"]], +"vector_svg": [[8, "src/Rosetta/vector/svg/init.luau"], [94, "src/Rosetta/vector/svg/Parse.luau"], [840, "src/Rosetta/vector/svg/PathData.luau"], [1208, "src/Rosetta/vector/svg/Render.luau"], [1625, "src/Rosetta/vector/svg/Style.luau"], [1997, "src/Rosetta/vector/svg/Write.luau"]], +"vector_tiled": [[8, "src/Rosetta/vector/tiled/init.luau"], [188, "src/Rosetta/vector/tiled/Data.luau"], [339, "src/Rosetta/vector/tiled/Tmj.luau"], [970, "src/Rosetta/vector/tiled/Tmx.luau"]], +"video_avi": [[8, "src/Rosetta/video/avi/init.luau"], [302, "src/Rosetta/video/fli/init.luau"]], +"video_flv": [[8, "src/Rosetta/video/flv/init.luau"], [392, "src/Rosetta/video/flv/Amf.luau"], [550, "src/Rosetta/video/flv/Mux.luau"], [831, "src/Rosetta/video/h264/init.luau"]], +"video_mkv": [[8, "src/Rosetta/video/mkv/init.luau"], [164, "src/Rosetta/video/mkv/Mux.luau"], [443, "src/Rosetta/video/mkv/Parse.luau"]], +"video_mp4": [[8, "src/Rosetta/video/mp4/init.luau"], [336, "src/Rosetta/video/mpegps/init.luau"], [523, "src/Rosetta/video/mpegts/init.luau"]], +"video_ogv": [[8, "src/Rosetta/video/ogv/init.luau"], [403, "src/Rosetta/video/smk/init.luau"], [712, "src/Rosetta/video/smk/Audio.luau"], [832, "src/Rosetta/video/y4m/init.luau"]] } diff --git a/build/Rosetta.rbxmx b/build/Rosetta.rbxmx index 6f17d75..0437068 100644 --- a/build/Rosetta.rbxmx +++ b/build/Rosetta.rbxmx @@ -9,24 +9,13 @@ -- required on the first include of one of them. require(this) -> the API (docs/API.md); -- Rosetta._internal("codecs/video/Mpeg1") -> an internal module. local __CHUNK = { - [""] = "Core_1", - ["Registry"] = "Core_1", - ["Types"] = "Core_1", - ["codecs/audio/Adpcm"] = "Core_1", - ["codecs/image/Yuv"] = "Core_1", - ["codecs/model/Rbx"] = "Core_1", - ["codecs/video/Video"] = "Core_1", - ["codecs/video/Video/Disposable"] = "Core_1", - ["codecs/video/Video/Pool"] = "Core_1", - ["containers/AudioWrap"] = "Core_1", - ["containers/Ogg/Mux"] = "Core_1", - ["core/Bytes"] = "Core_2", - ["core/Crc32"] = "Core_2", - ["core/Err"] = "Core_2", - ["core/Input"] = "Core_2", - ["host"] = "Core_2", - ["ops/ImageOps"] = "Core_2", - ["ops/ImageOps/Kernels"] = "Core_2", + [""] = "Core", + ["Registry"] = "Core", + ["Types"] = "Core", + ["core/Bytes"] = "Core", + ["core/Err"] = "Core", + ["core/Input"] = "Core", + ["host"] = "Core", ["Sniffs"] = "Detect", ["core/Bits"] = "Detect", ["core/Crc16"] = "Detect", @@ -166,470 +155,481 @@ local __CHUNK = { ["codecs/model/Draco/KdTree"] = "Draco", ["codecs/model/Draco/Predict"] = "Draco", ["codecs/model/Draco/Reader"] = "Draco", - ["archive/7z"] = "archive_1", - ["archive/7z/Header"] = "archive_1", - ["archive/adf"] = "archive_1", - ["archive/applesingle"] = "archive_1", - ["archive/ar"] = "archive_1", - ["archive/arj"] = "archive_1", - ["archive/binhex"] = "archive_1", - ["archive/br"] = "archive_1", - ["archive/bz2"] = "archive_1", - ["archive/cab"] = "archive_1", - ["archive/cab/Sum"] = "archive_1", - ["archive/cpio"] = "archive_1", - ["archive/d64"] = "archive_1", - ["archive/fat"] = "archive_1", - ["archive/grp"] = "archive_1", - ["archive/gzip"] = "archive_1", - ["archive/iso"] = "archive_1", - ["archive/lha"] = "archive_1", - ["archive/lz4"] = "archive_1", - ["archive/macbinary"] = "archive_1", - ["archive/mpq"] = "archive_1", - ["archive/mpq/Crypt"] = "archive_1", - ["archive/pak"] = "archive_1", - ["archive/rpm"] = "archive_1", - ["archive/tar"] = "archive_1", - ["archive/unitypackage"] = "archive_1", - ["archive/uu"] = "archive_1", - ["archive/vpk"] = "archive_1", - ["archive/vswap"] = "archive_1", - ["archive/wad"] = "archive_1", - ["archive/wad/Picture"] = "archive_1", - ["archive/wad2"] = "archive_1", - ["archive/xz"] = "archive_1", - ["archive/yenc"] = "archive_2", - ["archive/z"] = "archive_2", - ["archive/zip"] = "archive_2", - ["archive/zoo"] = "archive_2", - ["archive/zst"] = "archive_2", - ["audio/aac"] = "audio", - ["audio/ac3"] = "audio", - ["audio/adpcm"] = "audio", - ["audio/adx"] = "audio", - ["audio/aiff"] = "audio", - ["audio/ape"] = "audio", - ["audio/au"] = "audio", - ["audio/brstm"] = "audio", - ["audio/caf"] = "audio", - ["audio/flac"] = "audio", - ["audio/flac/Meta"] = "audio", - ["audio/flac/Stream"] = "audio", - ["audio/m4a"] = "audio", - ["audio/mp3"] = "audio", - ["audio/mp3/Index"] = "audio", - ["audio/mp3/Stream"] = "audio", - ["audio/mp3/Tags"] = "audio", - ["audio/mpc"] = "audio", - ["audio/opus"] = "audio", - ["audio/opus/Encode"] = "audio", - ["audio/qoa"] = "audio", - ["audio/tta"] = "audio", - ["audio/vag"] = "audio", - ["audio/voc"] = "audio", - ["audio/vorbis"] = "audio", - ["audio/vorbis/Encode"] = "audio", - ["audio/wav"] = "audio", - ["audio/wav/Codecs"] = "audio", - ["audio/wavpack"] = "audio", - ["cad/step"] = "cad", - ["cad/step/Brep"] = "cad", - ["cad/step/Parse"] = "cad", - ["cad/step/Write"] = "cad", - ["codecs/audio/Ac3"] = "codecs_audio", - ["codecs/audio/Ac3/Decode"] = "codecs_audio", - ["codecs/audio/Ac3/Tables"] = "codecs_audio", - ["codecs/audio/Adpcm/Decoder"] = "codecs_audio", - ["codecs/audio/Alac"] = "codecs_audio", - ["codecs/audio/Alac/Decode"] = "codecs_audio", - ["codecs/audio/Alac/Encode"] = "codecs_audio", - ["codecs/audio/Ape"] = "codecs_audio", - ["codecs/audio/Ape/Decode"] = "codecs_audio", - ["codecs/audio/ApeTag"] = "codecs_audio", - ["codecs/audio/Mdct"] = "codecs_audio", - ["codecs/audio/Mdct/Fft"] = "codecs_audio", - ["codecs/audio/MidiRender"] = "codecs_audio", - ["codecs/audio/Pcm"] = "codecs_audio", - ["codecs/audio/Pcm/Convert"] = "codecs_audio", - ["codecs/audio/Qoa"] = "codecs_audio", - ["codecs/audio/Resample"] = "codecs_audio", - ["codecs/audio/Stream"] = "codecs_audio", - ["codecs/audio/Tta"] = "codecs_audio", - ["codecs/audio/Tta/Decode"] = "codecs_audio", - ["codecs/audio/VorbisComment"] = "codecs_audio", - ["codecs/compress/Bzip2"] = "codecs_compress", - ["codecs/compress/Bzip2/Decode"] = "codecs_compress", - ["codecs/compress/Explode"] = "codecs_compress", - ["codecs/compress/Lz4"] = "codecs_compress", - ["codecs/compress/Lzh"] = "codecs_compress", - ["codecs/compress/Lzw"] = "codecs_compress", - ["codecs/compress/Lzx"] = "codecs_compress", - ["codecs/compress/PackBits"] = "codecs_compress", - ["codecs/compress/Quantum"] = "codecs_compress", - ["codecs/compress/UnixCompress"] = "codecs_compress", - ["codecs/compress/Xxh32"] = "codecs_compress", - ["codecs/entropy/Huffman"] = "codecs_entropy", - ["codecs/entropy/RangeCoder"] = "codecs_entropy", - ["codecs/entropy/RangeCoder/Decoder"] = "codecs_entropy", - ["codecs/entropy/RangeCoder/Encoder"] = "codecs_entropy", - ["codecs/font/Bitmap"] = "codecs_font", - ["codecs/font/Cff"] = "codecs_font", - ["codecs/font/GlyphNames"] = "codecs_font", - ["codecs/font/TrueType"] = "codecs_font", - ["codecs/font/TrueType/Glyf"] = "codecs_font", - ["codecs/font/TrueType/Tables"] = "codecs_font", - ["codecs/image/Blend"] = "codecs_image", - ["codecs/image/Etc"] = "codecs_image", - ["codecs/image/Half"] = "codecs_image", - ["codecs/image/Miptex"] = "codecs_image", - ["codecs/image/Pixels"] = "codecs_image", - ["codecs/image/Quantize"] = "codecs_image", - ["codecs/image/Raster"] = "codecs_image", - ["codecs/image/Texel"] = "codecs_image", - ["codecs/image/Texture"] = "codecs_image", - ["codecs/model/Brush"] = "codecs_model", - ["codecs/model/Displacement"] = "codecs_model", - ["codecs/model/DoomMap"] = "codecs_model", - ["codecs/model/DoomMap/Udmf"] = "codecs_model", - ["codecs/model/Mat4"] = "codecs_model", - ["codecs/model/MeshFlatten"] = "codecs_model", - ["codecs/model/Minecraft"] = "codecs_model", - ["codecs/model/Minecraft/Colors"] = "codecs_model", - ["codecs/model/Minecraft/Legacy"] = "codecs_model", - ["codecs/model/Minecraft/Packed"] = "codecs_model", - ["codecs/model/Patch"] = "codecs_model", - ["codecs/model/Polygon"] = "codecs_model", - ["codecs/model/Rbx/Binary"] = "codecs_model", - ["codecs/model/Rig"] = "codecs_model", - ["codecs/model/Sampler"] = "codecs_model", - ["codecs/model/SourceAnim"] = "codecs_model", - ["codecs/model/Vrml"] = "codecs_model", - ["codecs/model/Vrml/Build"] = "codecs_model", - ["codecs/model/Vrml/Fields"] = "codecs_model", - ["codecs/model/Vrml/Geometry"] = "codecs_model", - ["codecs/model/Vrml/Parse"] = "codecs_model", - ["codecs/model/Vrml/Write"] = "codecs_model", - ["codecs/model/Vrml/Xml"] = "codecs_model", - ["codecs/text/GodotVariant"] = "codecs_text", - ["codecs/text/Json"] = "codecs_text", - ["codecs/text/Json/Decode"] = "codecs_text", - ["codecs/text/Json/Encode"] = "codecs_text", - ["codecs/text/KeyValues"] = "codecs_text", - ["codecs/text/KeyValues/Binary"] = "codecs_text", - ["codecs/text/Lexer"] = "codecs_text", - ["codecs/text/Nbt"] = "codecs_text", - ["codecs/text/Nbt/Binary"] = "codecs_text", - ["codecs/text/Nbt/Snbt"] = "codecs_text", - ["codecs/text/Nbt/Value"] = "codecs_text", - ["codecs/text/Text"] = "codecs_text", - ["codecs/text/Url"] = "codecs_text", - ["codecs/text/Xml"] = "codecs_text", - ["codecs/text/Xml/Parse"] = "codecs_text", - ["codecs/video/Video/Source"] = "codecs_video", - ["containers/Archive"] = "containers", - ["containers/Avi"] = "containers", - ["containers/Blend"] = "containers", - ["containers/Chunks"] = "containers", - ["containers/Cpio"] = "containers", - ["containers/Demux"] = "containers", - ["containers/Ebml"] = "containers", - ["containers/Fat"] = "containers", - ["containers/Iso9660"] = "containers", - ["containers/IsoBmff"] = "containers", - ["containers/IsoBmff/Box"] = "containers", - ["containers/IsoBmff/Demux"] = "containers", - ["containers/IsoBmff/Meta"] = "containers", - ["containers/IsoBmff/Mux"] = "containers", - ["containers/IsoBmff/QtPalette"] = "containers", - ["containers/MacFile"] = "containers", - ["containers/Ogg"] = "containers", - ["containers/Ogg/Page"] = "containers", - ["containers/Riff"] = "containers", - ["containers/Tar"] = "containers", - ["containers/Zip"] = "containers", - ["core/Adler32"] = "core", - ["core/Base64"] = "core", - ["core/Md5"] = "core", - ["data/cbor"] = "data", - ["data/cbor/Codec"] = "data", - ["data/csv"] = "data", - ["data/ini"] = "data", - ["data/json"] = "data", - ["data/msgpack"] = "data", - ["data/msgpack/Codec"] = "data", - ["data/nbt"] = "data", - ["data/plist"] = "data", - ["data/plist/Binary"] = "data", - ["data/q3shader"] = "data", - ["data/q3skin"] = "data", - ["data/snbt"] = "data", - ["data/toml"] = "data", - ["data/toml/Decode"] = "data", - ["data/toml/Encode"] = "data", - ["data/tres"] = "data", - ["data/vdf"] = "data", - ["data/xml"] = "data", - ["data/yaml"] = "data", - ["data/yaml/Emit"] = "data", - ["data/yaml/Parse"] = "data", - ["font/bdf"] = "font", - ["font/bmfont"] = "font", - ["font/bmfont/Parse"] = "font", - ["font/eot"] = "font", - ["font/fon"] = "font", - ["font/hershey"] = "font", - ["font/pcf"] = "font", - ["font/psf"] = "font", - ["font/ttf"] = "font", - ["font/type1"] = "font", - ["font/type1/Charstring"] = "font", - ["font/woff"] = "font", - ["font/woff2"] = "font", - ["font/woff2/Rebuild"] = "font", - ["host/Love"] = "host", - ["host/LuaJIT"] = "host", - ["host/Luau"] = "host", - ["host/Roblox"] = "host", - ["image/ani"] = "image_1", - ["image/art"] = "image_1", - ["image/blp"] = "image_1", - ["image/bmp"] = "image_1", - ["image/dds"] = "image_1", - ["image/exr"] = "image_1", - ["image/exr/Codec"] = "image_1", - ["image/exr/Piz"] = "image_1", - ["image/gif"] = "image_1", - ["image/gif/Decode"] = "image_1", - ["image/hdr"] = "image_1", - ["image/hdr/Codec"] = "image_1", - ["image/icns"] = "image_1", - ["image/ico"] = "image_1", - ["image/ico/Dib"] = "image_1", - ["image/ilbm"] = "image_1", - ["image/jpeg"] = "image_1", - ["image/ktx"] = "image_1", - ["image/lmp"] = "image_1", - ["image/pcx"] = "image_1", - ["image/pnm"] = "image_1", - ["image/pnm/Codec"] = "image_1", - ["image/qoi"] = "image_1", - ["image/qoi/Codec"] = "image_1", - ["image/sgi"] = "image_1", - ["image/spr"] = "image_2", - ["image/sunras"] = "image_2", - ["image/tga"] = "image_2", - ["image/tga/Codec"] = "image_2", - ["image/tiff"] = "image_2", - ["image/tiff/Pixels"] = "image_2", - ["image/tim"] = "image_2", - ["image/vtf"] = "image_2", - ["image/webp"] = "image_2", - ["image/webp/Alpha"] = "image_2", - ["image/webp/Anim"] = "image_2", - ["image/xbm"] = "image_2", - ["image/xpm"] = "image_2", - ["image/xpm/Names"] = "image_2", - ["layered/aseprite"] = "layered", - ["layered/ora"] = "layered", - ["layered/psd"] = "layered", - ["layered/psd/Channels"] = "layered", - ["model/3ds"] = "model_1", - ["model/3ds/Build"] = "model_1", - ["model/3ds/Read"] = "model_1", - ["model/3ds/Write"] = "model_1", - ["model/3mf"] = "model_1", - ["model/3mf/Read"] = "model_1", - ["model/3mf/Write"] = "model_1", - ["model/ase"] = "model_1", - ["model/ase/Build"] = "model_1", - ["model/ase/Parse"] = "model_1", - ["model/ase/Write"] = "model_1", - ["model/b3d"] = "model_1", - ["model/b3d/Read"] = "model_1", - ["model/blend"] = "model_1", - ["model/blend/Anim"] = "model_1", - ["model/blend/Armature"] = "model_1", - ["model/blend/Driver"] = "model_1", - ["model/blend/Material"] = "model_1", - ["model/blend/Mesh"] = "model_1", - ["model/blend/Normals"] = "model_2", - ["model/blend/Prim"] = "model_2", - ["model/blend/Read"] = "model_2", - ["model/bsp"] = "model_2", - ["model/bsp/Lightmap"] = "model_2", - ["model/bsp/Quake"] = "model_2", - ["model/bsp/Quake3"] = "model_2", - ["model/bsp/Tree"] = "model_2", - ["model/buildmap"] = "model_2", - ["model/buildmap/Geometry"] = "model_2", - ["model/d3map"] = "model_2", - ["model/d3map/Parse"] = "model_2", - ["model/dae"] = "model_2", - ["model/dae/Math"] = "model_2", - ["model/dae/Read"] = "model_2", - ["model/dae/Write"] = "model_2", - ["model/fbx"] = "model_2", - ["model/fbx/Ascii"] = "model_2", - ["model/fbx/Binary"] = "model_2", - ["model/fbx/Read"] = "model_3", - ["model/fbx/Write"] = "model_3", - ["model/fbx/Xform"] = "model_3", - ["model/gltf"] = "model_3", - ["model/gltf/Pack"] = "model_3", - ["model/gltf/Read"] = "model_3", - ["model/gltf/Write"] = "model_3", - ["model/godot"] = "model_3", - ["model/godot/Build"] = "model_3", - ["model/godot/Primitives"] = "model_3", - ["model/godot/Surface"] = "model_3", - ["model/godot/Write"] = "model_3", - ["model/iqm"] = "model_3", - ["model/iqm/Read"] = "model_3", - ["model/iqm/Write"] = "model_3", - ["model/ldraw"] = "model_3", - ["model/ldraw/Colors"] = "model_3", - ["model/ldraw/Read"] = "model_4", - ["model/lwo"] = "model_4", - ["model/lwo/Build"] = "model_4", - ["model/lwo/Parse"] = "model_4", - ["model/map"] = "model_4", - ["model/map/Build"] = "model_4", - ["model/map/Parse"] = "model_4", - ["model/map/Write"] = "model_4", - ["model/mca"] = "model_4", - ["model/mca/Chunk"] = "model_4", - ["model/mca/Lz4Block"] = "model_4", - ["model/md2"] = "model_4", - ["model/md3"] = "model_4", - ["model/md5"] = "model_4", - ["model/md5/Read"] = "model_4", - ["model/mdl"] = "model_4", - ["model/mdl/HalfLife"] = "model_4", - ["model/mdl/Quake"] = "model_4", - ["model/ms3d"] = "model_4", - ["model/ms3d/Read"] = "model_4", - ["model/ms3d/Write"] = "model_4", - ["model/obj"] = "model_4", - ["model/obj/Mtl"] = "model_4", - ["model/off"] = "model_4", - ["model/ply"] = "model_5", - ["model/ply/Binary"] = "model_5", - ["model/pmx"] = "model_5", - ["model/pmx/Build"] = "model_5", - ["model/pmx/Pmd"] = "model_5", - ["model/pmx/Read"] = "model_5", - ["model/proc"] = "model_5", - ["model/qb"] = "model_5", - ["model/rbxm"] = "model_5", - ["model/rbxmx"] = "model_5", - ["model/robloxmesh"] = "model_5", - ["model/robloxmesh/Parse"] = "model_5", - ["model/robloxmesh/Write"] = "model_5", - ["model/schematic"] = "model_5", - ["model/schematic/Common"] = "model_5", - ["model/schematic/Litematic"] = "model_5", - ["model/schematic/Mcedit"] = "model_5", - ["model/schematic/Sponge"] = "model_5", - ["model/smd"] = "model_5", - ["model/smd/Read"] = "model_5", - ["model/smd/Write"] = "model_5", - ["model/sourcemdl"] = "model_5", - ["model/sourcemdl/Build"] = "model_5", - ["model/sourcemdl/Material"] = "model_5", - ["model/sourcemdl/Mdl"] = "model_6", - ["model/sourcemdl/Phy"] = "model_6", - ["model/sourcemdl/Vtx"] = "model_6", - ["model/sourcemdl/Vvd"] = "model_6", - ["model/stl"] = "model_6", - ["model/stl/Decode"] = "model_6", - ["model/t3d"] = "model_6", - ["model/t3d/Build"] = "model_6", - ["model/t3d/Parse"] = "model_6", - ["model/udmf"] = "model_6", - ["model/usda"] = "model_6", - ["model/usda/Build"] = "model_6", - ["model/usda/Parse"] = "model_6", - ["model/usda/Write"] = "model_6", - ["model/vbsp"] = "model_6", - ["model/vbsp/Faces"] = "model_6", - ["model/vbsp/Props"] = "model_6", - ["model/vmf"] = "model_6", - ["model/vmf/Build"] = "model_6", - ["model/vox"] = "model_6", - ["model/vox/Grid"] = "model_6", - ["model/vrml"] = "model_6", - ["model/x"] = "model_6", - ["model/x/Build"] = "model_7", - ["model/x/Parse"] = "model_7", - ["model/x3d"] = "model_7", - ["music/669"] = "music", - ["music/ahx"] = "music", - ["music/far"] = "music", - ["music/hmp"] = "music", - ["music/hvl"] = "music", - ["music/it"] = "music", - ["music/it/Itsex"] = "music", - ["music/med"] = "music", - ["music/midi"] = "music", - ["music/midi/Smf"] = "music", - ["music/mod"] = "music", - ["music/mtm"] = "music", - ["music/mus"] = "music", - ["music/okt"] = "music", - ["music/ptm"] = "music", - ["music/s3m"] = "music", - ["music/sf2"] = "music", - ["music/stm"] = "music", - ["music/ult"] = "music", - ["music/umx"] = "music", - ["music/xm"] = "music", - ["music/xmi"] = "music", - ["ops/AudioOps"] = "ops", - ["ops/LayerOps"] = "ops", - ["ops/MeshOps"] = "ops", - ["ops/MeshOps/Greedy"] = "ops", - ["ops/MusicOps"] = "ops", - ["playlist/m3u"] = "playlist", - ["playlist/pls"] = "playlist", - ["playlist/xspf"] = "playlist", - ["subtitle/ass"] = "subtitle", - ["subtitle/srt"] = "subtitle", - ["subtitle/vtt"] = "subtitle", - ["vector/gamemaps"] = "vector", - ["vector/gamemaps/Expand"] = "vector", - ["vector/ldtk"] = "vector", - ["vector/ldtk/Read"] = "vector", - ["vector/ldtk/Write"] = "vector", - ["vector/ogmo"] = "vector", - ["vector/ogmo/Read"] = "vector", - ["vector/ogmo/Write"] = "vector", - ["vector/svg"] = "vector", - ["vector/svg/Parse"] = "vector", - ["vector/svg/PathData"] = "vector", - ["vector/svg/Render"] = "vector", - ["vector/svg/Style"] = "vector", - ["vector/svg/Write"] = "vector", - ["vector/tiled"] = "vector", - ["vector/tiled/Data"] = "vector", - ["vector/tiled/Tmj"] = "vector", - ["vector/tiled/Tmx"] = "vector", - ["video/avi"] = "video", - ["video/fli"] = "video", - ["video/flv"] = "video", - ["video/flv/Amf"] = "video", - ["video/flv/Mux"] = "video", - ["video/h264"] = "video", - ["video/mkv"] = "video", - ["video/mkv/Mux"] = "video", - ["video/mkv/Parse"] = "video", - ["video/mp4"] = "video", - ["video/mpegps"] = "video", - ["video/mpegts"] = "video", - ["video/ogv"] = "video", - ["video/smk"] = "video", - ["video/smk/Audio"] = "video", - ["video/y4m"] = "video", + ["archive/7z"] = "archive_7z", + ["archive/7z/Header"] = "archive_7z", + ["archive/adf"] = "archive_7z", + ["archive/applesingle"] = "archive_applesingle", + ["archive/ar"] = "archive_applesingle", + ["archive/arj"] = "archive_applesingle", + ["archive/binhex"] = "archive_binhex", + ["archive/br"] = "archive_binhex", + ["archive/bz2"] = "archive_binhex", + ["archive/cab"] = "archive_binhex", + ["archive/cab/Sum"] = "archive_binhex", + ["archive/cpio"] = "archive_binhex", + ["archive/d64"] = "archive_d64", + ["archive/fat"] = "archive_d64", + ["archive/grp"] = "archive_d64", + ["archive/gzip"] = "archive_d64", + ["archive/iso"] = "archive_d64", + ["archive/lha"] = "archive_lha", + ["archive/lz4"] = "archive_lha", + ["archive/macbinary"] = "archive_lha", + ["archive/mpq"] = "archive_mpq", + ["archive/mpq/Crypt"] = "archive_mpq", + ["archive/pak"] = "archive_mpq", + ["archive/rpm"] = "archive_mpq", + ["archive/tar"] = "archive_tar", + ["archive/unitypackage"] = "archive_tar", + ["archive/uu"] = "archive_tar", + ["archive/vpk"] = "archive_tar", + ["archive/vswap"] = "archive_vswap", + ["archive/wad"] = "archive_vswap", + ["archive/wad/Picture"] = "archive_vswap", + ["archive/wad2"] = "archive_wad2", + ["archive/xz"] = "archive_wad2", + ["archive/yenc"] = "archive_wad2", + ["archive/z"] = "archive_wad2", + ["archive/zip"] = "archive_wad2", + ["archive/zoo"] = "archive_zoo", + ["archive/zst"] = "archive_zoo", + ["audio/aac"] = "audio_aac", + ["audio/ac3"] = "audio_aac", + ["audio/adpcm"] = "audio_aac", + ["audio/adx"] = "audio_aac", + ["audio/aiff"] = "audio_aiff", + ["audio/ape"] = "audio_aiff", + ["audio/au"] = "audio_aiff", + ["audio/brstm"] = "audio_aiff", + ["audio/caf"] = "audio_caf", + ["audio/flac"] = "audio_flac", + ["audio/flac/Meta"] = "audio_flac", + ["audio/flac/Stream"] = "audio_flac", + ["audio/m4a"] = "audio_flac", + ["audio/mp3"] = "audio_mp3", + ["audio/mp3/Index"] = "audio_mp3", + ["audio/mp3/Stream"] = "audio_mp3", + ["audio/mp3/Tags"] = "audio_mp3", + ["audio/mpc"] = "audio_mpc", + ["audio/opus"] = "audio_mpc", + ["audio/opus/Encode"] = "audio_mpc", + ["audio/qoa"] = "audio_mpc", + ["audio/tta"] = "audio_mpc", + ["audio/vag"] = "audio_vag", + ["audio/voc"] = "audio_vag", + ["audio/vorbis"] = "audio_vorbis", + ["audio/vorbis/Encode"] = "audio_vorbis", + ["audio/wav"] = "audio_wav", + ["audio/wav/Codecs"] = "audio_wav", + ["audio/wavpack"] = "audio_wav", + ["cad/step"] = "cad_step", + ["cad/step/Brep"] = "cad_step", + ["cad/step/Parse"] = "cad_step", + ["cad/step/Write"] = "cad_step", + ["codecs/audio/Ac3"] = "codecs_audio_Ac3", + ["codecs/audio/Ac3/Decode"] = "codecs_audio_Ac3", + ["codecs/audio/Ac3/Tables"] = "codecs_audio_Ac3", + ["codecs/audio/Adpcm"] = "codecs_audio_Adpcm", + ["codecs/audio/Adpcm/Decoder"] = "codecs_audio_Adpcm", + ["codecs/audio/Alac"] = "codecs_audio_Alac", + ["codecs/audio/Alac/Decode"] = "codecs_audio_Alac", + ["codecs/audio/Alac/Encode"] = "codecs_audio_Alac", + ["codecs/audio/Ape"] = "codecs_audio_Ape", + ["codecs/audio/Ape/Decode"] = "codecs_audio_Ape", + ["codecs/audio/ApeTag"] = "codecs_audio_Ape", + ["codecs/audio/Mdct"] = "codecs_audio_Mdct", + ["codecs/audio/Mdct/Fft"] = "codecs_audio_Mdct", + ["codecs/audio/MidiRender"] = "codecs_audio_Mdct", + ["codecs/audio/Pcm"] = "codecs_audio_Pcm", + ["codecs/audio/Pcm/Convert"] = "codecs_audio_Pcm", + ["codecs/audio/Qoa"] = "codecs_audio_Pcm", + ["codecs/audio/Resample"] = "codecs_audio_Resample", + ["codecs/audio/Stream"] = "codecs_audio_Resample", + ["codecs/audio/Tta"] = "codecs_audio_Resample", + ["codecs/audio/Tta/Decode"] = "codecs_audio_Resample", + ["codecs/audio/VorbisComment"] = "codecs_audio_Resample", + ["codecs/compress/Bzip2"] = "codecs_compress_Bzip2", + ["codecs/compress/Bzip2/Decode"] = "codecs_compress_Bzip2", + ["codecs/compress/Explode"] = "codecs_compress_Bzip2", + ["codecs/compress/Lz4"] = "codecs_compress_Bzip2", + ["codecs/compress/Lzh"] = "codecs_compress_Lzh", + ["codecs/compress/Lzw"] = "codecs_compress_Lzh", + ["codecs/compress/Lzx"] = "codecs_compress_Lzh", + ["codecs/compress/PackBits"] = "codecs_compress_PackBits", + ["codecs/compress/Quantum"] = "codecs_compress_PackBits", + ["codecs/compress/UnixCompress"] = "codecs_compress_PackBits", + ["codecs/compress/Xxh32"] = "codecs_compress_PackBits", + ["codecs/entropy/Huffman"] = "codecs_entropy_Huffman", + ["codecs/entropy/RangeCoder"] = "codecs_entropy_Huffman", + ["codecs/entropy/RangeCoder/Decoder"] = "codecs_entropy_Huffman", + ["codecs/entropy/RangeCoder/Encoder"] = "codecs_entropy_Huffman", + ["codecs/font/Bitmap"] = "codecs_font_Bitmap", + ["codecs/font/Cff"] = "codecs_font_Bitmap", + ["codecs/font/GlyphNames"] = "codecs_font_Bitmap", + ["codecs/font/TrueType"] = "codecs_font_TrueType", + ["codecs/font/TrueType/Glyf"] = "codecs_font_TrueType", + ["codecs/font/TrueType/Tables"] = "codecs_font_TrueType", + ["codecs/image/Blend"] = "codecs_image_Blend", + ["codecs/image/Etc"] = "codecs_image_Blend", + ["codecs/image/Half"] = "codecs_image_Blend", + ["codecs/image/Miptex"] = "codecs_image_Miptex", + ["codecs/image/Pixels"] = "codecs_image_Miptex", + ["codecs/image/Quantize"] = "codecs_image_Quantize", + ["codecs/image/Raster"] = "codecs_image_Raster", + ["codecs/image/Texel"] = "codecs_image_Texel", + ["codecs/image/Texture"] = "codecs_image_Texel", + ["codecs/image/Yuv"] = "codecs_image_Texel", + ["codecs/model/Brush"] = "codecs_model_Brush", + ["codecs/model/Displacement"] = "codecs_model_Brush", + ["codecs/model/DoomMap"] = "codecs_model_DoomMap", + ["codecs/model/DoomMap/Udmf"] = "codecs_model_DoomMap", + ["codecs/model/Mat4"] = "codecs_model_DoomMap", + ["codecs/model/MeshFlatten"] = "codecs_model_MeshFlatten", + ["codecs/model/Minecraft"] = "codecs_model_Minecraft", + ["codecs/model/Minecraft/Colors"] = "codecs_model_Minecraft", + ["codecs/model/Minecraft/Legacy"] = "codecs_model_Minecraft", + ["codecs/model/Minecraft/Packed"] = "codecs_model_Minecraft", + ["codecs/model/Patch"] = "codecs_model_Patch", + ["codecs/model/Polygon"] = "codecs_model_Patch", + ["codecs/model/Rbx"] = "codecs_model_Rbx", + ["codecs/model/Rbx/Binary"] = "codecs_model_Rbx", + ["codecs/model/Rig"] = "codecs_model_Rig", + ["codecs/model/Sampler"] = "codecs_model_Rig", + ["codecs/model/SourceAnim"] = "codecs_model_Rig", + ["codecs/model/Vrml"] = "codecs_model_Vrml", + ["codecs/model/Vrml/Build"] = "codecs_model_Vrml", + ["codecs/model/Vrml/Fields"] = "codecs_model_Vrml", + ["codecs/model/Vrml/Geometry"] = "codecs_model_Vrml", + ["codecs/model/Vrml/Parse"] = "codecs_model_Vrml", + ["codecs/model/Vrml/Write"] = "codecs_model_Vrml", + ["codecs/model/Vrml/Xml"] = "codecs_model_Vrml", + ["codecs/text/GodotVariant"] = "codecs_text_GodotVariant", + ["codecs/text/Json"] = "codecs_text_Json", + ["codecs/text/Json/Decode"] = "codecs_text_Json", + ["codecs/text/Json/Encode"] = "codecs_text_Json", + ["codecs/text/KeyValues"] = "codecs_text_KeyValues", + ["codecs/text/KeyValues/Binary"] = "codecs_text_KeyValues", + ["codecs/text/Lexer"] = "codecs_text_KeyValues", + ["codecs/text/Nbt"] = "codecs_text_Nbt", + ["codecs/text/Nbt/Binary"] = "codecs_text_Nbt", + ["codecs/text/Nbt/Snbt"] = "codecs_text_Nbt", + ["codecs/text/Nbt/Value"] = "codecs_text_Nbt", + ["codecs/text/Text"] = "codecs_text_Text", + ["codecs/text/Url"] = "codecs_text_Text", + ["codecs/text/Xml"] = "codecs_text_Xml", + ["codecs/text/Xml/Parse"] = "codecs_text_Xml", + ["codecs/video/Video"] = "codecs_video_Video", + ["codecs/video/Video/Disposable"] = "codecs_video_Video", + ["codecs/video/Video/Pool"] = "codecs_video_Video", + ["codecs/video/Video/Source"] = "codecs_video_Video", + ["containers/Archive"] = "containers_Archive", + ["containers/AudioWrap"] = "containers_Archive", + ["containers/Avi"] = "containers_Avi", + ["containers/Blend"] = "containers_Blend", + ["containers/Chunks"] = "containers_Blend", + ["containers/Cpio"] = "containers_Cpio", + ["containers/Demux"] = "containers_Cpio", + ["containers/Ebml"] = "containers_Cpio", + ["containers/Fat"] = "containers_Fat", + ["containers/Iso9660"] = "containers_Iso9660", + ["containers/IsoBmff"] = "containers_IsoBmff", + ["containers/IsoBmff/Box"] = "containers_IsoBmff", + ["containers/IsoBmff/Demux"] = "containers_IsoBmff", + ["containers/IsoBmff/Meta"] = "containers_IsoBmff", + ["containers/IsoBmff/Mux"] = "containers_IsoBmff", + ["containers/IsoBmff/QtPalette"] = "containers_IsoBmff", + ["containers/MacFile"] = "containers_MacFile", + ["containers/Ogg"] = "containers_MacFile", + ["containers/Ogg/Mux"] = "containers_MacFile", + ["containers/Ogg/Page"] = "containers_MacFile", + ["containers/Riff"] = "containers_Riff", + ["containers/Tar"] = "containers_Riff", + ["containers/Zip"] = "containers_Zip", + ["core/Adler32"] = "core_Adler32", + ["core/Base64"] = "core_Adler32", + ["core/Crc32"] = "core_Adler32", + ["core/Md5"] = "core_Adler32", + ["data/cbor"] = "data_cbor", + ["data/cbor/Codec"] = "data_cbor", + ["data/csv"] = "data_cbor", + ["data/ini"] = "data_ini", + ["data/json"] = "data_ini", + ["data/msgpack"] = "data_ini", + ["data/msgpack/Codec"] = "data_ini", + ["data/nbt"] = "data_ini", + ["data/plist"] = "data_plist", + ["data/plist/Binary"] = "data_plist", + ["data/q3shader"] = "data_plist", + ["data/q3skin"] = "data_plist", + ["data/snbt"] = "data_plist", + ["data/toml"] = "data_toml", + ["data/toml/Decode"] = "data_toml", + ["data/toml/Encode"] = "data_toml", + ["data/tres"] = "data_toml", + ["data/vdf"] = "data_toml", + ["data/xml"] = "data_xml", + ["data/yaml"] = "data_yaml", + ["data/yaml/Emit"] = "data_yaml", + ["data/yaml/Parse"] = "data_yaml", + ["font/bdf"] = "font_bdf", + ["font/bmfont"] = "font_bmfont", + ["font/bmfont/Parse"] = "font_bmfont", + ["font/eot"] = "font_bmfont", + ["font/fon"] = "font_fon", + ["font/hershey"] = "font_fon", + ["font/pcf"] = "font_fon", + ["font/psf"] = "font_psf", + ["font/ttf"] = "font_psf", + ["font/type1"] = "font_psf", + ["font/type1/Charstring"] = "font_psf", + ["font/woff"] = "font_woff", + ["font/woff2"] = "font_woff", + ["font/woff2/Rebuild"] = "font_woff", + ["host/Love"] = "host_Love", + ["host/LuaJIT"] = "host_Love", + ["host/Luau"] = "host_Love", + ["host/Roblox"] = "host_Love", + ["image/ani"] = "image_ani", + ["image/art"] = "image_ani", + ["image/blp"] = "image_ani", + ["image/bmp"] = "image_bmp", + ["image/dds"] = "image_bmp", + ["image/exr"] = "image_exr", + ["image/exr/Codec"] = "image_exr", + ["image/exr/Piz"] = "image_exr", + ["image/gif"] = "image_gif", + ["image/gif/Decode"] = "image_gif", + ["image/hdr"] = "image_gif", + ["image/hdr/Codec"] = "image_gif", + ["image/icns"] = "image_icns", + ["image/ico"] = "image_icns", + ["image/ico/Dib"] = "image_icns", + ["image/ilbm"] = "image_ilbm", + ["image/jpeg"] = "image_ilbm", + ["image/ktx"] = "image_ktx", + ["image/lmp"] = "image_ktx", + ["image/pcx"] = "image_pcx", + ["image/pnm"] = "image_pcx", + ["image/pnm/Codec"] = "image_pcx", + ["image/qoi"] = "image_qoi", + ["image/qoi/Codec"] = "image_qoi", + ["image/sgi"] = "image_qoi", + ["image/spr"] = "image_qoi", + ["image/sunras"] = "image_sunras", + ["image/tga"] = "image_sunras", + ["image/tga/Codec"] = "image_sunras", + ["image/tiff"] = "image_tiff", + ["image/tiff/Pixels"] = "image_tiff", + ["image/tim"] = "image_tim", + ["image/vtf"] = "image_tim", + ["image/webp"] = "image_webp", + ["image/webp/Alpha"] = "image_webp", + ["image/webp/Anim"] = "image_webp", + ["image/xbm"] = "image_webp", + ["image/xpm"] = "image_xpm", + ["image/xpm/Names"] = "image_xpm", + ["layered/aseprite"] = "layered_aseprite", + ["layered/ora"] = "layered_ora", + ["layered/psd"] = "layered_psd", + ["layered/psd/Channels"] = "layered_psd", + ["model/3ds"] = "model_3ds", + ["model/3ds/Build"] = "model_3ds", + ["model/3ds/Read"] = "model_3ds", + ["model/3ds/Write"] = "model_3ds", + ["model/3mf"] = "model_3mf", + ["model/3mf/Read"] = "model_3mf", + ["model/3mf/Write"] = "model_3mf", + ["model/ase"] = "model_ase", + ["model/ase/Build"] = "model_ase", + ["model/ase/Parse"] = "model_ase", + ["model/ase/Write"] = "model_ase", + ["model/b3d"] = "model_b3d", + ["model/b3d/Read"] = "model_b3d", + ["model/blend"] = "model_blend", + ["model/blend/Anim"] = "model_blend", + ["model/blend/Armature"] = "model_blend", + ["model/blend/Driver"] = "model_blend", + ["model/blend/Material"] = "model_blend", + ["model/blend/Mesh"] = "model_blend", + ["model/blend/Normals"] = "model_blend", + ["model/blend/Prim"] = "model_blend", + ["model/blend/Read"] = "model_blend", + ["model/bsp"] = "model_bsp", + ["model/bsp/Lightmap"] = "model_bsp", + ["model/bsp/Quake"] = "model_bsp", + ["model/bsp/Quake3"] = "model_bsp", + ["model/bsp/Tree"] = "model_bsp", + ["model/buildmap"] = "model_buildmap", + ["model/buildmap/Geometry"] = "model_buildmap", + ["model/d3map"] = "model_d3map", + ["model/d3map/Parse"] = "model_d3map", + ["model/dae"] = "model_dae", + ["model/dae/Math"] = "model_dae", + ["model/dae/Read"] = "model_dae", + ["model/dae/Write"] = "model_dae", + ["model/fbx"] = "model_fbx", + ["model/fbx/Ascii"] = "model_fbx", + ["model/fbx/Binary"] = "model_fbx", + ["model/fbx/Read"] = "model_fbx", + ["model/fbx/Write"] = "model_fbx", + ["model/fbx/Xform"] = "model_fbx", + ["model/gltf"] = "model_gltf", + ["model/gltf/Pack"] = "model_gltf", + ["model/gltf/Read"] = "model_gltf", + ["model/gltf/Write"] = "model_gltf", + ["model/godot"] = "model_godot", + ["model/godot/Build"] = "model_godot", + ["model/godot/Primitives"] = "model_godot", + ["model/godot/Surface"] = "model_godot", + ["model/godot/Write"] = "model_godot", + ["model/iqm"] = "model_iqm", + ["model/iqm/Read"] = "model_iqm", + ["model/iqm/Write"] = "model_iqm", + ["model/ldraw"] = "model_ldraw", + ["model/ldraw/Colors"] = "model_ldraw", + ["model/ldraw/Read"] = "model_ldraw", + ["model/lwo"] = "model_lwo", + ["model/lwo/Build"] = "model_lwo", + ["model/lwo/Parse"] = "model_lwo", + ["model/map"] = "model_map", + ["model/map/Build"] = "model_map", + ["model/map/Parse"] = "model_map", + ["model/map/Write"] = "model_map", + ["model/mca"] = "model_mca", + ["model/mca/Chunk"] = "model_mca", + ["model/mca/Lz4Block"] = "model_mca", + ["model/md2"] = "model_mca", + ["model/md3"] = "model_md3", + ["model/md5"] = "model_md3", + ["model/md5/Read"] = "model_md3", + ["model/mdl"] = "model_mdl", + ["model/mdl/HalfLife"] = "model_mdl", + ["model/mdl/Quake"] = "model_mdl", + ["model/ms3d"] = "model_ms3d", + ["model/ms3d/Read"] = "model_ms3d", + ["model/ms3d/Write"] = "model_ms3d", + ["model/obj"] = "model_obj", + ["model/obj/Mtl"] = "model_obj", + ["model/off"] = "model_off", + ["model/ply"] = "model_ply", + ["model/ply/Binary"] = "model_ply", + ["model/pmx"] = "model_pmx", + ["model/pmx/Build"] = "model_pmx", + ["model/pmx/Pmd"] = "model_pmx", + ["model/pmx/Read"] = "model_pmx", + ["model/proc"] = "model_proc", + ["model/qb"] = "model_proc", + ["model/rbxm"] = "model_rbxm", + ["model/rbxmx"] = "model_rbxmx", + ["model/robloxmesh"] = "model_robloxmesh", + ["model/robloxmesh/Parse"] = "model_robloxmesh", + ["model/robloxmesh/Write"] = "model_robloxmesh", + ["model/schematic"] = "model_schematic", + ["model/schematic/Common"] = "model_schematic", + ["model/schematic/Litematic"] = "model_schematic", + ["model/schematic/Mcedit"] = "model_schematic", + ["model/schematic/Sponge"] = "model_schematic", + ["model/smd"] = "model_smd", + ["model/smd/Read"] = "model_smd", + ["model/smd/Write"] = "model_smd", + ["model/sourcemdl"] = "model_sourcemdl", + ["model/sourcemdl/Build"] = "model_sourcemdl", + ["model/sourcemdl/Material"] = "model_sourcemdl", + ["model/sourcemdl/Mdl"] = "model_sourcemdl", + ["model/sourcemdl/Phy"] = "model_sourcemdl", + ["model/sourcemdl/Vtx"] = "model_sourcemdl", + ["model/sourcemdl/Vvd"] = "model_sourcemdl", + ["model/stl"] = "model_stl", + ["model/stl/Decode"] = "model_stl", + ["model/t3d"] = "model_t3d", + ["model/t3d/Build"] = "model_t3d", + ["model/t3d/Parse"] = "model_t3d", + ["model/udmf"] = "model_t3d", + ["model/usda"] = "model_usda", + ["model/usda/Build"] = "model_usda", + ["model/usda/Parse"] = "model_usda", + ["model/usda/Write"] = "model_usda", + ["model/vbsp"] = "model_vbsp", + ["model/vbsp/Faces"] = "model_vbsp", + ["model/vbsp/Props"] = "model_vbsp", + ["model/vmf"] = "model_vmf", + ["model/vmf/Build"] = "model_vmf", + ["model/vox"] = "model_vox", + ["model/vox/Grid"] = "model_vox", + ["model/vrml"] = "model_vox", + ["model/x"] = "model_x", + ["model/x/Build"] = "model_x", + ["model/x/Parse"] = "model_x", + ["model/x3d"] = "model_x3d", + ["music/669"] = "music_669", + ["music/ahx"] = "music_669", + ["music/far"] = "music_669", + ["music/hmp"] = "music_669", + ["music/hvl"] = "music_669", + ["music/it"] = "music_it", + ["music/it/Itsex"] = "music_it", + ["music/med"] = "music_med", + ["music/midi"] = "music_midi", + ["music/midi/Smf"] = "music_midi", + ["music/mod"] = "music_midi", + ["music/mtm"] = "music_mtm", + ["music/mus"] = "music_mtm", + ["music/okt"] = "music_mtm", + ["music/ptm"] = "music_mtm", + ["music/s3m"] = "music_s3m", + ["music/sf2"] = "music_s3m", + ["music/stm"] = "music_s3m", + ["music/ult"] = "music_s3m", + ["music/umx"] = "music_s3m", + ["music/xm"] = "music_xm", + ["music/xmi"] = "music_xm", + ["ops/AudioOps"] = "ops_AudioOps", + ["ops/ImageOps"] = "ops_ImageOps", + ["ops/ImageOps/Kernels"] = "ops_ImageOps", + ["ops/LayerOps"] = "ops_LayerOps", + ["ops/MeshOps"] = "ops_MeshOps", + ["ops/MeshOps/Greedy"] = "ops_MeshOps", + ["ops/MusicOps"] = "ops_MusicOps", + ["playlist/m3u"] = "playlist_m3u", + ["playlist/pls"] = "playlist_m3u", + ["playlist/xspf"] = "playlist_m3u", + ["subtitle/ass"] = "subtitle_ass", + ["subtitle/srt"] = "subtitle_ass", + ["subtitle/vtt"] = "subtitle_ass", + ["vector/gamemaps"] = "vector_gamemaps", + ["vector/gamemaps/Expand"] = "vector_gamemaps", + ["vector/ldtk"] = "vector_ldtk", + ["vector/ldtk/Read"] = "vector_ldtk", + ["vector/ldtk/Write"] = "vector_ldtk", + ["vector/ogmo"] = "vector_ogmo", + ["vector/ogmo/Read"] = "vector_ogmo", + ["vector/ogmo/Write"] = "vector_ogmo", + ["vector/svg"] = "vector_svg", + ["vector/svg/Parse"] = "vector_svg", + ["vector/svg/PathData"] = "vector_svg", + ["vector/svg/Render"] = "vector_svg", + ["vector/svg/Style"] = "vector_svg", + ["vector/svg/Write"] = "vector_svg", + ["vector/tiled"] = "vector_tiled", + ["vector/tiled/Data"] = "vector_tiled", + ["vector/tiled/Tmj"] = "vector_tiled", + ["vector/tiled/Tmx"] = "vector_tiled", + ["video/avi"] = "video_avi", + ["video/fli"] = "video_avi", + ["video/flv"] = "video_flv", + ["video/flv/Amf"] = "video_flv", + ["video/flv/Mux"] = "video_flv", + ["video/h264"] = "video_flv", + ["video/mkv"] = "video_mkv", + ["video/mkv/Mux"] = "video_mkv", + ["video/mkv/Parse"] = "video_mkv", + ["video/mp4"] = "video_mp4", + ["video/mpegps"] = "video_mp4", + ["video/mpegts"] = "video_mp4", + ["video/ogv"] = "video_ogv", + ["video/smk"] = "video_ogv", + ["video/smk/Audio"] = "video_ogv", + ["video/y4m"] = "video_ogv", } local __FILES = {} local __LOADED = {} @@ -681,11 +681,11 @@ return Rosetta - Core_1 + Core --!optimize 2 --!nocheck --- rosetta chunk Core_1 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 11 modules (3 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk Core (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 7 modules (1 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES[""] = function() @@ -698,10 +698,6 @@ local Bytes = __include("core/Bytes") local Input = __include("core/Input") local Types = __include("Types") local Registry = __include("Registry") -local Video = __include("codecs/video/Video") -local AudioWrap = __include("containers/AudioWrap") -local Rbx = __include("codecs/model/Rbx") -local ImageOps = __include("ops/ImageOps") local host = __include("host") local F = {} @@ -710,7 +706,6 @@ F.version = "0.1.0" F.Err = Err F.Types = Types F.Bytes = Bytes -F.Rbx = Rbx F.null = Types.null F.host = host F.plugins = {} :: { [string]: any } -- injected optional dependencies (plugins.brep for cad/step) @@ -1029,7 +1024,7 @@ end -- api hooks (a format never requires another format): opts.decodeImage / encodeImage, opts.plugins, opts.decodeModule, -- opts.openAudio (containers/AudioWrap: PCM -> WAV, Opus / Vorbis -> Ogg, AAC -> ADTS, MP3 / FLAC / AC-3 as they are) local function openAudio(demuxer: any, track: any, sbr: boolean?): (any, Err.Err?) - local buf, fmt, err = AudioWrap.wrap(demuxer, track) + local buf, fmt, err = __include("containers/AudioWrap").wrap(demuxer, track) if not buf then return nil, err end @@ -1041,7 +1036,7 @@ local function openAudio(demuxer: any, track: any, sbr: boolean?): (any, Err.Err local skip = if type(track.codecDelay) == "number" and track.codecDelay > 0 then math.floor(track.codecDelay * dec.sampleRate + 0.5) else 0 local length = if type(track.playDuration) == "number" and track.playDuration > 0 then math.floor(track.playDuration * dec.sampleRate + 0.5) else nil if skip > 0 or length then - dec = AudioWrap.trim(dec, skip, length) + dec = __include("containers/AudioWrap").trim(dec, skip, length) end end return dec, oerr @@ -1221,7 +1216,7 @@ local function videoToImage(v: any, o: Options): (any, Err.Err?) if #images == 0 then return nil, Err.new(Err.ARG, "save: the video has no frames") end - local img, ierr = ImageOps.fromFrames(images, delays) + local img, ierr = __include("ops/ImageOps").fromFrames(images, delays) if not img then return nil, ierr end @@ -1507,7 +1502,7 @@ F.video.fromImage = function(img: any, opts: Options?): (any, Err.Err?) end local frames, delays = { img }, { 0.1 } if type(img.frames) == "table" and #img.frames > 0 then - local list, cerr = ImageOps.coalesce(img) + local list, cerr = __include("ops/ImageOps").coalesce(img) if not list then return nil, cerr end @@ -1517,19 +1512,18 @@ F.video.fromImage = function(img: any, opts: Options?): (any, Err.Err?) delays[i] = if type(f.delay) == "number" and f.delay > 0 then f.delay else 0.1 end elseif img.format ~= "rgba8" and img.format ~= "yuv420p" then - local c, cerr = ImageOps.convert(img, "rgba8") + local c, cerr = __include("ops/ImageOps").convert(img, "rgba8") if not c then return nil, cerr end frames = { c } end local src = type(img.meta) == "table" and img.meta.source - return Video.fromFrames(frames, delays, { format = type(src) == "table" and src.format or "image", loops = img.loops, meta = img.meta }) + return __include("codecs/video/Video").fromFrames(frames, delays, { format = type(src) == "table" and src.format or "image", loops = img.loops, meta = img.meta }) end F.video.fromFrames = function(images: any, delays: any?, opts: Options?): (any, Err.Err?) - return Video.fromFrames(images, delays, opts) + return __include("codecs/video/Video").fromFrames(images, delays, opts) end -F.video.codecs = Video F.model.loadTextures = function(scene: any, opts: Options?): (any, { [number]: Err.Err }) local errs: { [number]: Err.Err } = {} @@ -1558,7 +1552,7 @@ end local OPS: { [string]: () -> any } = { image = function() - return ImageOps + return __include("ops/ImageOps") end, mesh = function() return __include("ops/MeshOps") @@ -1603,6 +1597,28 @@ F.ops = setmetatable({}, { end, }) :: any +-- F.Rbx (codecs/model/Rbx), F.video.codecs (codecs/video/Video): required on first use +setmetatable(F, { + __index = function(t: any, k: string): any + if k == "Rbx" then + local m = __include("codecs/model/Rbx") + rawset(t, k, m) + return m + end + return nil + end, +}) +setmetatable(F.video, { + __index = function(t: any, k: string): any + if k == "codecs" then + local m = __include("codecs/video/Video") + rawset(t, k, m) + return m + end + return nil + end, +}) + return F end __FILES["Registry"] = function() @@ -5339,2908 +5355,6 @@ Types.CATEGORIES = table.freeze({ return Types end -__FILES["codecs/audio/Adpcm"] = @native function() - - - --- codecs/audio/Adpcm: the 4-bit ADPCM family, decode (and encode where it is cheap). --- ADX, PS-ADPCM and Nintendo DSP decoding follow vgmstream r2117 (ISC, licenses/vgmstream-LICENSE.txt) bit-exactly: the --- ADX scale + 1 and version 3 rounding, PS-ADPCM's float filter (exact in integers below 2^17), DSP's 1024 rounding. -local readu8, readi16, readu16, readi32 = buffer.readu8, buffer.readi16, buffer.readu16, buffer.readi32 -local writef32, readf32, writei32, writeu8, writeu16 = buffer.writef32, buffer.readf32, buffer.writei32, buffer.writeu8, buffer.writeu16 -local band, rshift, bor, lshift = bit32.band, bit32.rshift, bit32.bor, bit32.lshift -local floor = math.floor - -local Adpcm = {} - -local IMA_STEP = { - 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, - 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, - 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, - 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767, -} -local IMA_ADJ = { -1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8 } --- IMA_DIFF[index * 8 + (nibble & 7) + 1]: the shift-and-add difference (step/8 + bits of step/4, step/2, step), as --- the IMA reference computes it (not (2n + 1) * step / 8, which rounds differently) -local IMA_DIFF = table.create(89 * 8, 0) --- IMA_NEXT[index * 16 + nibble + 1]: the next step index -local IMA_NEXT = table.create(89 * 16, 0) -for i = 0, 88 do - local step = IMA_STEP[i + 1] - for n = 0, 7 do - local d = rshift(step, 3) - if band(n, 1) ~= 0 then - d += rshift(step, 2) - end - if band(n, 2) ~= 0 then - d += rshift(step, 1) - end - if band(n, 4) ~= 0 then - d += step - end - IMA_DIFF[i * 8 + n + 1] = d - end - for n = 0, 15 do - IMA_NEXT[i * 16 + n + 1] = math.clamp(i + IMA_ADJ[n + 1], 0, 88) - end -end -Adpcm.IMA_STEP = IMA_STEP - --- IMA nibble q is in byte p + q // 2, the low half first unless hi -@native function Adpcm.ima(src: buffer, p: number, q0: number, qs: number, count: number, hi: boolean, st: buffer, so: number, - dst: buffer, d: number, ds: number) - local pred = readi32(st, so) - local index = math.clamp(readi32(st, so + 4), 0, 88) - local q = q0 - local o = d * 4 - local os = ds * 4 - for _ = 1, count do - local b = readu8(src, p + rshift(q, 1)) - local nib - if (band(q, 1) == 0) == hi then - nib = rshift(b, 4) - else - nib = band(b, 15) - end - local diff = IMA_DIFF[index * 8 + band(nib, 7) + 1] - if nib >= 8 then - pred -= diff - if pred < -32768 then - pred = -32768 - end - else - pred += diff - if pred > 32767 then - pred = 32767 - end - end - index = IMA_NEXT[index * 16 + nib + 1] - writef32(dst, o, pred / 32768) - o += os - q += qs - end - writei32(st, so, pred) - writei32(st, so + 4, index) -end - --- Apple ima4: 34 bytes: a big-endian header (the predictor's top 9 bits, 7-bit step index), 64 nibbles low first; --- Apple's decoders keep the full-precision predictor while the header agrees (same step index, within 127) -@native function Adpcm.imaQt(src: buffer, p: number, st: buffer, so: number, dst: buffer, d: number, ds: number) - local h = readu8(src, p) * 256 + readu8(src, p + 1) - local pred = band(h, 0xFF80) - if pred >= 32768 then - pred -= 65536 - end - local index = band(h, 0x7F) - if index ~= readi32(st, so + 4) or math.abs(pred - readi32(st, so)) > 0x7F then - writei32(st, so, pred) - writei32(st, so + 4, index) - end - Adpcm.ima(src, p + 2, 0, 1, 64, false, st, so, dst, d, ds) -end - --- Microsoft IMA block: per channel s16 predictor (= the first sample), u8 step index, pad; then 4-byte groups --- (8 nibbles, low first) per channel in turn -@native function Adpcm.imaWav(src: buffer, off: number, avail: number, ch: number, spb: number, dst: buffer, d: number): number - if avail < 4 * ch then - return 0 - end - local groups = (avail - 4 * ch) // (4 * ch) - local frames = math.min(spb, 1 + groups * 8) - local o = d * 4 - for c = 0, ch - 1 do - local pred = readi16(src, off + c * 4) - local index = math.min(readu8(src, off + c * 4 + 2), 88) - writef32(dst, o + c * 4, pred / 32768) - local f = 1 - local g = 0 - while f < frames do - local p = off + 4 * ch + (g * ch + c) * 4 - local k = 0 - while k < 8 and f < frames do - local b = readu8(src, p + rshift(k, 1)) - local nib = if band(k, 1) == 0 then band(b, 15) else rshift(b, 4) - local diff = IMA_DIFF[index * 8 + band(nib, 7) + 1] - if nib >= 8 then - pred -= diff - if pred < -32768 then - pred = -32768 - end - else - pred += diff - if pred > 32767 then - pred = 32767 - end - end - index = IMA_NEXT[index * 16 + nib + 1] - writef32(dst, o + (f * ch + c) * 4, pred / 32768) - f += 1 - k += 1 - end - g += 1 - end - end - return frames -end - -local MS_ADAPT = { 230, 230, 230, 230, 307, 409, 512, 614, 768, 614, 512, 409, 307, 230, 230, 230 } -Adpcm.MS_COEF1 = { 256, 512, 0, 192, 240, 460, 392 } -Adpcm.MS_COEF2 = { 0, -256, 0, 64, 0, -208, -232 } - --- MS ADPCM block: per channel u8 predictor index, s16 delta, s16 sample 1, s16 sample 2 (each field for every channel --- in turn), then nibbles high first, channels interleaved per nibble; coefficients 256 = 1.0 -@native function Adpcm.msBlock(src: buffer, off: number, avail: number, ch: number, spb: number, dst: buffer, d: number, - coefs: buffer, ncoef: number, state: buffer): number - local hdr = 7 * ch - if avail < hdr or ncoef < 1 then - return 0 - end - local frames = math.min(spb, 2 + ((avail - hdr) * 2) // ch) - local o = d * 4 - for c = 0, ch - 1 do - local pi = math.min(readu8(src, off + c), ncoef - 1) - local idelta = readi16(src, off + ch + c * 2) - local s1 = readi16(src, off + 3 * ch + c * 2) - local s2 = readi16(src, off + 5 * ch + c * 2) - local so = c * 20 - writei32(state, so, readi32(coefs, pi * 8)) - writei32(state, so + 4, readi32(coefs, pi * 8 + 4)) - writei32(state, so + 8, idelta) - writei32(state, so + 12, s1) - writei32(state, so + 16, s2) - writef32(dst, o + c * 4, s2 / 32768) - if frames > 1 then - writef32(dst, o + (ch + c) * 4, s1 / 32768) - end - end - local total = (frames - 2) * ch - for k = 0, total - 1 do - local b = readu8(src, off + hdr + rshift(k, 1)) - local nib = if band(k, 1) == 0 then rshift(b, 4) else band(b, 15) - local so = (k % ch) * 20 - local c1, c2 = readi32(state, so), readi32(state, so + 4) - local idelta = readi32(state, so + 8) - local s1, s2 = readi32(state, so + 12), readi32(state, so + 16) - local p = s1 * c1 + s2 * c2 - p = if p >= 0 then p // 256 else -((-p) // 256) - p += (if nib >= 8 then nib - 16 else nib) * idelta - if p > 32767 then - p = 32767 - elseif p < -32768 then - p = -32768 - end - idelta = (MS_ADAPT[nib + 1] * idelta) // 256 - if idelta < 16 then - idelta = 16 - elseif idelta > 2796202 then -- INT_MAX / 768 - idelta = 2796202 - end - writei32(state, so + 8, idelta) - writei32(state, so + 12, p) - writei32(state, so + 16, s1) - writef32(dst, o + (2 * ch + k) * 4, p / 32768) - end - return frames -end - -local F32 = buffer.create(4) -@native local function f32(x: number): number - writef32(F32, 0, x) - return readf32(F32, 0) -end - --- coef1, coef2 (12 fractional bits): the 2-pole high-pass predictor from the header's cutoff, in single precision as --- CRI's decoders (and vgmstream) compute it -@native function Adpcm.adxCoefs(cutoff: number, rate: number): (number, number) - if rate <= 0 then - return 0, 0 - end - local z = f32(math.cos(f32(2 * math.pi * cutoff / rate))) - local a = f32(math.sqrt(2) - z) - local b = f32(math.sqrt(2) - 1) - local c = f32(f32(a - f32(math.sqrt(f32(f32(a + b) * f32(a - b))))) / b) - local c1 = c * 8192 - local c2 = f32(c * c) * -4096 - c1 = if c1 >= 0 then floor(c1) else -floor(-c1) - c2 = if c2 >= 0 then floor(c2) else -floor(-c2) - return c1, c2 -end - --- ADX frame: s16 big-endian scale, 32 nibbles high first. v3 shifts each product on its own; scale 0x8001 (CRI's end --- marker) decodes as silence -@native function Adpcm.adx(src: buffer, p: number, pstride: number, nframes: number, c1: number, c2: number, v3: boolean, - st: buffer, so: number, dst: buffer, d: number, ds: number) - local h1, h2 = readi32(st, so), readi32(st, so + 4) - local o = d * 4 - local os = ds * 4 - for f = 0, nframes - 1 do - local fp = p + f * pstride - local scale = readu8(src, fp) * 256 + readu8(src, fp + 1) - if scale == 0x8001 then - scale = 0 - elseif scale >= 32768 then - scale -= 65535 -- the signed value + 1 - else - scale += 1 - end - for k = 0, 31 do - local b = readu8(src, fp + 2 + rshift(k, 1)) - local n = if band(k, 1) == 0 then rshift(b, 4) else band(b, 15) - if n >= 8 then - n -= 16 - end - local s - if v3 then - s = n * scale + (c1 * h1) // 4096 + (c2 * h2) // 4096 - else - s = n * scale + (c1 * h1 + c2 * h2) // 4096 - end - if s > 32767 then - s = 32767 - elseif s < -32768 then - s = -32768 - end - h2 = h1 - h1 = s - writef32(dst, o, s / 32768) - o += os - end - end - writei32(st, so, h1) - writei32(st, so + 4, h2) -end - -local PSX1 = { 0, 60, 115, 98, 122 } -local PSX2 = { 0, 0, -52, -55, -60 } - --- the filter term (c1 * h1 + c2 * h2) / 64 * 256 truncated, as vgmstream's single-precision float code computes it: --- exact in integers while the products fit a float's 24 bits -@native local function psxPred(f: number, h1: number, h2: number): number - local x = PSX1[f] * h1 + PSX2[f] * h2 - if h1 > -65536 and h1 < 65536 and h2 > -65536 and h2 < 65536 then - return 4 * x - end - local v = f32(f32(f32(PSX1[f] / 64) * h1) + f32(f32(PSX2[f] / 64) * h2)) * 256 - return if v >= 0 then floor(v) else -floor(-v) -end - --- PS-ADPCM frame: filter << 4 | shift, flags, 28 nibbles low first. Filters past 4 decode as 0 and shifts past 12 as 9 --- (as vgmstream); flags 7 is silence; the history keeps the unclipped value -@native function Adpcm.psx(src: buffer, p: number, pstride: number, nframes: number, st: buffer, so: number, dst: buffer, - d: number, ds: number) - local h1, h2 = readi32(st, so), readi32(st, so + 4) - local o = d * 4 - local os = ds * 4 - for f = 0, nframes - 1 do - local fp = p + f * pstride - local head = readu8(src, fp) - local filter = rshift(head, 4) - local shift = band(head, 15) - if filter > 4 then - filter = 0 - end - if shift > 12 then - shift = 9 - end - local mul = 2 ^ (20 - shift) - local fi = filter + 1 - local silent = band(readu8(src, fp + 1), 15) == 7 - for k = 0, 27 do - local s = 0 - if not silent then - local b = readu8(src, fp + 2 + rshift(k, 1)) - local n = if band(k, 1) == 0 then band(b, 15) else rshift(b, 4) - if n >= 8 then - n -= 16 - end - s = (n * mul + psxPred(fi, h1, h2)) // 256 - end - h2 = h1 - h1 = s - if s > 32767 then - s = 32767 - elseif s < -32768 then - s = -32768 - end - writef32(dst, o, s / 32768) - o += os - end - end - writei32(st, so, h1) - writei32(st, so + 4, h2) -end - --- DSP frame: predictor << 4 | scale shift, 14 nibbles high first; coefs 8 pairs, 11 fractional bits; a predictor --- index past 7 uses pair 7 -@native function Adpcm.dsp(src: buffer, p: number, count: number, coefs: buffer, co: number, st: buffer, so: number, - dst: buffer, d: number, ds: number) - local h1, h2 = readi32(st, so), readi32(st, so + 4) - local o = d * 4 - local os = ds * 4 - local done = 0 - local fp = p - while done < count do - local head = readu8(src, fp) - local pi = math.min(rshift(head, 4), 7) - local scale = 2 ^ band(head, 15) * 2048 - local c1, c2 = readi32(coefs, co + pi * 8), readi32(coefs, co + pi * 8 + 4) - local n14 = math.min(14, count - done) - for k = 0, n14 - 1 do - local b = readu8(src, fp + 1 + rshift(k, 1)) - local n = if band(k, 1) == 0 then rshift(b, 4) else band(b, 15) - if n >= 8 then - n -= 16 - end - local s = (n * scale + 1024 + c1 * h1 + c2 * h2) // 2048 - if s > 32767 then - s = 32767 - elseif s < -32768 then - s = -32768 - end - h2 = h1 - h1 = s - writef32(dst, o, s / 32768) - o += os - end - done += n14 - fp += 8 - end - writei32(st, so, h1) - writei32(st, so + 4, h2) -end - -@native local function toS16(x: number): number - local v = floor(x * 32768 + 0.5) - if v ~= v then - return 0 - elseif v > 32767 then - return 32767 - elseif v < -32768 then - return -32768 - end - return v -end -Adpcm.toS16 = toS16 - -@native local function imaNibble(x: number, pred: number, index: number): number - local base = index * 8 + 1 - local best, bestErr = 0, math.huge - for m = 0, 7 do - local diff = IMA_DIFF[base + m] - local up = math.min(pred + diff, 32767) - local e = math.abs(x - up) - if e < bestErr then - best, bestErr = m, e - end - local down = math.max(pred - diff, -32768) - e = math.abs(x - down) - if e < bestErr then - best, bestErr = m + 8, e - end - end - return best -end - -@native function Adpcm.imaEncode(x: buffer, xi: number, xs: number, count: number, st: buffer, so: number, out: buffer, - p: number, q0: number, qs: number, hi: boolean) - local pred = readi32(st, so) - local index = math.clamp(readi32(st, so + 4), 0, 88) - local q = q0 - for i = 0, count - 1 do - local v = toS16(readf32(x, (xi + i * xs) * 4)) - local nib = imaNibble(v, pred, index) - local diff = IMA_DIFF[index * 8 + band(nib, 7) + 1] - pred = if nib >= 8 then math.max(pred - diff, -32768) else math.min(pred + diff, 32767) - index = IMA_NEXT[index * 16 + nib + 1] - local bp = p + rshift(q, 1) - local b = readu8(out, bp) - if (band(q, 1) == 0) == hi then - b = bor(band(b, 0x0F), lshift(nib, 4)) - else - b = bor(band(b, 0xF0), nib) - end - writeu8(out, bp, b) - q += qs - end - writei32(st, so, pred) - writei32(st, so + 4, index) -end - --- Microsoft IMA block: spb = 1 + 8k frames, 4 * ch + (spb - 1) / 2 * ch bytes -@native function Adpcm.imaWavEncode(x: buffer, xf: number, n: number, ch: number, spb: number, st: buffer, out: buffer, off: number) - local groups = (spb - 1) // 8 - for c = 0, ch - 1 do - local so = c * 8 - local first = if n > 0 then toS16(readf32(x, (xf * ch + c) * 4)) else 0 - writei32(st, so, first) - local index = math.clamp(readi32(st, so + 4), 0, 88) - writei32(st, so + 4, index) - buffer.writei16(out, off + c * 4, first) - writeu8(out, off + c * 4 + 2, index) - writeu8(out, off + c * 4 + 3, 0) - local pred = first - for g = 0, groups - 1 do - local gp = off + 4 * ch + (g * ch + c) * 4 - for k = 0, 7 do - local f = 1 + g * 8 + k - local v = if f < n then toS16(readf32(x, ((xf + f) * ch + c) * 4)) else pred - local nib = imaNibble(v, pred, index) - local diff = IMA_DIFF[index * 8 + band(nib, 7) + 1] - pred = if nib >= 8 then math.max(pred - diff, -32768) else math.min(pred + diff, 32767) - index = IMA_NEXT[index * 16 + nib + 1] - local bp = gp + rshift(k, 1) - if band(k, 1) == 0 then - writeu8(out, bp, nib) - else - writeu8(out, bp, bor(readu8(out, bp), lshift(nib, 4))) - end - end - end - writei32(st, so + 4, index) - end -end - -@native local function msTrial(xs: { number }, n: number, c1: number, c2: number, delta0: number, nibs: { number }?): number - local s1, s2 = xs[2], xs[1] - local idelta = delta0 - local err = 0 - for i = 3, n do - local p = s1 * c1 + s2 * c2 - p = if p >= 0 then p // 256 else -((-p) // 256) - local e = xs[i] - p - local nib = if e >= 0 then (e + idelta // 2) // idelta else -((-e + idelta // 2) // idelta) - nib = math.clamp(nib, -8, 7) - local v = math.clamp(p + nib * idelta, -32768, 32767) - err += (xs[i] - v) * (xs[i] - v) - if nibs then - nibs[i] = band(nib, 15) - end - idelta = math.clamp((MS_ADAPT[band(nib, 15) + 1] * idelta) // 256, 16, 2796202) - s2 = s1 - s1 = v - end - return err -end - --- MS ADPCM block (standard 7 coefficient pairs): 7 * ch + (spb - 2) * ch / 2 bytes -@native function Adpcm.msEncode(x: buffer, xf: number, n: number, ch: number, spb: number, out: buffer, off: number) - local C1, C2 = Adpcm.MS_COEF1, Adpcm.MS_COEF2 - local xs = table.create(spb, 0) - local nibs = table.create(spb, 0) - local all = table.create(spb * ch, 0) - for c = 0, ch - 1 do - for i = 1, spb do - xs[i] = if i <= n then toS16(readf32(x, ((xf + i - 1) * ch + c) * 4)) else 0 - end - local sum = 0 - for i = 3, math.min(spb, 10) do - sum += math.abs(xs[i] - xs[i - 1]) - end - local delta0 = math.clamp(sum // 16, 16, 32767) - local best, bestErr = 1, math.huge - for k = 1, 7 do - local e = msTrial(xs, spb, C1[k], C2[k], delta0, nil) - if e < bestErr then - best, bestErr = k, e - end - end - msTrial(xs, spb, C1[best], C2[best], delta0, nibs) - writeu8(out, off + c, best - 1) - writeu16(out, off + ch + c * 2, delta0) - buffer.writei16(out, off + 3 * ch + c * 2, xs[2] or 0) - buffer.writei16(out, off + 5 * ch + c * 2, xs[1]) - for i = 3, spb do - all[(i - 3) * ch + c + 1] = nibs[i] - end - end - local total = (spb - 2) * ch - for k = 0, total - 1, 2 do - writeu8(out, off + 7 * ch + k // 2, all[k + 1] * 16 + (all[k + 2] or 0)) - end -end - -@native local function adxTrial(xs: { number }, scale: number, c1: number, c2: number, h1: number, h2: number, nibs: { number }?): (number, number, number) - local err = 0 - for k = 1, 32 do - local pred = (c1 * h1 + c2 * h2) // 4096 - local e = xs[k] - pred - local n = if e >= 0 then (e + scale // 2) // scale else -((-e + scale // 2) // scale) - n = math.clamp(n, -8, 7) - local s = math.clamp(n * scale + pred, -32768, 32767) - err += (xs[k] - s) * (xs[k] - s) - if nibs then - nibs[k] = band(n, 15) - end - h2 = h1 - h1 = s - end - return err, h1, h2 -end - --- ADX v4 rounding; the scale is stored minus one as CRI's decoders add it back --- (v4 rounding, the scale stored minus one as CRI's decoders add it back) at out[p], pstride bytes apart; the frame -@native function Adpcm.adxEncode(x: buffer, xi: number, xs: number, count: number, c1: number, c2: number, st: buffer, so: number, - out: buffer, p: number, pstride: number) - local h1, h2 = readi32(st, so), readi32(st, so + 4) - local v = table.create(32, 0) - local nibs = table.create(32, 0) - for f = 0, (count + 31) // 32 - 1 do - local peak = 0 - local a, b = h1, h2 - for k = 1, 32 do - local i = f * 32 + k - 1 - local s = if i < count then toS16(readf32(x, (xi + i * xs) * 4)) else 0 - v[k] = s - peak = math.max(peak, math.abs(s - (c1 * a + c2 * b) // 4096)) - b = a - a = s - end - local base = math.max(1, (peak + 6) // 7) - local best, bestErr = base, math.huge - for _, m in { 1, 0.75, 1.25, 0.5, 1.6 } do - local sc = math.clamp(floor(base * m + 0.5), 1, 0x7FFF) - local e = adxTrial(v, sc, c1, c2, h1, h2, nil) - if e < bestErr then - best, bestErr = sc, e - end - end - local _, n1, n2 = adxTrial(v, best, c1, c2, h1, h2, nibs) - h1, h2 = n1, n2 - local fp = p + f * pstride - writeu8(out, fp, rshift(best - 1, 8)) - writeu8(out, fp + 1, band(best - 1, 255)) - for k = 0, 15 do - writeu8(out, fp + 2 + k, nibs[k * 2 + 1] * 16 + nibs[k * 2 + 2]) - end - end - writei32(st, so, h1) - writei32(st, so + 4, h2) -end - -@native function Adpcm.psxEncode(x: buffer, xi: number, xs: number, count: number, st: buffer, so: number, out: buffer, - p: number, pstride: number) - local h1, h2 = readi32(st, so), readi32(st, so + 4) - local v = table.create(28, 0) - local nibs = table.create(28, 0) - for f = 0, (count + 27) // 28 - 1 do - for k = 1, 28 do - local i = f * 28 + k - 1 - v[k] = if i < count then toS16(readf32(x, (xi + i * xs) * 4)) else 0 - end - local bestErr, bestHead = math.huge, 0 - for fi = 1, 5 do - for shift = 0, 12 do - local mul = 2 ^ (20 - shift) - local a, b = h1, h2 - local err = 0 - for k = 1, 28 do - local pred = psxPred(fi, a, b) - local n = floor((v[k] * 256 - pred) / mul + 0.5) - n = if n > 7 then 7 elseif n < -8 then -8 else n - local s = (n * mul + pred) // 256 - local c = if s > 32767 then 32767 elseif s < -32768 then -32768 else s - err += (v[k] - c) * (v[k] - c) - if err >= bestErr then - break - end - b = a - a = s - end - if err < bestErr then - bestErr, bestHead = err, (fi - 1) * 16 + shift - end - end - end - local fi, shift = rshift(bestHead, 4) + 1, band(bestHead, 15) - local mul = 2 ^ (20 - shift) - for k = 1, 28 do - local pred = psxPred(fi, h1, h2) - local n = math.clamp(floor((v[k] * 256 - pred) / mul + 0.5), -8, 7) - nibs[k] = band(n, 15) - h2 = h1 - h1 = (n * mul + pred) // 256 - end - local fp = p + f * pstride - writeu8(out, fp, bestHead) - writeu8(out, fp + 1, 0) - for k = 0, 13 do - writeu8(out, fp + 2 + k, nibs[k * 2 + 1] + nibs[k * 2 + 2] * 16) - end - end - writei32(st, so, h1) - writei32(st, so + 4, h2) -end - --- ModPlug / OpenMPT ADPCM (sample data marked 0xAD): 16 signed byte deltas, then nibbles low first, each adding its --- delta to a wrapping signed byte; value / 128 -@native function Adpcm.modplug(src: buffer, p: number, count: number, dst: buffer, d: number) - local tab = table.create(16, 0) - for k = 0, 15 do - tab[k + 1] = buffer.readi8(src, p + k) - end - local v = 0 - for i = 0, count - 1 do - local b = readu8(src, p + 16 + rshift(i, 1)) - local nib = if band(i, 1) == 0 then band(b, 15) else rshift(b, 4) - v = (v + tab[nib + 1] + 128) % 256 - 128 - writef32(dst, (d + i) * 4, v / 128) - end -end - --- The SWF / FLV ADPCM (SoundFormat 1, Adobe's SWF specification, "ADPCM compression"): an MSB-first bit stream of --- 2 bits (code size - 2), then blocks of 4096 frames: per channel a signed 16-bit first sample and a 6-bit step --- index, then 4095 frames of `bits`-bit codes, channels interleaved. A code is IMA generalised to 2..5 bits: sign in --- the top bit, the magnitude bits adding step, step/2, ... and the final step/2^(bits-1) (as ffmpeg's adpcm_swf and --- the spec's reference decoder do); the step index moves by SWF_INDEX[bits]. The last block may be short. -local SWF_INDEX: { { number } } = { - { -1, 2 }, - { -1, -1, 2, 4 }, - { -1, -1, -1, -1, 2, 4, 6, 8 }, - { -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16 }, -} - -@native function Adpcm.swfFrames(src: buffer, p: number, n: number, ch: number): number - if n < 1 or ch < 1 then - return 0 - end - local bits = rshift(readu8(src, p), 6) + 2 - local total = n * 8 - 2 - local hdr = 22 * ch - local block = hdr + bits * ch * 4095 - local blocks = total // block - local left = total - blocks * block - local frames = blocks * 4096 - if left >= hdr then - frames += 1 + (left - hdr) // (bits * ch) - end - return frames -end - -@native local function msb(src: buffer, p: number, e: number, pos: number, k: number): number - local q = p + rshift(pos, 3) - local v = readu8(src, q) * 65536 - if q + 1 < e then - v += readu8(src, q + 1) * 256 - end - if q + 2 < e then - v += readu8(src, q + 2) - end - return band(rshift(v, 24 - band(pos, 7) - k), lshift(1, k) - 1) -end - -@native function Adpcm.swf(src: buffer, p: number, n: number, ch: number, dst: buffer, d: number): number - local frames = Adpcm.swfFrames(src, p, n, ch) - if frames == 0 then - return 0 - end - local e = p + n - local bits = rshift(readu8(src, p), 6) + 2 - local tab = SWF_INDEX[bits - 1] - local k0 = lshift(1, bits - 2) - local sign = lshift(1, bits - 1) - local mask = sign - 1 - local pred = table.create(ch, 0) - local index = table.create(ch, 0) - local pos = 2 - local o = d * 4 - local done = 0 - while done < frames do - for c = 1, ch do - local v = msb(src, p, e, pos, 16) - if v >= 32768 then - v -= 65536 - end - pred[c] = v - index[c] = msb(src, p, e, pos + 16, 6) - pos += 22 - writef32(dst, o, v / 32768) - o += 4 - end - done += 1 - local m = math.min(4095, frames - done) - for _ = 1, m do - for c = 1, ch do - local code = msb(src, p, e, pos, bits) - pos += bits - local step = IMA_STEP[math.clamp(index[c], 0, 88) + 1] - local diff = 0 - local k = k0 - while k > 0 do - if band(code, k) ~= 0 then - diff += step - end - step = rshift(step, 1) - k = rshift(k, 1) - end - diff += step - local v = pred[c] - if band(code, sign) ~= 0 then - v -= diff - else - v += diff - end - v = math.clamp(v, -32768, 32767) - pred[c] = v - index[c] = math.clamp(index[c] + tab[band(code, mask) + 1], 0, 88) - writef32(dst, o, v / 32768) - o += 4 - end - end - done += m - end - return frames -end - -return Adpcm -end -__FILES["codecs/image/Yuv"] = @native function() - - - --- codecs/image/Yuv: planar 4:2:0 Y'CbCr <-> rgba8, BT.601 / BT.709, limited or full range. --- yuv -> rgb: nearest chroma, swscale's default 16-bit coefficients (within about one level of ffmpeg -pix_fmt rgba); --- rgb -> yuv: each 2x2 block averaged for the chroma. -local Types = __include("Types") - -local readu8, writeu8, writeu32 = buffer.readu8, buffer.writeu8, buffer.writeu32 -local bcreate = buffer.create -local floor = math.floor - -local Yuv = {} - --- coefficients (x 65536): r = y' + crv * v; g = y' - cgu * u - cgv * v; b = y' + cbu * u --- limited: y' = (y - 16) * 255 / 219, chroma scaled by 255 / 224 -local MATRIX: { [string]: { kr: number, kb: number } } = { - bt601 = { kr = 0.299, kb = 0.114 }, - bt709 = { kr = 0.2126, kb = 0.0722 }, -} - -type Coeffs = { ys: number, yo: number, crv: number, cgu: number, cgv: number, cbu: number, cs: number, yt: { number } } - -local cache: { [string]: Coeffs } = {} -@native local function coeffs(range: string?, matrix: string?): Coeffs - local key = (range or "limited") .. (matrix or "bt601") - local c = cache[key] - if c then - return c - end - local m = MATRIX[matrix or "bt601"] or MATRIX.bt601 - local kr, kb = m.kr, m.kb - local kg = 1 - kr - kb - local full = range == "full" - local ys = if full then 1 else 255 / 219 - local cs = if full then 1 else 255 / 224 - c = { - ys = floor(ys * 65536 + 0.5), - yo = if full then 0 else 16, - crv = floor(2 * (1 - kr) * cs * 65536 + 0.5), - cbu = floor(2 * (1 - kb) * cs * 65536 + 0.5), - cgu = floor(2 * (1 - kb) * kb / kg * cs * 65536 + 0.5), - cgv = floor(2 * (1 - kr) * kr / kg * cs * 65536 + 0.5), - cs = cs, - yt = table.create(256, 0), - } - for v = 0, 255 do - c.yt[v + 1] = (c.ys * (v - c.yo) + 32768) // 65536 + 1024 - end - cache[key] = c - return c -end - -local CLIP = bcreate(2304) -for i = 0, 2303 do - writeu8(CLIP, i, math.clamp(i - 1024, 0, 255)) -end --- CLIP's values shifted into their rgba8 byte (CB carries the alpha); indexes stay within 600..1700 -local CR: { number } = table.create(2304, 0) -local CG: { number } = table.create(2304, 0) -local CB: { number } = table.create(2304, 0) -for i = 1, 2304 do - local v = math.clamp(i - 1024, 0, 255) - CR[i] = v - CG[i] = v * 256 - CB[i] = v * 65536 + 0xff000000 -end - --- hook: called (through pcall) every 16 rows, a cooperative yield point -@native function Yuv.toRgba(src: buffer, w: number, h: number, uo: number, vo: number, cw: number, range: string?, matrix: string?, out: buffer?, hook: (() -> ())?): buffer - local dst = out or bcreate(w * h * 4) - local c = coeffs(range, matrix) - local crv, cgu, cgv, cbu = c.crv, c.cgu, c.cgv, c.cbu - local yt, cr, cg, cb = c.yt, CR, CG, CB - local ch = (h + 1) // 2 - if buffer.len(src) < vo + cw * ch or buffer.len(dst) < w * h * 4 or uo + cw * ch > buffer.len(src) then - return dst - end - local w2 = w // 2 - local stride = w * 4 - for y = 0, h - 1, 2 do - if hook and y % 16 == 0 and y > 0 then - pcall(hook) - end - local yrow = y * w - local ci = uo + (y // 2) * cw - local dv = vo - uo - local o = yrow * 4 - local two = y + 1 < h - for _ = 1, w2 do - local u = readu8(src, ci) - 128 - local v = readu8(src, ci + dv) - 128 - ci += 1 - local rv = (crv * v + 32768) // 65536 - local gv = -((cgu * u + cgv * v + 32768) // 65536) - local bu = (cbu * u + 32768) // 65536 - local yy = yt[readu8(src, yrow) + 1] - writeu32(dst, o, cr[yy + rv] + cg[yy + gv] + cb[yy + bu]) - yy = yt[readu8(src, yrow + 1) + 1] - writeu32(dst, o + 4, cr[yy + rv] + cg[yy + gv] + cb[yy + bu]) - if two then - yy = yt[readu8(src, yrow + w) + 1] - writeu32(dst, o + stride, cr[yy + rv] + cg[yy + gv] + cb[yy + bu]) - yy = yt[readu8(src, yrow + w + 1) + 1] - writeu32(dst, o + stride + 4, cr[yy + rv] + cg[yy + gv] + cb[yy + bu]) - end - yrow += 2 - o += 8 - end - if w % 2 == 1 then - local u = readu8(src, ci) - 128 - local v = readu8(src, ci + dv) - 128 - local rv = (crv * v + 32768) // 65536 - local gv = -((cgu * u + cgv * v + 32768) // 65536) - local bu = (cbu * u + 32768) // 65536 - local yy = yt[readu8(src, yrow) + 1] - writeu32(dst, o, cr[yy + rv] + cg[yy + gv] + cb[yy + bu]) - if two then - yy = yt[readu8(src, yrow + w) + 1] - writeu32(dst, o + stride, cr[yy + rv] + cg[yy + gv] + cb[yy + bu]) - end - end - end - return dst -end - -@native function Yuv.fromRgba(src: buffer, w: number, h: number, range: string?, matrix: string?, out: buffer?): buffer - local cw, ch = (w + 1) // 2, (h + 1) // 2 - local uo, vo = w * h, w * h + cw * ch - local dst = out or bcreate(w * h + 2 * cw * ch) - if buffer.len(src) < w * h * 4 or buffer.len(dst) < w * h + 2 * cw * ch then - return dst - end - local m = MATRIX[matrix or "bt601"] or MATRIX.bt601 - local kr, kb = m.kr, m.kb - local kg = 1 - kr - kb - local full = range == "full" - local ysc = if full then 1 else 219 / 255 - local csc = if full then 1 else 224 / 255 - local yof = if full then 0.5 else 16.5 - local yr, yg, yb = floor(kr * ysc * 65536 + 0.5), floor(kg * ysc * 65536 + 0.5), floor(kb * ysc * 65536 + 0.5) - local yoff = floor(yof * 65536) - local ur = floor(-kr / (2 * (1 - kb)) * csc * 65536 + 0.5) - local ug = floor(-kg / (2 * (1 - kb)) * csc * 65536 + 0.5) - local ub = floor(0.5 * csc * 65536 + 0.5) - local vr = ub - local vg = floor(-kg / (2 * (1 - kr)) * csc * 65536 + 0.5) - local vb = floor(-kb / (2 * (1 - kr)) * csc * 65536 + 0.5) - local coff4 = floor(128.5 * 65536) * 4 - for i = 0, w * h - 1 do - local o = i * 4 - local r, g, b = readu8(src, o), readu8(src, o + 1), readu8(src, o + 2) - writeu8(dst, i, readu8(CLIP, (yr * r + yg * g + yb * b + yoff) // 65536 + 1024)) - end - for cy = 0, ch - 1 do - local y0 = cy * 2 - local y1 = if y0 + 1 < h then y0 + 1 else y0 - for cx = 0, cw - 1 do - local x0 = cx * 2 - local x1 = if x0 + 1 < w then x0 + 1 else x0 - local a, b2, c2, d = (y0 * w + x0) * 4, (y0 * w + x1) * 4, (y1 * w + x0) * 4, (y1 * w + x1) * 4 - local r = readu8(src, a) + readu8(src, b2) + readu8(src, c2) + readu8(src, d) - local g = readu8(src, a + 1) + readu8(src, b2 + 1) + readu8(src, c2 + 1) + readu8(src, d + 1) - local b = readu8(src, a + 2) + readu8(src, b2 + 2) + readu8(src, c2 + 2) + readu8(src, d + 2) - local i = cy * cw + cx - writeu8(dst, uo + i, readu8(CLIP, (ur * r + ug * g + ub * b + coff4) // 262144 + 1024)) - writeu8(dst, vo + i, readu8(CLIP, (vr * r + vg * g + vb * b + coff4) // 262144 + 1024)) - end - end - return dst -end - -@native local function info(img: Types.Image): (string, string) - local m = img.meta - local y = m and m.yuv - if type(y) == "table" then - return y.range or "limited", y.matrix or "bt601" - end - local src = m and m.source - if type(src) == "table" and src.range == "full" then - return "full", "bt601" - end - return "limited", "bt601" -end -Yuv.info = info - -@native function Yuv.planes(w: number, h: number): (number, number, number, number) - local cw, ch = (w + 1) // 2, (h + 1) // 2 - return w * h, w * h + cw * ch, cw, ch -end - -local FULL_Y = bcreate(256) -local FULL_C = bcreate(256) -for v = 0, 255 do - writeu8(FULL_Y, v, math.clamp(floor((v - 16) * 255 / 219 + 0.5), 0, 255)) - writeu8(FULL_C, v, math.clamp(floor((v - 128) * 255 / 224 + 128.5), 0, 255)) -end - -@native function Yuv.toFullRange(img: Types.Image): Types.Image - if img.format ~= "yuv420p" or info(img) == "full" then - return img - end - local w, h = img.width, img.height - local out = Types.Image.new(w, h, "yuv420p") - local src, dst = img.pixels, out.pixels - local ny = w * h - local n = math.min(buffer.len(src), buffer.len(dst)) - for i = 0, math.min(ny, n) - 1 do - writeu8(dst, i, readu8(FULL_Y, readu8(src, i))) - end - for i = ny, n - 1 do - writeu8(dst, i, readu8(FULL_C, readu8(src, i))) - end - out.meta.yuv = { range = "full", matrix = select(2, info(img)) } - out.meta.source = img.meta.source - return out -end - --- out: an rgba8 Image of the same size to write into (else a new one) -@native function Yuv.imageToRgba(img: Types.Image, out: Types.Image?, hook: (() -> ())?): Types.Image? - if img.format == "rgba8" then - return img - end - if img.format ~= "yuv420p" then - return nil - end - local w, h = img.width, img.height - local uo, vo, cw = Yuv.planes(w, h) - local range, matrix = info(img) - if not out or out.format ~= "rgba8" or out.width ~= w or out.height ~= h or buffer.len(out.pixels) < w * h * 4 then - out = Types.Image.new(w, h, "rgba8") - end - local o = out :: Types.Image - Yuv.toRgba(img.pixels, w, h, uo, vo, cw, range, matrix, o.pixels, hook) - o.meta.source = img.meta.source - return o -end - -@native function Yuv.imageFromRgba(img: Types.Image, range: string?, matrix: string?): Types.Image? - if img.format == "yuv420p" then - return img - end - if img.format ~= "rgba8" then - return nil - end - local out = Types.Image.new(img.width, img.height, "yuv420p") - Yuv.fromRgba(img.pixels, img.width, img.height, range, matrix, out.pixels) - out.meta.yuv = { range = range or "limited", matrix = matrix or "bt601" } - out.meta.source = img.meta.source - return out -end - -@native local function scalePlane(src: buffer, so: number, sw: number, sh: number, dst: buffer, d0: number, dw: number, dh: number, hook: (() -> ())?) - local fx, fy = sw / dw, sh / dh - for y = 0, dh - 1 do - if hook and y % 16 == 15 then - pcall(hook) - end - local sy = (y + 0.5) * fy - 0.5 - if sy < 0 then - sy = 0 - end - local y0 = floor(sy) - if y0 > sh - 1 then - y0 = sh - 1 - end - local y1 = if y0 < sh - 1 then y0 + 1 else y0 - local wy = floor((sy - y0) * 256) - local r0, r1 = so + y0 * sw, so + y1 * sw - local o = d0 + y * dw - for x = 0, dw - 1 do - local sx = (x + 0.5) * fx - 0.5 - if sx < 0 then - sx = 0 - end - local x0 = floor(sx) - if x0 > sw - 1 then - x0 = sw - 1 - end - local x1 = if x0 < sw - 1 then x0 + 1 else x0 - local wx = floor((sx - x0) * 256) - local a = readu8(src, r0 + x0) * (256 - wx) + readu8(src, r0 + x1) * wx - local b = readu8(src, r1 + x0) * (256 - wx) + readu8(src, r1 + x1) * wx - writeu8(dst, o + x, (a * (256 - wy) + b * wy + 32768) // 65536) - end - end -end - -@native function Yuv.scale(src: buffer, w: number, h: number, width: number, height: number, out: buffer?, hook: (() -> ())?): buffer - local dw: number = math.max(1, floor(width)) - local dh: number = math.max(1, floor(height)) - local cw: number = (w + 1) // 2 - local ch: number = (h + 1) // 2 - local dcw: number = (dw + 1) // 2 - local dch: number = (dh + 1) // 2 - local size = dw * dh + 2 * dcw * dch - local dst = if out and buffer.len(out) >= size then out else bcreate(size) - if w < 1 or h < 1 or buffer.len(src) < w * h + 2 * cw * ch then - return dst - end - scalePlane(src, 0, w, h, dst, 0, dw, dh, hook) - scalePlane(src, w * h, cw, ch, dst, dw * dh, dcw, dch, hook) - scalePlane(src, w * h + cw * ch, cw, ch, dst, dw * dh + dcw * dch, dcw, dch, hook) - return dst -end - --- out: a yuv420p Image of the target size to write into (else a new one) -@native function Yuv.imageScale(img: Types.Image, dw: number, dh: number, out: Types.Image?, hook: (() -> ())?): Types.Image - local tw, th = math.max(1, floor(dw)), math.max(1, floor(dh)) - if not out or out.format ~= "yuv420p" or out.width ~= tw or out.height ~= th then - out = Types.Image.new(tw, th, "yuv420p") - end - local o = out :: Types.Image - Yuv.scale(img.pixels, img.width, img.height, tw, th, o.pixels, hook) - o.meta = table.clone(img.meta or {}) - return o -end - -return Yuv -end -__FILES["codecs/model/Rbx"] = function() - --- codecs/model/Rbx: the Roblox instance tree and property values shared by model/rbxm and model/rbxmx. --- Written from the rbx-dom format notes (docs/binary.md, docs/xml.md); checked against rbx-dom through rojo / lune. --- Faces: bits Right 1, Top 2, Back 4, Left 8, Bottom 16, Front 32 --- Axes: bits X 1, Y 2, Z 4 --- UniqueId: 32 hex digits: random (16), time (8), index (8) - -local Rbx = {} - -type Value = { type: string, value: any } -type Instance = { - className: string, - name: string, - properties: { [string]: Value }, - children: { Instance }, - parent: Instance?, - referent: string?, - service: boolean?, -- a service (binary INST object format 1; rbxl roots) -} -type Tree = { - kind: "rbxtree", - roots: { Instance }, - place: boolean, - metadata: { [string]: string }, -- binary META / XML <Meta> entries (ExplicitAutoJoints, ...) - extra: { any }, - meta: { source: { format: string, [string]: any }?, [string]: any }, -} - -function Rbx.tree(place: boolean?): Tree - return { kind = "rbxtree", roots = {}, place = place == true, metadata = {}, extra = {}, meta = {} } -end - -function Rbx.instance(className: string, name: string?): Instance - return { className = className, name = name or className, properties = {}, children = {} } -end - -function Rbx.add(parent: any, child: Instance): Instance - if parent.kind == "rbxtree" then - child.parent = nil - table.insert(parent.roots, child) - else - child.parent = parent - table.insert(parent.children, child) - end - return child -end - -function Rbx.set(inst: Instance, name: string, typ: string, value: any) - inst.properties[name] = { type = typ, value = value } -end - -function Rbx.get(inst: Instance, name: string): any - local v = inst.properties[name] - return if v then v.value else nil -end - -function Rbx.descendants(root: any): () -> (Instance?, number?) - local stack: { any } = {} - local list = if root.kind == "rbxtree" then root.roots else root.children - for i = #list, 1, -1 do - table.insert(stack, { list[i], 1 }) - end - return function(): (Instance?, number?) - local top = table.remove(stack) - if not top then - return nil, nil - end - local inst, depth = top[1], top[2] - for i = #inst.children, 1, -1 do - table.insert(stack, { inst.children[i], depth + 1 }) - end - return inst, depth - end -end - -function Rbx.list(tree: any): { Instance } - local out = {} - for inst in Rbx.descendants(tree) do - table.insert(out, inst :: Instance) - end - return out -end - -function Rbx.find(root: any, path: string): Instance? - local cur: any = root - for part in string.gmatch(path, "[^/]+") do - local list = if cur.kind == "rbxtree" then cur.roots else cur.children - local found = nil - for _, c in list do - if c.name == part then - found = c - break - end - end - if not found then - return nil - end - cur = found - end - return if cur.kind == "rbxtree" then nil else cur -end - -function Rbx.fullName(inst: Instance): string - local parts = {} - local cur: Instance? = inst - while cur do - table.insert(parts, 1, cur.name) - cur = cur.parent - end - return table.concat(parts, ".") -end - --- The binary format stores axis-aligned rotations as one byte: id = 6 * n(RightVector) + n(UpVector) + 1, where n is --- the NormalId of a unit axis (+X 0, +Y 1, +Z 2, -X 3, -Y 4, -Z 5) and the third column is their cross product. -local AXES = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 }, { -1, 0, 0 }, { 0, -1, 0 }, { 0, 0, -1 } } - -local ROTATIONS: { [number]: { number } } = {} -for a = 0, 5 do - for b = 0, 5 do - if a % 3 ~= b % 3 then - local r, u = AXES[a + 1], AXES[b + 1] - local k = { r[2] * u[3] - r[3] * u[2], r[3] * u[1] - r[1] * u[3], r[1] * u[2] - r[2] * u[1] } - -- columns: right, up, back (= right x up) - ROTATIONS[6 * a + b + 1] = { r[1], u[1], k[1] + 0, r[2], u[2], k[2] + 0, r[3], u[3], k[3] + 0 } - end - end -end -Rbx.ROTATIONS = ROTATIONS - -local function axisIndex(x: number, y: number, z: number): number? - for i, a in AXES do - if a[1] == x and a[2] == y and a[3] == z then - return i - 1 - end - end - return nil -end - -function Rbx.rotationId(cf: { number }): number - local a = axisIndex(cf[4], cf[7], cf[10]) - local b = axisIndex(cf[5], cf[8], cf[11]) - if not a or not b then - return 0 - end - local id = 6 * a + b + 1 - local rot = ROTATIONS[id] - if not rot or rot[3] ~= cf[6] or rot[6] ~= cf[9] or rot[9] ~= cf[12] then - return 0 - end - return id -end - --- binary type ids (rbx-dom docs/binary.md) by type name, and back -Rbx.TYPE_IDS = table.freeze({ - String = 0x01, - BinaryString = 0x01, - ProtectedString = 0x01, - ContentId = 0x01, - Bool = 0x02, - Int32 = 0x03, - Float32 = 0x04, - Float64 = 0x05, - UDim = 0x06, - UDim2 = 0x07, - Ray = 0x08, - Faces = 0x09, - Axes = 0x0A, - BrickColor = 0x0B, - Color3 = 0x0C, - Vector2 = 0x0D, - Vector3 = 0x0E, - Vector2int16 = 0x0F, - CFrame = 0x10, - Enum = 0x12, - Ref = 0x13, - Vector3int16 = 0x14, - NumberSequence = 0x15, - ColorSequence = 0x16, - NumberRange = 0x17, - Rect = 0x18, - PhysicalProperties = 0x19, - Color3uint8 = 0x1A, - Int64 = 0x1B, - SharedString = 0x1C, - Bytecode = 0x1D, - OptionalCFrame = 0x1E, - UniqueId = 0x1F, - Font = 0x20, - SecurityCapabilities = 0x21, - Content = 0x22, -} :: { [string]: number }) -local NAMES: { [number]: string } = {} -for name, id in Rbx.TYPE_IDS do - if NAMES[id] == nil or name == "String" then - NAMES[id] = name - end -end -Rbx.TYPE_NAMES = table.freeze(NAMES) - --- BrickColor 194 (Medium stone grey) is Roblox's default -local IDENTITY_CF = { 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 } -function Rbx.default(typ: string): any - if typ == "String" or typ == "BinaryString" or typ == "ProtectedString" or typ == "ContentId" or typ == "Bytecode" or typ == "SharedString" then - return "" - elseif typ == "Bool" then - return false - elseif typ == "BrickColor" then - return 194 - elseif typ == "UDim" or typ == "NumberRange" or typ == "Vector2" or typ == "Vector2int16" then - return { 0, 0 } - elseif typ == "UDim2" or typ == "Rect" then - return { 0, 0, 0, 0 } - elseif typ == "Vector3" or typ == "Vector3int16" or typ == "Color3" or typ == "Color3uint8" then - return { 0, 0, 0 } - elseif typ == "Ray" then - return { 0, 0, 0, 0, 0, 0 } - elseif typ == "CFrame" then - return table.clone(IDENTITY_CF) - elseif typ == "NumberSequence" then - return { { 0, 0, 0 }, { 1, 0, 0 } } - elseif typ == "ColorSequence" then - return { { 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0 } } - elseif typ == "UniqueId" then - return string.rep("0", 32) - elseif typ == "Font" then - return { family = "rbxasset://fonts/families/SourceSansPro.json", weight = 400, style = "Normal" } - elseif typ == "PhysicalProperties" or typ == "Ref" or typ == "OptionalCFrame" or typ == "Content" then - return nil - end - return 0 -end - -Rbx.STRINGS = table.freeze({ String = true, BinaryString = true, ProtectedString = true, ContentId = true, Bytecode = true } :: { [string]: boolean }) - -return Rbx -end -__FILES["codecs/video/Video"] = function() - - --- codecs/video/Video: the video codec registry and the generic VideoDecoder. New in rosetta. -local Err = __include("core/Err") -local Types = __include("Types") -local Yuv = __include("codecs/image/Yuv") -local Disposable = __include("codecs/video/Video/Disposable") -local Pool = __include("codecs/video/Video/Pool") - -local Video = {} - -type Entry = { - id: string, - name: string, - fourcc: { string }?, -- AVI biCompression / MOV sample entry FourCCs - matroska: { string }?, -- Matroska / WebM CodecIDs - new: ((track: Types.Track, opts: any?) -> (Types.VideoCodecDecoder?, Err.Err?))?, - [string]: any, -} - --- decodeOne -> nil, nil: a packet with no picture to show (a hidden VP8 altref frame); false: a picture skipped -function Video.simpleDecoder(decodeOne: (data: buffer, packet: Types.Packet) -> (Types.Image? | false, Err.Err?), resetFn: (() -> ())?): Types.VideoCodecDecoder - local queue: { any } = {} - local self = {} - function self.decode(_: any, packet: Types.Packet): Err.Err? - local ok, img, err = pcall(decodeOne, packet.data, packet) - if not ok then - return Err.new(Err.CORRUPT, "decoder threw: " .. tostring(img)) - end - if img ~= nil then - table.insert(queue, { img, packet.pts, packet.keyframe }) - end - return err - end - function self.receive(_: any): (Types.Image? | false, number?, boolean?) - local q = table.remove(queue, 1) - if q then - return q[1], q[2], q[3] - end - return nil, nil, nil - end - function self.flush(_: any) end - function self.reset(_: any) - table.clear(queue) - if resetFn then - resetFn() - end - end - return self :: any -end - --- raw video: yuv420p (I420 / IYUV / y4m), yv12 (V before U), yuv422p / yuv444p / yuva444p / gray (chroma averaged --- down to 4:2:0, alpha dropped), track.bitDepth 9..16 (little-endian 16-bit samples scaled to 8 bits), rgb24 / bgr24 / --- bgra / rgba (AVI DIBs: track.flip = bottom-up rows, track.stride = padded rows) -local function rawPlanar(data: buffer, pf: string, bits: number, w: number, h: number): Types.Image - local img = Types.Image.new(w, h, "yuv420p") - local px = img.pixels - local cw, ch = (w + 1) // 2, (h + 1) // 2 - local bps = if bits > 8 then 2 else 1 - local shift = 2 ^ (bits - 8) - local function sample(o: number): number - if bps == 1 then - return buffer.readu8(data, o) - end - return math.min(255, buffer.readu16(data, o) // shift) - end - for i = 0, w * h - 1 do - buffer.writeu8(px, i, sample(i * bps)) - end - local scw, sch = w, h -- source chroma plane size - if pf == "yuv420p" then - scw, sch = cw, ch - elseif pf == "yuv422p" then - scw, sch = cw, h - end - local uo, vo = w * h * bps, (w * h + scw * sch) * bps - for cy = 0, ch - 1 do - for cx = 0, cw - 1 do - local i = cy * cw + cx - local u, v - if pf == "gray" then - u, v = 128, 128 - elseif pf == "yuv420p" then - u, v = sample(uo + i * bps), sample(vo + i * bps) :: number - elseif pf == "yuv422p" then - local y0, y1 = cy * 2, math.min(cy * 2 + 1, h - 1) - u = (sample(uo + (y0 * scw + cx) * bps) + sample(uo + (y1 * scw + cx) * bps) + 1) // 2 - v = (sample(vo + (y0 * scw + cx) * bps) + sample(vo + (y1 * scw + cx) * bps) + 1) // 2 - else - local x0, x1 = cx * 2, math.min(cx * 2 + 1, w - 1) - local y0, y1 = cy * 2, math.min(cy * 2 + 1, h - 1) - local a, b, c, d = (y0 * w + x0) * bps, (y0 * w + x1) * bps, (y1 * w + x0) * bps, (y1 * w + x1) * bps - u = (sample(uo + a) + sample(uo + b) + sample(uo + c) + sample(uo + d) + 2) // 4 - v = (sample(vo + a) + sample(vo + b) + sample(vo + c) + sample(vo + d) + 2) // 4 - end - buffer.writeu8(px, w * h + i, u) - buffer.writeu8(px, w * h + cw * ch + i, v) - end - end - return img -end - -local PLANAR_SIZE: { [string]: (w: number, h: number, cw: number, ch: number) -> number } = { - yuv420p = function(w, h, cw, ch) - return w * h + 2 * cw * ch - end, - yv12 = function(w, h, cw, ch) - return w * h + 2 * cw * ch - end, - yuv422p = function(w, h, cw, _ch) - return w * h + 2 * cw * h - end, - yuv444p = function(w, h) - return w * h * 3 - end, - yuva444p = function(w, h) - return w * h * 4 - end, - gray = function(w, h) - return w * h - end, -} - -local function rawDecoder(track: Types.Track, _opts: any?): (Types.VideoCodecDecoder?, Err.Err?) - local w, h = track.width or 0, track.height or 0 - if w <= 0 or h <= 0 or w * h > 2 ^ 26 then - return nil, Err.new(Err.CORRUPT, "raw video without a valid size") - end - local pf = track.pixelFormat or "yuv420p" - local bits = track.bitDepth or 8 - local cw, ch = (w + 1) // 2, (h + 1) // 2 - local flip = track.flip == true - local planar = PLANAR_SIZE[pf] - return Video.simpleDecoder(function(data: buffer): (Types.Image?, Err.Err?) - local n = buffer.len(data) - if planar then - local need = planar(w, h, cw, ch) * (if bits > 8 then 2 else 1) - if n < need then - return nil, Err.new(Err.TRUNCATED, "raw frame: " .. n .. " of " .. need .. " bytes") - end - if pf == "yuv420p" and bits == 8 then - local img = Types.Image.new(w, h, "yuv420p") - buffer.copy(img.pixels, 0, data, 0, need) - return img, nil - elseif pf == "yv12" then - local img = Types.Image.new(w, h, "yuv420p") - buffer.copy(img.pixels, 0, data, 0, w * h) - buffer.copy(img.pixels, w * h, data, w * h + cw * ch, cw * ch) - buffer.copy(img.pixels, w * h + cw * ch, data, w * h, cw * ch) - return img, nil - end - return rawPlanar(data, pf, bits, w, h), nil - end - local bpp = if pf == "bgra" or pf == "rgba" then 4 else 3 - local stride: number = track.stride or w * bpp - if n < stride * (h - 1) + w * bpp then - return nil, Err.new(Err.TRUNCATED, "raw frame too short") - end - local img = Types.Image.new(w, h, "rgba8") - local px = img.pixels - local bgr = pf == "bgr24" or pf == "bgra" - for y = 0, h - 1 do - local s = (if flip then h - 1 - y else y) * stride - local o = y * w * 4 - for x = 0, w - 1 do - local p = s + x * bpp - local a, b, c = buffer.readu8(data, p), buffer.readu8(data, p + 1), buffer.readu8(data, p + 2) - if bgr then - a, c = c, a - end - buffer.writeu32(px, o + x * 4, a + b * 256 + c * 65536 + 0xff000000) - end - end - return img, nil - end), nil -end - -local function vp8Decoder(_track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) - local Vp8 = __include("codecs/image/Vp8") - local dec = Vp8.newDecoder() - local o = { maxPixels = opts and opts.maxPixels, yield = opts and opts.yield, skipDisposable = opts and opts.skipDisposable } - local self: any - self = Video.simpleDecoder(function(data: buffer): (Types.Image? | false, Err.Err?) - local img, err = dec:decodeFrame(data, 0, buffer.len(data), o) - if not img then - if err then - return nil, err - end - self.skipped += 1 - -- show_frame (RFC 6386 9.1): a shown frame keeps its place - return if buffer.readu8(data, 0) // 16 % 2 == 1 then false else nil, nil - end - local src = img.meta.source - if type(src) == "table" and src.show == false then - return nil, nil - end - img.meta.yuv = { range = "limited", matrix = "bt601" } - return img, nil - end, function() - if dec.reset then - dec:reset() - else - dec = Vp8.newDecoder() - end - end) :: any - self.skipped = 0 - function self.release(_: any, image: Types.Image): boolean - return dec:release(image) - end - return self, nil -end - --- Motion JPEG: yuv420p straight from the planes (full range) when the layout allows, else rgba8 -local function mjpegDecoder(_track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) - local Jpeg = __include("codecs/image/Jpeg") - local o: Jpeg.DecodeOptions = { yuv = true, maxPixels = opts and opts.maxPixels } - return Video.simpleDecoder(function(data: buffer): (Types.Image?, Err.Err?) - local img, err = Jpeg.decode(data, 0, buffer.len(data), o) - if img and img.format == "yuv420p" then - img.meta.yuv = { range = "full", matrix = "bt601" } - end - return img, err - end), nil -end - --- the MJPEG encoder (writers): JPEG is full-range, so limited-range yuv420p frames are remapped first -local function mjpegEncode(img: Types.Image, opts: any?): (buffer?, Err.Err?) - local Jpeg = __include("codecs/image/Jpeg") - local src = img - if img.format == "yuv420p" then - local range = Yuv.info(img) - if range ~= "full" then - src = Yuv.toFullRange(img) - end - end - return Jpeg.encode(src, { quality = opts and opts.quality or 90 }) -end - -local function mpeg2Decoder(track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) - local Mpeg2 = __include("codecs/video/Mpeg2") - return Mpeg2.newVideoDecoder(track, opts) -end - -local function h264Decoder(track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) - local H264 = __include("codecs/video/H264") - return H264.newVideoDecoder(track, opts) -end - -local function h263Decoder(track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) - local H263 = __include("codecs/video/H263") - local dec = H263.new({ flv = track.codec == "flv1", maxPixels = opts and opts.maxPixels }) - return Video.simpleDecoder(function(data: buffer): (Types.Image?, Err.Err?) - return dec:image(data) - end, function() - dec:reset() - end), nil -end - -local function theoraDecoder(track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) - local Theora = __include("codecs/video/Theora") - return Theora.newVideoDecoder(track, opts) -end - -local function legacyDecoder(id: string): (track: Types.Track, opts: any?) -> (Types.VideoCodecDecoder?, Err.Err?) - return function(track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) - return __include("codecs/video/Legacy").newDecoder(id, track, opts) - end -end - --- FourCCs compare case-sensitively first, then upper-cased -local BUILTIN: { Entry } = { - { id = "vp8", name = "VP8", fourcc = { "VP80", "vp08" }, matroska = { "V_VP8" }, new = vp8Decoder }, - { id = "mjpeg", name = "Motion JPEG", fourcc = { "MJPG", "mjpa", "mjpb", "jpeg", "AVRn", "AVDJ", "dmb1", "LJPG", "JPGL", "MJLS", "ijpg" }, matroska = { "V_MJPEG" }, new = mjpegDecoder, encode = mjpegEncode }, - { id = "mpeg1", name = "MPEG-1 video", fourcc = { "mpg1", "MPG1", "PIM1", "m1v " }, matroska = { "V_MPEG1" }, new = mpeg2Decoder }, - { id = "rawvideo", name = "raw video", fourcc = { "\0\0\0\0", "I420", "IYUV", "YV12", "raw ", "DIB " }, matroska = { "V_UNCOMPRESSED" }, new = rawDecoder }, - { id = "mpeg2", name = "MPEG-2 video", fourcc = { "mpg2", "MPG2", "MPEG", "mp2v", "hdv1", "hdv2", "hdv3", "hdv5", "hdv6", "hdv7", "hdv8", "hdv9", "hdva", "xdv1", "xdv2", "xdv3", "xdv4", "xdv5", "xdv6", "xdv7", "xdv8", "xdv9", "xdva", "xdvb", "xdvc", "xdvd", "xdve", "xdvf", "xd54", "xd55", "xd59", "xd5a", "xd5b", "xd5c", "xd5d", "xd5e", "xd5f", "xdhd", "xdh2", "AVmp", "mx3n", "mx3p", "mx4n", "mx4p", "mx5n", "mx5p", "mmes", "MMES", "M701", "M702", "M703", "M704", "M705", "mpgv", "m2v1", "M2V1" }, matroska = { "V_MPEG2" }, new = mpeg2Decoder }, - { id = "mpeg4", name = "MPEG-4 part 2", fourcc = { "mp4v", "FMP4", "XVID", "DIVX", "DX50", "MP4V" }, matroska = { "V_MPEG4/ISO/SP", "V_MPEG4/ISO/ASP", "V_MPEG4/ISO/AP" } }, - { id = "h264", name = "H.264 / AVC", fourcc = { "avc1", "avc3", "H264", "h264", "X264", "x264", "AVC1", "DAVC", "VSSH" }, matroska = { "V_MPEG4/ISO/AVC" }, new = h264Decoder }, - { id = "hevc", name = "H.265 / HEVC", fourcc = { "hvc1", "hev1", "HEVC", "H265" }, matroska = { "V_MPEGH/ISO/HEVC" } }, - { id = "vp9", name = "VP9", fourcc = { "VP90", "vp09" }, matroska = { "V_VP9" } }, - { id = "av1", name = "AV1", fourcc = { "AV01", "av01" }, matroska = { "V_AV1" } }, - { id = "theora", name = "Theora", matroska = { "V_THEORA" }, new = theoraDecoder }, - { id = "h263", name = "H.263", fourcc = { "H263", "h263", "s263", "U263" }, new = h263Decoder }, - { id = "flv1", name = "Sorenson Spark (FLV1)", fourcc = { "FLV1" }, new = h263Decoder }, - { id = "vp6f", name = "On2 VP6 (Flash)", fourcc = { "VP6F", "FLV4" } }, - { id = "vp6a", name = "On2 VP6 with alpha (Flash)", fourcc = { "VP6A" } }, - { id = "flashsv", name = "Flash Screen Video", fourcc = { "FSV1" } }, - { id = "flashsv2", name = "Flash Screen Video 2" }, - { id = "png", name = "PNG", fourcc = { "png ", "MPNG" }, matroska = { "V_PNG" } }, - { id = "cinepak", name = "Cinepak", fourcc = { "cvid" }, new = legacyDecoder("cinepak") }, - { id = "msvideo1", name = "Microsoft Video 1", fourcc = { "CRAM", "MSVC", "WHAM" }, new = legacyDecoder("msvideo1") }, - { id = "qtrle", name = "QuickTime Animation (RLE)", fourcc = { "rle " }, new = legacyDecoder("qtrle") }, - { id = "smc", name = "QuickTime Graphics (SMC)", fourcc = { "smc " }, new = legacyDecoder("smc") }, - { id = "flic", name = "Autodesk Animator FLIC", fourcc = { "AFLC" }, new = legacyDecoder("flic") }, - { id = "smackvid", name = "Smacker video", fourcc = { "SMK2", "SMK4" }, new = legacyDecoder("smackvid") }, -} - -local byId: { [string]: Entry } = {} -local byFourcc: { [string]: string } = {} -local byMatroska: { [string]: string } = {} - -function Video.register(entry: Entry): (boolean, Err.Err?) - if type(entry) ~= "table" or type(entry.id) ~= "string" then - return false, Err.new(Err.ARG, "register: needs an entry with an id") - end - local old = byId[entry.id] - if old and entry.new == nil then - entry.new = old.new - end - byId[entry.id] = entry - for _, f in entry.fourcc or {} do - byFourcc[f] = entry.id - end - for _, m in entry.matroska or {} do - byMatroska[m] = entry.id - end - return true, nil -end -for _, e in BUILTIN do - Video.register(e) -end - -Video.codecs = byId - -function Video.fromFourcc(fcc: string): string? - return byFourcc[fcc] or byFourcc[string.upper(fcc)] or byFourcc[string.lower(fcc)] -end - -function Video.fromMatroska(id: string): string? - return byMatroska[id] -end - -function Video.entry(id: string): Entry? - return byId[id] -end - --- disposable: no later frame predicts from the packet's; droppable: it may also be left out unread (VP8 headers can --- carry probability and loop filter updates, so a disposable VP8 frame is droppable only without them) -function Video.isDisposable(track: Types.Track | string, packet: Types.Packet | buffer): (boolean, boolean) - local codec = if type(track) == "table" then track.codec else track - local config = if type(track) == "table" then track.config else nil - local data = if type(packet) == "table" then packet.data else packet - if type(data) ~= "buffer" or type(codec) ~= "string" then - return false, false - end - return Disposable.check(codec, data, config) -end - -function Video.canDecode(id: string): boolean - local e = byId[id] - return e ~= nil and e.new ~= nil -end - -function Video.decoder(track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) - local e = byId[track.codec] - if not e or not e.new then - return nil, Err.new(Err.UNSUPPORTED, "no decoder for video codec " .. tostring(track.codec)) - end - local ok, dec, err = pcall(e.new :: any, track, opts) - if not ok then - return nil, Err.new(Err.CORRUPT, "codec " .. track.codec .. " failed to start: " .. tostring(dec)) - end - return dec, err -end - -local function toRGBA(_self: any, f: any): Types.Image - local img = if type(f) == "table" and f.image then f.image else f - local out = Yuv.imageToRgba(img) - return out or img -end - -type OpenOptions = { - rgba: boolean?, - track: number?, - maxPixels: number?, - openAudio: ((demuxer: Types.Demuxer, track: Types.Track) -> (Types.Decoder?, Err.Err?))?, - audio: boolean?, - maxSide: number?, - yield: (() -> ())?, - skipDisposable: boolean?, - reuse: boolean?, -- nextFrame may overwrite the Image of the frame it returned before - [string]: any, -} - -function Video.open(demuxer: Types.Demuxer, opts: OpenOptions?): (Types.VideoDecoder?, Err.Err?) - local o: OpenOptions = opts or {} - local track: Types.Track? = nil - if o.track then - for _, t in demuxer.tracks do - if t.id == o.track then - track = t - end - end - if not track then - return nil, Err.new(Err.ARG, "no track " .. tostring(o.track)) - end - else - track = demuxer:track("video") - end - local codec: Types.VideoCodecDecoder? = nil - local codecErr: Err.Err? = nil - if track then - codec, codecErr = Video.decoder(track, o) - else - codecErr = Err.new(Err.UNSUPPORTED, "no video track") - end - local v: any = { - kind = "video", - format = demuxer.format, - codec = if track then track.codec else "none", - width = if track then track.width or 0 else 0, - height = if track then track.height or 0 else 0, - frameRate = if track then track.frameRate or 0 else 0, - frames = if track then track.frames or 0 else 0, - duration = if track and track.duration and track.duration > 0 then track.duration else demuxer.duration, - track = track, - demuxer = demuxer, - meta = demuxer.meta or {}, - decodeError = codecErr, - toRGBA = toRGBA, - } - if v.frames == 0 and v.frameRate > 0 and v.duration > 0 then - v.frames = math.floor(v.duration * v.frameRate + 0.5) - end - if o.audio ~= false then - local at = demuxer:track("audio") - if at then - if o.openAudio then - local ok, dec, err = pcall(o.openAudio, demuxer, at) - if ok and dec then - v.audio = dec - else - v.audioError = if ok then err else Err.new(Err.CORRUPT, "audio: " .. tostring(dec)) - end - else - v.audioError = Err.new(Err.UNSUPPORTED, "no audio hook (open through the api: F.video.open)") - end - end - end - local index, flushed, skipUntil = 0, false, -math.huge - local tid = if track then track.id else -1 - local scale: number = if track and track.timescale and track.timescale > 0 then track.timescale else 1000 - local start = demuxer.startTime or 0 - v.startTime = start - local defaultDur = if v.frameRate > 0 then 1 / v.frameRate else 0 - local lastPts = nil :: number? - -- rgba8 / scaled Images made here; the codec's own go back through codec:release - local own = Pool.new(2) - local function recycle(img: any) - if img and not own:give(img) and codec and codec.release then - codec:release(img) - end - end - local lastFrame: any = nil - function v.release(self: any, frame: any) - recycle(if type(frame) == "table" and frame.kind == "image" then frame else type(frame) == "table" and frame.image) - end - function v.nextFrame(self: any): (Types.VideoFrame?, Err.Err?) - if not codec then - return nil, codecErr - end - if lastFrame then - recycle(lastFrame.image) - lastFrame = nil - end - local dec = codec :: Types.VideoCodecDecoder - while true do - local img, pts, key = dec:receive() - if img == false then - -- a picture skipped (skipDisposable): it keeps its place in output order - if index >= 0 then - index += 1 - end - elseif img then - local t = (pts or 0) / scale - start - if t + 1e-9 >= skipUntil then - if index < 0 then - -- after a seek: constant-rate index = round(pts * fps), else counted from the seek - index = if v.frameRate > 0 then math.max(0, math.floor(t * v.frameRate + 0.5)) else 0 - end - index += 1 - local d = defaultDur - if lastPts and t > (lastPts :: number) and defaultDur == 0 then - d = t - (lastPts :: number) - end - lastPts = t - local maxSide = o.maxSide - local hook = o.yield - if hook and (o.rgba or maxSide) then - pcall(hook) - end - if maxSide and maxSide >= 1 and img.format == "yuv420p" and math.max(img.width, img.height) > maxSide then - local s = maxSide / math.max(img.width, img.height) - local dw, dh = math.max(1, math.floor(img.width * s + 0.5)), math.max(1, math.floor(img.height * s + 0.5)) - local src = img - img = Yuv.imageScale(src, dw, dh, own:take(dw, dh, "yuv420p"), o.yield) - recycle(src) -- (never seen by the caller) - end - if o.rgba and img.format == "yuv420p" then - local src = img - img = Yuv.imageToRgba(src, own:take(src.width, src.height, "rgba8"), o.yield) or src - recycle(src) - end - local frame = { image = img, pts = t, duration = d, keyframe = key, index = index } - if o.reuse then - lastFrame = frame - end - return frame, nil - end - else - local p = demuxer:read(tid) - if p == nil then - if flushed then - return nil, nil - end - flushed = true - dec:flush() - else - local err = dec:decode(p) - if err then - return nil, err - end - end - end - end - end - function v.seek(self: any, seconds: number) - lastFrame = nil - demuxer:seek(seconds + start) - if codec then - codec:reset() - end - flushed = false - skipUntil = seconds - lastPts = nil - index = -1 -- recomputed from the first frame's time - if self.audio then - pcall(self.audio.seek, self.audio, seconds) - end - end - function v.reset(self: any) - self:seek(0) - skipUntil = -math.huge - index = 0 - end - return v, nil -end - -function Video.fromFrames(images: { Types.Image }, delays: (number | { number })?, opts: any?): (Types.VideoDecoder?, Err.Err?) - if type(images) ~= "table" or #images == 0 or type(images[1]) ~= "table" then - return nil, Err.new(Err.ARG, "fromFrames: needs a list of Images") - end - local w, h = images[1].width, images[1].height - local pts: { number } = {} - local durs: { number } = {} - local t = 0 - for i, img in images do - if type(img) ~= "table" or img.width ~= w or img.height ~= h then - return nil, Err.new(Err.ARG, "fromFrames: frame " .. i .. " is not a " .. w .. "x" .. h .. " Image") - end - local d = if type(delays) == "table" then delays[i] or 0.1 else (delays or 0.1) - if type(d) ~= "number" or d ~= d or d < 0 then - d = 0.1 - end - pts[i] = t - durs[i] = d - t += d - end - local n = #images - local o = opts or {} - local v: any = { - kind = "video", - format = o.format or "frames", - codec = "frames", - width = w, - height = h, - frameRate = if t > 0 then n / t else 10, - frames = n, - duration = t, - loops = o.loops, - meta = o.meta or {}, - toRGBA = toRGBA, - images = images, - } - local i = 0 - function v.nextFrame(self: any): (Types.VideoFrame?, Err.Err?) - i += 1 - if i > n then - i = n - return nil, nil - end - local img = images[i] - if o.rgba then - img = Yuv.imageToRgba(img) or img - end - return { image = img, pts = pts[i], duration = durs[i], keyframe = true, index = i }, nil - end - function v.seek(self: any, seconds: number) - local k = 0 - for j = 1, n do - if pts[j] <= seconds + 1e-9 then - k = j - 1 - end - end - i = k - end - function v.reset(self: any) - i = 0 - end - return v, nil -end - -return Video -end -__FILES["codecs/video/Video/Disposable"] = function() - - --- codecs/video/Video/Disposable: packets whose frame no later frame predicts from (a player may skip decoding them). --- H.264: the first VCL NAL unit has nal_ref_idc 0 (7.4.1: then every slice of the picture has), and no parameter --- set comes before it; one access unit per packet, length-prefixed (avcC lengthSizeMinusOne) or Annex B. --- VP8 (RFC 6386 9.3-9.11, 19.2): an inter frame that refreshes no reference (last / golden / altref, no copies) and --- leaves the segment map; its header may still change decoder state (probabilities, loop filter deltas). -local readu8 = buffer.readu8 - -local Disposable = {} - --- the offset of the first byte after the first start code at or after p, or -1 -local function nextStart(b: buffer, p: number, e: number): number - local i = p - while i + 2 < e do - local b2 = readu8(b, i + 2) - if b2 > 1 then - i += 3 - elseif readu8(b, i + 1) ~= 0 then - i += 2 - elseif b2 == 1 and readu8(b, i) == 0 then - return i + 3 - else - i += 1 - end - end - return -1 -end - --- nal_unit_type 1..5: slices (decided by nal_ref_idc); 7, 8, 13, 15: parameter sets (never dropped) -local function nalVerdict(hdr: number): boolean? - local t = hdr % 32 - if t >= 1 and t <= 5 then - return hdr // 32 % 4 == 0 - elseif t == 7 or t == 8 or t == 13 or t == 15 then - return false - end - return nil -end - -function Disposable.h264(b: buffer, lengthSize: number?): boolean - local n = buffer.len(b) - if lengthSize then - local p = 0 - while p + lengthSize < n do - local len = 0 - for k = 0, lengthSize - 1 do - len = len * 256 + readu8(b, p + k) - end - p += lengthSize - if len > n - p then - return false - end - if len > 0 then - local v = nalVerdict(readu8(b, p)) - if v ~= nil then - return v - end - end - p += len - end - return false - end - if n >= 3 and readu8(b, 0) == 0 and readu8(b, 1) == 0 then - local p = nextStart(b, 0, n) - while p >= 0 and p < n do - local v = nalVerdict(readu8(b, p)) - if v ~= nil then - return v - end - p = nextStart(b, p, n) - end - return false - end - return n > 0 and nalVerdict(readu8(b, 0)) == true -end - --- the boolean decoder of RFC 6386 7.3 (a 2-byte window), enough for the frame header -type Bool = { b: buffer, p: number, e: number, value: number, range: number, count: number } - -local function byteAt(d: Bool): number - local p = d.p - d.p = p + 1 - return if p < d.e then readu8(d.b, p) else 0 -end - -local function boolNew(b: buffer, p: number, e: number): Bool - local d: Bool = { b = b, p = p, e = e, value = 0, range = 255, count = 0 } - d.value = byteAt(d) * 256 + byteAt(d) - return d -end - -local function boolRead(d: Bool, prob: number): number - local split = 1 + (d.range - 1) * prob // 256 - local big = split * 256 - local bit = 0 - if d.value >= big then - bit = 1 - d.range -= split - d.value -= big - else - d.range = split - end - while d.range < 128 do - d.value *= 2 - d.range *= 2 - d.count += 1 - if d.count == 8 then - d.count = 0 - d.value += byteAt(d) - end - end - return bit -end - -local function lit(d: Bool, n: number): number - local v = 0 - for _ = 1, n do - v = v * 2 + boolRead(d, 128) - end - return v -end - --- skips flag ? (n bits + sign) : nothing -local function optSigned(d: Bool, n: number) - if lit(d, 1) == 1 then - lit(d, n + 1) - end -end - --- disposable: no reference refresh or copy and no segment map update; droppable: also no state the decoder keeps --- (refresh_entropy_probs 0, no segment feature or loop filter delta update) -function Disposable.vp8(b: buffer): (boolean, boolean) - local n = buffer.len(b) - if n < 4 then - return false, false - end - local tag = readu8(b, 0) + readu8(b, 1) * 256 + readu8(b, 2) * 65536 - if tag % 2 == 0 then - return false, false -- key frame - end - local first = tag // 32 - if first > n - 3 then - return false, false - end - local d = boolNew(b, 3, 3 + first) - local keep = true - if lit(d, 1) == 1 then -- segmentation_enabled - local updateMap, updateData = lit(d, 1), lit(d, 1) - if updateMap == 1 then - return false, false - end - if updateData == 1 then - keep = false - lit(d, 1) -- segment_feature_mode - for _ = 1, 4 do - optSigned(d, 7) - end - for _ = 1, 4 do - optSigned(d, 6) - end - end - end - lit(d, 1 + 6 + 3) -- filter_type, loop_filter_level, sharpness_level - if lit(d, 1) == 1 and lit(d, 1) == 1 then -- loop_filter_adj_enable, mode_ref_lf_delta_update - keep = false - for _ = 1, 8 do - optSigned(d, 6) - end - end - lit(d, 2 + 7) -- log2_nbr_of_dct_partitions, y_ac_qi - for _ = 1, 5 do - optSigned(d, 4) - end - local refreshGolden, refreshAlt = lit(d, 1), lit(d, 1) - if refreshGolden == 1 or refreshAlt == 1 then - return false, false - end - if lit(d, 2) ~= 0 or lit(d, 2) ~= 0 then -- copy_buffer_to_golden, copy_buffer_to_alternate - return false, false - end - lit(d, 2) -- sign_bias_golden, sign_bias_alternate - local refreshEntropy, refreshLast = lit(d, 1), lit(d, 1) - if refreshLast == 1 or d.p > d.e + 2 then - return false, false - end - return true, keep and refreshEntropy == 0 -end - --- the avcC NAL length size of a track (nil: Annex B or one bare NAL unit per packet) -function Disposable.lengthSize(config: buffer?): number? - if config and buffer.len(config) >= 7 and readu8(config, 0) == 1 then - return readu8(config, 4) % 4 + 1 - end - return nil -end - --- disposable: no later frame predicts from it; droppable: it can also be left out without telling the decoder -function Disposable.check(codec: string?, data: buffer, config: buffer?): (boolean, boolean) - if codec == "h264" then - local v = Disposable.h264(data, Disposable.lengthSize(config)) - return v, v - elseif codec == "vp8" then - return Disposable.vp8(data) - end - return false, false -end - -return Disposable -end -__FILES["codecs/video/Video/Pool"] = function() - - --- codecs/video/Video/Pool: output Images handed back by the caller (decoder:release), reused for later frames. Only --- Images this pool made are taken back; a reused Image gets a fresh meta table. -local Types = __include("Types") - -local Pool = {} -Pool.__index = Pool - -type Pool = typeof(setmetatable({} :: { free: { Types.Image }, made: { [Types.Image]: boolean }, max: number }, Pool)) - -function Pool.new(max: number?): Pool - return setmetatable({ free = {}, made = setmetatable({}, { __mode = "k" }) :: any, max = max or 3 }, Pool) -end - -function Pool.take(self: Pool, w: number, h: number, format: Types.PixelFormat): Types.Image - local free = self.free - for i = #free, 1, -1 do - local img = free[i] - if img.width == w and img.height == h and img.format == format then - table.remove(free, i) - img.meta = {} - return img - end - end - local img = Types.Image.new(w, h, format) - self.made[img] = true - return img -end - --- true when the Image was this pool's (it is kept for reuse, or dropped when the pool is full) -function Pool.give(self: Pool, img: any): boolean - if type(img) ~= "table" or not self.made[img] then - return false - end - local free = self.free - for _, q in free do - if q == img then - return true - end - end - if #free < self.max then - table.insert(free, img) - else - self.made[img] = nil - end - return true -end - -return Pool -end -__FILES["containers/AudioWrap"] = function() - --- containers/AudioWrap: a video container's audio track as a stream an audio format reads (a format never requires --- another). New in rosetta. PCM / WAVEFORMATEX -> WAV, adpcm_swf -> f32 WAV, mp1-3 / ac3 -> frames back to back, --- flac -> fLaC + metadata blocks, opus / vorbis -> Ogg, aac -> ADTS. E-AC-3 is UNSUPPORTED. -local Err = __include("core/Err") -local Bytes = __include("core/Bytes") -local Types = __include("Types") -local Mux = __include("containers/Ogg/Mux") -local Adpcm = __include("codecs/audio/Adpcm") - -local AudioWrap = {} - -type PacketSource = { - count: ((self: any, track: number) -> number)?, - get: ((self: any, track: number, k: number) -> Types.Packet?)?, -} - -local function allPackets(dmx: PacketSource, track: Types.Track): { Types.Packet } - local out: { Types.Packet } = {} - local n = if dmx.count then dmx:count(track.id) else 0 - if n > 0 and dmx.get then - for k = 1, n do - local p = dmx:get(track.id, k) - if p then - table.insert(out, p) - end - end - end - return out -end - -local function concat(packets: { Types.Packet }, prefix: buffer?): buffer - local total = if prefix then buffer.len(prefix) else 0 - for _, p in packets do - total += buffer.len(p.data) - end - local out = buffer.create(total) - local o = 0 - if prefix then - buffer.copy(out, 0, prefix) - o = buffer.len(prefix) - end - for _, p in packets do - buffer.copy(out, o, p.data) - o += buffer.len(p.data) - end - return out -end - -local PCM: { [string]: { number } } = { -- tag, bits, bytes swapped (big-endian source) - pcm_u8 = { 1, 8, 0 }, - pcm_s8 = { 1, 8, 0 }, - pcm_s16le = { 1, 16, 0 }, - pcm_s24le = { 1, 24, 0 }, - pcm_s32le = { 1, 32, 0 }, - pcm_s16be = { 1, 16, 1 }, - pcm_s24be = { 1, 24, 1 }, - pcm_s32be = { 1, 32, 1 }, - pcm_f32le = { 3, 32, 0 }, - pcm_f64le = { 3, 64, 0 }, - pcm_f32be = { 3, 32, 1 }, - pcm_f64be = { 3, 64, 1 }, - pcm_alaw = { 6, 8, 0 }, - pcm_mulaw = { 7, 8, 0 }, -} - -local function wav(fmt: buffer, data: buffer): buffer - local w = Bytes.writer(buffer.len(data) + buffer.len(fmt) + 64) - local fl = buffer.len(fmt) - local dl = buffer.len(data) - w:string("RIFF") - w:u32le(4 + 8 + fl + (fl % 2) + 8 + dl + (dl % 2)) - w:string("WAVE") - w:string("fmt ") - w:u32le(fl) - w:bytes(fmt) - if fl % 2 == 1 then - w:u8(0) - end - w:string("data") - w:u32le(dl) - w:bytes(data) - if dl % 2 == 1 then - w:u8(0) - end - return w:finish() -end - -local function pcmWav(track: Types.Track, packets: { Types.Packet }): (buffer?, Err.Err?) - local spec = PCM[track.codec] - local ch = track.channels or 1 - local rate = math.floor((track.sampleRate or 0) + 0.5) - if ch < 1 or rate <= 0 then - return nil, Err.new(Err.CORRUPT, "PCM track without channels / sample rate") - end - local bits = spec[2] - local data = concat(packets) - if spec[3] == 1 then - local bps = bits // 8 - for i = 0, buffer.len(data) - bps, bps do - for k = 0, bps // 2 - 1 do - local a, b = buffer.readu8(data, i + k), buffer.readu8(data, i + bps - 1 - k) - buffer.writeu8(data, i + k, b) - buffer.writeu8(data, i + bps - 1 - k, a) - end - end - end - if track.codec == "pcm_s8" then - for i = 0, buffer.len(data) - 1 do - buffer.writeu8(data, i, (buffer.readu8(data, i) + 128) % 256) - end - end - local f = Bytes.writer(16) - local align = ch * bits // 8 - f:u16le(spec[1]) - f:u16le(ch) - f:u32le(rate) - f:u32le(rate * align) - f:u16le(align) - f:u16le(bits) - return wav(f:finish(), data), nil -end - --- Flash ADPCM packets decode on their own (each starts with its code size and block headers): f32 samples in a WAV -local function swfWav(track: Types.Track, packets: { Types.Packet }): (buffer?, Err.Err?) - local ch = track.channels or 1 - local rate = math.floor((track.sampleRate or 0) + 0.5) - if ch < 1 or ch > 2 or rate <= 0 then - return nil, Err.new(Err.CORRUPT, "Flash ADPCM track without channels / sample rate") - end - local frames = 0 - for _, pk in packets do - frames += Adpcm.swfFrames(pk.data, 0, buffer.len(pk.data), ch) - end - local data = buffer.create(frames * ch * 4) - local d = 0 - for _, pk in packets do - d += Adpcm.swf(pk.data, 0, buffer.len(pk.data), ch, data, d) * ch - end - local f = Bytes.writer(16) - f:u16le(3) - f:u16le(ch) - f:u32le(rate) - f:u32le(rate * ch * 4) - f:u16le(ch * 4) - f:u16le(32) - return wav(f:finish(), data), nil -end - --- the number of 48 kHz samples in an Opus packet (RFC 6716 section 3.1) -local function opusSamples(b: buffer): number - local n = buffer.len(b) - if n < 1 then - return 0 - end - local toc = buffer.readu8(b, 0) - local config = toc // 8 - local fs: number - if config < 12 then - fs = ({ 480, 960, 1920, 2880 })[config % 4 + 1] - elseif config < 16 then - fs = if config % 2 == 0 then 480 else 960 - else - fs = ({ 120, 240, 480, 960 })[config % 4 + 1] - end - local c = toc % 4 - local frames = if c == 0 then 1 elseif c == 3 then (if n >= 2 then buffer.readu8(b, 1) % 64 else 0) else 2 - return fs * frames -end - -local function opusHead(track: Types.Track): buffer - local c = track.config - if c and buffer.len(c) >= 19 and buffer.readstring(c, 0, 8) == "OpusHead" then - return c - end - local w = Bytes.writer(19) - w:string("OpusHead") - w:u8(1) - w:u8(math.clamp(track.channels or 2, 1, 2)) - w:u16le(math.floor((track.codecDelay or 0) * 48000 + 0.5)) - w:u32le(math.floor(track.sampleRate or 48000)) - w:u16le(0) - w:u8(0) - return w:finish() -end - -local function opusTags(): buffer - local w = Bytes.writer(32) - w:string("OpusTags") - local vendor = "rosetta" - w:u32le(#vendor) - w:string(vendor) - w:u32le(0) - return w:finish() -end - -local function ogg(headers: { buffer }, packets: { Types.Packet }, granuleOf: (p: Types.Packet, i: number) -> number): buffer - local mux = Mux.new({ pageSize = 4096 }) - local s = mux:stream(1) - for i, h in headers do - s:packet(h, 0, { flush = i == 1 or i == #headers }) - end - for i, p in packets do - s:packet(p.data, granuleOf(p, i), { eos = i == #packets }) - end - return mux:finish() -end - --- Matroska's Vorbis CodecPrivate: Xiph-laced headers (count - 1, sizes, data) -local function xiphHeaders(c: buffer): { buffer }? - local n = buffer.len(c) - if n < 3 then - return nil - end - local count = buffer.readu8(c, 0) + 1 - local p = 1 - local sizes = {} - local total = 0 - for k = 1, count - 1 do - local s = 0 - while true do - if p >= n then - return nil - end - local b = buffer.readu8(c, p) - p += 1 - s += b - if b ~= 255 then - break - end - end - sizes[k] = s - total += s - end - sizes[count] = n - p - total - if sizes[count] < 0 then - return nil - end - local out = {} - for k = 1, count do - local b = buffer.create(sizes[k]) - buffer.copy(b, 0, c, p, sizes[k]) - p += sizes[k] - out[k] = b - end - return out -end - --- Vorbis packet sizes: the block sizes from the identification header and each mode's block flag from the end of the --- setup header (read backwards from its framing bit: mode entries are 41 bits whose window / transform types are 0, --- preceded by the 6-bit mode count), so the Ogg granules are exact: a packet yields (previous + current block) / 4 --- samples (the first one as if its previous block had its own size, as ffmpeg times it). -local function bit(b: buffer, k: number): number - return bit32.extract(buffer.readu8(b, k // 8), k % 8, 1) -end -local function bits(b: buffer, k: number, n: number): number - local v = 0 - for i = n - 1, 0, -1 do - v = v * 2 + bit(b, k + i) - end - return v -end - -local function vorbisModes(id: buffer, setup: buffer): ({ number }?, { boolean }?) - if buffer.len(id) < 30 or buffer.len(setup) < 8 then - return nil, nil - end - local bs = buffer.readu8(id, 28) - local sizes = { 2 ^ (bs % 16), 2 ^ (bs // 16) } - -- the framing bit: the highest set bit of the last non-zero byte - local last = buffer.len(setup) - 1 - while last > 0 and buffer.readu8(setup, last) == 0 do - last -= 1 - end - local v = buffer.readu8(setup, last) - local hb = 7 - while hb > 0 and bit32.extract(v, hb, 1) == 0 do - hb -= 1 - end - local f = last * 8 + hb - local flags: { boolean } = {} - local pos = f - while #flags < 64 and pos - 41 >= 7 * 8 do - local s0 = pos - 41 - if bits(setup, s0 + 1, 16) ~= 0 or bits(setup, s0 + 17, 16) ~= 0 then - break - end - table.insert(flags, 1, bit(setup, s0) == 1) - pos = s0 - end - -- the largest count whose 6-bit field matches - for n = #flags, 1, -1 do - local start = f - 41 * n - if start - 6 >= 0 and bits(setup, start - 6, 6) == n - 1 then - local out = {} - for i = #flags - n + 1, #flags do - table.insert(out, flags[i]) - end - return sizes, out - end - end - return nil, nil -end - -local function adts(track: Types.Track, packets: { Types.Packet }): (buffer?, Err.Err?) - local c = track.config - local profile, rateIndex, chanConfig - if c and buffer.len(c) >= 2 then - local b0, b1 = buffer.readu8(c, 0), buffer.readu8(c, 1) - profile = b0 // 8 -- audio object type - rateIndex = (b0 % 8) * 2 + b1 // 128 - chanConfig = (b1 // 8) % 16 - -- HE-AAC (5) / HE-AACv2 (29), 14496-3 1.6.2.1: ADTS carries the AAC-LC core (the decoder finds SBR / PS in it) - if (profile == 5 or profile == 29) and rateIndex ~= 15 and buffer.len(c) >= 4 then - local v = buffer.readu8(c, 1) * 65536 + buffer.readu8(c, 2) * 256 + buffer.readu8(c, 3) - local extIndex = (v // 2 ^ 15) % 16 -- after aot (5), sfi (4), channels (4): bits 13 .. 16 - local core = if extIndex == 15 then -1 else (v // 2 ^ 10) % 32 -- bits 17 .. 21 - profile = if core == 2 then 2 else -1 - end - else - local rates = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 } - profile = 2 - rateIndex = 4 - for i, r in rates do - if r == math.floor((track.sampleRate or 44100) + 0.5) then - rateIndex = i - 1 - end - end - chanConfig = track.channels or 2 - end - if profile < 1 or profile > 4 or rateIndex > 12 then - return nil, Err.new(Err.UNSUPPORTED, "AAC object type " .. tostring(profile) .. " in ADTS") - end - local w = Bytes.writer(64) - for _, p in packets do - local len = buffer.len(p.data) + 7 - w:u8(0xFF) - w:u8(0xF1) - w:u8((profile - 1) * 64 + rateIndex * 4 + chanConfig // 4) - w:u8((chanConfig % 4) * 64 + (len // 2048) % 4) - w:u8((len // 8) % 256) - w:u8((len % 8) * 32 + 0x1F) - w:u8(0xFC) - w:bytes(p.data) - end - return w:finish(), nil -end - --- trim: a container's codec delay (Matroska CodecDelay, an MP4 edit's media time for MP2 / MP3 / AAC, as ffmpeg) --- and end padding -function AudioWrap.trim(dec: any, skip: number, length: number?): any - if skip <= 0 and length == nil then - return dec - end - skip = math.max(0, skip) - local rate = dec.sampleRate - local w: any = setmetatable({}, { __index = dec }) - w.frames = math.max(0, (dec.frames or 0) - skip) - if length then - w.frames = if (dec.frames or 0) > 0 then math.min(w.frames, length) else length - end - w.duration = w.frames / rate - local cap = length or math.huge - local delivered = 0 - local function drop() - local left = skip - while left > 0 do - local _, n = dec:read(math.min(left, 4096)) - if not n or n <= 0 then - break - end - left -= n - end - end - local started = false - function w.read(_: any, n: number, out: buffer?): (buffer, number) - if not started then - started = true - drop() - end - local want = math.min(n, cap - delivered) - if want <= 0 then - return out or buffer.create(0), 0 - end - local b, got = dec:read(want, out) - delivered += got - return b, got - end - function w.seek(_: any, seconds: number) - started = true - if seconds <= 0 then - dec:seek(0) - drop() - delivered = 0 - else - dec:seek(seconds + skip / rate) - delivered = math.floor(seconds * rate + 0.5) - end - end - function w.position(_: any): number - return math.max(0, dec:position() - skip / rate) - end - return w -end - -function AudioWrap.wrap(dmx: any, track: Types.Track): (buffer?, string?, Err.Err?) - if type(track) ~= "table" or track.kind ~= "audio" then - return nil, nil, Err.new(Err.ARG, "not an audio track") - end - if track.unsupported then - return nil, nil, Err.new(Err.UNSUPPORTED, track.unsupported) - end - local codec = track.codec - local packets = allPackets(dmx, track) - if #packets == 0 then - return nil, nil, Err.new(Err.CORRUPT, "audio track without packets") - end - if track.waveFormat and string.sub(codec, 1, 6) == "adpcm_" then - return wav(track.waveFormat, concat(packets)), "wav", nil - end - if codec == "adpcm_swf" then - local b, err = swfWav(track, packets) - return b, if b then "wav" else nil, err - end - if PCM[codec] then - local b, err = pcmWav(track, packets) - return b, if b then "wav" else nil, err - end - if codec == "mp3" or codec == "mp2" or codec == "mp1" then - return concat(packets), "mp3", nil - end - if codec == "ac3" then - return concat(packets), "ac3", nil - end - if codec == "flac" then - local c = track.config - local prefix: buffer? = nil - if c and buffer.len(c) >= 4 and buffer.readstring(c, 0, 4) == "fLaC" then - prefix = c - elseif c and buffer.len(c) >= 34 then - -- metadata blocks without the marker (MP4 dfLa payload after version / flags) - local start = if buffer.len(c) >= 38 and buffer.readu8(c, 0) == 0 and buffer.readu8(c, 4) % 128 == 0 then 4 else 0 - local b = buffer.create(4 + buffer.len(c) - start) - buffer.writestring(b, 0, "fLaC") - buffer.copy(b, 4, c, start) - prefix = b - else - return nil, nil, Err.new(Err.CORRUPT, "FLAC track without its STREAMINFO") - end - return concat(packets, prefix), "flac", nil - end - if codec == "opus" then - local head = opusHead(track) - local pre = buffer.readu16(head, 10) - local g = pre - local out = ogg({ head, opusTags() }, packets, function(p: Types.Packet): number - g += opusSamples(p.data) - local d = (p :: any).discardPadding - if type(d) == "number" and d > 0 then - return g - math.floor(d * 48000 + 0.5) -- the end trimming (WebM DiscardPadding) - end - return g - end) - return out, "opus", nil - end - if codec == "vorbis" then - local c = track.config - local headers = c and xiphHeaders(c) - if not headers or #headers ~= 3 then - return nil, nil, Err.new(Err.CORRUPT, "Vorbis track without its three headers") - end - local sizes, modes = vorbisModes(headers[1], headers[3]) - local granule, prev = 0, nil :: number? - local rate = track.sampleRate or 44100 - local scale = track.timescale - local out = ogg(headers, packets, function(p: Types.Packet): number - if not sizes or not modes then - return math.floor((p.pts + (p.duration or 0)) / scale * rate + 0.5) -- from the container's times - end - local d = p.data - if buffer.len(d) == 0 or buffer.readu8(d, 0) % 2 ~= 0 then - return granule - end - local mb = 0 - while 2 ^ mb < #(modes :: { boolean }) do - mb += 1 - end - local m = if mb > 0 and buffer.len(d) * 8 > mb then bits(d, 1, mb) else 0 - local cur = sizes[if (modes :: { boolean })[m + 1] then 2 else 1] - if prev then - granule += (prev + cur) // 4 - end - prev = cur - return granule - end) - return out, "vorbis", nil - end - if codec == "aac" then - if track.adts then - return concat(packets), "aac", nil -- already ADTS (MPEG-TS) - end - local b, err = adts(track, packets) - return b, if b then "aac" else nil, err - end - return nil, nil, Err.new(Err.UNSUPPORTED, "no audio format for codec " .. tostring(codec)) -end - -return AudioWrap -end -__FILES["containers/Ogg/Mux"] = @native function() - - - --- containers/Ogg/Mux: the Ogg page writer (RFC 3533), for Ogg Opus / Vorbis / FLAC output. New in rosetta. --- Packets are laced into pages per logical stream; a page is closed when it reaches opts.pageSize bytes of data (or --- 255 lacing values), when a packet asks for flush, and at the end (eos). The page granule is the granule of the last --- packet that finishes on it (-1 when none does). Pages go to the output in the order they close, so the bos pages --- of a multiplexed file come first when every stream's first packet is written (with flush) before any other. --- Never throws: a bad argument returns false, Err. -local Err = __include("core/Err") -local Crc32 = __include("core/Crc32") - -local writeu8, writeu32, writei32 = buffer.writeu8, buffer.writeu32, buffer.writei32 - -local Mux = {} -Mux.__index = Mux -local Stream = {} -Stream.__index = Stream - -type Options = { - pageSize: number?, -- close a page once its data reaches this many bytes (default 4096; at most 255 * 255) -} -type PacketOptions = { - flush: boolean?, -- close the page after this packet (headers; default false) - eos: boolean?, -- this is the stream's last packet (default false: finish() writes an empty eos page if needed) -} - -@native function Mux.new(opts: Options?): any - local size = opts and opts.pageSize or 4096 - if type(size) ~= "number" or size < 1 then - size = 4096 - end - return setmetatable({ - pageSize = math.min(size, 255 * 255), - chunks = {} :: { buffer }, - total = 0, - streams = {} :: { any }, - nextSerial = 1, - }, Mux) -end - -@native function Mux.stream(self: any, serial: number?): any - local sr = serial or self.nextSerial - self.nextSerial = math.max(self.nextSerial, sr + 1) - local s = setmetatable({ - mux = self, - serial = sr % 4294967296, - seq = 0, - lacing = {} :: { number }, - parts = {} :: { any }, -- buffer, offset, length triples of the page data - dataLen = 0, - granule = -1, - continued = false, -- the page being built starts with the tail of a packet - first = true, - ended = false, - lastGranule = -1, - }, Stream) - table.insert(self.streams, s) - return s -end - --- the CRC of a page (the crc field written as zero) -@native local function crc(b: buffer, n: number): number - return Crc32.msb(b, 0, n, 0) -end - -@native function Stream._flush(self: any, eos: boolean) - local nseg = #self.lacing - local n = 27 + nseg + self.dataLen - local b = buffer.create(n) - buffer.writestring(b, 0, "OggS") - local flags = (if self.continued then 1 else 0) + (if self.first then 2 else 0) + (if eos then 4 else 0) - writeu8(b, 5, flags) - local g = self.granule - if g < 0 then - writeu32(b, 6, 0xFFFFFFFF) - writei32(b, 10, -1) - else - writeu32(b, 6, g % 4294967296) - writeu32(b, 10, (g // 4294967296) % 4294967296) - end - writeu32(b, 14, self.serial) - writeu32(b, 18, self.seq % 4294967296) - writeu8(b, 26, nseg) - for i = 1, nseg do - writeu8(b, 26 + i, self.lacing[i]) - end - local o = 27 + nseg - local parts = self.parts - for i = 1, #parts, 3 do - buffer.copy(b, o, parts[i], parts[i + 1], parts[i + 2]) - o += parts[i + 2] - end - writeu32(b, 22, crc(b, n)) - local m = self.mux - table.insert(m.chunks, b) - m.total += n - self.seq += 1 - self.first = false - self.lacing, self.parts, self.dataLen, self.granule = {}, {}, 0, -1 - self.continued = false - if eos then - self.ended = true - end -end - -@native function Stream.packet(self: any, data: any, granule: number, opts: PacketOptions?, offset: number?, length: number?): (boolean, Err.Err?) - if self.ended then - return false, Err.new(Err.ARG, "packet after the end of stream " .. self.serial) - end - local b: buffer - if type(data) == "string" then - b = buffer.fromstring(data) - elseif type(data) == "buffer" then - b = data - else - return false, Err.new(Err.ARG, "packet: data must be a buffer or a string") - end - if type(granule) ~= "number" then - return false, Err.new(Err.ARG, "packet: granule must be a number") - end - local off = offset or 0 - local len = length or (buffer.len(b) - off) - if off < 0 or len < 0 or off + len > buffer.len(b) then - return false, Err.new(Err.ARG, "packet: range outside the buffer") - end - local pageSize = self.mux.pageSize - local left = len - local pos = off - -- lacing: 255-byte segments then one < 255 (0 when the size is a multiple of 255) - while true do - if #self.lacing == 255 or (self.dataLen >= pageSize and #self.lacing > 0) then - self:_flush(false) - self.continued = pos > off -- the next page starts inside this packet - end - local seg = math.min(left, 255) - table.insert(self.lacing, seg) - if seg > 0 then - table.insert(self.parts, b) - table.insert(self.parts, pos) - table.insert(self.parts, seg) - end - self.dataLen += seg - pos += seg - left -= seg - if seg < 255 then - break - end - end - if granule >= 0 then -- -1 (unknown) keeps the granule of an earlier packet finishing on this page - self.granule = granule - self.lastGranule = granule - end - local eos = opts and opts.eos or false - if eos then - self:_flush(true) - elseif (opts and opts.flush) or self.dataLen >= pageSize or #self.lacing == 255 then - self:_flush(false) - end - return true, nil -end - -@native function Stream.flush(self: any) - if not self.ended and #self.lacing > 0 then - self:_flush(false) - end -end - -@native function Mux.finish(self: any): buffer - for _, s in self.streams do - if not s.ended then - if #s.lacing == 0 then - s.granule = s.lastGranule - end - s:_flush(true) - end - end - local out = buffer.create(self.total) - local o = 0 - for _, c in self.chunks do - buffer.copy(out, o, c, 0, buffer.len(c)) - o += buffer.len(c) - end - return out -end - -return Mux -end -end - - - - - - Core_2 - --!optimize 2 ---!nocheck --- rosetta chunk Core_2 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 7 modules (3 native: @native); the Rosetta root requires it when one of them is first included. --- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). -return function(__FILES, __include) __FILES["core/Bytes"] = @native function() @@ -8768,157 +5882,6 @@ end return Bytes end -__FILES["core/Crc32"] = @native function() - - --- core/Crc32: CRC-32 (IEEE 802.3, the zlib / gzip / zip / PNG polynomial 0xEDB88320, reflected), slice-by-8. --- Absorbed from deflate-luau src/Deflate/Checksum.luau (same author; no third-party code). Never throws. -local band, bxor, rshift, lshift, byteswap = bit32.band, bit32.bxor, bit32.rshift, bit32.lshift, bit32.byteswap -local readu8, readu32 = buffer.readu8, buffer.readu32 - -local T0, T1, T2, T3 = table.create(256, 0), table.create(256, 0), table.create(256, 0), table.create(256, 0) -local T4, T5, T6, T7 = table.create(256, 0), table.create(256, 0), table.create(256, 0), table.create(256, 0) -for n = 0, 255 do - local c = n - for _ = 1, 8 do - if band(c, 1) ~= 0 then - c = bxor(0xEDB88320, rshift(c, 1)) - else - c = rshift(c, 1) - end - end - T0[n + 1] = c -end -for n = 0, 255 do - local c = T0[n + 1] - c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) - T1[n + 1] = c - c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) - T2[n + 1] = c - c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) - T3[n + 1] = c - c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) - T4[n + 1] = c - c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) - T5[n + 1] = c - c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) - T6[n + 1] = c - c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) - T7[n + 1] = c -end - -@native local function crc32(buf: buffer, off: number, len: number, crc: number?): number - local c = bxor(crc or 0, 0xFFFFFFFF) - local i, e = off, off + len - local e8 = e - 8 - while i <= e8 do - c = bxor(c, readu32(buf, i)) - local d = readu32(buf, i + 4) - c = bxor( - T7[band(c, 255) + 1], - T6[band(rshift(c, 8), 255) + 1], - T5[band(rshift(c, 16), 255) + 1], - T4[rshift(c, 24) + 1], - T3[band(d, 255) + 1], - T2[band(rshift(d, 8), 255) + 1], - T1[band(rshift(d, 16), 255) + 1], - T0[rshift(d, 24) + 1] - ) - i += 8 - end - local e4 = e - 4 - while i <= e4 do - c = bxor(c, readu32(buf, i)) - c = bxor(T3[band(c, 255) + 1], T2[band(rshift(c, 8), 255) + 1], T1[band(rshift(c, 16), 255) + 1], T0[rshift(c, 24) + 1]) - i += 4 - end - while i < e do - c = bxor(T0[band(bxor(c, readu8(buf, i)), 255) + 1], rshift(c, 8)) - i += 1 - end - return bxor(c, 0xFFFFFFFF) -end - -@native local function range(buf: buffer, offset: number?, length: number?): (number, number) - local n = buffer.len(buf) - local o = math.clamp(offset or 0, 0, n) - return o, math.clamp(length or (n - o), 0, n - o) -end - -local Crc32 = {} - -@native function Crc32.of(buf: buffer, offset: number?, length: number?, crc: number?): number - local o, l = range(buf, offset, length) - return crc32(buf, o, l, crc) -end - -@native function Crc32.string(s: string, crc: number?): number - return crc32(buffer.fromstring(s), 0, #s, crc) -end - -Crc32.raw = crc32 - --- MSB-first CRC-32 (polynomial 0x04C11DB7, not reflected, raw register, no inversions): Ogg pages (init 0), --- MPEG-2 PSI sections and bzip2 blocks (init 0xFFFFFFFF) -local MSB = table.create(256, 0) -for n = 0, 255 do - local c = lshift(n, 24) - for _ = 1, 8 do - c = if band(c, 0x80000000) ~= 0 then bxor(lshift(c, 1), 0x04C11DB7) else lshift(c, 1) - end - MSB[n + 1] = c -end -Crc32.MSB_TABLE = MSB - --- slice-by-8 for the MSB-first CRC: M[k][n] = the CRC register after byte n and k zero bytes -local M1, M2, M3 = table.create(256, 0), table.create(256, 0), table.create(256, 0) -local M4, M5, M6, M7 = table.create(256, 0), table.create(256, 0), table.create(256, 0), table.create(256, 0) -for n = 0, 255 do - local c = MSB[n + 1] - c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) - M1[n + 1] = c - c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) - M2[n + 1] = c - c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) - M3[n + 1] = c - c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) - M4[n + 1] = c - c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) - M5[n + 1] = c - c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) - M6[n + 1] = c - c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) - M7[n + 1] = c -end - -@native function Crc32.msb(buf: buffer, off: number, len: number, init: number?): number - local c = init or 0 - local i, e = off, off + len - local e8 = e - 8 - while i <= e8 do - c = bxor(c, byteswap(readu32(buf, i))) - local d = byteswap(readu32(buf, i + 4)) - c = bxor( - M7[rshift(c, 24) + 1], - M6[band(rshift(c, 16), 255) + 1], - M5[band(rshift(c, 8), 255) + 1], - M4[band(c, 255) + 1], - M3[rshift(d, 24) + 1], - M2[band(rshift(d, 16), 255) + 1], - M1[band(rshift(d, 8), 255) + 1], - MSB[band(d, 255) + 1] - ) - i += 8 - end - while i < e do - c = bxor(lshift(c, 8), MSB[bxor(rshift(c, 24), readu8(buf, i)) + 1]) - i += 1 - end - return c -end - -return Crc32 -end __FILES["core/Err"] = function() -- core/Err: the error values every decoder / encoder returns (`nil, err`; nothing in the library throws on bad data). @@ -9122,1299 +6085,11 @@ end local _ = Err return host end -__FILES["ops/ImageOps"] = function() - --- ops/ImageOps: editing on the standard Image: conversion, crop, resize, flips, rotation, compositing, pixel access, --- animation helpers. New code; the resampling and compositing follow Pillow's C sources. --- Conventions: angles are degrees counter-clockwise and rotate90 turns are counter-clockwise quarter turns (as --- Pillow). Resizing and rotating filter premultiplied alpha (as Pillow does for RGBA / LA). Grey is Pillow's --- L = (19595 R + 38470 G + 7471 B + 32768) >> 16. 8 <-> 16 bit is * 257 and --- (v * 255 + 32767) // 65535; float <-> integer clamps to 0..1 and rounds (no gamma). alpha8 converts to white with --- that alpha. yuv420p is JPEG-style BT.601 full range (2x2 box chroma); geometric ops on yuv420p go through rgba8. -local Err = __include("core/Err") -local Types = __include("Types") -local K = __include("ops/ImageOps/Kernels") - -local ImageOps = {} - -local MAX_PIXELS = 2 ^ 26 - -type Image = Types.Image - -local function arg(msg: string): (nil, Err.Err) - return nil, Err.new(Err.ARG, msg) -end - -local function isInt(v: any): boolean - return type(v) == "number" and v == v and v % 1 == 0 and v > -2 ^ 31 and v < 2 ^ 31 -end - -local function bytesOf(fmt: string, w: number, h: number): number? - if fmt == "yuv420p" then - return w * h + 2 * ((w + 1) // 2) * ((h + 1) // 2) - end - local bpp = Types.BPP[fmt] - return if bpp then w * h * bpp else nil -end - -local function check(img: any): (boolean?, Err.Err?) - if type(img) ~= "table" or type(img.pixels) ~= "buffer" then - return arg("expected an Image") - end - if not isInt(img.width) or not isInt(img.height) or img.width < 1 or img.height < 1 then - return arg("bad image size") - end - local need = bytesOf(img.format, img.width, img.height) - if not need then - return arg("unknown pixel format " .. tostring(img.format)) - end - if buffer.len(img.pixels) < need then - return arg("pixel buffer too small for " .. img.width .. " x " .. img.height .. " " .. img.format) - end - return true, nil -end -ImageOps.check = check - -local function limit(w: number, h: number, opts: any): (boolean?, Err.Err?) - local max: number = (type(opts) == "table" and opts.maxPixels) or MAX_PIXELS - if w * h > max then - return nil, Err.new(Err.LIMIT, string.format("%d x %d is over the %d pixel limit", w, h, max)) - end - return true, nil -end - -local function like(img: Image, w: number, h: number, fmt: string?): Image - local out = Types.Image.new(w, h, (fmt or img.format) :: any) - for k, v in img.meta do - out.meta[k] = v - end - out.loops = img.loops - return out -end - -function ImageOps.new(w: number, h: number, format: string?): (Image?, Err.Err?) - local fmt = format or "rgba8" - if not isInt(w) or not isInt(h) or w < 1 or h < 1 then - return arg("bad image size") - end - if not bytesOf(fmt, 1, 1) then - return arg("unknown pixel format " .. tostring(fmt)) - end - local ok, e = limit(w, h, nil) - if not ok then - return nil, e - end - return Types.Image.new(w, h, fmt :: any), nil -end - -function ImageOps.copy(img: Image): (Image?, Err.Err?) - local ok, e = check(img) - if not ok then - return nil, e - end - local out = like(img, img.width, img.height) - buffer.copy(out.pixels, 0, img.pixels, 0, buffer.len(out.pixels)) - out.frames = img.frames - return out, nil -end - -function ImageOps.convert(img: Image, format: string): (Image?, Err.Err?) - local ok, e = check(img) - if not ok then - return nil, e - end - if not bytesOf(format, 1, 1) then - return arg("unknown pixel format " .. tostring(format)) - end - local w, h = img.width, img.height - if img.format == format then - return ImageOps.copy(img) - end - local src = img - if img.format == "yuv420p" then - local rgba = like(img, w, h, "rgba8") - K.yuvToRgba(img.pixels, w, h, rgba.pixels) - if format == "rgba8" then - return rgba, nil - end - src = rgba - end - local out = like(img, w, h, format) - if format == "yuv420p" then - local rgba = src - if src.format ~= "rgba8" then - rgba = like(img, w, h, "rgba8") - K.convert(src.pixels, K.ID[src.format], rgba.pixels, K.ID.rgba8, w * h) - end - K.rgbaToYuv(rgba.pixels, w, h, out.pixels) - return out, nil - end - K.convert(src.pixels, K.ID[src.format], out.pixels, K.ID[format], w * h) - return out, nil -end - --- ops on yuv420p run on rgba8 and convert back -local function viaRgba(img: Image, f: (Image) -> (Image?, Err.Err?)): (Image?, Err.Err?) - if img.format ~= "yuv420p" then - return f(img) - end - local rgba = ImageOps.convert(img, "rgba8") :: Image - local res, e = f(rgba) - if not res then - return nil, e - end - return ImageOps.convert(res, "yuv420p") -end - -local ALPHA_CH: { [string]: number } = { rgba8 = 4, rgba16 = 4, rgbaf32 = 4, graya8 = 2 } - -function ImageOps.crop(img: Image, x: number, y: number, w: number, h: number): (Image?, Err.Err?) - local ok, e = check(img) - if not ok then - return nil, e - end - if not (isInt(x) and isInt(y) and isInt(w) and isInt(h)) then - return arg("crop: integer x, y, w, h") - end - local x0, y0 = math.max(0, x), math.max(0, y) - local x1, y1 = math.min(img.width, x + w), math.min(img.height, y + h) - if x1 <= x0 or y1 <= y0 then - return arg("crop: the rectangle is outside the image or empty") - end - return viaRgba(img, function(im: Image): (Image?, Err.Err?) - local bpp = Types.BPP[im.format] :: number - local out = like(im, x1 - x0, y1 - y0) - K.copyRect(out.pixels, out.width, im.pixels, im.width, x0, y0, 0, 0, out.width, out.height, bpp) - return out, nil - end) -end - -function ImageOps.flip(img: Image, axis: string): (Image?, Err.Err?) - local ok, e = check(img) - if not ok then - return nil, e - end - if axis ~= "h" and axis ~= "v" then - return arg("flip: axis must be \"h\" or \"v\"") - end - return viaRgba(img, function(im: Image): (Image?, Err.Err?) - local out = like(im, im.width, im.height) - K.flip(im.pixels, out.pixels, im.width, im.height, Types.BPP[im.format] :: number, axis == "h") - return out, nil - end) -end - -function ImageOps.rotate90(img: Image, turns: number): (Image?, Err.Err?) - local ok, e = check(img) - if not ok then - return nil, e - end - if not isInt(turns) then - return arg("rotate90: integer turns") - end - local t = turns % 4 - if t == 0 then - return ImageOps.copy(img) - end - return viaRgba(img, function(im: Image): (Image?, Err.Err?) - local swap = t ~= 2 - local out = like(im, if swap then im.height else im.width, if swap then im.width else im.height) - K.rotate90(im.pixels, out.pixels, im.width, im.height, Types.BPP[im.format] :: number, t) - return out, nil - end) -end - -type ResizeFilter = "nearest" | "bilinear" | "lanczos" - -function ImageOps.resize(img: Image, w: number, h: number, filter: string?, opts: any?): (Image?, Err.Err?) - local ok, e = check(img) - if not ok then - return nil, e - end - if not isInt(w) or not isInt(h) or w < 1 or h < 1 then - return arg("resize: bad target size") - end - local f = filter or "bilinear" - if f ~= "nearest" and f ~= "bilinear" and f ~= "lanczos" then - return arg("resize: filter must be nearest, bilinear or lanczos") - end - local lok, le = limit(w, h, opts) - if not lok then - return nil, le - end - return viaRgba(img, function(im: Image): (Image?, Err.Err?) - local fmt = im.format - local bpp = Types.BPP[fmt] :: number - local out = like(im, w, h) - if f == "nearest" then - K.nearest(im.pixels, im.width, im.height, bpp, out.pixels, w, h) - return out, nil - end - local kind, ch = K.KIND[fmt], K.CHANNELS[fmt] - local src, sw, sh = im.pixels, im.width, im.height - local alpha = ALPHA_CH[fmt] - local unAlpha = alpha - if alpha == 4 and kind == 1 and K.opaque(src, sw * sh) then - alpha = nil -- premultiplying is the identity; the resampled alpha can still round to 254: unpremultiplied below - end - if alpha then - src = buffer.create(buffer.len(im.pixels)) - buffer.copy(src, 0, im.pixels) - K.premultiply(src, sw * sh, alpha, kind, false) - end - if w ~= sw then - local tmp = buffer.create(w * sh * bpp) - K.resamplePass(src, sw, sh, ch, kind, tmp, w, K.coeffs(sw, w, f), true) - src, sw = tmp, w - end - if h ~= sh then - K.resamplePass(src, sw, sh, ch, kind, out.pixels, h, K.coeffs(sh, h, f), false) - elseif src == im.pixels or (w == im.width and alpha) then - buffer.copy(out.pixels, 0, im.pixels, 0, w * h * bpp) - return out, nil - else - out.pixels = src - end - if unAlpha then - K.premultiply(out.pixels, w * h, unAlpha, kind, true) - end - return out, nil - end) -end - -function ImageOps.rotate(img: Image, degrees: number, opts: { expand: boolean?, maxPixels: number? }?): (Image?, Err.Err?) - local ok, e = check(img) - if not ok then - return nil, e - end - if type(degrees) ~= "number" or degrees ~= degrees or degrees == math.huge or degrees == -math.huge then - return arg("rotate: degrees must be a finite number") - end - local expand = not (opts and opts.expand == false) - if degrees % 90 == 0 and (expand or degrees % 180 == 0 or img.width == img.height) then - return ImageOps.rotate90(img, (degrees // 90) % 4) - end - local w, h = img.width, img.height - local ang = -math.rad(degrees) - local function r15(v: number): number - return math.floor(v * 1e15 + 0.5) / 1e15 - end - local m = { r15(math.cos(ang)), r15(math.sin(ang)), 0, r15(-math.sin(ang)), r15(math.cos(ang)), 0 } - local function tr(x: number, y: number): (number, number) - return m[1] * x + m[2] * y + m[3], m[4] * x + m[5] * y + m[6] - end - local cx, cy = w / 2, h / 2 - m[3], m[6] = tr(-cx, -cy) - m[3] += cx - m[6] += cy - local nw, nh = w, h - if expand then - local xs, ys = {}, {} - for _, p in { { 0, 0 }, { w, 0 }, { w, h }, { 0, h } } do - local x, y = tr(p[1], p[2]) - table.insert(xs, x) - table.insert(ys, y) - end - nw = math.ceil(math.max(xs[1], xs[2], xs[3], xs[4])) - math.floor(math.min(xs[1], xs[2], xs[3], xs[4])) - nh = math.ceil(math.max(ys[1], ys[2], ys[3], ys[4])) - math.floor(math.min(ys[1], ys[2], ys[3], ys[4])) - m[3], m[6] = tr(-(nw - w) / 2, -(nh - h) / 2) - end - local lok, le = limit(nw, nh, opts) - if not lok then - return nil, le - end - return viaRgba(img, function(im: Image): (Image?, Err.Err?) - local out = like(im, nw, nh) - local kind = K.KIND[im.format] - local alpha = ALPHA_CH[im.format] - local src = im.pixels - if alpha then - src = buffer.create(buffer.len(im.pixels)) - buffer.copy(src, 0, im.pixels) - K.premultiply(src, w * h, alpha, kind, false) - end - K.affine(src, w, h, K.CHANNELS[im.format], kind, out.pixels, nw, nh, m) - if alpha then - K.premultiply(out.pixels, nw * nh, alpha, kind, true) - end - return out, nil - end) -end - -local RGBA: { [string]: boolean } = { rgba8 = true, rgba16 = true, rgbaf32 = true } - -type BlitOptions = { blend: ("over" | "source")?, opacity: number? } - -function ImageOps.blit(dst: Image, src: Image, x: number, y: number, opts: BlitOptions?): (Image?, Err.Err?) - local ok, e = check(dst) - if not ok then - return nil, e - end - local ok2, e2 = check(src) - if not ok2 then - return nil, e2 - end - if not isInt(x) or not isInt(y) then - return arg("blit: integer x, y") - end - local blend = (opts and opts.blend) or "over" - if blend ~= "over" and blend ~= "source" then - return arg("blit: blend must be \"over\" or \"source\"") - end - local opacity = (opts and opts.opacity) or 1 - if type(opacity) ~= "number" or not (opacity >= 0 and opacity <= 1) then - return arg("blit: opacity must be 0..1") - end - local sx, sy = math.max(0, -x), math.max(0, -y) - local dx, dy = math.max(0, x), math.max(0, y) - local w = math.min(src.width - sx, dst.width - dx) - local h = math.min(src.height - sy, dst.height - dy) - if w <= 0 or h <= 0 then - return dst, nil - end - if dst.format == "yuv420p" or (blend == "over" and not RGBA[dst.format]) then - -- work on an rgba copy of the region, then write it back in dst's format - local region = ImageOps.crop(dst, dx, dy, w, h) :: Image - local work = if region.format == "rgba8" then region else ImageOps.convert(region, "rgba8") :: Image - ImageOps.blit(work, src, x - dx, y - dy, opts) - if dst.format == "yuv420p" then - local full = ImageOps.convert(dst, "rgba8") :: Image - ImageOps.blit(full, work, dx, dy, { blend = "source" }) - local back = ImageOps.convert(full, "yuv420p") :: Image - buffer.copy(dst.pixels, 0, back.pixels, 0, buffer.len(back.pixels)) - else - local back = ImageOps.convert(work, dst.format) :: Image - K.copyRect(dst.pixels, dst.width, back.pixels, back.width, 0, 0, dx, dy, w, h, Types.BPP[dst.format] :: number) - end - return dst, nil - end - local s = src - if src.format ~= dst.format then - s = ImageOps.convert(src, dst.format) :: Image - end - if blend == "source" then - K.copyRect(dst.pixels, dst.width, s.pixels, s.width, sx, sy, dx, dy, w, h, Types.BPP[dst.format] :: number) - elseif dst.format == "rgba8" then - K.overRgba8(dst.pixels, dst.width, s.pixels, s.width, sx, sy, dx, dy, w, h, math.floor(opacity * 255 + 0.5)) - else - K.overFloat(dst.pixels, dst.width, s.pixels, s.width, sx, sy, dx, dy, w, h, opacity, K.KIND[dst.format]) - end - return dst, nil -end - -function ImageOps.composite(dst: Image, src: Image, x: number?, y: number?, opts: BlitOptions?): (Image?, Err.Err?) - local out, e = ImageOps.copy(dst) - if not out then - return nil, e - end - out.frames = nil - return ImageOps.blit(out, src, x or 0, y or 0, opts) -end - -local function premul(img: Image, un: boolean): (Image?, Err.Err?) - local out, e = ImageOps.copy(img) - if not out then - return nil, e - end - out.frames = nil - local ch = ALPHA_CH[img.format] - if ch then - K.premultiply(out.pixels, img.width * img.height, ch, K.KIND[img.format], un) - end - return out, nil -end - -function ImageOps.premultiply(img: Image): (Image?, Err.Err?) - return premul(img, false) -end -function ImageOps.unpremultiply(img: Image): (Image?, Err.Err?) - return premul(img, true) -end - -local MAXV: { [string]: number } = { rgba8 = 255, rgba16 = 65535, rgbaf32 = 1, rgb8 = 255, gray8 = 255, gray16 = 65535, graya8 = 255, alpha8 = 255, yuv420p = 255 } - -function ImageOps.getPixel(img: Image, x: number, y: number): (any, any, number?, number?) - local ok, e = check(img) - if not ok then - return nil, e - end - if not isInt(x) or not isInt(y) or x < 0 or y < 0 or x >= img.width or y >= img.height then - return arg("getPixel: coordinates out of range") - end - local b, f, i = img.pixels, img.format, y * img.width + x - local ru8, ru16, rf = buffer.readu8, buffer.readu16, buffer.readf32 - if f == "rgba8" then - return ru8(b, i * 4), ru8(b, i * 4 + 1), ru8(b, i * 4 + 2), ru8(b, i * 4 + 3) - elseif f == "rgba16" then - return ru16(b, i * 8), ru16(b, i * 8 + 2), ru16(b, i * 8 + 4), ru16(b, i * 8 + 6) - elseif f == "rgbaf32" then - return rf(b, i * 16), rf(b, i * 16 + 4), rf(b, i * 16 + 8), rf(b, i * 16 + 12) - elseif f == "rgb8" then - return ru8(b, i * 3), ru8(b, i * 3 + 1), ru8(b, i * 3 + 2), 255 - elseif f == "gray8" then - local v = ru8(b, i) - return v, v, v, 255 - elseif f == "gray16" then - local v = ru16(b, i * 2) - return v, v, v, 65535 - elseif f == "graya8" then - local v = ru8(b, i * 2) - return v, v, v, ru8(b, i * 2 + 1) - elseif f == "alpha8" then - return 255, 255, 255, ru8(b, i) - end - local one = ImageOps.crop(img, x - x % 2, y - y % 2, 2, 2) :: Image - local rgba = ImageOps.convert(one, "rgba8") :: Image - local j = ((y % 2) * rgba.width + (x % 2)) * 4 - if j + 4 > buffer.len(rgba.pixels) then - j = 0 - end - return ru8(rgba.pixels, j), ru8(rgba.pixels, j + 1), ru8(rgba.pixels, j + 2), 255 -end - -function ImageOps.setPixel(img: Image, x: number, y: number, r: number, g: number, b: number, a: number?): (boolean?, Err.Err?) - local ok, e = check(img) - if not ok then - return nil, e - end - if not isInt(x) or not isInt(y) or x < 0 or y < 0 or x >= img.width or y >= img.height then - return arg("setPixel: coordinates out of range") - end - if type(r) ~= "number" or type(g) ~= "number" or type(b) ~= "number" or (a ~= nil and type(a) ~= "number") then - return arg("setPixel: numeric channels") - end - local f = img.format - if f == "yuv420p" then - return arg("setPixel: not supported on yuv420p (convert to rgba8 first)") - end - local max = MAXV[f] - local al = if a == nil then max else a - local function q(v: number): number - if max == 1 then - return v - end - if v ~= v then - return 0 - end - return math.clamp(math.floor(v + 0.5), 0, max) - end - local px, i = img.pixels, y * img.width + x - local wu8, wu16, wf = buffer.writeu8, buffer.writeu16, buffer.writef32 - local function grey(): number - if max == 1 then - return (r * 19595 + g * 38470 + b * 7471) / 65536 - end - return (q(r) * 19595 + q(g) * 38470 + q(b) * 7471 + 32768) // 65536 - end - if f == "rgba8" then - wu8(px, i * 4, q(r)) - wu8(px, i * 4 + 1, q(g)) - wu8(px, i * 4 + 2, q(b)) - wu8(px, i * 4 + 3, q(al)) - elseif f == "rgba16" then - wu16(px, i * 8, q(r)) - wu16(px, i * 8 + 2, q(g)) - wu16(px, i * 8 + 4, q(b)) - wu16(px, i * 8 + 6, q(al)) - elseif f == "rgbaf32" then - wf(px, i * 16, r) - wf(px, i * 16 + 4, g) - wf(px, i * 16 + 8, b) - wf(px, i * 16 + 12, al) - elseif f == "rgb8" then - wu8(px, i * 3, q(r)) - wu8(px, i * 3 + 1, q(g)) - wu8(px, i * 3 + 2, q(b)) - elseif f == "gray8" then - wu8(px, i, grey()) - elseif f == "gray16" then - wu16(px, i * 2, grey()) - elseif f == "graya8" then - wu8(px, i * 2, grey()) - wu8(px, i * 2 + 1, q(al)) - else - wu8(px, i, q(al)) - end - return true, nil -end - -function ImageOps.fill(img: Image, r: number, g: number, b: number, a: number?): (Image?, Err.Err?) - local ok, e = check(img) - if not ok then - return nil, e - end - if img.format == "yuv420p" then - return arg("fill: not supported on yuv420p") - end - local sok, se = ImageOps.setPixel(img, 0, 0, r, g, b, a) - if not sok then - return nil, se - end - local bpp = Types.BPP[img.format] :: number - local n = img.width * img.height * bpp - local filled = bpp - while filled < n do - local c = math.min(filled, n - filled) - buffer.copy(img.pixels, filled, img.pixels, 0, c) - filled += c - end - return img, nil -end - -function ImageOps.frameCount(img: Image): number - if type(img) == "table" and type(img.frames) == "table" and #img.frames > 0 then - return #img.frames - end - return 1 -end - -function ImageOps.durations(img: Image): { number } - local out = {} - if type(img) == "table" and type(img.frames) == "table" and #img.frames > 0 then - for i, f in img.frames do - out[i] = if type(f.delay) == "number" then f.delay else 0 - end - return out - end - return { 0 } -end - --- coalesce: dispose "none" keeps the canvas, "background" clears the frame's rectangle, "previous" restores it -function ImageOps.coalesce(img: Image): ({ Image }?, Err.Err?) - local ok, e = check(img) - if not ok then - return nil, e - end - local frames = img.frames - if type(frames) ~= "table" or #frames == 0 then - return { img }, nil - end - local fmt = if RGBA[img.format] then img.format else "rgba8" - local canvas = Types.Image.new(img.width, img.height, fmt :: any) - local bpp = Types.BPP[fmt] :: number - local out = {} - for i, f in frames do - if type(f) ~= "table" then - return arg("coalesce: frame " .. i .. " is not a Frame") - end - local fi = f.image - local fok, fe = check(fi) - if not fok then - return nil, Err.new(Err.ARG, "coalesce: frame " .. i .. ": " .. (fe :: Err.Err).message) - end - local fx, fy = if isInt(f.x) then f.x else 0, if isInt(f.y) then f.y else 0 - local saved: buffer? = nil - if f.dispose == "previous" then - local sb = buffer.create(buffer.len(canvas.pixels)) - buffer.copy(sb, 0, canvas.pixels) - saved = sb - end - local bok, be = ImageOps.blit(canvas, fi, fx, fy, { blend = if f.blend == "source" then "source" else "over" }) - if not bok then - return nil, be - end - local snap = Types.Image.new(img.width, img.height, fmt :: any) - buffer.copy(snap.pixels, 0, canvas.pixels) - for k, v in img.meta do - snap.meta[k] = v - end - snap.meta.delay = f.delay - out[i] = snap - if f.dispose == "background" then - local x0, y0 = math.max(0, fx), math.max(0, fy) - local x1, y1 = math.min(img.width, fx + fi.width), math.min(img.height, fy + fi.height) - for y = y0, y1 - 1 do - if x1 > x0 then - buffer.fill(canvas.pixels, (y * img.width + x0) * bpp, 0, (x1 - x0) * bpp) - end - end - elseif saved then - canvas.pixels = saved - end - end - return out, nil -end - -function ImageOps.fromFrames(images: { Image }, delays: (number | { number })?): (Image?, Err.Err?) - if type(images) ~= "table" or #images == 0 then - return arg("fromFrames: a non-empty list of Images") - end - local first = images[1] - local ok, e = check(first) - if not ok then - return nil, e - end - local frames = {} - for i, im in images do - local iok, ie = check(im) - if not iok then - return nil, ie - end - if im.width ~= first.width or im.height ~= first.height or im.format ~= first.format then - return arg("fromFrames: frame " .. i .. " differs in size or format from frame 1") - end - local d = 0.1 - if type(delays) == "number" then - d = delays - elseif type(delays) == "table" and type(delays[i]) == "number" then - d = delays[i] - end - frames[i] = { image = im, delay = d, x = 0, y = 0, dispose = "none", blend = "source" } - end - local out = like(first, first.width, first.height) - buffer.copy(out.pixels, 0, first.pixels, 0, buffer.len(out.pixels)) - out.frames = frames :: any - out.loops = 0 - return out, nil -end - -return ImageOps -end -__FILES["ops/ImageOps/Kernels"] = @native function() - - - --- ops/ImageOps/Kernels: the hot loops behind ops/ImageOps; callers validate, so indexes are in range by construction. --- Sample kinds: 1 = u8, 2 = u16, 4 = f32 (little endian). Resampling follows Pillow's Resample.c (separable, 22-bit --- fixed point for 8-bit) and Geometry.c (affine through pixel centres); compositing is Pillow's AlphaComposite.c. -local readu8, writeu8, readu16, writeu16, readf32, writef32 = buffer.readu8, buffer.writeu8, buffer.readu16, buffer.writeu16, buffer.readf32, buffer.writef32 -local readu32, writeu32 = buffer.readu32, buffer.writeu32 -local floor, clamp = math.floor, math.clamp - -local K = {} - --- format ids: rgba8 1, rgba16 2, rgbaf32 3, rgb8 4, gray8 5, gray16 6, graya8 7, alpha8 8 -K.ID = { rgba8 = 1, rgba16 = 2, rgbaf32 = 3, rgb8 = 4, gray8 = 5, gray16 = 6, graya8 = 7, alpha8 = 8 } :: { [string]: number } -K.KIND = { rgba8 = 1, rgba16 = 2, rgbaf32 = 4, rgb8 = 1, gray8 = 1, gray16 = 2, graya8 = 1, alpha8 = 1 } :: { [string]: number } -K.CHANNELS = { rgba8 = 4, rgba16 = 4, rgbaf32 = 4, rgb8 = 3, gray8 = 1, gray16 = 1, graya8 = 2, alpha8 = 1 } :: { [string]: number } - -@native local function rd(b: buffer, o: number, kind: number): number - if kind == 1 then - return readu8(b, o) - elseif kind == 2 then - return readu16(b, o) - end - return readf32(b, o) -end - -@native local function wr(b: buffer, o: number, kind: number, v: number) - if kind == 1 then - writeu8(b, o, clamp(floor(v + 0.5), 0, 255)) - elseif kind == 2 then - writeu16(b, o, clamp(floor(v + 0.5), 0, 65535)) - else - writef32(b, o, v) - end -end - --- depth: 8 -> 0..255, 16 -> 0..65535, 0 -> float 0..1 -local DEPTH = { 8, 16, 0, 8, 8, 16, 8, 8 } - -@native local function depthConv(v: number, from: number, to: number): number - if from == to then - return v - end - if from == 8 then - if to == 16 then - return v * 257 - end - return v / 255 - elseif from == 16 then - if to == 8 then - return (v * 255 + 32767) // 65535 - end - return v / 65535 - end - if v ~= v then - v = 0 - end - if to == 8 then - return clamp(floor(v * 255 + 0.5), 0, 255) - end - return clamp(floor(v * 65535 + 0.5), 0, 65535) -end - --- Pillow's L24 luma (19595 R + 38470 G + 7471 B + 0x8000) >> 16, in the source depth -@native local function luma(r: number, g: number, b: number, depth: number): number - if depth == 0 then - return (r * 19595 + g * 38470 + b * 7471) / 65536 - end - return (r * 19595 + g * 38470 + b * 7471 + 32768) // 65536 -end - -@native function K.convert(src: buffer, sf: number, dst: buffer, df: number, n: number) - if sf == 1 and df == 5 then - for i = 0, n - 1 do - local o = i * 4 - writeu8(dst, i, (readu8(src, o) * 19595 + readu8(src, o + 1) * 38470 + readu8(src, o + 2) * 7471 + 32768) // 65536) - end - return - elseif sf == 1 and df == 4 and n > 0 then - -- a u32 per pixel; its fourth byte is overwritten by the next pixel (the last one is written as 2 + 1 bytes) - for i = 0, n - 2 do - writeu32(dst, i * 3, readu32(src, i * 4)) - end - local o, d = (n - 1) * 4, (n - 1) * 3 - writeu16(dst, d, readu16(src, o)) - writeu8(dst, d + 2, readu8(src, o + 2)) - return - elseif df == 1 and (sf == 4 or sf == 5) then - for i = 0, n - 1 do - if sf == 4 then - local o = i * 3 - writeu32(dst, i * 4, readu8(src, o) + readu8(src, o + 1) * 256 + readu8(src, o + 2) * 65536 + 0xFF000000) - else - writeu32(dst, i * 4, readu8(src, i) * 0x10101 + 0xFF000000) - end - end - return - end - local sd, dd = DEPTH[sf] :: number, DEPTH[df] :: number - local smax = if sd == 8 then 255 elseif sd == 16 then 65535 else 1 - local toGray = df == 5 or df == 6 or df == 7 - for i = 0, n - 1 do - local r: number, g: number, b: number, a: number - if sf == 1 then - local o = i * 4 - r, g, b, a = readu8(src, o), readu8(src, o + 1), readu8(src, o + 2), readu8(src, o + 3) :: number - elseif sf == 2 then - local o = i * 8 - r, g, b, a = readu16(src, o), readu16(src, o + 2), readu16(src, o + 4), readu16(src, o + 6) :: number - elseif sf == 3 then - local o = i * 16 - r, g, b, a = readf32(src, o), readf32(src, o + 4), readf32(src, o + 8), readf32(src, o + 12) :: number - elseif sf == 4 then - local o = i * 3 - r, g, b, a = readu8(src, o), readu8(src, o + 1), readu8(src, o + 2), 255 - elseif sf == 5 then - local v = readu8(src, i) - r, g, b, a = v, v, v, 255 - elseif sf == 6 then - local v = readu16(src, i * 2) - r, g, b, a = v, v, v, 65535 - elseif sf == 7 then - local v = readu8(src, i * 2) - r, g, b, a = v, v, v, readu8(src, i * 2 + 1) :: number - else - r, g, b, a = 255, 255, 255, readu8(src, i) - end - if toGray then - local isGray = sf == 5 or sf == 6 or sf == 7 - local l = if isGray then r else luma(r, g, b, sd) - l = depthConv(l, sd, dd) - if df == 5 then - writeu8(dst, i, l) - elseif df == 6 then - writeu16(dst, i * 2, l) - else - writeu8(dst, i * 2, l) - writeu8(dst, i * 2 + 1, depthConv(a, sd, dd)) - end - elseif df == 8 then - writeu8(dst, i, depthConv(a, sd, 8)) - else - r, g, b = depthConv(r, sd, dd), depthConv(g, sd, dd), depthConv(b, sd, dd) :: number - if df == 1 then - local o = i * 4 - writeu8(dst, o, r) - writeu8(dst, o + 1, g) - writeu8(dst, o + 2, b) - writeu8(dst, o + 3, depthConv(a, sd, dd)) - elseif df == 2 then - local o = i * 8 - writeu16(dst, o, r) - writeu16(dst, o + 2, g) - writeu16(dst, o + 4, b) - writeu16(dst, o + 6, depthConv(a, sd, dd)) - elseif df == 3 then - local o = i * 16 - writef32(dst, o, r) - writef32(dst, o + 4, g) - writef32(dst, o + 8, b) - writef32(dst, o + 12, if a == smax and sd ~= 0 then 1 else depthConv(a, sd, dd)) - else -- rgb8 - local o = i * 3 - writeu8(dst, o, r) - writeu8(dst, o + 1, g) - writeu8(dst, o + 2, b) - end - end - end -end - --- JPEG-style BT.601 full range -@native function K.rgbaToYuv(src: buffer, w: number, h: number, dst: buffer) - local cw, ch = (w + 1) // 2, (h + 1) // 2 - local uo, vo = w * h, w * h + cw * ch - for i = 0, w * h - 1 do - local o = i * 4 - local r, g, b = readu8(src, o), readu8(src, o + 1), readu8(src, o + 2) - writeu8(dst, i, clamp(floor(0.299 * r + 0.587 * g + 0.114 * b + 0.5), 0, 255)) - end - for cy = 0, ch - 1 do - for cx = 0, cw - 1 do - local sr, sg, sb, n = 0, 0, 0, 0 - for dy = 0, 1 do - local y = cy * 2 + dy - if y < h then - for dx = 0, 1 do - local x = cx * 2 + dx - if x < w then - local o = (y * w + x) * 4 - sr += readu8(src, o) - sg += readu8(src, o + 1) - sb += readu8(src, o + 2) - n += 1 - end - end - end - end - sr, sg, sb = sr / n, sg / n, sb / n - local i = cy * cw + cx - writeu8(dst, uo + i, clamp(floor(128 - 0.168736 * sr - 0.331264 * sg + 0.5 * sb + 0.5), 0, 255)) - writeu8(dst, vo + i, clamp(floor(128 + 0.5 * sr - 0.418688 * sg - 0.081312 * sb + 0.5), 0, 255)) - end - end -end - -@native function K.yuvToRgba(src: buffer, w: number, h: number, dst: buffer) - local cw, ch = (w + 1) // 2, (h + 1) // 2 - local uo, vo = w * h, w * h + cw * ch - for y = 0, h - 1 do - local crow = (y // 2) * cw - for x = 0, w - 1 do - local yy = readu8(src, y * w + x) - local ci = crow + x // 2 - local u, v = readu8(src, uo + ci) - 128, readu8(src, vo + ci) - 128 - local o = (y * w + x) * 4 - writeu8(dst, o, clamp(floor(yy + 1.402 * v + 0.5), 0, 255)) - writeu8(dst, o + 1, clamp(floor(yy - 0.344136 * u - 0.714136 * v + 0.5), 0, 255)) - writeu8(dst, o + 2, clamp(floor(yy + 1.772 * u + 0.5), 0, 255)) - writeu8(dst, o + 3, 255) - end - end - local _ = ch -end - -@native function K.flip(src: buffer, dst: buffer, w: number, h: number, bpp: number, horizontal: boolean) - local stride = w * bpp - if not horizontal then - for y = 0, h - 1 do - buffer.copy(dst, (h - 1 - y) * stride, src, y * stride, stride) - end - return - end - for y = 0, h - 1 do - local row = y * stride - for x = 0, w - 1 do - buffer.copy(dst, row + (w - 1 - x) * bpp, src, row + x * bpp, bpp) - end - end -end - --- counter-clockwise quarter turns 1..3 -@native function K.rotate90(src: buffer, dst: buffer, w: number, h: number, bpp: number, turns: number) - for y = 0, h - 1 do - for x = 0, w - 1 do - local ox, oy, ow - if turns == 1 then - ox, oy, ow = y, w - 1 - x, h - elseif turns == 2 then - ox, oy, ow = w - 1 - x, h - 1 - y, w - else - ox, oy, ow = h - 1 - y, x, h - end - local so, d = (y * w + x) * bpp, (oy * ow + ox) * bpp - if bpp == 4 then - buffer.writeu32(dst, d, buffer.readu32(src, so)) - else - buffer.copy(dst, d, src, so, bpp) - end - end - end -end - -@native local function bilinearF(x: number): number - if x < 0 then - x = -x - end - if x < 1 then - return 1 - x - end - return 0 -end - -@native local function sinc(x: number): number - if x == 0 then - return 1 - end - x *= math.pi - return math.sin(x) / x -end - -@native local function lanczosF(x: number): number - if x > -3 and x < 3 then - return sinc(x) * sinc(x / 3) - end - return 0 -end - -@native local function trunc(x: number): number - return if x < 0 then math.ceil(x) else floor(x) -end - --- Pillow precompute_coeffs: per output index its first input index, tap count and weights (normalised) -type Coeffs = { start: { number }, count: { number }, weights: { { number } } } - -@native function K.coeffs(inSize: number, outSize: number, filter: string): Coeffs - local support0 = if filter == "lanczos" then 3 else 1 - local f = if filter == "lanczos" then lanczosF else bilinearF - local scale = inSize / outSize - local filterscale = math.max(scale, 1) - local support = support0 * filterscale - local ss = 1 / filterscale - local start, count, weights = table.create(outSize, 0), table.create(outSize, 0), table.create(outSize) :: { { number } } - for xx = 0, outSize - 1 do - local center = (xx + 0.5) * scale - local xmin = math.max(0, trunc(center - support + 0.5)) - local xmax = math.min(inSize, trunc(center + support + 0.5)) - xmin - local w = table.create(math.max(xmax, 0), 0) - local ww = 0 - for x = 0, xmax - 1 do - local v = f((x + xmin - center + 0.5) * ss) - w[x + 1] = v - ww += v - end - if ww ~= 0 then - for x = 1, xmax do - w[x] /= ww - end - end - start[xx + 1], count[xx + 1], weights[xx + 1] = xmin, math.max(xmax, 0), w - end - return { start = start, count = count, weights = weights } -end - --- 8-bit RGBA: the four channels of a tap together, the pixel written as one u32 -@native local function resample4(src: buffer, w: number, h: number, dst: buffer, outN: number, start: { number }, count: { number }, iw: { { number } }, horizontal: boolean) - local o = 0 - if horizontal then - for y = 0, h - 1 do - local row = y * w * 4 - for xx = 1, outN do - local wt = iw[xx] - local p = row + start[xx] * 4 - local a0, a1, a2, a3 = 2097152, 2097152, 2097152, 2097152 - for k = 1, count[xx] do - local wk = wt[k] - a0 += readu8(src, p) * wk - a1 += readu8(src, p + 1) * wk - a2 += readu8(src, p + 2) * wk - a3 += readu8(src, p + 3) * wk - p += 4 - end - writeu32(dst, o, clamp(a0 // 4194304, 0, 255) + clamp(a1 // 4194304, 0, 255) * 256 + clamp(a2 // 4194304, 0, 255) * 65536 + clamp(a3 // 4194304, 0, 255) * 16777216) - o += 4 - end - end - else - local rs = w * 4 - for yy = 1, outN do - local wt, n = iw[yy], count[yy] - local base = start[yy] * rs - for x = 0, rs - 4, 4 do - local p = base + x - local a0, a1, a2, a3 = 2097152, 2097152, 2097152, 2097152 - for k = 1, n do - local wk = wt[k] - a0 += readu8(src, p) * wk - a1 += readu8(src, p + 1) * wk - a2 += readu8(src, p + 2) * wk - a3 += readu8(src, p + 3) * wk - p += rs - end - writeu32(dst, o, clamp(a0 // 4194304, 0, 255) + clamp(a1 // 4194304, 0, 255) * 256 + clamp(a2 // 4194304, 0, 255) * 65536 + clamp(a3 // 4194304, 0, 255) * 16777216) - o += 4 - end - end - end - local _ = h -end - -@native function K.resamplePass(src: buffer, w: number, h: number, ch: number, kind: number, dst: buffer, outN: number, c: Coeffs, horizontal: boolean) - local start, count, weights = c.start, c.count, c.weights - local size = kind - local fixed = kind == 1 - -- 8-bit: Pillow's 22-bit fixed-point coefficients - local iw: { { number } } = weights - if fixed then - iw = table.create(outN) :: { { number } } - for i = 1, outN do - local src0 = weights[i] - local t = table.create(#src0, 0) - for k = 1, #src0 do - local v = src0[k] * 4194304 - t[k] = if v < 0 then math.ceil(v - 0.5) else floor(v + 0.5) - end - iw[i] = t - end - end - if fixed and ch == 4 then - resample4(src, w, h, dst, outN, start, count, iw, horizontal) - return - end - if horizontal then - for y = 0, h - 1 do - local row = y * w - for xx = 0, outN - 1 do - local s0, n, wt = start[xx + 1], count[xx + 1], iw[xx + 1] - local o = ((y * outN) + xx) * ch * size - for cc = 0, ch - 1 do - if fixed then - local acc = 2097152 - for k = 0, n - 1 do - acc += readu8(src, (row + s0 + k) * ch + cc) * wt[k + 1] - end - writeu8(dst, o + cc, clamp(acc // 4194304, 0, 255)) - else - local acc = 0 - for k = 0, n - 1 do - acc += rd(src, ((row + s0 + k) * ch + cc) * size, kind) * wt[k + 1] - end - wr(dst, o + cc * size, kind, acc) - end - end - end - end - else - for yy = 0, outN - 1 do - local s0, n, wt = start[yy + 1], count[yy + 1], iw[yy + 1] - for x = 0, w - 1 do - local o = (yy * w + x) * ch * size - for cc = 0, ch - 1 do - if fixed then - local acc = 2097152 - for k = 0, n - 1 do - acc += readu8(src, ((s0 + k) * w + x) * ch + cc) * wt[k + 1] - end - writeu8(dst, o + cc, clamp(acc // 4194304, 0, 255)) - else - local acc = 0 - for k = 0, n - 1 do - acc += rd(src, (((s0 + k) * w + x) * ch + cc) * size, kind) * wt[k + 1] - end - wr(dst, o + cc * size, kind, acc) - end - end - end - end - end - local _ = h -end - --- nearest: dst pixel (x, y) = src pixel (floor((x + 0.5) * w / ow), ...) -@native function K.nearest(src: buffer, w: number, h: number, bpp: number, dst: buffer, ow: number, oh: number) - local sx, sy = w / ow, h / oh - local xs = table.create(ow, 0) - for x = 0, ow - 1 do - xs[x + 1] = math.min(floor((x + 0.5) * sx), w - 1) * bpp - end - local o = 0 - for y = 0, oh - 1 do - local row = math.min(floor((y + 0.5) * sy), h - 1) * w * bpp - if bpp == 4 then - for x = 1, ow do - writeu32(dst, o, readu32(src, row + xs[x])) - o += 4 - end - else - for x = 1, ow do - buffer.copy(dst, o, src, row + xs[x], bpp) - o += bpp - end - end - end -end - --- affine: dst pixel centres through m = { a, b, c, d, e, f } (xin = a x + b y + c), bilinear with clamped --- neighbours; centres outside the source -> zeros (Pillow) -@native function K.affine(src: buffer, w: number, h: number, ch: number, kind: number, dst: buffer, ow: number, oh: number, m: { number }) - local a, b, c, d, e, f = m[1], m[2], m[3], m[4], m[5], m[6] - local size = kind - for y = 0, oh - 1 do - local py = y + 0.5 - for x = 0, ow - 1 do - local px = x + 0.5 - local xin = a * px + b * py + c - 0.5 - local yin = d * px + e * py + f - 0.5 - local o = (y * ow + x) * ch * size - local x0 = floor(xin) - local y0 = floor(yin) - if xin < -0.5 or xin >= w - 0.5 or yin < -0.5 or yin >= h - 0.5 then - continue -- dst starts zeroed - end - local dx, dy = xin - x0, yin - y0 - local xa, xb = clamp(x0, 0, w - 1), clamp(x0 + 1, 0, w - 1) - local ya, yb = clamp(y0, 0, h - 1), clamp(y0 + 1, 0, h - 1) - for cc = 0, ch - 1 do - local p00 = rd(src, ((ya * w + xa) * ch + cc) * size, kind) - local p01 = rd(src, ((ya * w + xb) * ch + cc) * size, kind) - local p10 = rd(src, ((yb * w + xa) * ch + cc) * size, kind) - local p11 = rd(src, ((yb * w + xb) * ch + cc) * size, kind) - local top = p00 + (p01 - p00) * dx - local bot = p10 + (p11 - p10) * dx - local v = top + (bot - top) * dy - if kind == 1 then - writeu8(dst, o + cc, clamp(floor(v), 0, 255)) -- Pillow truncates - else - wr(dst, o + cc * size, kind, v) - end - end - end - end -end - --- Pillow's alpha_composite of src onto dst, in place -@native function K.overRgba8(dst: buffer, dw: number, src: buffer, sw: number, sx: number, sy: number, dx: number, dy: number, w: number, h: number, opacity: number) - for y = 0, h - 1 do - for x = 0, w - 1 do - local so = ((sy + y) * sw + sx + x) * 4 - local doff = ((dy + y) * dw + dx + x) * 4 - local sa = readu8(src, so + 3) - if opacity < 255 then - sa = (sa * opacity + 127) // 255 - end - if sa == 0 then - continue - elseif sa == 255 then - -- coef1 = 255 * 128, coef2 = 0: the source pixel exactly - writeu32(dst, doff, readu32(src, so)) - continue - end - local da = readu8(dst, doff + 3) - local blend = da * (255 - sa) - local outa255 = sa * 255 + blend - local coef1 = (sa * 255 * 255 * 128) // outa255 - local coef2 = 255 * 128 - coef1 - for cc = 0, 2 do - local t = readu8(src, so + cc) * coef1 + readu8(dst, doff + cc) * coef2 + 0x80 * 128 - t = ((t // 256) + t) // 256 - writeu8(dst, doff + cc, t // 128) - end - local t = outa255 + 0x80 - writeu8(dst, doff + 3, ((t // 256) + t) // 256) - end - end -end - --- overFloat: straight-alpha "over" for rgba16 (kind 2) / rgbaf32 (kind 4); max = 65535 or 1 -@native function K.overFloat(dst: buffer, dw: number, src: buffer, sw: number, sx: number, sy: number, dx: number, dy: number, w: number, h: number, opacity: number, kind: number) - local max = if kind == 2 then 65535 else 1 - local px = 4 * kind - for y = 0, h - 1 do - for x = 0, w - 1 do - local so = ((sy + y) * sw + sx + x) * px - local doff = ((dy + y) * dw + dx + x) * px - local sa = rd(src, so + 3 * kind, kind) / max * opacity - if sa <= 0 then - continue - end - local da = rd(dst, doff + 3 * kind, kind) / max - local oa = sa + da * (1 - sa) - for cc = 0, 2 do - local s = rd(src, so + cc * kind, kind) - local d = rd(dst, doff + cc * kind, kind) - wr(dst, doff + cc * kind, kind, if oa > 0 then (s * sa + d * da * (1 - sa)) / oa else 0) - end - wr(dst, doff + 3 * kind, kind, oa * max) - end - end -end - -@native function K.copyRect(dst: buffer, dw: number, src: buffer, sw: number, sx: number, sy: number, dx: number, dy: number, w: number, h: number, bpp: number) - for y = 0, h - 1 do - buffer.copy(dst, ((dy + y) * dw + dx) * bpp, src, ((sy + y) * sw + sx) * bpp, w * bpp) - end -end - --- a = 255 leaves the colour as it is both ways (MULDIV255(v, 255) = v, v * 255 // 255 = v) -@native local function premultiply4(b: buffer, n: number, un: boolean) - for o = 3, n * 4 - 1, 4 do - local a = readu8(b, o) - if a == 255 then - continue - end - if a == 0 then - writeu16(b, o - 3, 0) - writeu8(b, o - 1, 0) - continue - end - for c = o - 3, o - 1 do - local v = readu8(b, c) - if un then - writeu8(b, c, math.min(255, (v * 255) // a)) -- Pillow's rgbA2rgba - else - local t = v * a + 128 -- Pillow's MULDIV255 - writeu8(b, c, ((t // 256) + t) // 256) - end - end - end -end - -@native function K.opaque(b: buffer, n: number): boolean - for o = 3, n * 4 - 1, 4 do - if readu8(b, o) ~= 255 then - return false - end - end - return true -end - -@native function K.premultiply(b: buffer, n: number, ch: number, kind: number, un: boolean) - if kind == 1 and ch == 4 then - premultiply4(b, n, un) - return - end - local max = if kind == 1 then 255 elseif kind == 2 then 65535 else 1 - local px = ch * kind - for i = 0, n - 1 do - local o = i * px - local a = rd(b, o + (ch - 1) * kind, kind) - for cc = 0, ch - 2 do - local v = rd(b, o + cc * kind, kind) - local r - if un then - if a <= 0 then - r = 0 - elseif kind == 4 then - r = v / a - elseif kind == 1 then - r = math.min(255, (v * 255) // a) -- Pillow's rgbA2rgba - else - r = math.min(max, (v * max + a // 2) // a) - end - else - if kind == 4 then - r = v * a - elseif kind == 1 then - local t = v * a + 128 -- Pillow's MULDIV255 - r = ((t // 256) + t) // 256 - else - r = (v * a + max // 2) // max - end - end - wr(b, o + cc * kind, kind, r) - end - end -end - -return K -end end - + Detect --!optimize 2 @@ -15011,7 +10686,7 @@ end - + Mpeg2 --!optimize 2 @@ -18055,7 +13730,7 @@ end - + H263 --!optimize 2 @@ -19287,7 +14962,7 @@ end - + H264 --!optimize 2 @@ -25786,7 +21461,7 @@ end - + Theora --!optimize 2 @@ -27691,7 +23366,7 @@ end - + Legacy --!optimize 2 @@ -29638,7 +25313,7 @@ end - + MpegTs --!optimize 2 @@ -30832,7 +26507,7 @@ end - + Dct --!optimize 2 @@ -31340,7 +27015,7 @@ end - + Jpeg --!optimize 2 @@ -34748,7 +30423,7 @@ end - + Vp8 --!optimize 2 @@ -39534,7 +35209,7 @@ end - + Bcn --!optimize 2 @@ -40567,7 +36242,7 @@ end - + Png --!optimize 2 @@ -42043,7 +37718,7 @@ end - + Deflate --!optimize 2 @@ -43472,7 +39147,7 @@ end - + Brotli --!optimize 2 @@ -45437,7 +41112,7 @@ end - + Lzma --!optimize 2 @@ -46706,7 +42381,7 @@ end - + Zstd --!optimize 2 @@ -47912,7 +43587,7 @@ end - + Mpa --!optimize 2 @@ -51344,7 +47019,7 @@ end - + Opus --!optimize 2 @@ -57834,7 +53509,7 @@ end - + Vorbis --!optimize 2 @@ -59280,7 +54955,7 @@ end - + Aac --!optimize 2 @@ -65053,7 +60728,7 @@ end - + Flac --!optimize 2 @@ -66647,7 +62322,7 @@ end - + Musepack --!optimize 2 @@ -68279,7 +63954,7 @@ end - + WavPack --!optimize 2 @@ -70033,7 +65708,7 @@ end - + Tracker --!optimize 2 @@ -73290,7 +68965,7 @@ end - + Hively --!optimize 2 @@ -74929,7 +70604,7 @@ end - + SoundFont --!optimize 2 @@ -76454,7 +72129,7 @@ end - + Draco --!optimize 2 @@ -80401,13 +76076,13 @@ end - + - archive_1 + archive_7z --!optimize 2 --!nocheck --- rosetta chunk archive_1 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 33 modules (3 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk archive_7z (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["archive/7z"] = function() @@ -81604,6 +77279,19 @@ end return Adf end +end + + + + + + archive_applesingle + --!optimize 2 +--!nocheck +-- rosetta chunk archive_applesingle (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["archive/applesingle"] = function() -- archive/applesingle: AppleSingle (0x00051600) / AppleDouble (0x00051607) v1 and v2 (RFC 1740): data fork (1), @@ -82403,6 +78091,19 @@ end return Arj end +end + + + + + + archive_binhex + --!optimize 2 +--!nocheck +-- rosetta chunk archive_binhex (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 6 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["archive/binhex"] = function() -- archive/binhex: BinHex 4.0 (.hqx; RFC 1741 notes): 6-bit text, RLE90, header and forks each with CRC-16/XMODEM, as @@ -83413,6 +79114,19 @@ end return CpioFormat end +end + + + + + + archive_d64 + --!optimize 2 +--!nocheck +-- rosetta chunk archive_d64 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 5 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["archive/d64"] = function() -- archive/d64: Commodore D64 (1541: 35 / 40 / 42 tracks, error block), D71, D81 (Peter Schepers' notes); PETSCII names @@ -84320,6 +80034,19 @@ end return Iso end +end + + + + + + archive_lha + --!optimize 2 +--!nocheck +-- rosetta chunk archive_lha (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["archive/lha"] = function() -- archive/lha: LHA / LZH (and LArc .lzs; Yoshizaki's LHa notes, lhasa's lha_file_header.c, ISC): header levels 0-3, @@ -85287,6 +81014,19 @@ end return MacBinary end +end + + + + + + archive_mpq + --!optimize 2 +--!nocheck +-- rosetta chunk archive_mpq (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["archive/mpq"] = function() -- archive/mpq: Blizzard MPQ ("The MoPaQ Archive Format", Olbrantz / Roy; StormLib docs; no code taken). Supports: @@ -86216,6 +81956,19 @@ end return Rpm end +end + + + + + + archive_tar + --!optimize 2 +--!nocheck +-- rosetta chunk archive_tar (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["archive/tar"] = function() -- archive/tar: tar archives (ustar, pax, GNU long names; containers/Tar). Supports: read (lazy), write from any @@ -87151,6 +82904,19 @@ end return Vpk end +end + + + + + + archive_vswap + --!optimize 2 +--!nocheck +-- rosetta chunk archive_vswap (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["archive/vswap"] = function() -- archive/vswap: Wolfenstein 3D / Spear of Destiny page files (VSWAP.WL1 / .WL6 / .SOD / .SDM: u16 chunks, sprite @@ -87977,6 +83743,19 @@ end return Picture end +end + + + + + + archive_wad2 + --!optimize 2 +--!nocheck +-- rosetta chunk archive_wad2 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 5 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["archive/wad2"] = function() -- archive/wad2: Quake WAD2 and Half-Life WAD3 texture / graphics WADs (wad.h of the Quake source, the GoldSrc WAD3 @@ -88359,19 +84138,6 @@ end return Xz end -end - - - - - - archive_2 - --!optimize 2 ---!nocheck --- rosetta chunk archive_2 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 5 modules (0 native: @native); the Rosetta root requires it when one of them is first included. --- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). -return function(__FILES, __include) __FILES["archive/yenc"] = function() -- archive/yenc: yEnc 1.3 (=ybegin / =ypart / =yend, byte + 42, "=" escapes; Jürgen Helbing's draft): parts in one text @@ -88959,6 +84725,19 @@ Zip.Container = Container return Zip end +end + + + + + + archive_zoo + --!optimize 2 +--!nocheck +-- rosetta chunk archive_zoo (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["archive/zoo"] = function() -- archive/zoo: Zoo 1.x / 2.x (zoo 2.10's zoo.h / ar.h): directory entries type 1 and 2, methods 0 stored, 1 LZW @@ -89223,13 +85002,13 @@ end - + - audio + audio_aac --!optimize 2 --!nocheck --- rosetta chunk audio (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 29 modules (5 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk audio_aac (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["audio/aac"] = function() @@ -89970,6 +85749,19 @@ end return Adx end +end + + + + + + audio_aiff + --!optimize 2 +--!nocheck +-- rosetta chunk audio_aiff (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["audio/aiff"] = function() @@ -90945,6 +86737,19 @@ end return Brstm end +end + + + + + + audio_caf + --!optimize 2 +--!nocheck +-- rosetta chunk audio_caf (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["audio/caf"] = function() @@ -91612,6 +87417,19 @@ end return Caf end +end + + + + + + audio_flac + --!optimize 2 +--!nocheck +-- rosetta chunk audio_flac (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (2 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["audio/flac"] = function() @@ -92696,6 +88514,19 @@ end return M4a end +end + + + + + + audio_mp3 + --!optimize 2 +--!nocheck +-- rosetta chunk audio_mp3 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["audio/mp3"] = function() @@ -93687,6 +89518,19 @@ end return Tags end +end + + + + + + audio_mpc + --!optimize 2 +--!nocheck +-- rosetta chunk audio_mpc (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 5 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["audio/mpc"] = function() @@ -94573,6 +90417,19 @@ end return Tta end +end + + + + + + audio_vag + --!optimize 2 +--!nocheck +-- rosetta chunk audio_vag (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["audio/vag"] = function() @@ -95073,6 +90930,19 @@ end return Voc end +end + + + + + + audio_vorbis + --!optimize 2 +--!nocheck +-- rosetta chunk audio_vorbis (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["audio/vorbis"] = function() @@ -96341,6 +92211,19 @@ Encode.BOOKS = BOOKS return Encode end +end + + + + + + audio_wav + --!optimize 2 +--!nocheck +-- rosetta chunk audio_wav (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["audio/wav"] = function() @@ -97353,12 +93236,12 @@ end - + - cad + cad_step --!optimize 2 --!nocheck --- rosetta chunk cad (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- rosetta chunk cad_step (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. -- 4 modules (2 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) @@ -98788,13 +94671,13 @@ end - + - codecs_audio + codecs_audio_Ac3 --!optimize 2 --!nocheck --- rosetta chunk codecs_audio (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 21 modules (10 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk codecs_audio_Ac3 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (1 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["codecs/audio/Ac3"] = function() @@ -99944,6 +95827,773 @@ end return T end +end + + + + + + codecs_audio_Adpcm + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_audio_Adpcm (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) +__FILES["codecs/audio/Adpcm"] = @native function() + + + +-- codecs/audio/Adpcm: the 4-bit ADPCM family, decode (and encode where it is cheap). +-- ADX, PS-ADPCM and Nintendo DSP decoding follow vgmstream r2117 (ISC, licenses/vgmstream-LICENSE.txt) bit-exactly: the +-- ADX scale + 1 and version 3 rounding, PS-ADPCM's float filter (exact in integers below 2^17), DSP's 1024 rounding. +local readu8, readi16, readu16, readi32 = buffer.readu8, buffer.readi16, buffer.readu16, buffer.readi32 +local writef32, readf32, writei32, writeu8, writeu16 = buffer.writef32, buffer.readf32, buffer.writei32, buffer.writeu8, buffer.writeu16 +local band, rshift, bor, lshift = bit32.band, bit32.rshift, bit32.bor, bit32.lshift +local floor = math.floor + +local Adpcm = {} + +local IMA_STEP = { + 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, + 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, + 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, + 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767, +} +local IMA_ADJ = { -1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8 } +-- IMA_DIFF[index * 8 + (nibble & 7) + 1]: the shift-and-add difference (step/8 + bits of step/4, step/2, step), as +-- the IMA reference computes it (not (2n + 1) * step / 8, which rounds differently) +local IMA_DIFF = table.create(89 * 8, 0) +-- IMA_NEXT[index * 16 + nibble + 1]: the next step index +local IMA_NEXT = table.create(89 * 16, 0) +for i = 0, 88 do + local step = IMA_STEP[i + 1] + for n = 0, 7 do + local d = rshift(step, 3) + if band(n, 1) ~= 0 then + d += rshift(step, 2) + end + if band(n, 2) ~= 0 then + d += rshift(step, 1) + end + if band(n, 4) ~= 0 then + d += step + end + IMA_DIFF[i * 8 + n + 1] = d + end + for n = 0, 15 do + IMA_NEXT[i * 16 + n + 1] = math.clamp(i + IMA_ADJ[n + 1], 0, 88) + end +end +Adpcm.IMA_STEP = IMA_STEP + +-- IMA nibble q is in byte p + q // 2, the low half first unless hi +@native function Adpcm.ima(src: buffer, p: number, q0: number, qs: number, count: number, hi: boolean, st: buffer, so: number, + dst: buffer, d: number, ds: number) + local pred = readi32(st, so) + local index = math.clamp(readi32(st, so + 4), 0, 88) + local q = q0 + local o = d * 4 + local os = ds * 4 + for _ = 1, count do + local b = readu8(src, p + rshift(q, 1)) + local nib + if (band(q, 1) == 0) == hi then + nib = rshift(b, 4) + else + nib = band(b, 15) + end + local diff = IMA_DIFF[index * 8 + band(nib, 7) + 1] + if nib >= 8 then + pred -= diff + if pred < -32768 then + pred = -32768 + end + else + pred += diff + if pred > 32767 then + pred = 32767 + end + end + index = IMA_NEXT[index * 16 + nib + 1] + writef32(dst, o, pred / 32768) + o += os + q += qs + end + writei32(st, so, pred) + writei32(st, so + 4, index) +end + +-- Apple ima4: 34 bytes: a big-endian header (the predictor's top 9 bits, 7-bit step index), 64 nibbles low first; +-- Apple's decoders keep the full-precision predictor while the header agrees (same step index, within 127) +@native function Adpcm.imaQt(src: buffer, p: number, st: buffer, so: number, dst: buffer, d: number, ds: number) + local h = readu8(src, p) * 256 + readu8(src, p + 1) + local pred = band(h, 0xFF80) + if pred >= 32768 then + pred -= 65536 + end + local index = band(h, 0x7F) + if index ~= readi32(st, so + 4) or math.abs(pred - readi32(st, so)) > 0x7F then + writei32(st, so, pred) + writei32(st, so + 4, index) + end + Adpcm.ima(src, p + 2, 0, 1, 64, false, st, so, dst, d, ds) +end + +-- Microsoft IMA block: per channel s16 predictor (= the first sample), u8 step index, pad; then 4-byte groups +-- (8 nibbles, low first) per channel in turn +@native function Adpcm.imaWav(src: buffer, off: number, avail: number, ch: number, spb: number, dst: buffer, d: number): number + if avail < 4 * ch then + return 0 + end + local groups = (avail - 4 * ch) // (4 * ch) + local frames = math.min(spb, 1 + groups * 8) + local o = d * 4 + for c = 0, ch - 1 do + local pred = readi16(src, off + c * 4) + local index = math.min(readu8(src, off + c * 4 + 2), 88) + writef32(dst, o + c * 4, pred / 32768) + local f = 1 + local g = 0 + while f < frames do + local p = off + 4 * ch + (g * ch + c) * 4 + local k = 0 + while k < 8 and f < frames do + local b = readu8(src, p + rshift(k, 1)) + local nib = if band(k, 1) == 0 then band(b, 15) else rshift(b, 4) + local diff = IMA_DIFF[index * 8 + band(nib, 7) + 1] + if nib >= 8 then + pred -= diff + if pred < -32768 then + pred = -32768 + end + else + pred += diff + if pred > 32767 then + pred = 32767 + end + end + index = IMA_NEXT[index * 16 + nib + 1] + writef32(dst, o + (f * ch + c) * 4, pred / 32768) + f += 1 + k += 1 + end + g += 1 + end + end + return frames +end + +local MS_ADAPT = { 230, 230, 230, 230, 307, 409, 512, 614, 768, 614, 512, 409, 307, 230, 230, 230 } +Adpcm.MS_COEF1 = { 256, 512, 0, 192, 240, 460, 392 } +Adpcm.MS_COEF2 = { 0, -256, 0, 64, 0, -208, -232 } + +-- MS ADPCM block: per channel u8 predictor index, s16 delta, s16 sample 1, s16 sample 2 (each field for every channel +-- in turn), then nibbles high first, channels interleaved per nibble; coefficients 256 = 1.0 +@native function Adpcm.msBlock(src: buffer, off: number, avail: number, ch: number, spb: number, dst: buffer, d: number, + coefs: buffer, ncoef: number, state: buffer): number + local hdr = 7 * ch + if avail < hdr or ncoef < 1 then + return 0 + end + local frames = math.min(spb, 2 + ((avail - hdr) * 2) // ch) + local o = d * 4 + for c = 0, ch - 1 do + local pi = math.min(readu8(src, off + c), ncoef - 1) + local idelta = readi16(src, off + ch + c * 2) + local s1 = readi16(src, off + 3 * ch + c * 2) + local s2 = readi16(src, off + 5 * ch + c * 2) + local so = c * 20 + writei32(state, so, readi32(coefs, pi * 8)) + writei32(state, so + 4, readi32(coefs, pi * 8 + 4)) + writei32(state, so + 8, idelta) + writei32(state, so + 12, s1) + writei32(state, so + 16, s2) + writef32(dst, o + c * 4, s2 / 32768) + if frames > 1 then + writef32(dst, o + (ch + c) * 4, s1 / 32768) + end + end + local total = (frames - 2) * ch + for k = 0, total - 1 do + local b = readu8(src, off + hdr + rshift(k, 1)) + local nib = if band(k, 1) == 0 then rshift(b, 4) else band(b, 15) + local so = (k % ch) * 20 + local c1, c2 = readi32(state, so), readi32(state, so + 4) + local idelta = readi32(state, so + 8) + local s1, s2 = readi32(state, so + 12), readi32(state, so + 16) + local p = s1 * c1 + s2 * c2 + p = if p >= 0 then p // 256 else -((-p) // 256) + p += (if nib >= 8 then nib - 16 else nib) * idelta + if p > 32767 then + p = 32767 + elseif p < -32768 then + p = -32768 + end + idelta = (MS_ADAPT[nib + 1] * idelta) // 256 + if idelta < 16 then + idelta = 16 + elseif idelta > 2796202 then -- INT_MAX / 768 + idelta = 2796202 + end + writei32(state, so + 8, idelta) + writei32(state, so + 12, p) + writei32(state, so + 16, s1) + writef32(dst, o + (2 * ch + k) * 4, p / 32768) + end + return frames +end + +local F32 = buffer.create(4) +@native local function f32(x: number): number + writef32(F32, 0, x) + return readf32(F32, 0) +end + +-- coef1, coef2 (12 fractional bits): the 2-pole high-pass predictor from the header's cutoff, in single precision as +-- CRI's decoders (and vgmstream) compute it +@native function Adpcm.adxCoefs(cutoff: number, rate: number): (number, number) + if rate <= 0 then + return 0, 0 + end + local z = f32(math.cos(f32(2 * math.pi * cutoff / rate))) + local a = f32(math.sqrt(2) - z) + local b = f32(math.sqrt(2) - 1) + local c = f32(f32(a - f32(math.sqrt(f32(f32(a + b) * f32(a - b))))) / b) + local c1 = c * 8192 + local c2 = f32(c * c) * -4096 + c1 = if c1 >= 0 then floor(c1) else -floor(-c1) + c2 = if c2 >= 0 then floor(c2) else -floor(-c2) + return c1, c2 +end + +-- ADX frame: s16 big-endian scale, 32 nibbles high first. v3 shifts each product on its own; scale 0x8001 (CRI's end +-- marker) decodes as silence +@native function Adpcm.adx(src: buffer, p: number, pstride: number, nframes: number, c1: number, c2: number, v3: boolean, + st: buffer, so: number, dst: buffer, d: number, ds: number) + local h1, h2 = readi32(st, so), readi32(st, so + 4) + local o = d * 4 + local os = ds * 4 + for f = 0, nframes - 1 do + local fp = p + f * pstride + local scale = readu8(src, fp) * 256 + readu8(src, fp + 1) + if scale == 0x8001 then + scale = 0 + elseif scale >= 32768 then + scale -= 65535 -- the signed value + 1 + else + scale += 1 + end + for k = 0, 31 do + local b = readu8(src, fp + 2 + rshift(k, 1)) + local n = if band(k, 1) == 0 then rshift(b, 4) else band(b, 15) + if n >= 8 then + n -= 16 + end + local s + if v3 then + s = n * scale + (c1 * h1) // 4096 + (c2 * h2) // 4096 + else + s = n * scale + (c1 * h1 + c2 * h2) // 4096 + end + if s > 32767 then + s = 32767 + elseif s < -32768 then + s = -32768 + end + h2 = h1 + h1 = s + writef32(dst, o, s / 32768) + o += os + end + end + writei32(st, so, h1) + writei32(st, so + 4, h2) +end + +local PSX1 = { 0, 60, 115, 98, 122 } +local PSX2 = { 0, 0, -52, -55, -60 } + +-- the filter term (c1 * h1 + c2 * h2) / 64 * 256 truncated, as vgmstream's single-precision float code computes it: +-- exact in integers while the products fit a float's 24 bits +@native local function psxPred(f: number, h1: number, h2: number): number + local x = PSX1[f] * h1 + PSX2[f] * h2 + if h1 > -65536 and h1 < 65536 and h2 > -65536 and h2 < 65536 then + return 4 * x + end + local v = f32(f32(f32(PSX1[f] / 64) * h1) + f32(f32(PSX2[f] / 64) * h2)) * 256 + return if v >= 0 then floor(v) else -floor(-v) +end + +-- PS-ADPCM frame: filter << 4 | shift, flags, 28 nibbles low first. Filters past 4 decode as 0 and shifts past 12 as 9 +-- (as vgmstream); flags 7 is silence; the history keeps the unclipped value +@native function Adpcm.psx(src: buffer, p: number, pstride: number, nframes: number, st: buffer, so: number, dst: buffer, + d: number, ds: number) + local h1, h2 = readi32(st, so), readi32(st, so + 4) + local o = d * 4 + local os = ds * 4 + for f = 0, nframes - 1 do + local fp = p + f * pstride + local head = readu8(src, fp) + local filter = rshift(head, 4) + local shift = band(head, 15) + if filter > 4 then + filter = 0 + end + if shift > 12 then + shift = 9 + end + local mul = 2 ^ (20 - shift) + local fi = filter + 1 + local silent = band(readu8(src, fp + 1), 15) == 7 + for k = 0, 27 do + local s = 0 + if not silent then + local b = readu8(src, fp + 2 + rshift(k, 1)) + local n = if band(k, 1) == 0 then band(b, 15) else rshift(b, 4) + if n >= 8 then + n -= 16 + end + s = (n * mul + psxPred(fi, h1, h2)) // 256 + end + h2 = h1 + h1 = s + if s > 32767 then + s = 32767 + elseif s < -32768 then + s = -32768 + end + writef32(dst, o, s / 32768) + o += os + end + end + writei32(st, so, h1) + writei32(st, so + 4, h2) +end + +-- DSP frame: predictor << 4 | scale shift, 14 nibbles high first; coefs 8 pairs, 11 fractional bits; a predictor +-- index past 7 uses pair 7 +@native function Adpcm.dsp(src: buffer, p: number, count: number, coefs: buffer, co: number, st: buffer, so: number, + dst: buffer, d: number, ds: number) + local h1, h2 = readi32(st, so), readi32(st, so + 4) + local o = d * 4 + local os = ds * 4 + local done = 0 + local fp = p + while done < count do + local head = readu8(src, fp) + local pi = math.min(rshift(head, 4), 7) + local scale = 2 ^ band(head, 15) * 2048 + local c1, c2 = readi32(coefs, co + pi * 8), readi32(coefs, co + pi * 8 + 4) + local n14 = math.min(14, count - done) + for k = 0, n14 - 1 do + local b = readu8(src, fp + 1 + rshift(k, 1)) + local n = if band(k, 1) == 0 then rshift(b, 4) else band(b, 15) + if n >= 8 then + n -= 16 + end + local s = (n * scale + 1024 + c1 * h1 + c2 * h2) // 2048 + if s > 32767 then + s = 32767 + elseif s < -32768 then + s = -32768 + end + h2 = h1 + h1 = s + writef32(dst, o, s / 32768) + o += os + end + done += n14 + fp += 8 + end + writei32(st, so, h1) + writei32(st, so + 4, h2) +end + +@native local function toS16(x: number): number + local v = floor(x * 32768 + 0.5) + if v ~= v then + return 0 + elseif v > 32767 then + return 32767 + elseif v < -32768 then + return -32768 + end + return v +end +Adpcm.toS16 = toS16 + +@native local function imaNibble(x: number, pred: number, index: number): number + local base = index * 8 + 1 + local best, bestErr = 0, math.huge + for m = 0, 7 do + local diff = IMA_DIFF[base + m] + local up = math.min(pred + diff, 32767) + local e = math.abs(x - up) + if e < bestErr then + best, bestErr = m, e + end + local down = math.max(pred - diff, -32768) + e = math.abs(x - down) + if e < bestErr then + best, bestErr = m + 8, e + end + end + return best +end + +@native function Adpcm.imaEncode(x: buffer, xi: number, xs: number, count: number, st: buffer, so: number, out: buffer, + p: number, q0: number, qs: number, hi: boolean) + local pred = readi32(st, so) + local index = math.clamp(readi32(st, so + 4), 0, 88) + local q = q0 + for i = 0, count - 1 do + local v = toS16(readf32(x, (xi + i * xs) * 4)) + local nib = imaNibble(v, pred, index) + local diff = IMA_DIFF[index * 8 + band(nib, 7) + 1] + pred = if nib >= 8 then math.max(pred - diff, -32768) else math.min(pred + diff, 32767) + index = IMA_NEXT[index * 16 + nib + 1] + local bp = p + rshift(q, 1) + local b = readu8(out, bp) + if (band(q, 1) == 0) == hi then + b = bor(band(b, 0x0F), lshift(nib, 4)) + else + b = bor(band(b, 0xF0), nib) + end + writeu8(out, bp, b) + q += qs + end + writei32(st, so, pred) + writei32(st, so + 4, index) +end + +-- Microsoft IMA block: spb = 1 + 8k frames, 4 * ch + (spb - 1) / 2 * ch bytes +@native function Adpcm.imaWavEncode(x: buffer, xf: number, n: number, ch: number, spb: number, st: buffer, out: buffer, off: number) + local groups = (spb - 1) // 8 + for c = 0, ch - 1 do + local so = c * 8 + local first = if n > 0 then toS16(readf32(x, (xf * ch + c) * 4)) else 0 + writei32(st, so, first) + local index = math.clamp(readi32(st, so + 4), 0, 88) + writei32(st, so + 4, index) + buffer.writei16(out, off + c * 4, first) + writeu8(out, off + c * 4 + 2, index) + writeu8(out, off + c * 4 + 3, 0) + local pred = first + for g = 0, groups - 1 do + local gp = off + 4 * ch + (g * ch + c) * 4 + for k = 0, 7 do + local f = 1 + g * 8 + k + local v = if f < n then toS16(readf32(x, ((xf + f) * ch + c) * 4)) else pred + local nib = imaNibble(v, pred, index) + local diff = IMA_DIFF[index * 8 + band(nib, 7) + 1] + pred = if nib >= 8 then math.max(pred - diff, -32768) else math.min(pred + diff, 32767) + index = IMA_NEXT[index * 16 + nib + 1] + local bp = gp + rshift(k, 1) + if band(k, 1) == 0 then + writeu8(out, bp, nib) + else + writeu8(out, bp, bor(readu8(out, bp), lshift(nib, 4))) + end + end + end + writei32(st, so + 4, index) + end +end + +@native local function msTrial(xs: { number }, n: number, c1: number, c2: number, delta0: number, nibs: { number }?): number + local s1, s2 = xs[2], xs[1] + local idelta = delta0 + local err = 0 + for i = 3, n do + local p = s1 * c1 + s2 * c2 + p = if p >= 0 then p // 256 else -((-p) // 256) + local e = xs[i] - p + local nib = if e >= 0 then (e + idelta // 2) // idelta else -((-e + idelta // 2) // idelta) + nib = math.clamp(nib, -8, 7) + local v = math.clamp(p + nib * idelta, -32768, 32767) + err += (xs[i] - v) * (xs[i] - v) + if nibs then + nibs[i] = band(nib, 15) + end + idelta = math.clamp((MS_ADAPT[band(nib, 15) + 1] * idelta) // 256, 16, 2796202) + s2 = s1 + s1 = v + end + return err +end + +-- MS ADPCM block (standard 7 coefficient pairs): 7 * ch + (spb - 2) * ch / 2 bytes +@native function Adpcm.msEncode(x: buffer, xf: number, n: number, ch: number, spb: number, out: buffer, off: number) + local C1, C2 = Adpcm.MS_COEF1, Adpcm.MS_COEF2 + local xs = table.create(spb, 0) + local nibs = table.create(spb, 0) + local all = table.create(spb * ch, 0) + for c = 0, ch - 1 do + for i = 1, spb do + xs[i] = if i <= n then toS16(readf32(x, ((xf + i - 1) * ch + c) * 4)) else 0 + end + local sum = 0 + for i = 3, math.min(spb, 10) do + sum += math.abs(xs[i] - xs[i - 1]) + end + local delta0 = math.clamp(sum // 16, 16, 32767) + local best, bestErr = 1, math.huge + for k = 1, 7 do + local e = msTrial(xs, spb, C1[k], C2[k], delta0, nil) + if e < bestErr then + best, bestErr = k, e + end + end + msTrial(xs, spb, C1[best], C2[best], delta0, nibs) + writeu8(out, off + c, best - 1) + writeu16(out, off + ch + c * 2, delta0) + buffer.writei16(out, off + 3 * ch + c * 2, xs[2] or 0) + buffer.writei16(out, off + 5 * ch + c * 2, xs[1]) + for i = 3, spb do + all[(i - 3) * ch + c + 1] = nibs[i] + end + end + local total = (spb - 2) * ch + for k = 0, total - 1, 2 do + writeu8(out, off + 7 * ch + k // 2, all[k + 1] * 16 + (all[k + 2] or 0)) + end +end + +@native local function adxTrial(xs: { number }, scale: number, c1: number, c2: number, h1: number, h2: number, nibs: { number }?): (number, number, number) + local err = 0 + for k = 1, 32 do + local pred = (c1 * h1 + c2 * h2) // 4096 + local e = xs[k] - pred + local n = if e >= 0 then (e + scale // 2) // scale else -((-e + scale // 2) // scale) + n = math.clamp(n, -8, 7) + local s = math.clamp(n * scale + pred, -32768, 32767) + err += (xs[k] - s) * (xs[k] - s) + if nibs then + nibs[k] = band(n, 15) + end + h2 = h1 + h1 = s + end + return err, h1, h2 +end + +-- ADX v4 rounding; the scale is stored minus one as CRI's decoders add it back +-- (v4 rounding, the scale stored minus one as CRI's decoders add it back) at out[p], pstride bytes apart; the frame +@native function Adpcm.adxEncode(x: buffer, xi: number, xs: number, count: number, c1: number, c2: number, st: buffer, so: number, + out: buffer, p: number, pstride: number) + local h1, h2 = readi32(st, so), readi32(st, so + 4) + local v = table.create(32, 0) + local nibs = table.create(32, 0) + for f = 0, (count + 31) // 32 - 1 do + local peak = 0 + local a, b = h1, h2 + for k = 1, 32 do + local i = f * 32 + k - 1 + local s = if i < count then toS16(readf32(x, (xi + i * xs) * 4)) else 0 + v[k] = s + peak = math.max(peak, math.abs(s - (c1 * a + c2 * b) // 4096)) + b = a + a = s + end + local base = math.max(1, (peak + 6) // 7) + local best, bestErr = base, math.huge + for _, m in { 1, 0.75, 1.25, 0.5, 1.6 } do + local sc = math.clamp(floor(base * m + 0.5), 1, 0x7FFF) + local e = adxTrial(v, sc, c1, c2, h1, h2, nil) + if e < bestErr then + best, bestErr = sc, e + end + end + local _, n1, n2 = adxTrial(v, best, c1, c2, h1, h2, nibs) + h1, h2 = n1, n2 + local fp = p + f * pstride + writeu8(out, fp, rshift(best - 1, 8)) + writeu8(out, fp + 1, band(best - 1, 255)) + for k = 0, 15 do + writeu8(out, fp + 2 + k, nibs[k * 2 + 1] * 16 + nibs[k * 2 + 2]) + end + end + writei32(st, so, h1) + writei32(st, so + 4, h2) +end + +@native function Adpcm.psxEncode(x: buffer, xi: number, xs: number, count: number, st: buffer, so: number, out: buffer, + p: number, pstride: number) + local h1, h2 = readi32(st, so), readi32(st, so + 4) + local v = table.create(28, 0) + local nibs = table.create(28, 0) + for f = 0, (count + 27) // 28 - 1 do + for k = 1, 28 do + local i = f * 28 + k - 1 + v[k] = if i < count then toS16(readf32(x, (xi + i * xs) * 4)) else 0 + end + local bestErr, bestHead = math.huge, 0 + for fi = 1, 5 do + for shift = 0, 12 do + local mul = 2 ^ (20 - shift) + local a, b = h1, h2 + local err = 0 + for k = 1, 28 do + local pred = psxPred(fi, a, b) + local n = floor((v[k] * 256 - pred) / mul + 0.5) + n = if n > 7 then 7 elseif n < -8 then -8 else n + local s = (n * mul + pred) // 256 + local c = if s > 32767 then 32767 elseif s < -32768 then -32768 else s + err += (v[k] - c) * (v[k] - c) + if err >= bestErr then + break + end + b = a + a = s + end + if err < bestErr then + bestErr, bestHead = err, (fi - 1) * 16 + shift + end + end + end + local fi, shift = rshift(bestHead, 4) + 1, band(bestHead, 15) + local mul = 2 ^ (20 - shift) + for k = 1, 28 do + local pred = psxPred(fi, h1, h2) + local n = math.clamp(floor((v[k] * 256 - pred) / mul + 0.5), -8, 7) + nibs[k] = band(n, 15) + h2 = h1 + h1 = (n * mul + pred) // 256 + end + local fp = p + f * pstride + writeu8(out, fp, bestHead) + writeu8(out, fp + 1, 0) + for k = 0, 13 do + writeu8(out, fp + 2 + k, nibs[k * 2 + 1] + nibs[k * 2 + 2] * 16) + end + end + writei32(st, so, h1) + writei32(st, so + 4, h2) +end + +-- ModPlug / OpenMPT ADPCM (sample data marked 0xAD): 16 signed byte deltas, then nibbles low first, each adding its +-- delta to a wrapping signed byte; value / 128 +@native function Adpcm.modplug(src: buffer, p: number, count: number, dst: buffer, d: number) + local tab = table.create(16, 0) + for k = 0, 15 do + tab[k + 1] = buffer.readi8(src, p + k) + end + local v = 0 + for i = 0, count - 1 do + local b = readu8(src, p + 16 + rshift(i, 1)) + local nib = if band(i, 1) == 0 then band(b, 15) else rshift(b, 4) + v = (v + tab[nib + 1] + 128) % 256 - 128 + writef32(dst, (d + i) * 4, v / 128) + end +end + +-- The SWF / FLV ADPCM (SoundFormat 1, Adobe's SWF specification, "ADPCM compression"): an MSB-first bit stream of +-- 2 bits (code size - 2), then blocks of 4096 frames: per channel a signed 16-bit first sample and a 6-bit step +-- index, then 4095 frames of `bits`-bit codes, channels interleaved. A code is IMA generalised to 2..5 bits: sign in +-- the top bit, the magnitude bits adding step, step/2, ... and the final step/2^(bits-1) (as ffmpeg's adpcm_swf and +-- the spec's reference decoder do); the step index moves by SWF_INDEX[bits]. The last block may be short. +local SWF_INDEX: { { number } } = { + { -1, 2 }, + { -1, -1, 2, 4 }, + { -1, -1, -1, -1, 2, 4, 6, 8 }, + { -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16 }, +} + +@native function Adpcm.swfFrames(src: buffer, p: number, n: number, ch: number): number + if n < 1 or ch < 1 then + return 0 + end + local bits = rshift(readu8(src, p), 6) + 2 + local total = n * 8 - 2 + local hdr = 22 * ch + local block = hdr + bits * ch * 4095 + local blocks = total // block + local left = total - blocks * block + local frames = blocks * 4096 + if left >= hdr then + frames += 1 + (left - hdr) // (bits * ch) + end + return frames +end + +@native local function msb(src: buffer, p: number, e: number, pos: number, k: number): number + local q = p + rshift(pos, 3) + local v = readu8(src, q) * 65536 + if q + 1 < e then + v += readu8(src, q + 1) * 256 + end + if q + 2 < e then + v += readu8(src, q + 2) + end + return band(rshift(v, 24 - band(pos, 7) - k), lshift(1, k) - 1) +end + +@native function Adpcm.swf(src: buffer, p: number, n: number, ch: number, dst: buffer, d: number): number + local frames = Adpcm.swfFrames(src, p, n, ch) + if frames == 0 then + return 0 + end + local e = p + n + local bits = rshift(readu8(src, p), 6) + 2 + local tab = SWF_INDEX[bits - 1] + local k0 = lshift(1, bits - 2) + local sign = lshift(1, bits - 1) + local mask = sign - 1 + local pred = table.create(ch, 0) + local index = table.create(ch, 0) + local pos = 2 + local o = d * 4 + local done = 0 + while done < frames do + for c = 1, ch do + local v = msb(src, p, e, pos, 16) + if v >= 32768 then + v -= 65536 + end + pred[c] = v + index[c] = msb(src, p, e, pos + 16, 6) + pos += 22 + writef32(dst, o, v / 32768) + o += 4 + end + done += 1 + local m = math.min(4095, frames - done) + for _ = 1, m do + for c = 1, ch do + local code = msb(src, p, e, pos, bits) + pos += bits + local step = IMA_STEP[math.clamp(index[c], 0, 88) + 1] + local diff = 0 + local k = k0 + while k > 0 do + if band(code, k) ~= 0 then + diff += step + end + step = rshift(step, 1) + k = rshift(k, 1) + end + diff += step + local v = pred[c] + if band(code, sign) ~= 0 then + v -= diff + else + v += diff + end + v = math.clamp(v, -32768, 32767) + pred[c] = v + index[c] = math.clamp(index[c] + tab[band(code, mask) + 1], 0, 88) + writef32(dst, o, v / 32768) + o += 4 + end + end + done += m + end + return frames +end + +return Adpcm +end __FILES["codecs/audio/Adpcm/Decoder"] = function() @@ -100247,6 +96897,19 @@ end return Decoder end +end + + + + + + codecs_audio_Alac + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_audio_Alac (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (2 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/audio/Alac"] = function() @@ -101313,6 +97976,19 @@ end return Encode end +end + + + + + + codecs_audio_Ape + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_audio_Ape (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/audio/Ape"] = function() @@ -102388,6 +99064,19 @@ end return ApeTag end +end + + + + + + codecs_audio_Mdct + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_audio_Mdct (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (2 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/audio/Mdct"] = @native function() @@ -103209,6 +99898,19 @@ end return Render end +end + + + + + + codecs_audio_Pcm + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_audio_Pcm (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (2 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/audio/Pcm"] = function() @@ -104052,6 +100754,19 @@ end return Qoa end +end + + + + + + codecs_audio_Resample + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_audio_Resample (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 5 modules (2 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/audio/Resample"] = @native function() @@ -105036,13 +101751,13 @@ end - + - codecs_compress + codecs_compress_Bzip2 --!optimize 2 --!nocheck --- rosetta chunk codecs_compress (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 11 modules (10 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk codecs_compress_Bzip2 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (3 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["codecs/compress/Bzip2"] = function() @@ -106067,6 +102782,19 @@ end return Lz4 end +end + + + + + + codecs_compress_Lzh + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_compress_Lzh (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (3 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/compress/Lzh"] = @native function() @@ -107373,6 +104101,19 @@ end return Lzx end +end + + + + + + codecs_compress_PackBits + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_compress_PackBits (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (4 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/compress/PackBits"] = @native function() @@ -108077,12 +104818,12 @@ end - + - codecs_entropy + codecs_entropy_Huffman --!optimize 2 --!nocheck --- rosetta chunk codecs_entropy (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- rosetta chunk codecs_entropy_Huffman (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. -- 4 modules (3 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) @@ -108853,13 +105594,13 @@ end - + - codecs_font + codecs_font_Bitmap --!optimize 2 --!nocheck --- rosetta chunk codecs_font (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 6 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk codecs_font_Bitmap (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["codecs/font/Bitmap"] = function() @@ -109854,6 +106595,19 @@ end return GlyphNames end +end + + + + + + codecs_font_TrueType + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_font_TrueType (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/font/TrueType"] = function() -- codecs/font/TrueType: the sfnt container (.ttf, .otf with CFF outlines, .ttc collections) as the standard Font value. @@ -111066,13 +107820,13 @@ end - + - codecs_image + codecs_image_Blend --!optimize 2 --!nocheck --- rosetta chunk codecs_image (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 9 modules (7 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk codecs_image_Blend (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (3 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["codecs/image/Blend"] = @native function() @@ -111821,6 +108575,19 @@ end return Half end +end + + + + + + codecs_image_Miptex + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_image_Miptex (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/image/Miptex"] = function() -- codecs/image/Miptex: Quake / GoldSrc mip textures and the WAD2 / WAD3 lump directory, read and write. @@ -112441,6 +109208,19 @@ end return Pixels end +end + + + + + + codecs_image_Quantize + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_image_Quantize (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/image/Quantize"] = @native function() @@ -112902,6 +109682,19 @@ end return Quantize end +end + + + + + + codecs_image_Raster + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_image_Raster (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/image/Raster"] = @native function() @@ -113599,6 +110392,19 @@ end return Raster end +end + + + + + + codecs_image_Texel + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_image_Texel (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (2 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/image/Texel"] = @native function() @@ -114117,17 +110923,338 @@ end return Texture end +__FILES["codecs/image/Yuv"] = @native function() + + + +-- codecs/image/Yuv: planar 4:2:0 Y'CbCr <-> rgba8, BT.601 / BT.709, limited or full range. +-- yuv -> rgb: nearest chroma, swscale's default 16-bit coefficients (within about one level of ffmpeg -pix_fmt rgba); +-- rgb -> yuv: each 2x2 block averaged for the chroma. +local Types = __include("Types") + +local readu8, writeu8, writeu32 = buffer.readu8, buffer.writeu8, buffer.writeu32 +local bcreate = buffer.create +local floor = math.floor + +local Yuv = {} + +-- coefficients (x 65536): r = y' + crv * v; g = y' - cgu * u - cgv * v; b = y' + cbu * u +-- limited: y' = (y - 16) * 255 / 219, chroma scaled by 255 / 224 +local MATRIX: { [string]: { kr: number, kb: number } } = { + bt601 = { kr = 0.299, kb = 0.114 }, + bt709 = { kr = 0.2126, kb = 0.0722 }, +} + +type Coeffs = { ys: number, yo: number, crv: number, cgu: number, cgv: number, cbu: number, cs: number, yt: { number } } + +local cache: { [string]: Coeffs } = {} +@native local function coeffs(range: string?, matrix: string?): Coeffs + local key = (range or "limited") .. (matrix or "bt601") + local c = cache[key] + if c then + return c + end + local m = MATRIX[matrix or "bt601"] or MATRIX.bt601 + local kr, kb = m.kr, m.kb + local kg = 1 - kr - kb + local full = range == "full" + local ys = if full then 1 else 255 / 219 + local cs = if full then 1 else 255 / 224 + c = { + ys = floor(ys * 65536 + 0.5), + yo = if full then 0 else 16, + crv = floor(2 * (1 - kr) * cs * 65536 + 0.5), + cbu = floor(2 * (1 - kb) * cs * 65536 + 0.5), + cgu = floor(2 * (1 - kb) * kb / kg * cs * 65536 + 0.5), + cgv = floor(2 * (1 - kr) * kr / kg * cs * 65536 + 0.5), + cs = cs, + yt = table.create(256, 0), + } + for v = 0, 255 do + c.yt[v + 1] = (c.ys * (v - c.yo) + 32768) // 65536 + 1024 + end + cache[key] = c + return c +end + +local CLIP = bcreate(2304) +for i = 0, 2303 do + writeu8(CLIP, i, math.clamp(i - 1024, 0, 255)) +end +-- CLIP's values shifted into their rgba8 byte (CB carries the alpha); indexes stay within 600..1700 +local CR: { number } = table.create(2304, 0) +local CG: { number } = table.create(2304, 0) +local CB: { number } = table.create(2304, 0) +for i = 1, 2304 do + local v = math.clamp(i - 1024, 0, 255) + CR[i] = v + CG[i] = v * 256 + CB[i] = v * 65536 + 0xff000000 +end + +-- hook: called (through pcall) every 16 rows, a cooperative yield point +@native function Yuv.toRgba(src: buffer, w: number, h: number, uo: number, vo: number, cw: number, range: string?, matrix: string?, out: buffer?, hook: (() -> ())?): buffer + local dst = out or bcreate(w * h * 4) + local c = coeffs(range, matrix) + local crv, cgu, cgv, cbu = c.crv, c.cgu, c.cgv, c.cbu + local yt, cr, cg, cb = c.yt, CR, CG, CB + local ch = (h + 1) // 2 + if buffer.len(src) < vo + cw * ch or buffer.len(dst) < w * h * 4 or uo + cw * ch > buffer.len(src) then + return dst + end + local w2 = w // 2 + local stride = w * 4 + for y = 0, h - 1, 2 do + if hook and y % 16 == 0 and y > 0 then + pcall(hook) + end + local yrow = y * w + local ci = uo + (y // 2) * cw + local dv = vo - uo + local o = yrow * 4 + local two = y + 1 < h + for _ = 1, w2 do + local u = readu8(src, ci) - 128 + local v = readu8(src, ci + dv) - 128 + ci += 1 + local rv = (crv * v + 32768) // 65536 + local gv = -((cgu * u + cgv * v + 32768) // 65536) + local bu = (cbu * u + 32768) // 65536 + local yy = yt[readu8(src, yrow) + 1] + writeu32(dst, o, cr[yy + rv] + cg[yy + gv] + cb[yy + bu]) + yy = yt[readu8(src, yrow + 1) + 1] + writeu32(dst, o + 4, cr[yy + rv] + cg[yy + gv] + cb[yy + bu]) + if two then + yy = yt[readu8(src, yrow + w) + 1] + writeu32(dst, o + stride, cr[yy + rv] + cg[yy + gv] + cb[yy + bu]) + yy = yt[readu8(src, yrow + w + 1) + 1] + writeu32(dst, o + stride + 4, cr[yy + rv] + cg[yy + gv] + cb[yy + bu]) + end + yrow += 2 + o += 8 + end + if w % 2 == 1 then + local u = readu8(src, ci) - 128 + local v = readu8(src, ci + dv) - 128 + local rv = (crv * v + 32768) // 65536 + local gv = -((cgu * u + cgv * v + 32768) // 65536) + local bu = (cbu * u + 32768) // 65536 + local yy = yt[readu8(src, yrow) + 1] + writeu32(dst, o, cr[yy + rv] + cg[yy + gv] + cb[yy + bu]) + if two then + yy = yt[readu8(src, yrow + w) + 1] + writeu32(dst, o + stride, cr[yy + rv] + cg[yy + gv] + cb[yy + bu]) + end + end + end + return dst +end + +@native function Yuv.fromRgba(src: buffer, w: number, h: number, range: string?, matrix: string?, out: buffer?): buffer + local cw, ch = (w + 1) // 2, (h + 1) // 2 + local uo, vo = w * h, w * h + cw * ch + local dst = out or bcreate(w * h + 2 * cw * ch) + if buffer.len(src) < w * h * 4 or buffer.len(dst) < w * h + 2 * cw * ch then + return dst + end + local m = MATRIX[matrix or "bt601"] or MATRIX.bt601 + local kr, kb = m.kr, m.kb + local kg = 1 - kr - kb + local full = range == "full" + local ysc = if full then 1 else 219 / 255 + local csc = if full then 1 else 224 / 255 + local yof = if full then 0.5 else 16.5 + local yr, yg, yb = floor(kr * ysc * 65536 + 0.5), floor(kg * ysc * 65536 + 0.5), floor(kb * ysc * 65536 + 0.5) + local yoff = floor(yof * 65536) + local ur = floor(-kr / (2 * (1 - kb)) * csc * 65536 + 0.5) + local ug = floor(-kg / (2 * (1 - kb)) * csc * 65536 + 0.5) + local ub = floor(0.5 * csc * 65536 + 0.5) + local vr = ub + local vg = floor(-kg / (2 * (1 - kr)) * csc * 65536 + 0.5) + local vb = floor(-kb / (2 * (1 - kr)) * csc * 65536 + 0.5) + local coff4 = floor(128.5 * 65536) * 4 + for i = 0, w * h - 1 do + local o = i * 4 + local r, g, b = readu8(src, o), readu8(src, o + 1), readu8(src, o + 2) + writeu8(dst, i, readu8(CLIP, (yr * r + yg * g + yb * b + yoff) // 65536 + 1024)) + end + for cy = 0, ch - 1 do + local y0 = cy * 2 + local y1 = if y0 + 1 < h then y0 + 1 else y0 + for cx = 0, cw - 1 do + local x0 = cx * 2 + local x1 = if x0 + 1 < w then x0 + 1 else x0 + local a, b2, c2, d = (y0 * w + x0) * 4, (y0 * w + x1) * 4, (y1 * w + x0) * 4, (y1 * w + x1) * 4 + local r = readu8(src, a) + readu8(src, b2) + readu8(src, c2) + readu8(src, d) + local g = readu8(src, a + 1) + readu8(src, b2 + 1) + readu8(src, c2 + 1) + readu8(src, d + 1) + local b = readu8(src, a + 2) + readu8(src, b2 + 2) + readu8(src, c2 + 2) + readu8(src, d + 2) + local i = cy * cw + cx + writeu8(dst, uo + i, readu8(CLIP, (ur * r + ug * g + ub * b + coff4) // 262144 + 1024)) + writeu8(dst, vo + i, readu8(CLIP, (vr * r + vg * g + vb * b + coff4) // 262144 + 1024)) + end + end + return dst +end + +@native local function info(img: Types.Image): (string, string) + local m = img.meta + local y = m and m.yuv + if type(y) == "table" then + return y.range or "limited", y.matrix or "bt601" + end + local src = m and m.source + if type(src) == "table" and src.range == "full" then + return "full", "bt601" + end + return "limited", "bt601" +end +Yuv.info = info + +@native function Yuv.planes(w: number, h: number): (number, number, number, number) + local cw, ch = (w + 1) // 2, (h + 1) // 2 + return w * h, w * h + cw * ch, cw, ch +end + +local FULL_Y = bcreate(256) +local FULL_C = bcreate(256) +for v = 0, 255 do + writeu8(FULL_Y, v, math.clamp(floor((v - 16) * 255 / 219 + 0.5), 0, 255)) + writeu8(FULL_C, v, math.clamp(floor((v - 128) * 255 / 224 + 128.5), 0, 255)) +end + +@native function Yuv.toFullRange(img: Types.Image): Types.Image + if img.format ~= "yuv420p" or info(img) == "full" then + return img + end + local w, h = img.width, img.height + local out = Types.Image.new(w, h, "yuv420p") + local src, dst = img.pixels, out.pixels + local ny = w * h + local n = math.min(buffer.len(src), buffer.len(dst)) + for i = 0, math.min(ny, n) - 1 do + writeu8(dst, i, readu8(FULL_Y, readu8(src, i))) + end + for i = ny, n - 1 do + writeu8(dst, i, readu8(FULL_C, readu8(src, i))) + end + out.meta.yuv = { range = "full", matrix = select(2, info(img)) } + out.meta.source = img.meta.source + return out +end + +-- out: an rgba8 Image of the same size to write into (else a new one) +@native function Yuv.imageToRgba(img: Types.Image, out: Types.Image?, hook: (() -> ())?): Types.Image? + if img.format == "rgba8" then + return img + end + if img.format ~= "yuv420p" then + return nil + end + local w, h = img.width, img.height + local uo, vo, cw = Yuv.planes(w, h) + local range, matrix = info(img) + if not out or out.format ~= "rgba8" or out.width ~= w or out.height ~= h or buffer.len(out.pixels) < w * h * 4 then + out = Types.Image.new(w, h, "rgba8") + end + local o = out :: Types.Image + Yuv.toRgba(img.pixels, w, h, uo, vo, cw, range, matrix, o.pixels, hook) + o.meta.source = img.meta.source + return o +end + +@native function Yuv.imageFromRgba(img: Types.Image, range: string?, matrix: string?): Types.Image? + if img.format == "yuv420p" then + return img + end + if img.format ~= "rgba8" then + return nil + end + local out = Types.Image.new(img.width, img.height, "yuv420p") + Yuv.fromRgba(img.pixels, img.width, img.height, range, matrix, out.pixels) + out.meta.yuv = { range = range or "limited", matrix = matrix or "bt601" } + out.meta.source = img.meta.source + return out +end + +@native local function scalePlane(src: buffer, so: number, sw: number, sh: number, dst: buffer, d0: number, dw: number, dh: number, hook: (() -> ())?) + local fx, fy = sw / dw, sh / dh + for y = 0, dh - 1 do + if hook and y % 16 == 15 then + pcall(hook) + end + local sy = (y + 0.5) * fy - 0.5 + if sy < 0 then + sy = 0 + end + local y0 = floor(sy) + if y0 > sh - 1 then + y0 = sh - 1 + end + local y1 = if y0 < sh - 1 then y0 + 1 else y0 + local wy = floor((sy - y0) * 256) + local r0, r1 = so + y0 * sw, so + y1 * sw + local o = d0 + y * dw + for x = 0, dw - 1 do + local sx = (x + 0.5) * fx - 0.5 + if sx < 0 then + sx = 0 + end + local x0 = floor(sx) + if x0 > sw - 1 then + x0 = sw - 1 + end + local x1 = if x0 < sw - 1 then x0 + 1 else x0 + local wx = floor((sx - x0) * 256) + local a = readu8(src, r0 + x0) * (256 - wx) + readu8(src, r0 + x1) * wx + local b = readu8(src, r1 + x0) * (256 - wx) + readu8(src, r1 + x1) * wx + writeu8(dst, o + x, (a * (256 - wy) + b * wy + 32768) // 65536) + end + end +end + +@native function Yuv.scale(src: buffer, w: number, h: number, width: number, height: number, out: buffer?, hook: (() -> ())?): buffer + local dw: number = math.max(1, floor(width)) + local dh: number = math.max(1, floor(height)) + local cw: number = (w + 1) // 2 + local ch: number = (h + 1) // 2 + local dcw: number = (dw + 1) // 2 + local dch: number = (dh + 1) // 2 + local size = dw * dh + 2 * dcw * dch + local dst = if out and buffer.len(out) >= size then out else bcreate(size) + if w < 1 or h < 1 or buffer.len(src) < w * h + 2 * cw * ch then + return dst + end + scalePlane(src, 0, w, h, dst, 0, dw, dh, hook) + scalePlane(src, w * h, cw, ch, dst, dw * dh, dcw, dch, hook) + scalePlane(src, w * h + cw * ch, cw, ch, dst, dw * dh + dcw * dch, dcw, dch, hook) + return dst +end + +-- out: a yuv420p Image of the target size to write into (else a new one) +@native function Yuv.imageScale(img: Types.Image, dw: number, dh: number, out: Types.Image?, hook: (() -> ())?): Types.Image + local tw, th = math.max(1, floor(dw)), math.max(1, floor(dh)) + if not out or out.format ~= "yuv420p" or out.width ~= tw or out.height ~= th then + out = Types.Image.new(tw, th, "yuv420p") + end + local o = out :: Types.Image + Yuv.scale(img.pixels, img.width, img.height, tw, th, o.pixels, hook) + o.meta = table.clone(img.meta or {}) + return o +end + +return Yuv +end end - + - codecs_model + codecs_model_Brush --!optimize 2 --!nocheck --- rosetta chunk codecs_model (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 23 modules (5 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk codecs_model_Brush (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["codecs/model/Brush"] = @native function() @@ -114919,6 +112046,19 @@ end return Displacement end +end + + + + + + codecs_model_DoomMap + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_model_DoomMap (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/model/DoomMap"] = function() -- codecs/model/DoomMap: Doom / Heretic / Hexen binary map lumps (Hexen when BEHAVIOR is present) and UDMF TEXTMAP to @@ -115873,6 +113013,19 @@ end return Mat4 end +end + + + + + + codecs_model_MeshFlatten + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_model_MeshFlatten (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/model/MeshFlatten"] = function() -- codecs/model/MeshFlatten: a Scene to one world-space mesh, for the writers of mesh-only formats (STL, PLY, OFF). @@ -116401,6 +113554,19 @@ end return Flatten end +end + + + + + + codecs_model_Minecraft + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_model_Minecraft (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/model/Minecraft"] = function() -- codecs/model/Minecraft: what Minecraft's voxel formats share (model/schematic, model/mca). New code. @@ -117345,6 +114511,19 @@ end return Packed end +end + + + + + + codecs_model_Patch + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_model_Patch (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/model/Patch"] = @native function() @@ -117703,6 +114882,256 @@ end return Polygon end +end + + + + + + codecs_model_Rbx + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_model_Rbx (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) +__FILES["codecs/model/Rbx"] = function() + +-- codecs/model/Rbx: the Roblox instance tree and property values shared by model/rbxm and model/rbxmx. +-- Written from the rbx-dom format notes (docs/binary.md, docs/xml.md); checked against rbx-dom through rojo / lune. +-- Faces: bits Right 1, Top 2, Back 4, Left 8, Bottom 16, Front 32 +-- Axes: bits X 1, Y 2, Z 4 +-- UniqueId: 32 hex digits: random (16), time (8), index (8) + +local Rbx = {} + +type Value = { type: string, value: any } +type Instance = { + className: string, + name: string, + properties: { [string]: Value }, + children: { Instance }, + parent: Instance?, + referent: string?, + service: boolean?, -- a service (binary INST object format 1; rbxl roots) +} +type Tree = { + kind: "rbxtree", + roots: { Instance }, + place: boolean, + metadata: { [string]: string }, -- binary META / XML <Meta> entries (ExplicitAutoJoints, ...) + extra: { any }, + meta: { source: { format: string, [string]: any }?, [string]: any }, +} + +function Rbx.tree(place: boolean?): Tree + return { kind = "rbxtree", roots = {}, place = place == true, metadata = {}, extra = {}, meta = {} } +end + +function Rbx.instance(className: string, name: string?): Instance + return { className = className, name = name or className, properties = {}, children = {} } +end + +function Rbx.add(parent: any, child: Instance): Instance + if parent.kind == "rbxtree" then + child.parent = nil + table.insert(parent.roots, child) + else + child.parent = parent + table.insert(parent.children, child) + end + return child +end + +function Rbx.set(inst: Instance, name: string, typ: string, value: any) + inst.properties[name] = { type = typ, value = value } +end + +function Rbx.get(inst: Instance, name: string): any + local v = inst.properties[name] + return if v then v.value else nil +end + +function Rbx.descendants(root: any): () -> (Instance?, number?) + local stack: { any } = {} + local list = if root.kind == "rbxtree" then root.roots else root.children + for i = #list, 1, -1 do + table.insert(stack, { list[i], 1 }) + end + return function(): (Instance?, number?) + local top = table.remove(stack) + if not top then + return nil, nil + end + local inst, depth = top[1], top[2] + for i = #inst.children, 1, -1 do + table.insert(stack, { inst.children[i], depth + 1 }) + end + return inst, depth + end +end + +function Rbx.list(tree: any): { Instance } + local out = {} + for inst in Rbx.descendants(tree) do + table.insert(out, inst :: Instance) + end + return out +end + +function Rbx.find(root: any, path: string): Instance? + local cur: any = root + for part in string.gmatch(path, "[^/]+") do + local list = if cur.kind == "rbxtree" then cur.roots else cur.children + local found = nil + for _, c in list do + if c.name == part then + found = c + break + end + end + if not found then + return nil + end + cur = found + end + return if cur.kind == "rbxtree" then nil else cur +end + +function Rbx.fullName(inst: Instance): string + local parts = {} + local cur: Instance? = inst + while cur do + table.insert(parts, 1, cur.name) + cur = cur.parent + end + return table.concat(parts, ".") +end + +-- The binary format stores axis-aligned rotations as one byte: id = 6 * n(RightVector) + n(UpVector) + 1, where n is +-- the NormalId of a unit axis (+X 0, +Y 1, +Z 2, -X 3, -Y 4, -Z 5) and the third column is their cross product. +local AXES = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 }, { -1, 0, 0 }, { 0, -1, 0 }, { 0, 0, -1 } } + +local ROTATIONS: { [number]: { number } } = {} +for a = 0, 5 do + for b = 0, 5 do + if a % 3 ~= b % 3 then + local r, u = AXES[a + 1], AXES[b + 1] + local k = { r[2] * u[3] - r[3] * u[2], r[3] * u[1] - r[1] * u[3], r[1] * u[2] - r[2] * u[1] } + -- columns: right, up, back (= right x up) + ROTATIONS[6 * a + b + 1] = { r[1], u[1], k[1] + 0, r[2], u[2], k[2] + 0, r[3], u[3], k[3] + 0 } + end + end +end +Rbx.ROTATIONS = ROTATIONS + +local function axisIndex(x: number, y: number, z: number): number? + for i, a in AXES do + if a[1] == x and a[2] == y and a[3] == z then + return i - 1 + end + end + return nil +end + +function Rbx.rotationId(cf: { number }): number + local a = axisIndex(cf[4], cf[7], cf[10]) + local b = axisIndex(cf[5], cf[8], cf[11]) + if not a or not b then + return 0 + end + local id = 6 * a + b + 1 + local rot = ROTATIONS[id] + if not rot or rot[3] ~= cf[6] or rot[6] ~= cf[9] or rot[9] ~= cf[12] then + return 0 + end + return id +end + +-- binary type ids (rbx-dom docs/binary.md) by type name, and back +Rbx.TYPE_IDS = table.freeze({ + String = 0x01, + BinaryString = 0x01, + ProtectedString = 0x01, + ContentId = 0x01, + Bool = 0x02, + Int32 = 0x03, + Float32 = 0x04, + Float64 = 0x05, + UDim = 0x06, + UDim2 = 0x07, + Ray = 0x08, + Faces = 0x09, + Axes = 0x0A, + BrickColor = 0x0B, + Color3 = 0x0C, + Vector2 = 0x0D, + Vector3 = 0x0E, + Vector2int16 = 0x0F, + CFrame = 0x10, + Enum = 0x12, + Ref = 0x13, + Vector3int16 = 0x14, + NumberSequence = 0x15, + ColorSequence = 0x16, + NumberRange = 0x17, + Rect = 0x18, + PhysicalProperties = 0x19, + Color3uint8 = 0x1A, + Int64 = 0x1B, + SharedString = 0x1C, + Bytecode = 0x1D, + OptionalCFrame = 0x1E, + UniqueId = 0x1F, + Font = 0x20, + SecurityCapabilities = 0x21, + Content = 0x22, +} :: { [string]: number }) +local NAMES: { [number]: string } = {} +for name, id in Rbx.TYPE_IDS do + if NAMES[id] == nil or name == "String" then + NAMES[id] = name + end +end +Rbx.TYPE_NAMES = table.freeze(NAMES) + +-- BrickColor 194 (Medium stone grey) is Roblox's default +local IDENTITY_CF = { 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 } +function Rbx.default(typ: string): any + if typ == "String" or typ == "BinaryString" or typ == "ProtectedString" or typ == "ContentId" or typ == "Bytecode" or typ == "SharedString" then + return "" + elseif typ == "Bool" then + return false + elseif typ == "BrickColor" then + return 194 + elseif typ == "UDim" or typ == "NumberRange" or typ == "Vector2" or typ == "Vector2int16" then + return { 0, 0 } + elseif typ == "UDim2" or typ == "Rect" then + return { 0, 0, 0, 0 } + elseif typ == "Vector3" or typ == "Vector3int16" or typ == "Color3" or typ == "Color3uint8" then + return { 0, 0, 0 } + elseif typ == "Ray" then + return { 0, 0, 0, 0, 0, 0 } + elseif typ == "CFrame" then + return table.clone(IDENTITY_CF) + elseif typ == "NumberSequence" then + return { { 0, 0, 0 }, { 1, 0, 0 } } + elseif typ == "ColorSequence" then + return { { 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0 } } + elseif typ == "UniqueId" then + return string.rep("0", 32) + elseif typ == "Font" then + return { family = "rbxasset://fonts/families/SourceSansPro.json", weight = 400, style = "Normal" } + elseif typ == "PhysicalProperties" or typ == "Ref" or typ == "OptionalCFrame" or typ == "Content" then + return nil + end + return 0 +end + +Rbx.STRINGS = table.freeze({ String = true, BinaryString = true, ProtectedString = true, ContentId = true, Bytecode = true } :: { [string]: boolean }) + +return Rbx +end __FILES["codecs/model/Rbx/Binary"] = @native function() @@ -118457,6 +115886,19 @@ end return Binary end +end + + + + + + codecs_model_Rig + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_model_Rig (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/model/Rig"] = function() -- codecs/model/Rig: the Scene mapping shared by game model formats (MD2 / MD3 / MDL / MD5 / SMD / ...). New code. @@ -119081,6 +116523,19 @@ end return SourceAnim end +end + + + + + + codecs_model_Vrml + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_model_Vrml (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 7 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/model/Vrml"] = function() -- codecs/model/Vrml: VRML97 / X3D scene-graph engine (classic and XML encodings) for model/vrml and model/x3d. @@ -122200,13 +119655,13 @@ end - + - codecs_text + codecs_text_GodotVariant --!optimize 2 --!nocheck --- rosetta chunk codecs_text (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 15 modules (3 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk codecs_text_GodotVariant (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["codecs/text/GodotVariant"] = function() @@ -122868,6 +120323,19 @@ end return GodotVariant end +end + + + + + + codecs_text_Json + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_text_Json (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (2 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/text/Json"] = function() -- codecs/text/Json: JSON (RFC 8259 / ECMA-404) parse and serialize, the engine data/json, glTF, TMJ, ... use. New code. @@ -123917,6 +121385,19 @@ end return Encode end +end + + + + + + codecs_text_KeyValues + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_text_KeyValues (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/text/KeyValues"] = function() -- codecs/text/KeyValues: Valve KeyValues text (tier1/KeyValues.cpp of the Source SDK 2013, srctools' reading of it) @@ -124925,6 +122406,19 @@ end return Lexer end +end + + + + + + codecs_text_Nbt + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_text_Nbt (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/text/Nbt"] = function() -- codecs/text/Nbt: Minecraft's Named Binary Tag format and SNBT (Minecraft wiki "NBT format", wiki.vg "NBT"). @@ -126848,6 +124342,19 @@ end return Value end +end + + + + + + codecs_text_Text + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_text_Text (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/text/Text"] = function() @@ -127144,6 +124651,19 @@ end return Url end +end + + + + + + codecs_text_Xml + --!optimize 2 +--!nocheck +-- rosetta chunk codecs_text_Xml (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["codecs/text/Xml"] = function() -- codecs/text/Xml: XML 1.0 parse (DOM and pull events) and serialize. New code. @@ -128402,15 +125922,893 @@ end - + - codecs_video + codecs_video_Video --!optimize 2 --!nocheck --- rosetta chunk codecs_video (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk codecs_video_Video (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) +__FILES["codecs/video/Video"] = function() + + +-- codecs/video/Video: the video codec registry and the generic VideoDecoder. New in rosetta. +local Err = __include("core/Err") +local Types = __include("Types") +local Yuv = __include("codecs/image/Yuv") +local Disposable = __include("codecs/video/Video/Disposable") +local Pool = __include("codecs/video/Video/Pool") + +local Video = {} + +type Entry = { + id: string, + name: string, + fourcc: { string }?, -- AVI biCompression / MOV sample entry FourCCs + matroska: { string }?, -- Matroska / WebM CodecIDs + new: ((track: Types.Track, opts: any?) -> (Types.VideoCodecDecoder?, Err.Err?))?, + [string]: any, +} + +-- decodeOne -> nil, nil: a packet with no picture to show (a hidden VP8 altref frame); false: a picture skipped +function Video.simpleDecoder(decodeOne: (data: buffer, packet: Types.Packet) -> (Types.Image? | false, Err.Err?), resetFn: (() -> ())?): Types.VideoCodecDecoder + local queue: { any } = {} + local self = {} + function self.decode(_: any, packet: Types.Packet): Err.Err? + local ok, img, err = pcall(decodeOne, packet.data, packet) + if not ok then + return Err.new(Err.CORRUPT, "decoder threw: " .. tostring(img)) + end + if img ~= nil then + table.insert(queue, { img, packet.pts, packet.keyframe }) + end + return err + end + function self.receive(_: any): (Types.Image? | false, number?, boolean?) + local q = table.remove(queue, 1) + if q then + return q[1], q[2], q[3] + end + return nil, nil, nil + end + function self.flush(_: any) end + function self.reset(_: any) + table.clear(queue) + if resetFn then + resetFn() + end + end + return self :: any +end + +-- raw video: yuv420p (I420 / IYUV / y4m), yv12 (V before U), yuv422p / yuv444p / yuva444p / gray (chroma averaged +-- down to 4:2:0, alpha dropped), track.bitDepth 9..16 (little-endian 16-bit samples scaled to 8 bits), rgb24 / bgr24 / +-- bgra / rgba (AVI DIBs: track.flip = bottom-up rows, track.stride = padded rows) +local function rawPlanar(data: buffer, pf: string, bits: number, w: number, h: number): Types.Image + local img = Types.Image.new(w, h, "yuv420p") + local px = img.pixels + local cw, ch = (w + 1) // 2, (h + 1) // 2 + local bps = if bits > 8 then 2 else 1 + local shift = 2 ^ (bits - 8) + local function sample(o: number): number + if bps == 1 then + return buffer.readu8(data, o) + end + return math.min(255, buffer.readu16(data, o) // shift) + end + for i = 0, w * h - 1 do + buffer.writeu8(px, i, sample(i * bps)) + end + local scw, sch = w, h -- source chroma plane size + if pf == "yuv420p" then + scw, sch = cw, ch + elseif pf == "yuv422p" then + scw, sch = cw, h + end + local uo, vo = w * h * bps, (w * h + scw * sch) * bps + for cy = 0, ch - 1 do + for cx = 0, cw - 1 do + local i = cy * cw + cx + local u, v + if pf == "gray" then + u, v = 128, 128 + elseif pf == "yuv420p" then + u, v = sample(uo + i * bps), sample(vo + i * bps) :: number + elseif pf == "yuv422p" then + local y0, y1 = cy * 2, math.min(cy * 2 + 1, h - 1) + u = (sample(uo + (y0 * scw + cx) * bps) + sample(uo + (y1 * scw + cx) * bps) + 1) // 2 + v = (sample(vo + (y0 * scw + cx) * bps) + sample(vo + (y1 * scw + cx) * bps) + 1) // 2 + else + local x0, x1 = cx * 2, math.min(cx * 2 + 1, w - 1) + local y0, y1 = cy * 2, math.min(cy * 2 + 1, h - 1) + local a, b, c, d = (y0 * w + x0) * bps, (y0 * w + x1) * bps, (y1 * w + x0) * bps, (y1 * w + x1) * bps + u = (sample(uo + a) + sample(uo + b) + sample(uo + c) + sample(uo + d) + 2) // 4 + v = (sample(vo + a) + sample(vo + b) + sample(vo + c) + sample(vo + d) + 2) // 4 + end + buffer.writeu8(px, w * h + i, u) + buffer.writeu8(px, w * h + cw * ch + i, v) + end + end + return img +end + +local PLANAR_SIZE: { [string]: (w: number, h: number, cw: number, ch: number) -> number } = { + yuv420p = function(w, h, cw, ch) + return w * h + 2 * cw * ch + end, + yv12 = function(w, h, cw, ch) + return w * h + 2 * cw * ch + end, + yuv422p = function(w, h, cw, _ch) + return w * h + 2 * cw * h + end, + yuv444p = function(w, h) + return w * h * 3 + end, + yuva444p = function(w, h) + return w * h * 4 + end, + gray = function(w, h) + return w * h + end, +} + +local function rawDecoder(track: Types.Track, _opts: any?): (Types.VideoCodecDecoder?, Err.Err?) + local w, h = track.width or 0, track.height or 0 + if w <= 0 or h <= 0 or w * h > 2 ^ 26 then + return nil, Err.new(Err.CORRUPT, "raw video without a valid size") + end + local pf = track.pixelFormat or "yuv420p" + local bits = track.bitDepth or 8 + local cw, ch = (w + 1) // 2, (h + 1) // 2 + local flip = track.flip == true + local planar = PLANAR_SIZE[pf] + return Video.simpleDecoder(function(data: buffer): (Types.Image?, Err.Err?) + local n = buffer.len(data) + if planar then + local need = planar(w, h, cw, ch) * (if bits > 8 then 2 else 1) + if n < need then + return nil, Err.new(Err.TRUNCATED, "raw frame: " .. n .. " of " .. need .. " bytes") + end + if pf == "yuv420p" and bits == 8 then + local img = Types.Image.new(w, h, "yuv420p") + buffer.copy(img.pixels, 0, data, 0, need) + return img, nil + elseif pf == "yv12" then + local img = Types.Image.new(w, h, "yuv420p") + buffer.copy(img.pixels, 0, data, 0, w * h) + buffer.copy(img.pixels, w * h, data, w * h + cw * ch, cw * ch) + buffer.copy(img.pixels, w * h + cw * ch, data, w * h, cw * ch) + return img, nil + end + return rawPlanar(data, pf, bits, w, h), nil + end + local bpp = if pf == "bgra" or pf == "rgba" then 4 else 3 + local stride: number = track.stride or w * bpp + if n < stride * (h - 1) + w * bpp then + return nil, Err.new(Err.TRUNCATED, "raw frame too short") + end + local img = Types.Image.new(w, h, "rgba8") + local px = img.pixels + local bgr = pf == "bgr24" or pf == "bgra" + for y = 0, h - 1 do + local s = (if flip then h - 1 - y else y) * stride + local o = y * w * 4 + for x = 0, w - 1 do + local p = s + x * bpp + local a, b, c = buffer.readu8(data, p), buffer.readu8(data, p + 1), buffer.readu8(data, p + 2) + if bgr then + a, c = c, a + end + buffer.writeu32(px, o + x * 4, a + b * 256 + c * 65536 + 0xff000000) + end + end + return img, nil + end), nil +end + +local function vp8Decoder(_track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) + local Vp8 = __include("codecs/image/Vp8") + local dec = Vp8.newDecoder() + local o = { maxPixels = opts and opts.maxPixels, yield = opts and opts.yield, skipDisposable = opts and opts.skipDisposable } + local self: any + self = Video.simpleDecoder(function(data: buffer): (Types.Image? | false, Err.Err?) + local img, err = dec:decodeFrame(data, 0, buffer.len(data), o) + if not img then + if err then + return nil, err + end + self.skipped += 1 + -- show_frame (RFC 6386 9.1): a shown frame keeps its place + return if buffer.readu8(data, 0) // 16 % 2 == 1 then false else nil, nil + end + local src = img.meta.source + if type(src) == "table" and src.show == false then + return nil, nil + end + img.meta.yuv = { range = "limited", matrix = "bt601" } + return img, nil + end, function() + if dec.reset then + dec:reset() + else + dec = Vp8.newDecoder() + end + end) :: any + self.skipped = 0 + function self.release(_: any, image: Types.Image): boolean + return dec:release(image) + end + return self, nil +end + +-- Motion JPEG: yuv420p straight from the planes (full range) when the layout allows, else rgba8 +local function mjpegDecoder(_track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) + local Jpeg = __include("codecs/image/Jpeg") + local o: Jpeg.DecodeOptions = { yuv = true, maxPixels = opts and opts.maxPixels } + return Video.simpleDecoder(function(data: buffer): (Types.Image?, Err.Err?) + local img, err = Jpeg.decode(data, 0, buffer.len(data), o) + if img and img.format == "yuv420p" then + img.meta.yuv = { range = "full", matrix = "bt601" } + end + return img, err + end), nil +end + +-- the MJPEG encoder (writers): JPEG is full-range, so limited-range yuv420p frames are remapped first +local function mjpegEncode(img: Types.Image, opts: any?): (buffer?, Err.Err?) + local Jpeg = __include("codecs/image/Jpeg") + local src = img + if img.format == "yuv420p" then + local range = Yuv.info(img) + if range ~= "full" then + src = Yuv.toFullRange(img) + end + end + return Jpeg.encode(src, { quality = opts and opts.quality or 90 }) +end + +local function mpeg2Decoder(track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) + local Mpeg2 = __include("codecs/video/Mpeg2") + return Mpeg2.newVideoDecoder(track, opts) +end + +local function h264Decoder(track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) + local H264 = __include("codecs/video/H264") + return H264.newVideoDecoder(track, opts) +end + +local function h263Decoder(track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) + local H263 = __include("codecs/video/H263") + local dec = H263.new({ flv = track.codec == "flv1", maxPixels = opts and opts.maxPixels }) + return Video.simpleDecoder(function(data: buffer): (Types.Image?, Err.Err?) + return dec:image(data) + end, function() + dec:reset() + end), nil +end + +local function theoraDecoder(track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) + local Theora = __include("codecs/video/Theora") + return Theora.newVideoDecoder(track, opts) +end + +local function legacyDecoder(id: string): (track: Types.Track, opts: any?) -> (Types.VideoCodecDecoder?, Err.Err?) + return function(track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) + return __include("codecs/video/Legacy").newDecoder(id, track, opts) + end +end + +-- FourCCs compare case-sensitively first, then upper-cased +local BUILTIN: { Entry } = { + { id = "vp8", name = "VP8", fourcc = { "VP80", "vp08" }, matroska = { "V_VP8" }, new = vp8Decoder }, + { id = "mjpeg", name = "Motion JPEG", fourcc = { "MJPG", "mjpa", "mjpb", "jpeg", "AVRn", "AVDJ", "dmb1", "LJPG", "JPGL", "MJLS", "ijpg" }, matroska = { "V_MJPEG" }, new = mjpegDecoder, encode = mjpegEncode }, + { id = "mpeg1", name = "MPEG-1 video", fourcc = { "mpg1", "MPG1", "PIM1", "m1v " }, matroska = { "V_MPEG1" }, new = mpeg2Decoder }, + { id = "rawvideo", name = "raw video", fourcc = { "\0\0\0\0", "I420", "IYUV", "YV12", "raw ", "DIB " }, matroska = { "V_UNCOMPRESSED" }, new = rawDecoder }, + { id = "mpeg2", name = "MPEG-2 video", fourcc = { "mpg2", "MPG2", "MPEG", "mp2v", "hdv1", "hdv2", "hdv3", "hdv5", "hdv6", "hdv7", "hdv8", "hdv9", "hdva", "xdv1", "xdv2", "xdv3", "xdv4", "xdv5", "xdv6", "xdv7", "xdv8", "xdv9", "xdva", "xdvb", "xdvc", "xdvd", "xdve", "xdvf", "xd54", "xd55", "xd59", "xd5a", "xd5b", "xd5c", "xd5d", "xd5e", "xd5f", "xdhd", "xdh2", "AVmp", "mx3n", "mx3p", "mx4n", "mx4p", "mx5n", "mx5p", "mmes", "MMES", "M701", "M702", "M703", "M704", "M705", "mpgv", "m2v1", "M2V1" }, matroska = { "V_MPEG2" }, new = mpeg2Decoder }, + { id = "mpeg4", name = "MPEG-4 part 2", fourcc = { "mp4v", "FMP4", "XVID", "DIVX", "DX50", "MP4V" }, matroska = { "V_MPEG4/ISO/SP", "V_MPEG4/ISO/ASP", "V_MPEG4/ISO/AP" } }, + { id = "h264", name = "H.264 / AVC", fourcc = { "avc1", "avc3", "H264", "h264", "X264", "x264", "AVC1", "DAVC", "VSSH" }, matroska = { "V_MPEG4/ISO/AVC" }, new = h264Decoder }, + { id = "hevc", name = "H.265 / HEVC", fourcc = { "hvc1", "hev1", "HEVC", "H265" }, matroska = { "V_MPEGH/ISO/HEVC" } }, + { id = "vp9", name = "VP9", fourcc = { "VP90", "vp09" }, matroska = { "V_VP9" } }, + { id = "av1", name = "AV1", fourcc = { "AV01", "av01" }, matroska = { "V_AV1" } }, + { id = "theora", name = "Theora", matroska = { "V_THEORA" }, new = theoraDecoder }, + { id = "h263", name = "H.263", fourcc = { "H263", "h263", "s263", "U263" }, new = h263Decoder }, + { id = "flv1", name = "Sorenson Spark (FLV1)", fourcc = { "FLV1" }, new = h263Decoder }, + { id = "vp6f", name = "On2 VP6 (Flash)", fourcc = { "VP6F", "FLV4" } }, + { id = "vp6a", name = "On2 VP6 with alpha (Flash)", fourcc = { "VP6A" } }, + { id = "flashsv", name = "Flash Screen Video", fourcc = { "FSV1" } }, + { id = "flashsv2", name = "Flash Screen Video 2" }, + { id = "png", name = "PNG", fourcc = { "png ", "MPNG" }, matroska = { "V_PNG" } }, + { id = "cinepak", name = "Cinepak", fourcc = { "cvid" }, new = legacyDecoder("cinepak") }, + { id = "msvideo1", name = "Microsoft Video 1", fourcc = { "CRAM", "MSVC", "WHAM" }, new = legacyDecoder("msvideo1") }, + { id = "qtrle", name = "QuickTime Animation (RLE)", fourcc = { "rle " }, new = legacyDecoder("qtrle") }, + { id = "smc", name = "QuickTime Graphics (SMC)", fourcc = { "smc " }, new = legacyDecoder("smc") }, + { id = "flic", name = "Autodesk Animator FLIC", fourcc = { "AFLC" }, new = legacyDecoder("flic") }, + { id = "smackvid", name = "Smacker video", fourcc = { "SMK2", "SMK4" }, new = legacyDecoder("smackvid") }, +} + +local byId: { [string]: Entry } = {} +local byFourcc: { [string]: string } = {} +local byMatroska: { [string]: string } = {} + +function Video.register(entry: Entry): (boolean, Err.Err?) + if type(entry) ~= "table" or type(entry.id) ~= "string" then + return false, Err.new(Err.ARG, "register: needs an entry with an id") + end + local old = byId[entry.id] + if old and entry.new == nil then + entry.new = old.new + end + byId[entry.id] = entry + for _, f in entry.fourcc or {} do + byFourcc[f] = entry.id + end + for _, m in entry.matroska or {} do + byMatroska[m] = entry.id + end + return true, nil +end +for _, e in BUILTIN do + Video.register(e) +end + +Video.codecs = byId + +function Video.fromFourcc(fcc: string): string? + return byFourcc[fcc] or byFourcc[string.upper(fcc)] or byFourcc[string.lower(fcc)] +end + +function Video.fromMatroska(id: string): string? + return byMatroska[id] +end + +function Video.entry(id: string): Entry? + return byId[id] +end + +-- disposable: no later frame predicts from the packet's; droppable: it may also be left out unread (VP8 headers can +-- carry probability and loop filter updates, so a disposable VP8 frame is droppable only without them) +function Video.isDisposable(track: Types.Track | string, packet: Types.Packet | buffer): (boolean, boolean) + local codec = if type(track) == "table" then track.codec else track + local config = if type(track) == "table" then track.config else nil + local data = if type(packet) == "table" then packet.data else packet + if type(data) ~= "buffer" or type(codec) ~= "string" then + return false, false + end + return Disposable.check(codec, data, config) +end + +function Video.canDecode(id: string): boolean + local e = byId[id] + return e ~= nil and e.new ~= nil +end + +function Video.decoder(track: Types.Track, opts: any?): (Types.VideoCodecDecoder?, Err.Err?) + local e = byId[track.codec] + if not e or not e.new then + return nil, Err.new(Err.UNSUPPORTED, "no decoder for video codec " .. tostring(track.codec)) + end + local ok, dec, err = pcall(e.new :: any, track, opts) + if not ok then + return nil, Err.new(Err.CORRUPT, "codec " .. track.codec .. " failed to start: " .. tostring(dec)) + end + return dec, err +end + +local function toRGBA(_self: any, f: any): Types.Image + local img = if type(f) == "table" and f.image then f.image else f + local out = Yuv.imageToRgba(img) + return out or img +end + +type OpenOptions = { + rgba: boolean?, + track: number?, + maxPixels: number?, + openAudio: ((demuxer: Types.Demuxer, track: Types.Track) -> (Types.Decoder?, Err.Err?))?, + audio: boolean?, + maxSide: number?, + yield: (() -> ())?, + skipDisposable: boolean?, + reuse: boolean?, -- nextFrame may overwrite the Image of the frame it returned before + [string]: any, +} + +function Video.open(demuxer: Types.Demuxer, opts: OpenOptions?): (Types.VideoDecoder?, Err.Err?) + local o: OpenOptions = opts or {} + local track: Types.Track? = nil + if o.track then + for _, t in demuxer.tracks do + if t.id == o.track then + track = t + end + end + if not track then + return nil, Err.new(Err.ARG, "no track " .. tostring(o.track)) + end + else + track = demuxer:track("video") + end + local codec: Types.VideoCodecDecoder? = nil + local codecErr: Err.Err? = nil + if track then + codec, codecErr = Video.decoder(track, o) + else + codecErr = Err.new(Err.UNSUPPORTED, "no video track") + end + local v: any = { + kind = "video", + format = demuxer.format, + codec = if track then track.codec else "none", + width = if track then track.width or 0 else 0, + height = if track then track.height or 0 else 0, + frameRate = if track then track.frameRate or 0 else 0, + frames = if track then track.frames or 0 else 0, + duration = if track and track.duration and track.duration > 0 then track.duration else demuxer.duration, + track = track, + demuxer = demuxer, + meta = demuxer.meta or {}, + decodeError = codecErr, + toRGBA = toRGBA, + } + if v.frames == 0 and v.frameRate > 0 and v.duration > 0 then + v.frames = math.floor(v.duration * v.frameRate + 0.5) + end + if o.audio ~= false then + local at = demuxer:track("audio") + if at then + if o.openAudio then + local ok, dec, err = pcall(o.openAudio, demuxer, at) + if ok and dec then + v.audio = dec + else + v.audioError = if ok then err else Err.new(Err.CORRUPT, "audio: " .. tostring(dec)) + end + else + v.audioError = Err.new(Err.UNSUPPORTED, "no audio hook (open through the api: F.video.open)") + end + end + end + local index, flushed, skipUntil = 0, false, -math.huge + local tid = if track then track.id else -1 + local scale: number = if track and track.timescale and track.timescale > 0 then track.timescale else 1000 + local start = demuxer.startTime or 0 + v.startTime = start + local defaultDur = if v.frameRate > 0 then 1 / v.frameRate else 0 + local lastPts = nil :: number? + -- rgba8 / scaled Images made here; the codec's own go back through codec:release + local own = Pool.new(2) + local function recycle(img: any) + if img and not own:give(img) and codec and codec.release then + codec:release(img) + end + end + local lastFrame: any = nil + function v.release(self: any, frame: any) + recycle(if type(frame) == "table" and frame.kind == "image" then frame else type(frame) == "table" and frame.image) + end + function v.nextFrame(self: any): (Types.VideoFrame?, Err.Err?) + if not codec then + return nil, codecErr + end + if lastFrame then + recycle(lastFrame.image) + lastFrame = nil + end + local dec = codec :: Types.VideoCodecDecoder + while true do + local img, pts, key = dec:receive() + if img == false then + -- a picture skipped (skipDisposable): it keeps its place in output order + if index >= 0 then + index += 1 + end + elseif img then + local t = (pts or 0) / scale - start + if t + 1e-9 >= skipUntil then + if index < 0 then + -- after a seek: constant-rate index = round(pts * fps), else counted from the seek + index = if v.frameRate > 0 then math.max(0, math.floor(t * v.frameRate + 0.5)) else 0 + end + index += 1 + local d = defaultDur + if lastPts and t > (lastPts :: number) and defaultDur == 0 then + d = t - (lastPts :: number) + end + lastPts = t + local maxSide = o.maxSide + local hook = o.yield + if hook and (o.rgba or maxSide) then + pcall(hook) + end + if maxSide and maxSide >= 1 and img.format == "yuv420p" and math.max(img.width, img.height) > maxSide then + local s = maxSide / math.max(img.width, img.height) + local dw, dh = math.max(1, math.floor(img.width * s + 0.5)), math.max(1, math.floor(img.height * s + 0.5)) + local src = img + img = Yuv.imageScale(src, dw, dh, own:take(dw, dh, "yuv420p"), o.yield) + recycle(src) -- (never seen by the caller) + end + if o.rgba and img.format == "yuv420p" then + local src = img + img = Yuv.imageToRgba(src, own:take(src.width, src.height, "rgba8"), o.yield) or src + recycle(src) + end + local frame = { image = img, pts = t, duration = d, keyframe = key, index = index } + if o.reuse then + lastFrame = frame + end + return frame, nil + end + else + local p = demuxer:read(tid) + if p == nil then + if flushed then + return nil, nil + end + flushed = true + dec:flush() + else + local err = dec:decode(p) + if err then + return nil, err + end + end + end + end + end + function v.seek(self: any, seconds: number) + lastFrame = nil + demuxer:seek(seconds + start) + if codec then + codec:reset() + end + flushed = false + skipUntil = seconds + lastPts = nil + index = -1 -- recomputed from the first frame's time + if self.audio then + pcall(self.audio.seek, self.audio, seconds) + end + end + function v.reset(self: any) + self:seek(0) + skipUntil = -math.huge + index = 0 + end + return v, nil +end + +function Video.fromFrames(images: { Types.Image }, delays: (number | { number })?, opts: any?): (Types.VideoDecoder?, Err.Err?) + if type(images) ~= "table" or #images == 0 or type(images[1]) ~= "table" then + return nil, Err.new(Err.ARG, "fromFrames: needs a list of Images") + end + local w, h = images[1].width, images[1].height + local pts: { number } = {} + local durs: { number } = {} + local t = 0 + for i, img in images do + if type(img) ~= "table" or img.width ~= w or img.height ~= h then + return nil, Err.new(Err.ARG, "fromFrames: frame " .. i .. " is not a " .. w .. "x" .. h .. " Image") + end + local d = if type(delays) == "table" then delays[i] or 0.1 else (delays or 0.1) + if type(d) ~= "number" or d ~= d or d < 0 then + d = 0.1 + end + pts[i] = t + durs[i] = d + t += d + end + local n = #images + local o = opts or {} + local v: any = { + kind = "video", + format = o.format or "frames", + codec = "frames", + width = w, + height = h, + frameRate = if t > 0 then n / t else 10, + frames = n, + duration = t, + loops = o.loops, + meta = o.meta or {}, + toRGBA = toRGBA, + images = images, + } + local i = 0 + function v.nextFrame(self: any): (Types.VideoFrame?, Err.Err?) + i += 1 + if i > n then + i = n + return nil, nil + end + local img = images[i] + if o.rgba then + img = Yuv.imageToRgba(img) or img + end + return { image = img, pts = pts[i], duration = durs[i], keyframe = true, index = i }, nil + end + function v.seek(self: any, seconds: number) + local k = 0 + for j = 1, n do + if pts[j] <= seconds + 1e-9 then + k = j - 1 + end + end + i = k + end + function v.reset(self: any) + i = 0 + end + return v, nil +end + +return Video +end +__FILES["codecs/video/Video/Disposable"] = function() + + +-- codecs/video/Video/Disposable: packets whose frame no later frame predicts from (a player may skip decoding them). +-- H.264: the first VCL NAL unit has nal_ref_idc 0 (7.4.1: then every slice of the picture has), and no parameter +-- set comes before it; one access unit per packet, length-prefixed (avcC lengthSizeMinusOne) or Annex B. +-- VP8 (RFC 6386 9.3-9.11, 19.2): an inter frame that refreshes no reference (last / golden / altref, no copies) and +-- leaves the segment map; its header may still change decoder state (probabilities, loop filter deltas). +local readu8 = buffer.readu8 + +local Disposable = {} + +-- the offset of the first byte after the first start code at or after p, or -1 +local function nextStart(b: buffer, p: number, e: number): number + local i = p + while i + 2 < e do + local b2 = readu8(b, i + 2) + if b2 > 1 then + i += 3 + elseif readu8(b, i + 1) ~= 0 then + i += 2 + elseif b2 == 1 and readu8(b, i) == 0 then + return i + 3 + else + i += 1 + end + end + return -1 +end + +-- nal_unit_type 1..5: slices (decided by nal_ref_idc); 7, 8, 13, 15: parameter sets (never dropped) +local function nalVerdict(hdr: number): boolean? + local t = hdr % 32 + if t >= 1 and t <= 5 then + return hdr // 32 % 4 == 0 + elseif t == 7 or t == 8 or t == 13 or t == 15 then + return false + end + return nil +end + +function Disposable.h264(b: buffer, lengthSize: number?): boolean + local n = buffer.len(b) + if lengthSize then + local p = 0 + while p + lengthSize < n do + local len = 0 + for k = 0, lengthSize - 1 do + len = len * 256 + readu8(b, p + k) + end + p += lengthSize + if len > n - p then + return false + end + if len > 0 then + local v = nalVerdict(readu8(b, p)) + if v ~= nil then + return v + end + end + p += len + end + return false + end + if n >= 3 and readu8(b, 0) == 0 and readu8(b, 1) == 0 then + local p = nextStart(b, 0, n) + while p >= 0 and p < n do + local v = nalVerdict(readu8(b, p)) + if v ~= nil then + return v + end + p = nextStart(b, p, n) + end + return false + end + return n > 0 and nalVerdict(readu8(b, 0)) == true +end + +-- the boolean decoder of RFC 6386 7.3 (a 2-byte window), enough for the frame header +type Bool = { b: buffer, p: number, e: number, value: number, range: number, count: number } + +local function byteAt(d: Bool): number + local p = d.p + d.p = p + 1 + return if p < d.e then readu8(d.b, p) else 0 +end + +local function boolNew(b: buffer, p: number, e: number): Bool + local d: Bool = { b = b, p = p, e = e, value = 0, range = 255, count = 0 } + d.value = byteAt(d) * 256 + byteAt(d) + return d +end + +local function boolRead(d: Bool, prob: number): number + local split = 1 + (d.range - 1) * prob // 256 + local big = split * 256 + local bit = 0 + if d.value >= big then + bit = 1 + d.range -= split + d.value -= big + else + d.range = split + end + while d.range < 128 do + d.value *= 2 + d.range *= 2 + d.count += 1 + if d.count == 8 then + d.count = 0 + d.value += byteAt(d) + end + end + return bit +end + +local function lit(d: Bool, n: number): number + local v = 0 + for _ = 1, n do + v = v * 2 + boolRead(d, 128) + end + return v +end + +-- skips flag ? (n bits + sign) : nothing +local function optSigned(d: Bool, n: number) + if lit(d, 1) == 1 then + lit(d, n + 1) + end +end + +-- disposable: no reference refresh or copy and no segment map update; droppable: also no state the decoder keeps +-- (refresh_entropy_probs 0, no segment feature or loop filter delta update) +function Disposable.vp8(b: buffer): (boolean, boolean) + local n = buffer.len(b) + if n < 4 then + return false, false + end + local tag = readu8(b, 0) + readu8(b, 1) * 256 + readu8(b, 2) * 65536 + if tag % 2 == 0 then + return false, false -- key frame + end + local first = tag // 32 + if first > n - 3 then + return false, false + end + local d = boolNew(b, 3, 3 + first) + local keep = true + if lit(d, 1) == 1 then -- segmentation_enabled + local updateMap, updateData = lit(d, 1), lit(d, 1) + if updateMap == 1 then + return false, false + end + if updateData == 1 then + keep = false + lit(d, 1) -- segment_feature_mode + for _ = 1, 4 do + optSigned(d, 7) + end + for _ = 1, 4 do + optSigned(d, 6) + end + end + end + lit(d, 1 + 6 + 3) -- filter_type, loop_filter_level, sharpness_level + if lit(d, 1) == 1 and lit(d, 1) == 1 then -- loop_filter_adj_enable, mode_ref_lf_delta_update + keep = false + for _ = 1, 8 do + optSigned(d, 6) + end + end + lit(d, 2 + 7) -- log2_nbr_of_dct_partitions, y_ac_qi + for _ = 1, 5 do + optSigned(d, 4) + end + local refreshGolden, refreshAlt = lit(d, 1), lit(d, 1) + if refreshGolden == 1 or refreshAlt == 1 then + return false, false + end + if lit(d, 2) ~= 0 or lit(d, 2) ~= 0 then -- copy_buffer_to_golden, copy_buffer_to_alternate + return false, false + end + lit(d, 2) -- sign_bias_golden, sign_bias_alternate + local refreshEntropy, refreshLast = lit(d, 1), lit(d, 1) + if refreshLast == 1 or d.p > d.e + 2 then + return false, false + end + return true, keep and refreshEntropy == 0 +end + +-- the avcC NAL length size of a track (nil: Annex B or one bare NAL unit per packet) +function Disposable.lengthSize(config: buffer?): number? + if config and buffer.len(config) >= 7 and readu8(config, 0) == 1 then + return readu8(config, 4) % 4 + 1 + end + return nil +end + +-- disposable: no later frame predicts from it; droppable: it can also be left out without telling the decoder +function Disposable.check(codec: string?, data: buffer, config: buffer?): (boolean, boolean) + if codec == "h264" then + local v = Disposable.h264(data, Disposable.lengthSize(config)) + return v, v + elseif codec == "vp8" then + return Disposable.vp8(data) + end + return false, false +end + +return Disposable +end +__FILES["codecs/video/Video/Pool"] = function() + + +-- codecs/video/Video/Pool: output Images handed back by the caller (decoder:release), reused for later frames. Only +-- Images this pool made are taken back; a reused Image gets a fresh meta table. +local Types = __include("Types") + +local Pool = {} +Pool.__index = Pool + +type Pool = typeof(setmetatable({} :: { free: { Types.Image }, made: { [Types.Image]: boolean }, max: number }, Pool)) + +function Pool.new(max: number?): Pool + return setmetatable({ free = {}, made = setmetatable({}, { __mode = "k" }) :: any, max = max or 3 }, Pool) +end + +function Pool.take(self: Pool, w: number, h: number, format: Types.PixelFormat): Types.Image + local free = self.free + for i = #free, 1, -1 do + local img = free[i] + if img.width == w and img.height == h and img.format == format then + table.remove(free, i) + img.meta = {} + return img + end + end + local img = Types.Image.new(w, h, format) + self.made[img] = true + return img +end + +-- true when the Image was this pool's (it is kept for reuse, or dropped when the pool is full) +function Pool.give(self: Pool, img: any): boolean + if type(img) ~= "table" or not self.made[img] then + return false + end + local free = self.free + for _, q in free do + if q == img then + return true + end + end + if #free < self.max then + table.insert(free, img) + else + self.made[img] = nil + end + return true +end + +return Pool +end __FILES["codecs/video/Video/Source"] = function() @@ -128701,13 +127099,13 @@ end - + - containers + containers_Archive --!optimize 2 --!nocheck --- rosetta chunk containers (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 21 modules (2 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk containers_Archive (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["containers/Archive"] = function() @@ -128977,6 +127375,529 @@ end return Archive end +__FILES["containers/AudioWrap"] = function() + +-- containers/AudioWrap: a video container's audio track as a stream an audio format reads (a format never requires +-- another). New in rosetta. PCM / WAVEFORMATEX -> WAV, adpcm_swf -> f32 WAV, mp1-3 / ac3 -> frames back to back, +-- flac -> fLaC + metadata blocks, opus / vorbis -> Ogg, aac -> ADTS. E-AC-3 is UNSUPPORTED. +local Err = __include("core/Err") +local Bytes = __include("core/Bytes") +local Types = __include("Types") +local Mux = __include("containers/Ogg/Mux") +local Adpcm = __include("codecs/audio/Adpcm") + +local AudioWrap = {} + +type PacketSource = { + count: ((self: any, track: number) -> number)?, + get: ((self: any, track: number, k: number) -> Types.Packet?)?, +} + +local function allPackets(dmx: PacketSource, track: Types.Track): { Types.Packet } + local out: { Types.Packet } = {} + local n = if dmx.count then dmx:count(track.id) else 0 + if n > 0 and dmx.get then + for k = 1, n do + local p = dmx:get(track.id, k) + if p then + table.insert(out, p) + end + end + end + return out +end + +local function concat(packets: { Types.Packet }, prefix: buffer?): buffer + local total = if prefix then buffer.len(prefix) else 0 + for _, p in packets do + total += buffer.len(p.data) + end + local out = buffer.create(total) + local o = 0 + if prefix then + buffer.copy(out, 0, prefix) + o = buffer.len(prefix) + end + for _, p in packets do + buffer.copy(out, o, p.data) + o += buffer.len(p.data) + end + return out +end + +local PCM: { [string]: { number } } = { -- tag, bits, bytes swapped (big-endian source) + pcm_u8 = { 1, 8, 0 }, + pcm_s8 = { 1, 8, 0 }, + pcm_s16le = { 1, 16, 0 }, + pcm_s24le = { 1, 24, 0 }, + pcm_s32le = { 1, 32, 0 }, + pcm_s16be = { 1, 16, 1 }, + pcm_s24be = { 1, 24, 1 }, + pcm_s32be = { 1, 32, 1 }, + pcm_f32le = { 3, 32, 0 }, + pcm_f64le = { 3, 64, 0 }, + pcm_f32be = { 3, 32, 1 }, + pcm_f64be = { 3, 64, 1 }, + pcm_alaw = { 6, 8, 0 }, + pcm_mulaw = { 7, 8, 0 }, +} + +local function wav(fmt: buffer, data: buffer): buffer + local w = Bytes.writer(buffer.len(data) + buffer.len(fmt) + 64) + local fl = buffer.len(fmt) + local dl = buffer.len(data) + w:string("RIFF") + w:u32le(4 + 8 + fl + (fl % 2) + 8 + dl + (dl % 2)) + w:string("WAVE") + w:string("fmt ") + w:u32le(fl) + w:bytes(fmt) + if fl % 2 == 1 then + w:u8(0) + end + w:string("data") + w:u32le(dl) + w:bytes(data) + if dl % 2 == 1 then + w:u8(0) + end + return w:finish() +end + +local function pcmWav(track: Types.Track, packets: { Types.Packet }): (buffer?, Err.Err?) + local spec = PCM[track.codec] + local ch = track.channels or 1 + local rate = math.floor((track.sampleRate or 0) + 0.5) + if ch < 1 or rate <= 0 then + return nil, Err.new(Err.CORRUPT, "PCM track without channels / sample rate") + end + local bits = spec[2] + local data = concat(packets) + if spec[3] == 1 then + local bps = bits // 8 + for i = 0, buffer.len(data) - bps, bps do + for k = 0, bps // 2 - 1 do + local a, b = buffer.readu8(data, i + k), buffer.readu8(data, i + bps - 1 - k) + buffer.writeu8(data, i + k, b) + buffer.writeu8(data, i + bps - 1 - k, a) + end + end + end + if track.codec == "pcm_s8" then + for i = 0, buffer.len(data) - 1 do + buffer.writeu8(data, i, (buffer.readu8(data, i) + 128) % 256) + end + end + local f = Bytes.writer(16) + local align = ch * bits // 8 + f:u16le(spec[1]) + f:u16le(ch) + f:u32le(rate) + f:u32le(rate * align) + f:u16le(align) + f:u16le(bits) + return wav(f:finish(), data), nil +end + +-- Flash ADPCM packets decode on their own (each starts with its code size and block headers): f32 samples in a WAV +local function swfWav(track: Types.Track, packets: { Types.Packet }): (buffer?, Err.Err?) + local ch = track.channels or 1 + local rate = math.floor((track.sampleRate or 0) + 0.5) + if ch < 1 or ch > 2 or rate <= 0 then + return nil, Err.new(Err.CORRUPT, "Flash ADPCM track without channels / sample rate") + end + local frames = 0 + for _, pk in packets do + frames += Adpcm.swfFrames(pk.data, 0, buffer.len(pk.data), ch) + end + local data = buffer.create(frames * ch * 4) + local d = 0 + for _, pk in packets do + d += Adpcm.swf(pk.data, 0, buffer.len(pk.data), ch, data, d) * ch + end + local f = Bytes.writer(16) + f:u16le(3) + f:u16le(ch) + f:u32le(rate) + f:u32le(rate * ch * 4) + f:u16le(ch * 4) + f:u16le(32) + return wav(f:finish(), data), nil +end + +-- the number of 48 kHz samples in an Opus packet (RFC 6716 section 3.1) +local function opusSamples(b: buffer): number + local n = buffer.len(b) + if n < 1 then + return 0 + end + local toc = buffer.readu8(b, 0) + local config = toc // 8 + local fs: number + if config < 12 then + fs = ({ 480, 960, 1920, 2880 })[config % 4 + 1] + elseif config < 16 then + fs = if config % 2 == 0 then 480 else 960 + else + fs = ({ 120, 240, 480, 960 })[config % 4 + 1] + end + local c = toc % 4 + local frames = if c == 0 then 1 elseif c == 3 then (if n >= 2 then buffer.readu8(b, 1) % 64 else 0) else 2 + return fs * frames +end + +local function opusHead(track: Types.Track): buffer + local c = track.config + if c and buffer.len(c) >= 19 and buffer.readstring(c, 0, 8) == "OpusHead" then + return c + end + local w = Bytes.writer(19) + w:string("OpusHead") + w:u8(1) + w:u8(math.clamp(track.channels or 2, 1, 2)) + w:u16le(math.floor((track.codecDelay or 0) * 48000 + 0.5)) + w:u32le(math.floor(track.sampleRate or 48000)) + w:u16le(0) + w:u8(0) + return w:finish() +end + +local function opusTags(): buffer + local w = Bytes.writer(32) + w:string("OpusTags") + local vendor = "rosetta" + w:u32le(#vendor) + w:string(vendor) + w:u32le(0) + return w:finish() +end + +local function ogg(headers: { buffer }, packets: { Types.Packet }, granuleOf: (p: Types.Packet, i: number) -> number): buffer + local mux = Mux.new({ pageSize = 4096 }) + local s = mux:stream(1) + for i, h in headers do + s:packet(h, 0, { flush = i == 1 or i == #headers }) + end + for i, p in packets do + s:packet(p.data, granuleOf(p, i), { eos = i == #packets }) + end + return mux:finish() +end + +-- Matroska's Vorbis CodecPrivate: Xiph-laced headers (count - 1, sizes, data) +local function xiphHeaders(c: buffer): { buffer }? + local n = buffer.len(c) + if n < 3 then + return nil + end + local count = buffer.readu8(c, 0) + 1 + local p = 1 + local sizes = {} + local total = 0 + for k = 1, count - 1 do + local s = 0 + while true do + if p >= n then + return nil + end + local b = buffer.readu8(c, p) + p += 1 + s += b + if b ~= 255 then + break + end + end + sizes[k] = s + total += s + end + sizes[count] = n - p - total + if sizes[count] < 0 then + return nil + end + local out = {} + for k = 1, count do + local b = buffer.create(sizes[k]) + buffer.copy(b, 0, c, p, sizes[k]) + p += sizes[k] + out[k] = b + end + return out +end + +-- Vorbis packet sizes: the block sizes from the identification header and each mode's block flag from the end of the +-- setup header (read backwards from its framing bit: mode entries are 41 bits whose window / transform types are 0, +-- preceded by the 6-bit mode count), so the Ogg granules are exact: a packet yields (previous + current block) / 4 +-- samples (the first one as if its previous block had its own size, as ffmpeg times it). +local function bit(b: buffer, k: number): number + return bit32.extract(buffer.readu8(b, k // 8), k % 8, 1) +end +local function bits(b: buffer, k: number, n: number): number + local v = 0 + for i = n - 1, 0, -1 do + v = v * 2 + bit(b, k + i) + end + return v +end + +local function vorbisModes(id: buffer, setup: buffer): ({ number }?, { boolean }?) + if buffer.len(id) < 30 or buffer.len(setup) < 8 then + return nil, nil + end + local bs = buffer.readu8(id, 28) + local sizes = { 2 ^ (bs % 16), 2 ^ (bs // 16) } + -- the framing bit: the highest set bit of the last non-zero byte + local last = buffer.len(setup) - 1 + while last > 0 and buffer.readu8(setup, last) == 0 do + last -= 1 + end + local v = buffer.readu8(setup, last) + local hb = 7 + while hb > 0 and bit32.extract(v, hb, 1) == 0 do + hb -= 1 + end + local f = last * 8 + hb + local flags: { boolean } = {} + local pos = f + while #flags < 64 and pos - 41 >= 7 * 8 do + local s0 = pos - 41 + if bits(setup, s0 + 1, 16) ~= 0 or bits(setup, s0 + 17, 16) ~= 0 then + break + end + table.insert(flags, 1, bit(setup, s0) == 1) + pos = s0 + end + -- the largest count whose 6-bit field matches + for n = #flags, 1, -1 do + local start = f - 41 * n + if start - 6 >= 0 and bits(setup, start - 6, 6) == n - 1 then + local out = {} + for i = #flags - n + 1, #flags do + table.insert(out, flags[i]) + end + return sizes, out + end + end + return nil, nil +end + +local function adts(track: Types.Track, packets: { Types.Packet }): (buffer?, Err.Err?) + local c = track.config + local profile, rateIndex, chanConfig + if c and buffer.len(c) >= 2 then + local b0, b1 = buffer.readu8(c, 0), buffer.readu8(c, 1) + profile = b0 // 8 -- audio object type + rateIndex = (b0 % 8) * 2 + b1 // 128 + chanConfig = (b1 // 8) % 16 + -- HE-AAC (5) / HE-AACv2 (29), 14496-3 1.6.2.1: ADTS carries the AAC-LC core (the decoder finds SBR / PS in it) + if (profile == 5 or profile == 29) and rateIndex ~= 15 and buffer.len(c) >= 4 then + local v = buffer.readu8(c, 1) * 65536 + buffer.readu8(c, 2) * 256 + buffer.readu8(c, 3) + local extIndex = (v // 2 ^ 15) % 16 -- after aot (5), sfi (4), channels (4): bits 13 .. 16 + local core = if extIndex == 15 then -1 else (v // 2 ^ 10) % 32 -- bits 17 .. 21 + profile = if core == 2 then 2 else -1 + end + else + local rates = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 } + profile = 2 + rateIndex = 4 + for i, r in rates do + if r == math.floor((track.sampleRate or 44100) + 0.5) then + rateIndex = i - 1 + end + end + chanConfig = track.channels or 2 + end + if profile < 1 or profile > 4 or rateIndex > 12 then + return nil, Err.new(Err.UNSUPPORTED, "AAC object type " .. tostring(profile) .. " in ADTS") + end + local w = Bytes.writer(64) + for _, p in packets do + local len = buffer.len(p.data) + 7 + w:u8(0xFF) + w:u8(0xF1) + w:u8((profile - 1) * 64 + rateIndex * 4 + chanConfig // 4) + w:u8((chanConfig % 4) * 64 + (len // 2048) % 4) + w:u8((len // 8) % 256) + w:u8((len % 8) * 32 + 0x1F) + w:u8(0xFC) + w:bytes(p.data) + end + return w:finish(), nil +end + +-- trim: a container's codec delay (Matroska CodecDelay, an MP4 edit's media time for MP2 / MP3 / AAC, as ffmpeg) +-- and end padding +function AudioWrap.trim(dec: any, skip: number, length: number?): any + if skip <= 0 and length == nil then + return dec + end + skip = math.max(0, skip) + local rate = dec.sampleRate + local w: any = setmetatable({}, { __index = dec }) + w.frames = math.max(0, (dec.frames or 0) - skip) + if length then + w.frames = if (dec.frames or 0) > 0 then math.min(w.frames, length) else length + end + w.duration = w.frames / rate + local cap = length or math.huge + local delivered = 0 + local function drop() + local left = skip + while left > 0 do + local _, n = dec:read(math.min(left, 4096)) + if not n or n <= 0 then + break + end + left -= n + end + end + local started = false + function w.read(_: any, n: number, out: buffer?): (buffer, number) + if not started then + started = true + drop() + end + local want = math.min(n, cap - delivered) + if want <= 0 then + return out or buffer.create(0), 0 + end + local b, got = dec:read(want, out) + delivered += got + return b, got + end + function w.seek(_: any, seconds: number) + started = true + if seconds <= 0 then + dec:seek(0) + drop() + delivered = 0 + else + dec:seek(seconds + skip / rate) + delivered = math.floor(seconds * rate + 0.5) + end + end + function w.position(_: any): number + return math.max(0, dec:position() - skip / rate) + end + return w +end + +function AudioWrap.wrap(dmx: any, track: Types.Track): (buffer?, string?, Err.Err?) + if type(track) ~= "table" or track.kind ~= "audio" then + return nil, nil, Err.new(Err.ARG, "not an audio track") + end + if track.unsupported then + return nil, nil, Err.new(Err.UNSUPPORTED, track.unsupported) + end + local codec = track.codec + local packets = allPackets(dmx, track) + if #packets == 0 then + return nil, nil, Err.new(Err.CORRUPT, "audio track without packets") + end + if track.waveFormat and string.sub(codec, 1, 6) == "adpcm_" then + return wav(track.waveFormat, concat(packets)), "wav", nil + end + if codec == "adpcm_swf" then + local b, err = swfWav(track, packets) + return b, if b then "wav" else nil, err + end + if PCM[codec] then + local b, err = pcmWav(track, packets) + return b, if b then "wav" else nil, err + end + if codec == "mp3" or codec == "mp2" or codec == "mp1" then + return concat(packets), "mp3", nil + end + if codec == "ac3" then + return concat(packets), "ac3", nil + end + if codec == "flac" then + local c = track.config + local prefix: buffer? = nil + if c and buffer.len(c) >= 4 and buffer.readstring(c, 0, 4) == "fLaC" then + prefix = c + elseif c and buffer.len(c) >= 34 then + -- metadata blocks without the marker (MP4 dfLa payload after version / flags) + local start = if buffer.len(c) >= 38 and buffer.readu8(c, 0) == 0 and buffer.readu8(c, 4) % 128 == 0 then 4 else 0 + local b = buffer.create(4 + buffer.len(c) - start) + buffer.writestring(b, 0, "fLaC") + buffer.copy(b, 4, c, start) + prefix = b + else + return nil, nil, Err.new(Err.CORRUPT, "FLAC track without its STREAMINFO") + end + return concat(packets, prefix), "flac", nil + end + if codec == "opus" then + local head = opusHead(track) + local pre = buffer.readu16(head, 10) + local g = pre + local out = ogg({ head, opusTags() }, packets, function(p: Types.Packet): number + g += opusSamples(p.data) + local d = (p :: any).discardPadding + if type(d) == "number" and d > 0 then + return g - math.floor(d * 48000 + 0.5) -- the end trimming (WebM DiscardPadding) + end + return g + end) + return out, "opus", nil + end + if codec == "vorbis" then + local c = track.config + local headers = c and xiphHeaders(c) + if not headers or #headers ~= 3 then + return nil, nil, Err.new(Err.CORRUPT, "Vorbis track without its three headers") + end + local sizes, modes = vorbisModes(headers[1], headers[3]) + local granule, prev = 0, nil :: number? + local rate = track.sampleRate or 44100 + local scale = track.timescale + local out = ogg(headers, packets, function(p: Types.Packet): number + if not sizes or not modes then + return math.floor((p.pts + (p.duration or 0)) / scale * rate + 0.5) -- from the container's times + end + local d = p.data + if buffer.len(d) == 0 or buffer.readu8(d, 0) % 2 ~= 0 then + return granule + end + local mb = 0 + while 2 ^ mb < #(modes :: { boolean }) do + mb += 1 + end + local m = if mb > 0 and buffer.len(d) * 8 > mb then bits(d, 1, mb) else 0 + local cur = sizes[if (modes :: { boolean })[m + 1] then 2 else 1] + if prev then + granule += (prev + cur) // 4 + end + prev = cur + return granule + end) + return out, "vorbis", nil + end + if codec == "aac" then + if track.adts then + return concat(packets), "aac", nil -- already ADTS (MPEG-TS) + end + local b, err = adts(track, packets) + return b, if b then "aac" else nil, err + end + return nil, nil, Err.new(Err.UNSUPPORTED, "no audio format for codec " .. tostring(codec)) +end + +return AudioWrap +end +end + + + + + + containers_Avi + --!optimize 2 +--!nocheck +-- rosetta chunk containers_Avi (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["containers/Avi"] = function() @@ -129530,6 +128451,19 @@ end return Avi end +end + + + + + + containers_Blend + --!optimize 2 +--!nocheck +-- rosetta chunk containers_Blend (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["containers/Blend"] = function() -- containers/Blend: Blender .blend files (read only). New in rosetta, from the file layout: the 12-byte header @@ -130404,6 +129338,19 @@ end return Chunks end +end + + + + + + containers_Cpio + --!optimize 2 +--!nocheck +-- rosetta chunk containers_Cpio (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["containers/Cpio"] = function() -- containers/Cpio: cpio, read and written, from cpio(5) (libarchive, GNU cpio) and POSIX.1-1988 (odc). Reads newc @@ -131432,6 +130379,19 @@ end return Ebml end +end + + + + + + containers_Fat + --!optimize 2 +--!nocheck +-- rosetta chunk containers_Fat (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["containers/Fat"] = function() -- containers/Fat: FAT12 / FAT16 / FAT32 over a byte range (BPB, chains, VFAT long names checksum-validated against @@ -132120,6 +131080,19 @@ end return Fat end +end + + + + + + containers_Iso9660 + --!optimize 2 +--!nocheck +-- rosetta chunk containers_Iso9660 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["containers/Iso9660"] = function() -- containers/Iso9660: ISO 9660 (ECMA-119) images, read; from ECMA-119, SUSP / RRIP 1.12, Joliet and El Torito 1.0, no @@ -132625,6 +131598,19 @@ end return Iso9660 end +end + + + + + + containers_IsoBmff + --!optimize 2 +--!nocheck +-- rosetta chunk containers_IsoBmff (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 6 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["containers/IsoBmff"] = function() @@ -134988,6 +133974,19 @@ end return QtPalette end +end + + + + + + containers_MacFile + --!optimize 2 +--!nocheck +-- rosetta chunk containers_MacFile (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (3 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["containers/MacFile"] = function() -- containers/MacFile: classic Mac OS files (a data fork, a resource fork and Finder info) as Archive entries, shared by @@ -135562,6 +134561,195 @@ end return Ogg end +__FILES["containers/Ogg/Mux"] = @native function() + + + +-- containers/Ogg/Mux: the Ogg page writer (RFC 3533), for Ogg Opus / Vorbis / FLAC output. New in rosetta. +-- Packets are laced into pages per logical stream; a page is closed when it reaches opts.pageSize bytes of data (or +-- 255 lacing values), when a packet asks for flush, and at the end (eos). The page granule is the granule of the last +-- packet that finishes on it (-1 when none does). Pages go to the output in the order they close, so the bos pages +-- of a multiplexed file come first when every stream's first packet is written (with flush) before any other. +-- Never throws: a bad argument returns false, Err. +local Err = __include("core/Err") +local Crc32 = __include("core/Crc32") + +local writeu8, writeu32, writei32 = buffer.writeu8, buffer.writeu32, buffer.writei32 + +local Mux = {} +Mux.__index = Mux +local Stream = {} +Stream.__index = Stream + +type Options = { + pageSize: number?, -- close a page once its data reaches this many bytes (default 4096; at most 255 * 255) +} +type PacketOptions = { + flush: boolean?, -- close the page after this packet (headers; default false) + eos: boolean?, -- this is the stream's last packet (default false: finish() writes an empty eos page if needed) +} + +@native function Mux.new(opts: Options?): any + local size = opts and opts.pageSize or 4096 + if type(size) ~= "number" or size < 1 then + size = 4096 + end + return setmetatable({ + pageSize = math.min(size, 255 * 255), + chunks = {} :: { buffer }, + total = 0, + streams = {} :: { any }, + nextSerial = 1, + }, Mux) +end + +@native function Mux.stream(self: any, serial: number?): any + local sr = serial or self.nextSerial + self.nextSerial = math.max(self.nextSerial, sr + 1) + local s = setmetatable({ + mux = self, + serial = sr % 4294967296, + seq = 0, + lacing = {} :: { number }, + parts = {} :: { any }, -- buffer, offset, length triples of the page data + dataLen = 0, + granule = -1, + continued = false, -- the page being built starts with the tail of a packet + first = true, + ended = false, + lastGranule = -1, + }, Stream) + table.insert(self.streams, s) + return s +end + +-- the CRC of a page (the crc field written as zero) +@native local function crc(b: buffer, n: number): number + return Crc32.msb(b, 0, n, 0) +end + +@native function Stream._flush(self: any, eos: boolean) + local nseg = #self.lacing + local n = 27 + nseg + self.dataLen + local b = buffer.create(n) + buffer.writestring(b, 0, "OggS") + local flags = (if self.continued then 1 else 0) + (if self.first then 2 else 0) + (if eos then 4 else 0) + writeu8(b, 5, flags) + local g = self.granule + if g < 0 then + writeu32(b, 6, 0xFFFFFFFF) + writei32(b, 10, -1) + else + writeu32(b, 6, g % 4294967296) + writeu32(b, 10, (g // 4294967296) % 4294967296) + end + writeu32(b, 14, self.serial) + writeu32(b, 18, self.seq % 4294967296) + writeu8(b, 26, nseg) + for i = 1, nseg do + writeu8(b, 26 + i, self.lacing[i]) + end + local o = 27 + nseg + local parts = self.parts + for i = 1, #parts, 3 do + buffer.copy(b, o, parts[i], parts[i + 1], parts[i + 2]) + o += parts[i + 2] + end + writeu32(b, 22, crc(b, n)) + local m = self.mux + table.insert(m.chunks, b) + m.total += n + self.seq += 1 + self.first = false + self.lacing, self.parts, self.dataLen, self.granule = {}, {}, 0, -1 + self.continued = false + if eos then + self.ended = true + end +end + +@native function Stream.packet(self: any, data: any, granule: number, opts: PacketOptions?, offset: number?, length: number?): (boolean, Err.Err?) + if self.ended then + return false, Err.new(Err.ARG, "packet after the end of stream " .. self.serial) + end + local b: buffer + if type(data) == "string" then + b = buffer.fromstring(data) + elseif type(data) == "buffer" then + b = data + else + return false, Err.new(Err.ARG, "packet: data must be a buffer or a string") + end + if type(granule) ~= "number" then + return false, Err.new(Err.ARG, "packet: granule must be a number") + end + local off = offset or 0 + local len = length or (buffer.len(b) - off) + if off < 0 or len < 0 or off + len > buffer.len(b) then + return false, Err.new(Err.ARG, "packet: range outside the buffer") + end + local pageSize = self.mux.pageSize + local left = len + local pos = off + -- lacing: 255-byte segments then one < 255 (0 when the size is a multiple of 255) + while true do + if #self.lacing == 255 or (self.dataLen >= pageSize and #self.lacing > 0) then + self:_flush(false) + self.continued = pos > off -- the next page starts inside this packet + end + local seg = math.min(left, 255) + table.insert(self.lacing, seg) + if seg > 0 then + table.insert(self.parts, b) + table.insert(self.parts, pos) + table.insert(self.parts, seg) + end + self.dataLen += seg + pos += seg + left -= seg + if seg < 255 then + break + end + end + if granule >= 0 then -- -1 (unknown) keeps the granule of an earlier packet finishing on this page + self.granule = granule + self.lastGranule = granule + end + local eos = opts and opts.eos or false + if eos then + self:_flush(true) + elseif (opts and opts.flush) or self.dataLen >= pageSize or #self.lacing == 255 then + self:_flush(false) + end + return true, nil +end + +@native function Stream.flush(self: any) + if not self.ended and #self.lacing > 0 then + self:_flush(false) + end +end + +@native function Mux.finish(self: any): buffer + for _, s in self.streams do + if not s.ended then + if #s.lacing == 0 then + s.granule = s.lastGranule + end + s:_flush(true) + end + end + local out = buffer.create(self.total) + local o = 0 + for _, c in self.chunks do + buffer.copy(out, o, c, 0, buffer.len(c)) + o += buffer.len(c) + end + return out +end + +return Mux +end __FILES["containers/Ogg/Page"] = @native function() @@ -135728,6 +134916,19 @@ end return Page end +end + + + + + + containers_Riff + --!optimize 2 +--!nocheck +-- rosetta chunk containers_Riff (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["containers/Riff"] = function() -- containers/Riff: the RIFF chunk container (RIFF, RIFX big-endian, RF64 / BW64 with the ds64 chunk), read leniently @@ -136459,6 +135660,19 @@ end return Tar end +end + + + + + + containers_Zip + --!optimize 2 +--!nocheck +-- rosetta chunk containers_Zip (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["containers/Zip"] = function() @@ -137095,13 +136309,13 @@ end - + - core + core_Adler32 --!optimize 2 --!nocheck --- rosetta chunk core (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 3 modules (3 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk core_Adler32 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (4 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["core/Adler32"] = @native function() @@ -137392,6 +136606,157 @@ end return Base64 end +__FILES["core/Crc32"] = @native function() + + +-- core/Crc32: CRC-32 (IEEE 802.3, the zlib / gzip / zip / PNG polynomial 0xEDB88320, reflected), slice-by-8. +-- Absorbed from deflate-luau src/Deflate/Checksum.luau (same author; no third-party code). Never throws. +local band, bxor, rshift, lshift, byteswap = bit32.band, bit32.bxor, bit32.rshift, bit32.lshift, bit32.byteswap +local readu8, readu32 = buffer.readu8, buffer.readu32 + +local T0, T1, T2, T3 = table.create(256, 0), table.create(256, 0), table.create(256, 0), table.create(256, 0) +local T4, T5, T6, T7 = table.create(256, 0), table.create(256, 0), table.create(256, 0), table.create(256, 0) +for n = 0, 255 do + local c = n + for _ = 1, 8 do + if band(c, 1) ~= 0 then + c = bxor(0xEDB88320, rshift(c, 1)) + else + c = rshift(c, 1) + end + end + T0[n + 1] = c +end +for n = 0, 255 do + local c = T0[n + 1] + c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) + T1[n + 1] = c + c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) + T2[n + 1] = c + c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) + T3[n + 1] = c + c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) + T4[n + 1] = c + c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) + T5[n + 1] = c + c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) + T6[n + 1] = c + c = bxor(T0[band(c, 255) + 1], rshift(c, 8)) + T7[n + 1] = c +end + +@native local function crc32(buf: buffer, off: number, len: number, crc: number?): number + local c = bxor(crc or 0, 0xFFFFFFFF) + local i, e = off, off + len + local e8 = e - 8 + while i <= e8 do + c = bxor(c, readu32(buf, i)) + local d = readu32(buf, i + 4) + c = bxor( + T7[band(c, 255) + 1], + T6[band(rshift(c, 8), 255) + 1], + T5[band(rshift(c, 16), 255) + 1], + T4[rshift(c, 24) + 1], + T3[band(d, 255) + 1], + T2[band(rshift(d, 8), 255) + 1], + T1[band(rshift(d, 16), 255) + 1], + T0[rshift(d, 24) + 1] + ) + i += 8 + end + local e4 = e - 4 + while i <= e4 do + c = bxor(c, readu32(buf, i)) + c = bxor(T3[band(c, 255) + 1], T2[band(rshift(c, 8), 255) + 1], T1[band(rshift(c, 16), 255) + 1], T0[rshift(c, 24) + 1]) + i += 4 + end + while i < e do + c = bxor(T0[band(bxor(c, readu8(buf, i)), 255) + 1], rshift(c, 8)) + i += 1 + end + return bxor(c, 0xFFFFFFFF) +end + +@native local function range(buf: buffer, offset: number?, length: number?): (number, number) + local n = buffer.len(buf) + local o = math.clamp(offset or 0, 0, n) + return o, math.clamp(length or (n - o), 0, n - o) +end + +local Crc32 = {} + +@native function Crc32.of(buf: buffer, offset: number?, length: number?, crc: number?): number + local o, l = range(buf, offset, length) + return crc32(buf, o, l, crc) +end + +@native function Crc32.string(s: string, crc: number?): number + return crc32(buffer.fromstring(s), 0, #s, crc) +end + +Crc32.raw = crc32 + +-- MSB-first CRC-32 (polynomial 0x04C11DB7, not reflected, raw register, no inversions): Ogg pages (init 0), +-- MPEG-2 PSI sections and bzip2 blocks (init 0xFFFFFFFF) +local MSB = table.create(256, 0) +for n = 0, 255 do + local c = lshift(n, 24) + for _ = 1, 8 do + c = if band(c, 0x80000000) ~= 0 then bxor(lshift(c, 1), 0x04C11DB7) else lshift(c, 1) + end + MSB[n + 1] = c +end +Crc32.MSB_TABLE = MSB + +-- slice-by-8 for the MSB-first CRC: M[k][n] = the CRC register after byte n and k zero bytes +local M1, M2, M3 = table.create(256, 0), table.create(256, 0), table.create(256, 0) +local M4, M5, M6, M7 = table.create(256, 0), table.create(256, 0), table.create(256, 0), table.create(256, 0) +for n = 0, 255 do + local c = MSB[n + 1] + c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) + M1[n + 1] = c + c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) + M2[n + 1] = c + c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) + M3[n + 1] = c + c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) + M4[n + 1] = c + c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) + M5[n + 1] = c + c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) + M6[n + 1] = c + c = bxor(lshift(c, 8), MSB[rshift(c, 24) + 1]) + M7[n + 1] = c +end + +@native function Crc32.msb(buf: buffer, off: number, len: number, init: number?): number + local c = init or 0 + local i, e = off, off + len + local e8 = e - 8 + while i <= e8 do + c = bxor(c, byteswap(readu32(buf, i))) + local d = byteswap(readu32(buf, i + 4)) + c = bxor( + M7[rshift(c, 24) + 1], + M6[band(rshift(c, 16), 255) + 1], + M5[band(rshift(c, 8), 255) + 1], + M4[band(c, 255) + 1], + M3[rshift(d, 24) + 1], + M2[band(rshift(d, 16), 255) + 1], + M1[band(rshift(d, 8), 255) + 1], + MSB[band(d, 255) + 1] + ) + i += 8 + end + while i < e do + c = bxor(lshift(c, 8), MSB[bxor(rshift(c, 24), readu8(buf, i)) + 1]) + i += 1 + end + return c +end + +return Crc32 +end __FILES["core/Md5"] = @native function() @@ -137554,13 +136919,13 @@ end - + - data + data_cbor --!optimize 2 --!nocheck --- rosetta chunk data (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 22 modules (3 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk data_cbor (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (1 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["data/cbor"] = function() @@ -138543,6 +137908,19 @@ end return Csv end +end + + + + + + data_ini + --!optimize 2 +--!nocheck +-- rosetta chunk data_ini (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 5 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["data/ini"] = function() -- data/ini: INI files read the way Python's configparser does (interpolation off, key case kept), new code. Supports: @@ -139471,6 +138849,19 @@ NbtFormat.Nbt = Nbt return NbtFormat end +end + + + + + + data_plist + --!optimize 2 +--!nocheck +-- rosetta chunk data_plist (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 5 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["data/plist"] = function() -- data/plist: Apple property lists, new code. Supports: XML read / write (byte-identical to Python's plistlib), @@ -140442,6 +139833,19 @@ end return SnbtFormat end +end + + + + + + data_toml + --!optimize 2 +--!nocheck +-- rosetta chunk data_toml (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 5 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["data/toml"] = function() -- data/toml: TOML 1.0.0 (https://toml.io/en/v1.0.0), new code, tested against toml-test. Supports: the whole 1.0 @@ -141592,6 +140996,19 @@ end return Vdf end +end + + + + + + data_xml + --!optimize 2 +--!nocheck +-- rosetta chunk data_xml (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["data/xml"] = function() -- data/xml: XML 1.0 over codecs/text/Xml. Supports: decode to a "#document" XmlNode tree, encode a document or an @@ -141648,6 +141065,19 @@ end return XmlFormat end +end + + + + + + data_yaml + --!optimize 2 +--!nocheck +-- rosetta chunk data_yaml (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["data/yaml"] = function() -- data/yaml: YAML 1.2 (core schema), new code. Supports: block / flow styles, every scalar style, anchors and aliases @@ -143308,13 +142738,13 @@ end - + - font + font_bdf --!optimize 2 --!nocheck --- rosetta chunk font (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 14 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk font_bdf (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["font/bdf"] = function() @@ -143606,6 +143036,19 @@ end return Bdf end +end + + + + + + font_bmfont + --!optimize 2 +--!nocheck +-- rosetta chunk font_bmfont (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["font/bmfont"] = function() -- font/bmfont: AngelCode BMFont descriptors (.fnt: text, XML, binary version 3), read and written, from the BMFont @@ -144718,6 +144161,19 @@ end return Eot end +end + + + + + + font_fon + --!optimize 2 +--!nocheck +-- rosetta chunk font_fon (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["font/fon"] = function() -- font/fon: Windows raster fonts: .fnt resources (versions 2.0 / 3.0) and .fon NE / PE executables holding them as @@ -145476,6 +144932,19 @@ end return Pcf end +end + + + + + + font_psf + --!optimize 2 +--!nocheck +-- rosetta chunk font_psf (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["font/psf"] = function() -- font/psf: Linux console fonts (kbd project's psf docs, Andries Brouwer): PSF 1 (magic 36 04, UCS-2 table, FFFF / @@ -146484,6 +145953,19 @@ end return Charstring end +end + + + + + + font_woff + --!optimize 2 +--!nocheck +-- rosetta chunk font_woff (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["font/woff"] = function() -- font/woff: WOFF 1.0 (W3C Recommendation, 2012): zlib-compressed sfnt tables, rebuilt and read through @@ -147217,12 +146699,12 @@ end - + - host + host_Love --!optimize 2 --!nocheck --- rosetta chunk host (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- rosetta chunk host_Love (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. -- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) @@ -147805,13 +147287,13 @@ end - + - image_1 + image_ani --!optimize 2 --!nocheck --- rosetta chunk image_1 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 25 modules (7 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk image_ani (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["image/ani"] = function() @@ -148740,6 +148222,19 @@ end return Blp end +end + + + + + + image_bmp + --!optimize 2 +--!nocheck +-- rosetta chunk image_bmp (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["image/bmp"] = function() @@ -149638,6 +149133,19 @@ Dds.DXGI = DXGI return Dds end +end + + + + + + image_exr + --!optimize 2 +--!nocheck +-- rosetta chunk image_exr (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (2 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["image/exr"] = function() -- image/exr: OpenEXR (openexr.com file layout docs; PIZ after OpenEXR, BSD-3-Clause: licenses/openexr-LICENSE.md). @@ -150866,6 +150374,19 @@ end return Piz end +end + + + + + + image_gif + --!optimize 2 +--!nocheck +-- rosetta chunk image_gif (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (2 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["image/gif"] = function() -- image/gif: GIF87a / GIF89a, from the GIF89a spec (CompuServe 1990). Supports: every image, interlace, LZW code sizes @@ -151898,6 +151419,19 @@ end return Codec end +end + + + + + + image_icns + --!optimize 2 +--!nocheck +-- rosetta chunk image_icns (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["image/icns"] = function() -- image/icns: Apple icon images (icns resource type). Supports: is32 / il32 / ih32 / it32 (icns RLE) with s8mk / l8mk / @@ -152601,6 +152135,19 @@ end return Dib end +end + + + + + + image_ilbm + --!optimize 2 +--!nocheck +-- rosetta chunk image_ilbm (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["image/ilbm"] = function() -- image/ilbm: IFF ILBM / PBM (EA IFF 85 "ILBM", Amiga ROM Kernel Manual). Supports: 1..8 planes + CMAP, EHB (CAMG @@ -153079,6 +152626,19 @@ end return Jpeg end +end + + + + + + image_ktx + --!optimize 2 +--!nocheck +-- rosetta chunk image_ktx (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["image/ktx"] = function() -- image/ktx: Khronos KTX 1.1 / KTX 2.0. Supports: KTX1 (GL compressed and uncompressed, big-endian), KTX2 (VkFormat BCn @@ -153872,6 +153432,19 @@ end return Lmp end +end + + + + + + image_pcx + --!optimize 2 +--!nocheck +-- rosetta chunk image_pcx (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["image/pcx"] = function() -- image/pcx: ZSoft PC Paintbrush (ZSoft "Technical Reference Manual" header and RLE). Supports: 1-bit, 1-bit x 2..4 @@ -154791,6 +154364,19 @@ end return Codec end +end + + + + + + image_qoi + --!optimize 2 +--!nocheck +-- rosetta chunk image_qoi (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["image/qoi"] = function() -- image/qoi: QOI, the Quite OK Image format (specification 1.0, qoiformat.org). Supports: the whole spec (RGB / RGBA, @@ -155355,19 +154941,6 @@ end return Sgi end -end - - - - - - image_2 - --!optimize 2 ---!nocheck --- rosetta chunk image_2 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 14 modules (4 native: @native); the Rosetta root requires it when one of them is first included. --- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). -return function(__FILES, __include) __FILES["image/spr"] = function() -- image/spr: Quake (IDSP 1), Half-Life (IDSP 2, own palette, texture formats) and DarkPlaces SPR32 (IDSP 32, rgba) @@ -155681,6 +155254,19 @@ end return Spr end +end + + + + + + image_sunras + --!optimize 2 +--!nocheck +-- rosetta chunk image_sunras (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["image/sunras"] = function() -- image/sunras: Sun Raster (rasterfile(5), SunOS <rasterfile.h>). Supports: 1-bit (0 = white without a colour map), @@ -156397,6 +155983,19 @@ end return Codec end +end + + + + + + image_tiff + --!optimize 2 +--!nocheck +-- rosetta chunk image_tiff (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["image/tiff"] = function() -- image/tiff: TIFF 6.0 (+ Adobe technote 3, BigTIFF). Supports: strips, tiles, planar 1 / 2, none / LZW (old-style too) @@ -157614,6 +157213,19 @@ end return Pixels end +end + + + + + + image_tim + --!optimize 2 +--!nocheck +-- rosetta chunk image_tim (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["image/tim"] = function() -- image/tim: PlayStation TIM (magic 0x10), from Sony's PSX "File Formats" documentation. Supports: 4 / 8-bit CLUT, 15 / @@ -158091,6 +157703,19 @@ end return Vtf end +end + + + + + + image_webp + --!optimize 2 +--!nocheck +-- rosetta chunk image_webp (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (2 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["image/webp"] = function() -- image/webp: WebP (RFC 9649); bitstreams ported from libwebp 1.6 (BSD-3-Clause, licenses/libwebp-LICENSE.txt). @@ -159093,6 +158718,19 @@ end return Xbm end +end + + + + + + image_xpm + --!optimize 2 +--!nocheck +-- rosetta chunk image_xpm (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["image/xpm"] = function() -- image/xpm: X PixMap (XPM 3 C source and XPM 2 plain; Arnaud Le Hors's "XPM Manual"). Supports: the values line and @@ -159421,13 +159059,13 @@ end - + - layered + layered_aseprite --!optimize 2 --!nocheck --- rosetta chunk layered (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 4 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk layered_aseprite (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["layered/aseprite"] = function() @@ -160168,6 +159806,19 @@ end return Aseprite end +end + + + + + + layered_ora + --!optimize 2 +--!nocheck +-- rosetta chunk layered_ora (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["layered/ora"] = function() -- layered/ora: OpenRaster 0.0.6 (freedesktop.org; new code): a zip with a stored "mimetype" first, stack.xml, PNG @@ -160455,6 +160106,19 @@ end return Ora end +end + + + + + + layered_psd + --!optimize 2 +--!nocheck +-- rosetta chunk layered_psd (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["layered/psd"] = function() -- layered/psd: Adobe Photoshop PSD / PSB (Photoshop File Formats Specification, 2016). Supports: every colour mode at @@ -161546,13 +161210,13 @@ end - + - model_1 + model_3ds --!optimize 2 --!nocheck --- rosetta chunk model_1 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 19 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk model_3ds (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["model/3ds"] = function() @@ -163586,6 +163250,19 @@ end return Write end +end + + + + + + model_3mf + --!optimize 2 +--!nocheck +-- rosetta chunk model_3mf (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/3mf"] = function() -- model/3mf: 3D Manufacturing Format (core 1.3, materials extension 1.2, production extension 1.1 p:path). @@ -164661,6 +164338,19 @@ end return Write end +end + + + + + + model_ase + --!optimize 2 +--!nocheck +-- rosetta chunk model_ase (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/ase"] = function() -- model/ase: 3ds Max ASCII Scene Export (*3DSMAX_ASCIIEXPORT 200), read + write; checked against assimp's ASE loader. @@ -165890,6 +165580,19 @@ end return Write end +end + + + + + + model_b3d + --!optimize 2 +--!nocheck +-- rosetta chunk model_b3d (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/b3d"] = function() -- model/b3d: Blitz3D .b3d (BB3D chunks, version 1; blitzbasic.com "b3dfile_specs.txt", checked against assimp). @@ -166516,6 +166219,19 @@ end return Read end +end + + + + + + model_blend + --!optimize 2 +--!nocheck +-- rosetta chunk model_blend (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 9 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/blend"] = function() -- model/blend: Blender .blend files (read only), every version from 2.4x to 5.x: plain, gzip or zstd compressed; @@ -168896,19 +168612,6 @@ end return Mesh end -end - - - - - - model_2 - --!optimize 2 ---!nocheck --- rosetta chunk model_2 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 19 modules (1 native: @native); the Rosetta root requires it when one of them is first included. --- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). -return function(__FILES, __include) __FILES["model/blend/Normals"] = function() -- model/blend/Normals: Blender's encoded custom normals (CD_CUSTOMLOOPNORMAL / the "custom_normal" int16 x 2 corner @@ -170665,6 +170368,19 @@ end return Read end +end + + + + + + model_bsp + --!optimize 2 +--!nocheck +-- rosetta chunk model_bsp (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 5 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/bsp"] = function() -- model/bsp: compiled game maps, read: Quake 1 (BSP 29, BSP2, 2PSB), Half-Life (BSP 30), Quake II (IBSP 38), Quake III @@ -171928,6 +171644,19 @@ end return Tree end +end + + + + + + model_buildmap + --!optimize 2 +--!nocheck +-- rosetta chunk model_buildmap (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/buildmap"] = function() -- model/buildmap: Build engine maps (.map versions 7-9: Duke Nukem 3D, Shadow Warrior, eduke32), from Ken Silverman's @@ -172603,6 +172332,19 @@ end return Geometry end +end + + + + + + model_d3map + --!optimize 2 +--!nocheck +-- rosetta chunk model_d3map (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/d3map"] = function() -- model/d3map: Doom 3 / Quake 4 / Prey editor .map ("Version 2" / "Version 3"), read only. brushDef3 sides (plane @@ -173083,6 +172825,19 @@ end return Parse end +end + + + + + + model_dae + --!optimize 2 +--!nocheck +-- rosetta chunk model_dae (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/dae"] = function() -- model/dae: COLLADA 1.4.1 / 1.5.0 (Khronos specifications; .dae XML, .zae zip with manifest.xml). Supports: geometry, @@ -175538,6 +175293,19 @@ end return Write end +end + + + + + + model_fbx + --!optimize 2 +--!nocheck +-- rosetta chunk model_fbx (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 6 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/fbx"] = function() -- model/fbx: Autodesk FBX 7.x binary and ASCII, from Blender's io_scene_fbx, assimp and the FBX SDK transform docs. @@ -176411,19 +176179,6 @@ end return Binary end -end - - - - - - model_3 - --!optimize 2 ---!nocheck --- rosetta chunk model_3 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 17 modules (1 native: @native); the Rosetta root requires it when one of them is first included. --- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). -return function(__FILES, __include) __FILES["model/fbx/Read"] = function() -- model/fbx/Read: an FBX 7.x node tree -> Scene. Layer elements in every mapping (ByPolygonVertex, ByVertice, @@ -178812,6 +178567,19 @@ end return Xform end +end + + + + + + model_gltf + --!optimize 2 +--!nocheck +-- rosetta chunk model_gltf (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/gltf"] = function() -- model/gltf: glTF 2.0 (Khronos specification 2.0.1), .gltf JSON and .glb. Supports: the core spec, KHR_materials_*, @@ -180545,6 +180313,19 @@ end return Write end +end + + + + + + model_godot + --!optimize 2 +--!nocheck +-- rosetta chunk model_godot (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 5 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/godot"] = function() -- model/godot: Godot text scenes (.tscn, .escn; formats 2-4) as a Scene, read + write (format 3); checked against @@ -182267,6 +182048,19 @@ end return Write end +end + + + + + + model_iqm + --!optimize 2 +--!nocheck +-- rosetta chunk model_iqm (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/iqm"] = function() -- model/iqm: Inter-Quake Model (IQM version 2; iqm.txt / iqm.h of Lee Salzman's IQM SDK, public domain; checked against @@ -183385,6 +183179,19 @@ end return Write end +end + + + + + + model_ldraw + --!optimize 2 +--!nocheck +-- rosetta chunk model_ldraw (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/ldraw"] = function() -- model/ldraw: LDraw (.ldr / .dat / .mpd), read; File Format spec 1.0.2 with the MPD, BFC and !COLOUR extensions @@ -183781,19 +183588,6 @@ end return Colors end -end - - - - - - model_4 - --!optimize 2 ---!nocheck --- rosetta chunk model_4 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 24 modules (0 native: @native); the Rosetta root requires it when one of them is first included. --- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). -return function(__FILES, __include) __FILES["model/ldraw/Read"] = function() -- model/ldraw/Read: LDraw text -> Types.Scene. Sub-files are tried as written (backslashes as slashes), then lower @@ -184371,6 +184165,19 @@ end return Read end +end + + + + + + model_lwo + --!optimize 2 +--!nocheck +-- rosetta chunk model_lwo (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/lwo"] = function() -- model/lwo: LightWave objects LWO2 (6+), LWOB (5.x) and Modo's LXOB, read; from the LWO2 / LWOB specs, checked against @@ -185452,6 +185259,19 @@ end return Parse end +end + + + + + + model_map + --!optimize 2 +--!nocheck +-- rosetta chunk model_map (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/map"] = function() -- model/map: editor .map files of Quake, Half-Life (Valve 220), Quake II (surface / content flags) and Quake III @@ -186544,6 +186364,19 @@ end return Write end +end + + + + + + model_mca + --!optimize 2 +--!nocheck +-- rosetta chunk model_mca (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/mca"] = function() -- model/mca: Minecraft Anvil region files (wiki "Region file format", "Chunk format"), read-only. Supports: gzip, zlib, @@ -187288,6 +187121,19 @@ end return Md2 end +end + + + + + + model_md3 + --!optimize 2 +--!nocheck +-- rosetta chunk model_md3 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/md3"] = function() -- model/md3: Quake III MD3 ("IDP3" v15), from qfiles.h md3Header_t / md3Surface_t and PhaethonH's "MD3 file format"; @@ -188030,6 +187876,19 @@ end return Read end +end + + + + + + model_mdl + --!optimize 2 +--!nocheck +-- rosetta chunk model_mdl (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/mdl"] = function() -- model/mdl: Quake 1 ("IDPO" v6, model/mdl/Quake) and GoldSrc ("IDST" v10, model/mdl/HalfLife) models. Quake skins @@ -188634,6 +188493,19 @@ end return Quake end +end + + + + + + model_ms3d + --!optimize 2 +--!nocheck +-- rosetta chunk model_ms3d (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/ms3d"] = function() -- model/ms3d: MilkShape 3D 1.8 (.ms3d v3 / v4), from ms3dspec.h, tested against assimp's MS3D importer (no code @@ -189621,6 +189493,19 @@ end return Write end +end + + + + + + model_obj + --!optimize 2 +--!nocheck +-- rosetta chunk model_obj (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/obj"] = function() -- model/obj: Wavefront OBJ + MTL (Paul Bourke's specs, as Blender / Maya / assimp write them). Supports: v (with @@ -190727,6 +190612,19 @@ end return Mtl end +end + + + + + + model_off + --!optimize 2 +--!nocheck +-- rosetta chunk model_off (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/off"] = function() -- model/off: Geomview OFF text (geomview.org/docs/html/OFF.html), read + write. Supports: [ST][C][N]OFF, face colours @@ -191193,13 +191091,13 @@ end - + - model_5 + model_ply --!optimize 2 --!nocheck --- rosetta chunk model_5 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 24 modules (3 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk model_ply (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["model/ply"] = function() @@ -192508,6 +192406,19 @@ end return Binary end +end + + + + + + model_pmx + --!optimize 2 +--!nocheck +-- rosetta chunk model_pmx (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/pmx"] = function() -- model/pmx: MikuMikuDance PMX 2.0 / 2.1 (PmxEditor's specification notes) and PMD 1.0 (MMD community notes); no @@ -193612,6 +193523,19 @@ end return Read end +end + + + + + + model_proc + --!optimize 2 +--!nocheck +-- rosetta chunk model_proc (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/proc"] = function() -- model/proc: Doom 3 / Quake 4 / Prey `.proc` render geometry (dmap output: "mapProcFile003", Quake 4 "PROC" "4"; the @@ -194387,6 +194311,19 @@ end return Qb end +end + + + + + + model_rbxm + --!optimize 2 +--!nocheck +-- rosetta chunk model_rbxm (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/rbxm"] = function() -- model/rbxm: Roblox binary model / place (.rbxm / .rbxl, "<roblox!") to and from a codecs/model/Rbx RbxTree, from the @@ -194980,6 +194917,19 @@ end return Rbxm end +end + + + + + + model_rbxmx + --!optimize 2 +--!nocheck +-- rosetta chunk model_rbxmx (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/rbxmx"] = function() -- model/rbxmx: Roblox XML model / place (.rbxmx / .rbxlx, `<roblox version="4">`) to and from a codecs/model/Rbx @@ -195656,6 +195606,19 @@ end return Rbxmx end +end + + + + + + model_robloxmesh + --!optimize 2 +--!nocheck +-- rosetta chunk model_robloxmesh (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (2 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/robloxmesh"] = function() -- model/robloxmesh: Roblox FileMesh (.mesh), from MaximumADHD's "Roblox Mesh Format" (devforum.roblox.com/t/326114); no @@ -196881,6 +196844,19 @@ end return Write end +end + + + + + + model_schematic + --!optimize 2 +--!nocheck +-- rosetta chunk model_schematic (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 5 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/schematic"] = function() -- model/schematic: Minecraft schematics, read + write: MCEdit / WorldEdit .schematic (pre-1.13), Sponge .schem v1-3 @@ -197906,6 +197882,19 @@ end return Sponge end +end + + + + + + model_smd + --!optimize 2 +--!nocheck +-- rosetta chunk model_smd (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/smd"] = function() -- model/smd: Valve SMD (studiomdl "version 1" text, GoldSrc and Source), from the Valve Developer Community "SMD file @@ -198485,6 +198474,19 @@ end return Write end +end + + + + + + model_sourcemdl + --!optimize 2 +--!nocheck +-- rosetta chunk model_sourcemdl (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 7 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/sourcemdl"] = function() -- model/sourcemdl: Source engine studio models ("IDST" v44-49) with .vvd / .vtx (.dx90 / .dx80 / .sw) and optional .phy / @@ -199247,19 +199249,6 @@ end return Material end -end - - - - - - model_6 - --!optimize 2 ---!nocheck --- rosetta chunk model_6 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 23 modules (2 native: @native); the Rosetta root requires it when one of them is first included. --- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). -return function(__FILES, __include) __FILES["model/sourcemdl/Mdl"] = function() -- model/sourcemdl/Mdl: the studiohdr_t tables of Source MDL v44-49 (Source SDK 2013 public/studio.h layouts, SourceIO @@ -200186,6 +200175,19 @@ end return Vvd end +end + + + + + + model_stl + --!optimize 2 +--!nocheck +-- rosetta chunk model_stl (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/stl"] = function() -- model/stl: STL (3D Systems; Wikipedia "STL (file format)", the SLC spec), ASCII and binary, read + write. Supports: @@ -200710,6 +200712,19 @@ end return Decode end +end + + + + + + model_t3d + --!optimize 2 +--!nocheck +-- rosetta chunk model_t3d (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/t3d"] = function() -- model/t3d: Unreal T3D text (UnrealEd map / brush export: Begin Map / Level / Actor / Brush / PolyList / Polygon, @@ -201460,6 +201475,19 @@ end return Udmf end +end + + + + + + model_usda + --!optimize 2 +--!nocheck +-- rosetta chunk model_usda (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/usda"] = function() -- model/usda: USD ASCII layers (.usda, text .usd) and USDZ packages of them, from the Sdf text format and the UsdGeom / @@ -204562,6 +204590,19 @@ end return Write end +end + + + + + + model_vbsp + --!optimize 2 +--!nocheck +-- rosetta chunk model_vbsp (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/vbsp"] = function() -- model/vbsp: compiled Source engine maps (VBSP 19 / 20 / 21: HL2, TF2, L4D2's lump header, Portal 2 / CS:GO), read, @@ -205324,6 +205365,19 @@ end return Props end +end + + + + + + model_vmf + --!optimize 2 +--!nocheck +-- rosetta chunk model_vmf (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/vmf"] = function() -- model/vmf: Valve Hammer map sources (.vmf, KeyValues text), read and written. Solids through codecs/model/Brush @@ -206073,6 +206127,19 @@ end return Build end +end + + + + + + model_vox + --!optimize 2 +--!nocheck +-- rosetta chunk model_vox (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/vox"] = function() -- model/vox: MagicaVoxel .vox (ephtracy's MagicaVoxel-file-format-vox.txt / -vox-extension.txt, versions 150 and 200). @@ -207082,6 +207149,19 @@ end return Wrl end +end + + + + + + model_x + --!optimize 2 +--!nocheck +-- rosetta chunk model_x (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/x"] = function() -- model/x: DirectX .x, read only: text ("txt "), binary ("bin "), MSZIP ("tzip" / "bzip"), 32- and 64-bit floats; from @@ -207212,19 +207292,6 @@ end return X end -end - - - - - - model_7 - --!optimize 2 ---!nocheck --- rosetta chunk model_7 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. --- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). -return function(__FILES, __include) __FILES["model/x/Build"] = function() -- model/x/Build: the .x object tree to a Scene, from the DirectX template layouts. Direct3D is left-handed (y up, row @@ -208085,6 +208152,19 @@ end return Parse end +end + + + + + + model_x3d + --!optimize 2 +--!nocheck +-- rosetta chunk model_x3d (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["model/x3d"] = function() -- model/x3d: X3D (ISO/IEC 19775-1) XML (.x3d, 19776-1) and classic VRML (.x3dv, 19776-2) encodings, plain or gzipped, @@ -208167,13 +208247,13 @@ end - + - music + music_669 --!optimize 2 --!nocheck --- rosetta chunk music (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 22 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk music_669 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 5 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["music/669"] = function() @@ -208982,6 +209062,19 @@ end return Hvl end +end + + + + + + music_it + --!optimize 2 +--!nocheck +-- rosetta chunk music_it (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["music/it"] = function() @@ -209518,6 +209611,19 @@ end return Itsex end +end + + + + + + music_med + --!optimize 2 +--!nocheck +-- rosetta chunk music_med (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["music/med"] = function() @@ -210166,6 +210272,19 @@ end return Med end +end + + + + + + music_midi + --!optimize 2 +--!nocheck +-- rosetta chunk music_midi (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["music/midi"] = function() @@ -211076,6 +211195,19 @@ end return Mod end +end + + + + + + music_mtm + --!optimize 2 +--!nocheck +-- rosetta chunk music_mtm (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["music/mtm"] = function() @@ -211962,6 +212094,19 @@ end return Ptm end +end + + + + + + music_s3m + --!optimize 2 +--!nocheck +-- rosetta chunk music_s3m (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 5 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["music/s3m"] = function() @@ -212997,6 +213142,19 @@ end return Umx end +end + + + + + + music_xm + --!optimize 2 +--!nocheck +-- rosetta chunk music_xm (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["music/xm"] = function() @@ -213772,13 +213930,13 @@ end - + - ops + ops_AudioOps --!optimize 2 --!nocheck --- rosetta chunk ops (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 5 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk ops_AudioOps (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["ops/AudioOps"] = function() @@ -214260,6 +214418,1320 @@ end return AudioOps end +end + + + + + + ops_ImageOps + --!optimize 2 +--!nocheck +-- rosetta chunk ops_ImageOps (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) +__FILES["ops/ImageOps"] = function() + +-- ops/ImageOps: editing on the standard Image: conversion, crop, resize, flips, rotation, compositing, pixel access, +-- animation helpers. New code; the resampling and compositing follow Pillow's C sources. +-- Conventions: angles are degrees counter-clockwise and rotate90 turns are counter-clockwise quarter turns (as +-- Pillow). Resizing and rotating filter premultiplied alpha (as Pillow does for RGBA / LA). Grey is Pillow's +-- L = (19595 R + 38470 G + 7471 B + 32768) >> 16. 8 <-> 16 bit is * 257 and +-- (v * 255 + 32767) // 65535; float <-> integer clamps to 0..1 and rounds (no gamma). alpha8 converts to white with +-- that alpha. yuv420p is JPEG-style BT.601 full range (2x2 box chroma); geometric ops on yuv420p go through rgba8. +local Err = __include("core/Err") +local Types = __include("Types") +local K = __include("ops/ImageOps/Kernels") + +local ImageOps = {} + +local MAX_PIXELS = 2 ^ 26 + +type Image = Types.Image + +local function arg(msg: string): (nil, Err.Err) + return nil, Err.new(Err.ARG, msg) +end + +local function isInt(v: any): boolean + return type(v) == "number" and v == v and v % 1 == 0 and v > -2 ^ 31 and v < 2 ^ 31 +end + +local function bytesOf(fmt: string, w: number, h: number): number? + if fmt == "yuv420p" then + return w * h + 2 * ((w + 1) // 2) * ((h + 1) // 2) + end + local bpp = Types.BPP[fmt] + return if bpp then w * h * bpp else nil +end + +local function check(img: any): (boolean?, Err.Err?) + if type(img) ~= "table" or type(img.pixels) ~= "buffer" then + return arg("expected an Image") + end + if not isInt(img.width) or not isInt(img.height) or img.width < 1 or img.height < 1 then + return arg("bad image size") + end + local need = bytesOf(img.format, img.width, img.height) + if not need then + return arg("unknown pixel format " .. tostring(img.format)) + end + if buffer.len(img.pixels) < need then + return arg("pixel buffer too small for " .. img.width .. " x " .. img.height .. " " .. img.format) + end + return true, nil +end +ImageOps.check = check + +local function limit(w: number, h: number, opts: any): (boolean?, Err.Err?) + local max: number = (type(opts) == "table" and opts.maxPixels) or MAX_PIXELS + if w * h > max then + return nil, Err.new(Err.LIMIT, string.format("%d x %d is over the %d pixel limit", w, h, max)) + end + return true, nil +end + +local function like(img: Image, w: number, h: number, fmt: string?): Image + local out = Types.Image.new(w, h, (fmt or img.format) :: any) + for k, v in img.meta do + out.meta[k] = v + end + out.loops = img.loops + return out +end + +function ImageOps.new(w: number, h: number, format: string?): (Image?, Err.Err?) + local fmt = format or "rgba8" + if not isInt(w) or not isInt(h) or w < 1 or h < 1 then + return arg("bad image size") + end + if not bytesOf(fmt, 1, 1) then + return arg("unknown pixel format " .. tostring(fmt)) + end + local ok, e = limit(w, h, nil) + if not ok then + return nil, e + end + return Types.Image.new(w, h, fmt :: any), nil +end + +function ImageOps.copy(img: Image): (Image?, Err.Err?) + local ok, e = check(img) + if not ok then + return nil, e + end + local out = like(img, img.width, img.height) + buffer.copy(out.pixels, 0, img.pixels, 0, buffer.len(out.pixels)) + out.frames = img.frames + return out, nil +end + +function ImageOps.convert(img: Image, format: string): (Image?, Err.Err?) + local ok, e = check(img) + if not ok then + return nil, e + end + if not bytesOf(format, 1, 1) then + return arg("unknown pixel format " .. tostring(format)) + end + local w, h = img.width, img.height + if img.format == format then + return ImageOps.copy(img) + end + local src = img + if img.format == "yuv420p" then + local rgba = like(img, w, h, "rgba8") + K.yuvToRgba(img.pixels, w, h, rgba.pixels) + if format == "rgba8" then + return rgba, nil + end + src = rgba + end + local out = like(img, w, h, format) + if format == "yuv420p" then + local rgba = src + if src.format ~= "rgba8" then + rgba = like(img, w, h, "rgba8") + K.convert(src.pixels, K.ID[src.format], rgba.pixels, K.ID.rgba8, w * h) + end + K.rgbaToYuv(rgba.pixels, w, h, out.pixels) + return out, nil + end + K.convert(src.pixels, K.ID[src.format], out.pixels, K.ID[format], w * h) + return out, nil +end + +-- ops on yuv420p run on rgba8 and convert back +local function viaRgba(img: Image, f: (Image) -> (Image?, Err.Err?)): (Image?, Err.Err?) + if img.format ~= "yuv420p" then + return f(img) + end + local rgba = ImageOps.convert(img, "rgba8") :: Image + local res, e = f(rgba) + if not res then + return nil, e + end + return ImageOps.convert(res, "yuv420p") +end + +local ALPHA_CH: { [string]: number } = { rgba8 = 4, rgba16 = 4, rgbaf32 = 4, graya8 = 2 } + +function ImageOps.crop(img: Image, x: number, y: number, w: number, h: number): (Image?, Err.Err?) + local ok, e = check(img) + if not ok then + return nil, e + end + if not (isInt(x) and isInt(y) and isInt(w) and isInt(h)) then + return arg("crop: integer x, y, w, h") + end + local x0, y0 = math.max(0, x), math.max(0, y) + local x1, y1 = math.min(img.width, x + w), math.min(img.height, y + h) + if x1 <= x0 or y1 <= y0 then + return arg("crop: the rectangle is outside the image or empty") + end + return viaRgba(img, function(im: Image): (Image?, Err.Err?) + local bpp = Types.BPP[im.format] :: number + local out = like(im, x1 - x0, y1 - y0) + K.copyRect(out.pixels, out.width, im.pixels, im.width, x0, y0, 0, 0, out.width, out.height, bpp) + return out, nil + end) +end + +function ImageOps.flip(img: Image, axis: string): (Image?, Err.Err?) + local ok, e = check(img) + if not ok then + return nil, e + end + if axis ~= "h" and axis ~= "v" then + return arg("flip: axis must be \"h\" or \"v\"") + end + return viaRgba(img, function(im: Image): (Image?, Err.Err?) + local out = like(im, im.width, im.height) + K.flip(im.pixels, out.pixels, im.width, im.height, Types.BPP[im.format] :: number, axis == "h") + return out, nil + end) +end + +function ImageOps.rotate90(img: Image, turns: number): (Image?, Err.Err?) + local ok, e = check(img) + if not ok then + return nil, e + end + if not isInt(turns) then + return arg("rotate90: integer turns") + end + local t = turns % 4 + if t == 0 then + return ImageOps.copy(img) + end + return viaRgba(img, function(im: Image): (Image?, Err.Err?) + local swap = t ~= 2 + local out = like(im, if swap then im.height else im.width, if swap then im.width else im.height) + K.rotate90(im.pixels, out.pixels, im.width, im.height, Types.BPP[im.format] :: number, t) + return out, nil + end) +end + +type ResizeFilter = "nearest" | "bilinear" | "lanczos" + +function ImageOps.resize(img: Image, w: number, h: number, filter: string?, opts: any?): (Image?, Err.Err?) + local ok, e = check(img) + if not ok then + return nil, e + end + if not isInt(w) or not isInt(h) or w < 1 or h < 1 then + return arg("resize: bad target size") + end + local f = filter or "bilinear" + if f ~= "nearest" and f ~= "bilinear" and f ~= "lanczos" then + return arg("resize: filter must be nearest, bilinear or lanczos") + end + local lok, le = limit(w, h, opts) + if not lok then + return nil, le + end + return viaRgba(img, function(im: Image): (Image?, Err.Err?) + local fmt = im.format + local bpp = Types.BPP[fmt] :: number + local out = like(im, w, h) + if f == "nearest" then + K.nearest(im.pixels, im.width, im.height, bpp, out.pixels, w, h) + return out, nil + end + local kind, ch = K.KIND[fmt], K.CHANNELS[fmt] + local src, sw, sh = im.pixels, im.width, im.height + local alpha = ALPHA_CH[fmt] + local unAlpha = alpha + if alpha == 4 and kind == 1 and K.opaque(src, sw * sh) then + alpha = nil -- premultiplying is the identity; the resampled alpha can still round to 254: unpremultiplied below + end + if alpha then + src = buffer.create(buffer.len(im.pixels)) + buffer.copy(src, 0, im.pixels) + K.premultiply(src, sw * sh, alpha, kind, false) + end + if w ~= sw then + local tmp = buffer.create(w * sh * bpp) + K.resamplePass(src, sw, sh, ch, kind, tmp, w, K.coeffs(sw, w, f), true) + src, sw = tmp, w + end + if h ~= sh then + K.resamplePass(src, sw, sh, ch, kind, out.pixels, h, K.coeffs(sh, h, f), false) + elseif src == im.pixels or (w == im.width and alpha) then + buffer.copy(out.pixels, 0, im.pixels, 0, w * h * bpp) + return out, nil + else + out.pixels = src + end + if unAlpha then + K.premultiply(out.pixels, w * h, unAlpha, kind, true) + end + return out, nil + end) +end + +function ImageOps.rotate(img: Image, degrees: number, opts: { expand: boolean?, maxPixels: number? }?): (Image?, Err.Err?) + local ok, e = check(img) + if not ok then + return nil, e + end + if type(degrees) ~= "number" or degrees ~= degrees or degrees == math.huge or degrees == -math.huge then + return arg("rotate: degrees must be a finite number") + end + local expand = not (opts and opts.expand == false) + if degrees % 90 == 0 and (expand or degrees % 180 == 0 or img.width == img.height) then + return ImageOps.rotate90(img, (degrees // 90) % 4) + end + local w, h = img.width, img.height + local ang = -math.rad(degrees) + local function r15(v: number): number + return math.floor(v * 1e15 + 0.5) / 1e15 + end + local m = { r15(math.cos(ang)), r15(math.sin(ang)), 0, r15(-math.sin(ang)), r15(math.cos(ang)), 0 } + local function tr(x: number, y: number): (number, number) + return m[1] * x + m[2] * y + m[3], m[4] * x + m[5] * y + m[6] + end + local cx, cy = w / 2, h / 2 + m[3], m[6] = tr(-cx, -cy) + m[3] += cx + m[6] += cy + local nw, nh = w, h + if expand then + local xs, ys = {}, {} + for _, p in { { 0, 0 }, { w, 0 }, { w, h }, { 0, h } } do + local x, y = tr(p[1], p[2]) + table.insert(xs, x) + table.insert(ys, y) + end + nw = math.ceil(math.max(xs[1], xs[2], xs[3], xs[4])) - math.floor(math.min(xs[1], xs[2], xs[3], xs[4])) + nh = math.ceil(math.max(ys[1], ys[2], ys[3], ys[4])) - math.floor(math.min(ys[1], ys[2], ys[3], ys[4])) + m[3], m[6] = tr(-(nw - w) / 2, -(nh - h) / 2) + end + local lok, le = limit(nw, nh, opts) + if not lok then + return nil, le + end + return viaRgba(img, function(im: Image): (Image?, Err.Err?) + local out = like(im, nw, nh) + local kind = K.KIND[im.format] + local alpha = ALPHA_CH[im.format] + local src = im.pixels + if alpha then + src = buffer.create(buffer.len(im.pixels)) + buffer.copy(src, 0, im.pixels) + K.premultiply(src, w * h, alpha, kind, false) + end + K.affine(src, w, h, K.CHANNELS[im.format], kind, out.pixels, nw, nh, m) + if alpha then + K.premultiply(out.pixels, nw * nh, alpha, kind, true) + end + return out, nil + end) +end + +local RGBA: { [string]: boolean } = { rgba8 = true, rgba16 = true, rgbaf32 = true } + +type BlitOptions = { blend: ("over" | "source")?, opacity: number? } + +function ImageOps.blit(dst: Image, src: Image, x: number, y: number, opts: BlitOptions?): (Image?, Err.Err?) + local ok, e = check(dst) + if not ok then + return nil, e + end + local ok2, e2 = check(src) + if not ok2 then + return nil, e2 + end + if not isInt(x) or not isInt(y) then + return arg("blit: integer x, y") + end + local blend = (opts and opts.blend) or "over" + if blend ~= "over" and blend ~= "source" then + return arg("blit: blend must be \"over\" or \"source\"") + end + local opacity = (opts and opts.opacity) or 1 + if type(opacity) ~= "number" or not (opacity >= 0 and opacity <= 1) then + return arg("blit: opacity must be 0..1") + end + local sx, sy = math.max(0, -x), math.max(0, -y) + local dx, dy = math.max(0, x), math.max(0, y) + local w = math.min(src.width - sx, dst.width - dx) + local h = math.min(src.height - sy, dst.height - dy) + if w <= 0 or h <= 0 then + return dst, nil + end + if dst.format == "yuv420p" or (blend == "over" and not RGBA[dst.format]) then + -- work on an rgba copy of the region, then write it back in dst's format + local region = ImageOps.crop(dst, dx, dy, w, h) :: Image + local work = if region.format == "rgba8" then region else ImageOps.convert(region, "rgba8") :: Image + ImageOps.blit(work, src, x - dx, y - dy, opts) + if dst.format == "yuv420p" then + local full = ImageOps.convert(dst, "rgba8") :: Image + ImageOps.blit(full, work, dx, dy, { blend = "source" }) + local back = ImageOps.convert(full, "yuv420p") :: Image + buffer.copy(dst.pixels, 0, back.pixels, 0, buffer.len(back.pixels)) + else + local back = ImageOps.convert(work, dst.format) :: Image + K.copyRect(dst.pixels, dst.width, back.pixels, back.width, 0, 0, dx, dy, w, h, Types.BPP[dst.format] :: number) + end + return dst, nil + end + local s = src + if src.format ~= dst.format then + s = ImageOps.convert(src, dst.format) :: Image + end + if blend == "source" then + K.copyRect(dst.pixels, dst.width, s.pixels, s.width, sx, sy, dx, dy, w, h, Types.BPP[dst.format] :: number) + elseif dst.format == "rgba8" then + K.overRgba8(dst.pixels, dst.width, s.pixels, s.width, sx, sy, dx, dy, w, h, math.floor(opacity * 255 + 0.5)) + else + K.overFloat(dst.pixels, dst.width, s.pixels, s.width, sx, sy, dx, dy, w, h, opacity, K.KIND[dst.format]) + end + return dst, nil +end + +function ImageOps.composite(dst: Image, src: Image, x: number?, y: number?, opts: BlitOptions?): (Image?, Err.Err?) + local out, e = ImageOps.copy(dst) + if not out then + return nil, e + end + out.frames = nil + return ImageOps.blit(out, src, x or 0, y or 0, opts) +end + +local function premul(img: Image, un: boolean): (Image?, Err.Err?) + local out, e = ImageOps.copy(img) + if not out then + return nil, e + end + out.frames = nil + local ch = ALPHA_CH[img.format] + if ch then + K.premultiply(out.pixels, img.width * img.height, ch, K.KIND[img.format], un) + end + return out, nil +end + +function ImageOps.premultiply(img: Image): (Image?, Err.Err?) + return premul(img, false) +end +function ImageOps.unpremultiply(img: Image): (Image?, Err.Err?) + return premul(img, true) +end + +local MAXV: { [string]: number } = { rgba8 = 255, rgba16 = 65535, rgbaf32 = 1, rgb8 = 255, gray8 = 255, gray16 = 65535, graya8 = 255, alpha8 = 255, yuv420p = 255 } + +function ImageOps.getPixel(img: Image, x: number, y: number): (any, any, number?, number?) + local ok, e = check(img) + if not ok then + return nil, e + end + if not isInt(x) or not isInt(y) or x < 0 or y < 0 or x >= img.width or y >= img.height then + return arg("getPixel: coordinates out of range") + end + local b, f, i = img.pixels, img.format, y * img.width + x + local ru8, ru16, rf = buffer.readu8, buffer.readu16, buffer.readf32 + if f == "rgba8" then + return ru8(b, i * 4), ru8(b, i * 4 + 1), ru8(b, i * 4 + 2), ru8(b, i * 4 + 3) + elseif f == "rgba16" then + return ru16(b, i * 8), ru16(b, i * 8 + 2), ru16(b, i * 8 + 4), ru16(b, i * 8 + 6) + elseif f == "rgbaf32" then + return rf(b, i * 16), rf(b, i * 16 + 4), rf(b, i * 16 + 8), rf(b, i * 16 + 12) + elseif f == "rgb8" then + return ru8(b, i * 3), ru8(b, i * 3 + 1), ru8(b, i * 3 + 2), 255 + elseif f == "gray8" then + local v = ru8(b, i) + return v, v, v, 255 + elseif f == "gray16" then + local v = ru16(b, i * 2) + return v, v, v, 65535 + elseif f == "graya8" then + local v = ru8(b, i * 2) + return v, v, v, ru8(b, i * 2 + 1) + elseif f == "alpha8" then + return 255, 255, 255, ru8(b, i) + end + local one = ImageOps.crop(img, x - x % 2, y - y % 2, 2, 2) :: Image + local rgba = ImageOps.convert(one, "rgba8") :: Image + local j = ((y % 2) * rgba.width + (x % 2)) * 4 + if j + 4 > buffer.len(rgba.pixels) then + j = 0 + end + return ru8(rgba.pixels, j), ru8(rgba.pixels, j + 1), ru8(rgba.pixels, j + 2), 255 +end + +function ImageOps.setPixel(img: Image, x: number, y: number, r: number, g: number, b: number, a: number?): (boolean?, Err.Err?) + local ok, e = check(img) + if not ok then + return nil, e + end + if not isInt(x) or not isInt(y) or x < 0 or y < 0 or x >= img.width or y >= img.height then + return arg("setPixel: coordinates out of range") + end + if type(r) ~= "number" or type(g) ~= "number" or type(b) ~= "number" or (a ~= nil and type(a) ~= "number") then + return arg("setPixel: numeric channels") + end + local f = img.format + if f == "yuv420p" then + return arg("setPixel: not supported on yuv420p (convert to rgba8 first)") + end + local max = MAXV[f] + local al = if a == nil then max else a + local function q(v: number): number + if max == 1 then + return v + end + if v ~= v then + return 0 + end + return math.clamp(math.floor(v + 0.5), 0, max) + end + local px, i = img.pixels, y * img.width + x + local wu8, wu16, wf = buffer.writeu8, buffer.writeu16, buffer.writef32 + local function grey(): number + if max == 1 then + return (r * 19595 + g * 38470 + b * 7471) / 65536 + end + return (q(r) * 19595 + q(g) * 38470 + q(b) * 7471 + 32768) // 65536 + end + if f == "rgba8" then + wu8(px, i * 4, q(r)) + wu8(px, i * 4 + 1, q(g)) + wu8(px, i * 4 + 2, q(b)) + wu8(px, i * 4 + 3, q(al)) + elseif f == "rgba16" then + wu16(px, i * 8, q(r)) + wu16(px, i * 8 + 2, q(g)) + wu16(px, i * 8 + 4, q(b)) + wu16(px, i * 8 + 6, q(al)) + elseif f == "rgbaf32" then + wf(px, i * 16, r) + wf(px, i * 16 + 4, g) + wf(px, i * 16 + 8, b) + wf(px, i * 16 + 12, al) + elseif f == "rgb8" then + wu8(px, i * 3, q(r)) + wu8(px, i * 3 + 1, q(g)) + wu8(px, i * 3 + 2, q(b)) + elseif f == "gray8" then + wu8(px, i, grey()) + elseif f == "gray16" then + wu16(px, i * 2, grey()) + elseif f == "graya8" then + wu8(px, i * 2, grey()) + wu8(px, i * 2 + 1, q(al)) + else + wu8(px, i, q(al)) + end + return true, nil +end + +function ImageOps.fill(img: Image, r: number, g: number, b: number, a: number?): (Image?, Err.Err?) + local ok, e = check(img) + if not ok then + return nil, e + end + if img.format == "yuv420p" then + return arg("fill: not supported on yuv420p") + end + local sok, se = ImageOps.setPixel(img, 0, 0, r, g, b, a) + if not sok then + return nil, se + end + local bpp = Types.BPP[img.format] :: number + local n = img.width * img.height * bpp + local filled = bpp + while filled < n do + local c = math.min(filled, n - filled) + buffer.copy(img.pixels, filled, img.pixels, 0, c) + filled += c + end + return img, nil +end + +function ImageOps.frameCount(img: Image): number + if type(img) == "table" and type(img.frames) == "table" and #img.frames > 0 then + return #img.frames + end + return 1 +end + +function ImageOps.durations(img: Image): { number } + local out = {} + if type(img) == "table" and type(img.frames) == "table" and #img.frames > 0 then + for i, f in img.frames do + out[i] = if type(f.delay) == "number" then f.delay else 0 + end + return out + end + return { 0 } +end + +-- coalesce: dispose "none" keeps the canvas, "background" clears the frame's rectangle, "previous" restores it +function ImageOps.coalesce(img: Image): ({ Image }?, Err.Err?) + local ok, e = check(img) + if not ok then + return nil, e + end + local frames = img.frames + if type(frames) ~= "table" or #frames == 0 then + return { img }, nil + end + local fmt = if RGBA[img.format] then img.format else "rgba8" + local canvas = Types.Image.new(img.width, img.height, fmt :: any) + local bpp = Types.BPP[fmt] :: number + local out = {} + for i, f in frames do + if type(f) ~= "table" then + return arg("coalesce: frame " .. i .. " is not a Frame") + end + local fi = f.image + local fok, fe = check(fi) + if not fok then + return nil, Err.new(Err.ARG, "coalesce: frame " .. i .. ": " .. (fe :: Err.Err).message) + end + local fx, fy = if isInt(f.x) then f.x else 0, if isInt(f.y) then f.y else 0 + local saved: buffer? = nil + if f.dispose == "previous" then + local sb = buffer.create(buffer.len(canvas.pixels)) + buffer.copy(sb, 0, canvas.pixels) + saved = sb + end + local bok, be = ImageOps.blit(canvas, fi, fx, fy, { blend = if f.blend == "source" then "source" else "over" }) + if not bok then + return nil, be + end + local snap = Types.Image.new(img.width, img.height, fmt :: any) + buffer.copy(snap.pixels, 0, canvas.pixels) + for k, v in img.meta do + snap.meta[k] = v + end + snap.meta.delay = f.delay + out[i] = snap + if f.dispose == "background" then + local x0, y0 = math.max(0, fx), math.max(0, fy) + local x1, y1 = math.min(img.width, fx + fi.width), math.min(img.height, fy + fi.height) + for y = y0, y1 - 1 do + if x1 > x0 then + buffer.fill(canvas.pixels, (y * img.width + x0) * bpp, 0, (x1 - x0) * bpp) + end + end + elseif saved then + canvas.pixels = saved + end + end + return out, nil +end + +function ImageOps.fromFrames(images: { Image }, delays: (number | { number })?): (Image?, Err.Err?) + if type(images) ~= "table" or #images == 0 then + return arg("fromFrames: a non-empty list of Images") + end + local first = images[1] + local ok, e = check(first) + if not ok then + return nil, e + end + local frames = {} + for i, im in images do + local iok, ie = check(im) + if not iok then + return nil, ie + end + if im.width ~= first.width or im.height ~= first.height or im.format ~= first.format then + return arg("fromFrames: frame " .. i .. " differs in size or format from frame 1") + end + local d = 0.1 + if type(delays) == "number" then + d = delays + elseif type(delays) == "table" and type(delays[i]) == "number" then + d = delays[i] + end + frames[i] = { image = im, delay = d, x = 0, y = 0, dispose = "none", blend = "source" } + end + local out = like(first, first.width, first.height) + buffer.copy(out.pixels, 0, first.pixels, 0, buffer.len(out.pixels)) + out.frames = frames :: any + out.loops = 0 + return out, nil +end + +return ImageOps +end +__FILES["ops/ImageOps/Kernels"] = @native function() + + + +-- ops/ImageOps/Kernels: the hot loops behind ops/ImageOps; callers validate, so indexes are in range by construction. +-- Sample kinds: 1 = u8, 2 = u16, 4 = f32 (little endian). Resampling follows Pillow's Resample.c (separable, 22-bit +-- fixed point for 8-bit) and Geometry.c (affine through pixel centres); compositing is Pillow's AlphaComposite.c. +local readu8, writeu8, readu16, writeu16, readf32, writef32 = buffer.readu8, buffer.writeu8, buffer.readu16, buffer.writeu16, buffer.readf32, buffer.writef32 +local readu32, writeu32 = buffer.readu32, buffer.writeu32 +local floor, clamp = math.floor, math.clamp + +local K = {} + +-- format ids: rgba8 1, rgba16 2, rgbaf32 3, rgb8 4, gray8 5, gray16 6, graya8 7, alpha8 8 +K.ID = { rgba8 = 1, rgba16 = 2, rgbaf32 = 3, rgb8 = 4, gray8 = 5, gray16 = 6, graya8 = 7, alpha8 = 8 } :: { [string]: number } +K.KIND = { rgba8 = 1, rgba16 = 2, rgbaf32 = 4, rgb8 = 1, gray8 = 1, gray16 = 2, graya8 = 1, alpha8 = 1 } :: { [string]: number } +K.CHANNELS = { rgba8 = 4, rgba16 = 4, rgbaf32 = 4, rgb8 = 3, gray8 = 1, gray16 = 1, graya8 = 2, alpha8 = 1 } :: { [string]: number } + +@native local function rd(b: buffer, o: number, kind: number): number + if kind == 1 then + return readu8(b, o) + elseif kind == 2 then + return readu16(b, o) + end + return readf32(b, o) +end + +@native local function wr(b: buffer, o: number, kind: number, v: number) + if kind == 1 then + writeu8(b, o, clamp(floor(v + 0.5), 0, 255)) + elseif kind == 2 then + writeu16(b, o, clamp(floor(v + 0.5), 0, 65535)) + else + writef32(b, o, v) + end +end + +-- depth: 8 -> 0..255, 16 -> 0..65535, 0 -> float 0..1 +local DEPTH = { 8, 16, 0, 8, 8, 16, 8, 8 } + +@native local function depthConv(v: number, from: number, to: number): number + if from == to then + return v + end + if from == 8 then + if to == 16 then + return v * 257 + end + return v / 255 + elseif from == 16 then + if to == 8 then + return (v * 255 + 32767) // 65535 + end + return v / 65535 + end + if v ~= v then + v = 0 + end + if to == 8 then + return clamp(floor(v * 255 + 0.5), 0, 255) + end + return clamp(floor(v * 65535 + 0.5), 0, 65535) +end + +-- Pillow's L24 luma (19595 R + 38470 G + 7471 B + 0x8000) >> 16, in the source depth +@native local function luma(r: number, g: number, b: number, depth: number): number + if depth == 0 then + return (r * 19595 + g * 38470 + b * 7471) / 65536 + end + return (r * 19595 + g * 38470 + b * 7471 + 32768) // 65536 +end + +@native function K.convert(src: buffer, sf: number, dst: buffer, df: number, n: number) + if sf == 1 and df == 5 then + for i = 0, n - 1 do + local o = i * 4 + writeu8(dst, i, (readu8(src, o) * 19595 + readu8(src, o + 1) * 38470 + readu8(src, o + 2) * 7471 + 32768) // 65536) + end + return + elseif sf == 1 and df == 4 and n > 0 then + -- a u32 per pixel; its fourth byte is overwritten by the next pixel (the last one is written as 2 + 1 bytes) + for i = 0, n - 2 do + writeu32(dst, i * 3, readu32(src, i * 4)) + end + local o, d = (n - 1) * 4, (n - 1) * 3 + writeu16(dst, d, readu16(src, o)) + writeu8(dst, d + 2, readu8(src, o + 2)) + return + elseif df == 1 and (sf == 4 or sf == 5) then + for i = 0, n - 1 do + if sf == 4 then + local o = i * 3 + writeu32(dst, i * 4, readu8(src, o) + readu8(src, o + 1) * 256 + readu8(src, o + 2) * 65536 + 0xFF000000) + else + writeu32(dst, i * 4, readu8(src, i) * 0x10101 + 0xFF000000) + end + end + return + end + local sd, dd = DEPTH[sf] :: number, DEPTH[df] :: number + local smax = if sd == 8 then 255 elseif sd == 16 then 65535 else 1 + local toGray = df == 5 or df == 6 or df == 7 + for i = 0, n - 1 do + local r: number, g: number, b: number, a: number + if sf == 1 then + local o = i * 4 + r, g, b, a = readu8(src, o), readu8(src, o + 1), readu8(src, o + 2), readu8(src, o + 3) :: number + elseif sf == 2 then + local o = i * 8 + r, g, b, a = readu16(src, o), readu16(src, o + 2), readu16(src, o + 4), readu16(src, o + 6) :: number + elseif sf == 3 then + local o = i * 16 + r, g, b, a = readf32(src, o), readf32(src, o + 4), readf32(src, o + 8), readf32(src, o + 12) :: number + elseif sf == 4 then + local o = i * 3 + r, g, b, a = readu8(src, o), readu8(src, o + 1), readu8(src, o + 2), 255 + elseif sf == 5 then + local v = readu8(src, i) + r, g, b, a = v, v, v, 255 + elseif sf == 6 then + local v = readu16(src, i * 2) + r, g, b, a = v, v, v, 65535 + elseif sf == 7 then + local v = readu8(src, i * 2) + r, g, b, a = v, v, v, readu8(src, i * 2 + 1) :: number + else + r, g, b, a = 255, 255, 255, readu8(src, i) + end + if toGray then + local isGray = sf == 5 or sf == 6 or sf == 7 + local l = if isGray then r else luma(r, g, b, sd) + l = depthConv(l, sd, dd) + if df == 5 then + writeu8(dst, i, l) + elseif df == 6 then + writeu16(dst, i * 2, l) + else + writeu8(dst, i * 2, l) + writeu8(dst, i * 2 + 1, depthConv(a, sd, dd)) + end + elseif df == 8 then + writeu8(dst, i, depthConv(a, sd, 8)) + else + r, g, b = depthConv(r, sd, dd), depthConv(g, sd, dd), depthConv(b, sd, dd) :: number + if df == 1 then + local o = i * 4 + writeu8(dst, o, r) + writeu8(dst, o + 1, g) + writeu8(dst, o + 2, b) + writeu8(dst, o + 3, depthConv(a, sd, dd)) + elseif df == 2 then + local o = i * 8 + writeu16(dst, o, r) + writeu16(dst, o + 2, g) + writeu16(dst, o + 4, b) + writeu16(dst, o + 6, depthConv(a, sd, dd)) + elseif df == 3 then + local o = i * 16 + writef32(dst, o, r) + writef32(dst, o + 4, g) + writef32(dst, o + 8, b) + writef32(dst, o + 12, if a == smax and sd ~= 0 then 1 else depthConv(a, sd, dd)) + else -- rgb8 + local o = i * 3 + writeu8(dst, o, r) + writeu8(dst, o + 1, g) + writeu8(dst, o + 2, b) + end + end + end +end + +-- JPEG-style BT.601 full range +@native function K.rgbaToYuv(src: buffer, w: number, h: number, dst: buffer) + local cw, ch = (w + 1) // 2, (h + 1) // 2 + local uo, vo = w * h, w * h + cw * ch + for i = 0, w * h - 1 do + local o = i * 4 + local r, g, b = readu8(src, o), readu8(src, o + 1), readu8(src, o + 2) + writeu8(dst, i, clamp(floor(0.299 * r + 0.587 * g + 0.114 * b + 0.5), 0, 255)) + end + for cy = 0, ch - 1 do + for cx = 0, cw - 1 do + local sr, sg, sb, n = 0, 0, 0, 0 + for dy = 0, 1 do + local y = cy * 2 + dy + if y < h then + for dx = 0, 1 do + local x = cx * 2 + dx + if x < w then + local o = (y * w + x) * 4 + sr += readu8(src, o) + sg += readu8(src, o + 1) + sb += readu8(src, o + 2) + n += 1 + end + end + end + end + sr, sg, sb = sr / n, sg / n, sb / n + local i = cy * cw + cx + writeu8(dst, uo + i, clamp(floor(128 - 0.168736 * sr - 0.331264 * sg + 0.5 * sb + 0.5), 0, 255)) + writeu8(dst, vo + i, clamp(floor(128 + 0.5 * sr - 0.418688 * sg - 0.081312 * sb + 0.5), 0, 255)) + end + end +end + +@native function K.yuvToRgba(src: buffer, w: number, h: number, dst: buffer) + local cw, ch = (w + 1) // 2, (h + 1) // 2 + local uo, vo = w * h, w * h + cw * ch + for y = 0, h - 1 do + local crow = (y // 2) * cw + for x = 0, w - 1 do + local yy = readu8(src, y * w + x) + local ci = crow + x // 2 + local u, v = readu8(src, uo + ci) - 128, readu8(src, vo + ci) - 128 + local o = (y * w + x) * 4 + writeu8(dst, o, clamp(floor(yy + 1.402 * v + 0.5), 0, 255)) + writeu8(dst, o + 1, clamp(floor(yy - 0.344136 * u - 0.714136 * v + 0.5), 0, 255)) + writeu8(dst, o + 2, clamp(floor(yy + 1.772 * u + 0.5), 0, 255)) + writeu8(dst, o + 3, 255) + end + end + local _ = ch +end + +@native function K.flip(src: buffer, dst: buffer, w: number, h: number, bpp: number, horizontal: boolean) + local stride = w * bpp + if not horizontal then + for y = 0, h - 1 do + buffer.copy(dst, (h - 1 - y) * stride, src, y * stride, stride) + end + return + end + for y = 0, h - 1 do + local row = y * stride + for x = 0, w - 1 do + buffer.copy(dst, row + (w - 1 - x) * bpp, src, row + x * bpp, bpp) + end + end +end + +-- counter-clockwise quarter turns 1..3 +@native function K.rotate90(src: buffer, dst: buffer, w: number, h: number, bpp: number, turns: number) + for y = 0, h - 1 do + for x = 0, w - 1 do + local ox, oy, ow + if turns == 1 then + ox, oy, ow = y, w - 1 - x, h + elseif turns == 2 then + ox, oy, ow = w - 1 - x, h - 1 - y, w + else + ox, oy, ow = h - 1 - y, x, h + end + local so, d = (y * w + x) * bpp, (oy * ow + ox) * bpp + if bpp == 4 then + buffer.writeu32(dst, d, buffer.readu32(src, so)) + else + buffer.copy(dst, d, src, so, bpp) + end + end + end +end + +@native local function bilinearF(x: number): number + if x < 0 then + x = -x + end + if x < 1 then + return 1 - x + end + return 0 +end + +@native local function sinc(x: number): number + if x == 0 then + return 1 + end + x *= math.pi + return math.sin(x) / x +end + +@native local function lanczosF(x: number): number + if x > -3 and x < 3 then + return sinc(x) * sinc(x / 3) + end + return 0 +end + +@native local function trunc(x: number): number + return if x < 0 then math.ceil(x) else floor(x) +end + +-- Pillow precompute_coeffs: per output index its first input index, tap count and weights (normalised) +type Coeffs = { start: { number }, count: { number }, weights: { { number } } } + +@native function K.coeffs(inSize: number, outSize: number, filter: string): Coeffs + local support0 = if filter == "lanczos" then 3 else 1 + local f = if filter == "lanczos" then lanczosF else bilinearF + local scale = inSize / outSize + local filterscale = math.max(scale, 1) + local support = support0 * filterscale + local ss = 1 / filterscale + local start, count, weights = table.create(outSize, 0), table.create(outSize, 0), table.create(outSize) :: { { number } } + for xx = 0, outSize - 1 do + local center = (xx + 0.5) * scale + local xmin = math.max(0, trunc(center - support + 0.5)) + local xmax = math.min(inSize, trunc(center + support + 0.5)) - xmin + local w = table.create(math.max(xmax, 0), 0) + local ww = 0 + for x = 0, xmax - 1 do + local v = f((x + xmin - center + 0.5) * ss) + w[x + 1] = v + ww += v + end + if ww ~= 0 then + for x = 1, xmax do + w[x] /= ww + end + end + start[xx + 1], count[xx + 1], weights[xx + 1] = xmin, math.max(xmax, 0), w + end + return { start = start, count = count, weights = weights } +end + +-- 8-bit RGBA: the four channels of a tap together, the pixel written as one u32 +@native local function resample4(src: buffer, w: number, h: number, dst: buffer, outN: number, start: { number }, count: { number }, iw: { { number } }, horizontal: boolean) + local o = 0 + if horizontal then + for y = 0, h - 1 do + local row = y * w * 4 + for xx = 1, outN do + local wt = iw[xx] + local p = row + start[xx] * 4 + local a0, a1, a2, a3 = 2097152, 2097152, 2097152, 2097152 + for k = 1, count[xx] do + local wk = wt[k] + a0 += readu8(src, p) * wk + a1 += readu8(src, p + 1) * wk + a2 += readu8(src, p + 2) * wk + a3 += readu8(src, p + 3) * wk + p += 4 + end + writeu32(dst, o, clamp(a0 // 4194304, 0, 255) + clamp(a1 // 4194304, 0, 255) * 256 + clamp(a2 // 4194304, 0, 255) * 65536 + clamp(a3 // 4194304, 0, 255) * 16777216) + o += 4 + end + end + else + local rs = w * 4 + for yy = 1, outN do + local wt, n = iw[yy], count[yy] + local base = start[yy] * rs + for x = 0, rs - 4, 4 do + local p = base + x + local a0, a1, a2, a3 = 2097152, 2097152, 2097152, 2097152 + for k = 1, n do + local wk = wt[k] + a0 += readu8(src, p) * wk + a1 += readu8(src, p + 1) * wk + a2 += readu8(src, p + 2) * wk + a3 += readu8(src, p + 3) * wk + p += rs + end + writeu32(dst, o, clamp(a0 // 4194304, 0, 255) + clamp(a1 // 4194304, 0, 255) * 256 + clamp(a2 // 4194304, 0, 255) * 65536 + clamp(a3 // 4194304, 0, 255) * 16777216) + o += 4 + end + end + end + local _ = h +end + +@native function K.resamplePass(src: buffer, w: number, h: number, ch: number, kind: number, dst: buffer, outN: number, c: Coeffs, horizontal: boolean) + local start, count, weights = c.start, c.count, c.weights + local size = kind + local fixed = kind == 1 + -- 8-bit: Pillow's 22-bit fixed-point coefficients + local iw: { { number } } = weights + if fixed then + iw = table.create(outN) :: { { number } } + for i = 1, outN do + local src0 = weights[i] + local t = table.create(#src0, 0) + for k = 1, #src0 do + local v = src0[k] * 4194304 + t[k] = if v < 0 then math.ceil(v - 0.5) else floor(v + 0.5) + end + iw[i] = t + end + end + if fixed and ch == 4 then + resample4(src, w, h, dst, outN, start, count, iw, horizontal) + return + end + if horizontal then + for y = 0, h - 1 do + local row = y * w + for xx = 0, outN - 1 do + local s0, n, wt = start[xx + 1], count[xx + 1], iw[xx + 1] + local o = ((y * outN) + xx) * ch * size + for cc = 0, ch - 1 do + if fixed then + local acc = 2097152 + for k = 0, n - 1 do + acc += readu8(src, (row + s0 + k) * ch + cc) * wt[k + 1] + end + writeu8(dst, o + cc, clamp(acc // 4194304, 0, 255)) + else + local acc = 0 + for k = 0, n - 1 do + acc += rd(src, ((row + s0 + k) * ch + cc) * size, kind) * wt[k + 1] + end + wr(dst, o + cc * size, kind, acc) + end + end + end + end + else + for yy = 0, outN - 1 do + local s0, n, wt = start[yy + 1], count[yy + 1], iw[yy + 1] + for x = 0, w - 1 do + local o = (yy * w + x) * ch * size + for cc = 0, ch - 1 do + if fixed then + local acc = 2097152 + for k = 0, n - 1 do + acc += readu8(src, ((s0 + k) * w + x) * ch + cc) * wt[k + 1] + end + writeu8(dst, o + cc, clamp(acc // 4194304, 0, 255)) + else + local acc = 0 + for k = 0, n - 1 do + acc += rd(src, (((s0 + k) * w + x) * ch + cc) * size, kind) * wt[k + 1] + end + wr(dst, o + cc * size, kind, acc) + end + end + end + end + end + local _ = h +end + +-- nearest: dst pixel (x, y) = src pixel (floor((x + 0.5) * w / ow), ...) +@native function K.nearest(src: buffer, w: number, h: number, bpp: number, dst: buffer, ow: number, oh: number) + local sx, sy = w / ow, h / oh + local xs = table.create(ow, 0) + for x = 0, ow - 1 do + xs[x + 1] = math.min(floor((x + 0.5) * sx), w - 1) * bpp + end + local o = 0 + for y = 0, oh - 1 do + local row = math.min(floor((y + 0.5) * sy), h - 1) * w * bpp + if bpp == 4 then + for x = 1, ow do + writeu32(dst, o, readu32(src, row + xs[x])) + o += 4 + end + else + for x = 1, ow do + buffer.copy(dst, o, src, row + xs[x], bpp) + o += bpp + end + end + end +end + +-- affine: dst pixel centres through m = { a, b, c, d, e, f } (xin = a x + b y + c), bilinear with clamped +-- neighbours; centres outside the source -> zeros (Pillow) +@native function K.affine(src: buffer, w: number, h: number, ch: number, kind: number, dst: buffer, ow: number, oh: number, m: { number }) + local a, b, c, d, e, f = m[1], m[2], m[3], m[4], m[5], m[6] + local size = kind + for y = 0, oh - 1 do + local py = y + 0.5 + for x = 0, ow - 1 do + local px = x + 0.5 + local xin = a * px + b * py + c - 0.5 + local yin = d * px + e * py + f - 0.5 + local o = (y * ow + x) * ch * size + local x0 = floor(xin) + local y0 = floor(yin) + if xin < -0.5 or xin >= w - 0.5 or yin < -0.5 or yin >= h - 0.5 then + continue -- dst starts zeroed + end + local dx, dy = xin - x0, yin - y0 + local xa, xb = clamp(x0, 0, w - 1), clamp(x0 + 1, 0, w - 1) + local ya, yb = clamp(y0, 0, h - 1), clamp(y0 + 1, 0, h - 1) + for cc = 0, ch - 1 do + local p00 = rd(src, ((ya * w + xa) * ch + cc) * size, kind) + local p01 = rd(src, ((ya * w + xb) * ch + cc) * size, kind) + local p10 = rd(src, ((yb * w + xa) * ch + cc) * size, kind) + local p11 = rd(src, ((yb * w + xb) * ch + cc) * size, kind) + local top = p00 + (p01 - p00) * dx + local bot = p10 + (p11 - p10) * dx + local v = top + (bot - top) * dy + if kind == 1 then + writeu8(dst, o + cc, clamp(floor(v), 0, 255)) -- Pillow truncates + else + wr(dst, o + cc * size, kind, v) + end + end + end + end +end + +-- Pillow's alpha_composite of src onto dst, in place +@native function K.overRgba8(dst: buffer, dw: number, src: buffer, sw: number, sx: number, sy: number, dx: number, dy: number, w: number, h: number, opacity: number) + for y = 0, h - 1 do + for x = 0, w - 1 do + local so = ((sy + y) * sw + sx + x) * 4 + local doff = ((dy + y) * dw + dx + x) * 4 + local sa = readu8(src, so + 3) + if opacity < 255 then + sa = (sa * opacity + 127) // 255 + end + if sa == 0 then + continue + elseif sa == 255 then + -- coef1 = 255 * 128, coef2 = 0: the source pixel exactly + writeu32(dst, doff, readu32(src, so)) + continue + end + local da = readu8(dst, doff + 3) + local blend = da * (255 - sa) + local outa255 = sa * 255 + blend + local coef1 = (sa * 255 * 255 * 128) // outa255 + local coef2 = 255 * 128 - coef1 + for cc = 0, 2 do + local t = readu8(src, so + cc) * coef1 + readu8(dst, doff + cc) * coef2 + 0x80 * 128 + t = ((t // 256) + t) // 256 + writeu8(dst, doff + cc, t // 128) + end + local t = outa255 + 0x80 + writeu8(dst, doff + 3, ((t // 256) + t) // 256) + end + end +end + +-- overFloat: straight-alpha "over" for rgba16 (kind 2) / rgbaf32 (kind 4); max = 65535 or 1 +@native function K.overFloat(dst: buffer, dw: number, src: buffer, sw: number, sx: number, sy: number, dx: number, dy: number, w: number, h: number, opacity: number, kind: number) + local max = if kind == 2 then 65535 else 1 + local px = 4 * kind + for y = 0, h - 1 do + for x = 0, w - 1 do + local so = ((sy + y) * sw + sx + x) * px + local doff = ((dy + y) * dw + dx + x) * px + local sa = rd(src, so + 3 * kind, kind) / max * opacity + if sa <= 0 then + continue + end + local da = rd(dst, doff + 3 * kind, kind) / max + local oa = sa + da * (1 - sa) + for cc = 0, 2 do + local s = rd(src, so + cc * kind, kind) + local d = rd(dst, doff + cc * kind, kind) + wr(dst, doff + cc * kind, kind, if oa > 0 then (s * sa + d * da * (1 - sa)) / oa else 0) + end + wr(dst, doff + 3 * kind, kind, oa * max) + end + end +end + +@native function K.copyRect(dst: buffer, dw: number, src: buffer, sw: number, sx: number, sy: number, dx: number, dy: number, w: number, h: number, bpp: number) + for y = 0, h - 1 do + buffer.copy(dst, ((dy + y) * dw + dx) * bpp, src, ((sy + y) * sw + sx) * bpp, w * bpp) + end +end + +-- a = 255 leaves the colour as it is both ways (MULDIV255(v, 255) = v, v * 255 // 255 = v) +@native local function premultiply4(b: buffer, n: number, un: boolean) + for o = 3, n * 4 - 1, 4 do + local a = readu8(b, o) + if a == 255 then + continue + end + if a == 0 then + writeu16(b, o - 3, 0) + writeu8(b, o - 1, 0) + continue + end + for c = o - 3, o - 1 do + local v = readu8(b, c) + if un then + writeu8(b, c, math.min(255, (v * 255) // a)) -- Pillow's rgbA2rgba + else + local t = v * a + 128 -- Pillow's MULDIV255 + writeu8(b, c, ((t // 256) + t) // 256) + end + end + end +end + +@native function K.opaque(b: buffer, n: number): boolean + for o = 3, n * 4 - 1, 4 do + if readu8(b, o) ~= 255 then + return false + end + end + return true +end + +@native function K.premultiply(b: buffer, n: number, ch: number, kind: number, un: boolean) + if kind == 1 and ch == 4 then + premultiply4(b, n, un) + return + end + local max = if kind == 1 then 255 elseif kind == 2 then 65535 else 1 + local px = ch * kind + for i = 0, n - 1 do + local o = i * px + local a = rd(b, o + (ch - 1) * kind, kind) + for cc = 0, ch - 2 do + local v = rd(b, o + cc * kind, kind) + local r + if un then + if a <= 0 then + r = 0 + elseif kind == 4 then + r = v / a + elseif kind == 1 then + r = math.min(255, (v * 255) // a) -- Pillow's rgbA2rgba + else + r = math.min(max, (v * max + a // 2) // a) + end + else + if kind == 4 then + r = v * a + elseif kind == 1 then + local t = v * a + 128 -- Pillow's MULDIV255 + r = ((t // 256) + t) // 256 + else + r = (v * a + max // 2) // max + end + end + wr(b, o + cc * kind, kind, r) + end + end +end + +return K +end +end + + + + + + ops_LayerOps + --!optimize 2 +--!nocheck +-- rosetta chunk ops_LayerOps (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["ops/LayerOps"] = function() -- ops/LayerOps: editing on the Layered type (PSD, Aseprite): flatten a layer tree (or one animation frame) to an @@ -214353,6 +215825,19 @@ end return LayerOps end +end + + + + + + ops_MeshOps + --!optimize 2 +--!nocheck +-- rosetta chunk ops_MeshOps (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["ops/MeshOps"] = function() -- ops/MeshOps: editing meshes in the standard Scene type: triangulate, transform, normals (area weighted or flat), @@ -215660,6 +217145,19 @@ end return Greedy end +end + + + + + + ops_MusicOps + --!optimize 2 +--!nocheck +-- rosetta chunk ops_MusicOps (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 1 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["ops/MusicOps"] = function() @@ -216013,12 +217511,12 @@ end - + - playlist + playlist_m3u --!optimize 2 --!nocheck --- rosetta chunk playlist (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- rosetta chunk playlist_m3u (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. -- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) @@ -216760,12 +218258,12 @@ end - + - subtitle + subtitle_ass --!optimize 2 --!nocheck --- rosetta chunk subtitle (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- rosetta chunk subtitle_ass (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. -- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) @@ -217593,13 +219091,13 @@ end - + - vector + vector_gamemaps --!optimize 2 --!nocheck --- rosetta chunk vector (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 18 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk vector_gamemaps (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (1 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["vector/gamemaps"] = function() @@ -217886,6 +219384,19 @@ end return Expand end +end + + + + + + vector_ldtk + --!optimize 2 +--!nocheck +-- rosetta chunk vector_ldtk (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["vector/ldtk"] = function() -- vector/ldtk: LDtk projects (.ldtk JSON, ldtk.io/json, 1.x) as a TileMap, read + write. Supports: IntGrid, @@ -218962,6 +220473,19 @@ end return Write end +end + + + + + + vector_ogmo + --!optimize 2 +--!nocheck +-- rosetta chunk vector_ogmo (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["vector/ogmo"] = function() -- vector/ogmo: Ogmo Editor 3 levels (.json) and projects (.ogmo) as a TileMap, read + write (OgmoEditor3-CE 3.x @@ -219840,6 +221364,19 @@ end return Write end +end + + + + + + vector_svg + --!optimize 2 +--!nocheck +-- rosetta chunk vector_svg (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 6 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["vector/svg"] = function() -- vector/svg: SVG 1.1 / 2 static documents (W3C SVG 1.1 2nd ed., SVG 2 CR). Supports: shapes and paths, transforms, @@ -222029,6 +223566,19 @@ end return Write end +end + + + + + + vector_tiled + --!optimize 2 +--!nocheck +-- rosetta chunk vector_tiled (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["vector/tiled"] = function() -- vector/tiled: Tiled maps, TMX (XML) / TMJ (JSON), and TSX / TSJ tilesets (Tiled 1.12 docs: "TMX Map Format", "JSON @@ -223607,13 +225157,13 @@ end - + - video + video_avi --!optimize 2 --!nocheck --- rosetta chunk video (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. --- 16 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- rosetta chunk video_avi (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 2 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). return function(__FILES, __include) __FILES["video/avi"] = function() @@ -224061,6 +225611,19 @@ end return Fli end +end + + + + + + video_flv + --!optimize 2 +--!nocheck +-- rosetta chunk video_flv (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["video/flv"] = function() -- video/flv: Flash Video (Adobe FLV spec v10, Enhanced RTMP FourCC tags). Reads the tags and onMetaData (AMF0) into a @@ -225023,6 +226586,19 @@ end return Format end +end + + + + + + video_mkv + --!optimize 2 +--!nocheck +-- rosetta chunk video_mkv (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["video/mkv"] = function() -- video/mkv: Matroska / WebM (RFC 9559, the WebM guidelines), on containers/Ebml. Reads every packet (all lacings, @@ -226179,6 +227755,19 @@ end return Parse end +end + + + + + + video_mp4 + --!optimize 2 +--!nocheck +-- rosetta chunk video_mp4 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 3 modules (0 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["video/mp4"] = function() -- video/mp4: MP4 / M4V / MOV / 3GP (ISO/IEC 14496-12 / 14496-14, QuickTime), on containers/IsoBmff. Reads every @@ -226940,6 +228529,19 @@ end return Ts end +end + + + + + + video_ogv + --!optimize 2 +--!nocheck +-- rosetta chunk video_ogv (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. +-- 4 modules (1 native: @native); the Rosetta root requires it when one of them is first included. +-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). +return function(__FILES, __include) __FILES["video/ogv"] = function() -- video/ogv: Ogg Theora video (Theora I spec, RFC 3533 / 5334), on containers/Ogg: Theora (granule = keyframe << shift diff --git a/src/Rosetta/Sniffs.luau b/src/Rosetta/Sniffs.luau index 639bd70..8b580b1 100644 --- a/src/Rosetta/Sniffs.luau +++ b/src/Rosetta/Sniffs.luau @@ -19,7 +19,7 @@ end local P_audio_mp3_Tags: any = {} do -- audio/mp3/Tags: id3v2Size -local Tags = P_audio_mp3_Tags +local Tags = {} local band, bor, lshift = bit32.band, bit32.bor, bit32.lshift local ru8 = buffer.readu8 local function syncsafe(b: buffer, o: number): number @@ -43,11 +43,12 @@ function Tags.id3v2Size(b: buffer, o: number, len: number): number end return size end +P_audio_mp3_Tags.id3v2Size = Tags.id3v2Size end local P_codecs_audio_Aac: any = {} do -- codecs/audio/Aac: adts -local Aac = P_codecs_audio_Aac +local Aac = {} local Bits = require("@rosetta/core/Bits") Aac.RATES = { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350 } local function objectType(br: Bits.BitReader): number @@ -96,11 +97,12 @@ function Aac.adts(b: buffer, o: number, limit: number): Adts? protected = protected, } end +P_codecs_audio_Aac.adts = Aac.adts end local P_codecs_audio_Ac3_Tables: any = {} do -- codecs/audio/Ac3/Tables: BITRATES, RATES, frameWords -local T = P_codecs_audio_Ac3_Tables +local T = {} T.BITRATES = { 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, 640 } T.RATES = { 48000, 44100, 32000 } function T.frameWords(fscod: number, frmsizecod: number): number @@ -115,11 +117,14 @@ function T.frameWords(fscod: number, frmsizecod: number): number end return kbps * 1536000 // 705600 + frmsizecod % 2 end +P_codecs_audio_Ac3_Tables.BITRATES = T.BITRATES +P_codecs_audio_Ac3_Tables.RATES = T.RATES +P_codecs_audio_Ac3_Tables.frameWords = T.frameWords end local P_codecs_audio_Ac3: any = {} do -- codecs/audio/Ac3: header -local Ac3 = P_codecs_audio_Ac3 +local Ac3 = {} local T = P_codecs_audio_Ac3_Tables local readu8 = buffer.readu8 local NFCHANS = { [0] = 2, 1, 2, 3, 3, 4, 4, 5 } @@ -188,22 +193,24 @@ function Ac3.header(b: buffer, o: number, limit: number): Header? bsid = bsid, } end +P_codecs_audio_Ac3.header = Ac3.header end local P_codecs_audio_Mpa_Tables: any = {} do -- codecs/audio/Mpa/Tables: halfrate -local T = P_codecs_audio_Mpa_Tables +local T = {} T.halfrate = { [0] = 0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 56, 64, 72, 80, 0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 56, 64, 72, 80, 0, 16, 24, 28, 32, 40, 48, 56, 64, 72, 80, 88, 96, 112, 128, 0, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 0, 16, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, } +P_codecs_audio_Mpa_Tables.halfrate = T.halfrate end local P_codecs_audio_Mpa_Header: any = {} do -- codecs/audio/Mpa/Header: compare, frameBytes, padding, valid -local H = P_codecs_audio_Mpa_Header +local H = {} local T = P_codecs_audio_Mpa_Tables local band, bxor, rshift = bit32.band, bit32.bxor, bit32.rshift local ru8 = buffer.readu8 @@ -271,11 +278,15 @@ function H.padding(b: buffer, o: number): number end return if band(ru8(b, o + 1), 6) == 6 then 4 else 1 end +P_codecs_audio_Mpa_Header.compare = H.compare +P_codecs_audio_Mpa_Header.frameBytes = H.frameBytes +P_codecs_audio_Mpa_Header.padding = H.padding +P_codecs_audio_Mpa_Header.valid = H.valid end local P_codecs_audio_Musepack: any = {} do -- codecs/audio/Musepack: magic -local Musepack = P_codecs_audio_Musepack +local Musepack = {} function Musepack.magic(buf: buffer, p: number, limit: number): number if p + 4 > limit then return 0 @@ -289,15 +300,17 @@ function Musepack.magic(buf: buffer, p: number, limit: number): number end return 0 end +P_codecs_audio_Musepack.magic = Musepack.magic end local P_codecs_audio_SoundFont: any = {} do -- codecs/audio/SoundFont: sniff -local SoundFont = P_codecs_audio_SoundFont +local SoundFont = {} local Bytes = require("@rosetta/core/Bytes") function SoundFont.sniff(r: Bytes.Reader): boolean return r:peek(4) == "RIFF" and r:peek(4, 8) == "sfbk" end +P_codecs_audio_SoundFont.sniff = SoundFont.sniff end local P_codecs_compress_Brotli = lazy(function() @@ -310,7 +323,7 @@ end) local P_codecs_compress_Deflate: any = {} do -- codecs/compress/Deflate: peek -local Deflate = P_codecs_compress_Deflate +local Deflate = {} local Err = require("@rosetta/core/Err") local Bytes = require("@rosetta/core/Bytes") local Inflate = P_codecs_compress_Deflate_Inflate @@ -383,6 +396,7 @@ function Deflate.peek(buf: buffer | string, offset: number?, length: number?, n: end return shrink(out, k), nil end +P_codecs_compress_Deflate.peek = Deflate.peek end local P_codecs_compress_Zstd_Decode = lazy(function() @@ -391,7 +405,7 @@ end) local P_codecs_compress_Zstd: any = {} do -- codecs/compress/Zstd: MAGIC, decompress -local Zstd = P_codecs_compress_Zstd +local Zstd = {} local Err = require("@rosetta/core/Err") local Bytes = require("@rosetta/core/Bytes") local Decode = P_codecs_compress_Zstd_Decode @@ -421,11 +435,13 @@ function Zstd.decompress(buf: buffer | string, offset: number?, length: number?, end return out, consumed end +P_codecs_compress_Zstd.MAGIC = Zstd.MAGIC +P_codecs_compress_Zstd.decompress = Zstd.decompress end local P_codecs_text_KeyValues_Binary: any = {} do -- codecs/text/KeyValues/Binary: sniff -local Binary = P_codecs_text_KeyValues_Binary +local Binary = {} local readu8, readu32, readi32, readf32 = buffer.readu8, buffer.readu32, buffer.readi32, buffer.readf32 function Binary.sniff(b: buffer, o: number, n: number): boolean if n < 3 then @@ -445,18 +461,20 @@ function Binary.sniff(b: buffer, o: number, n: number): boolean end return false end +P_codecs_text_KeyValues_Binary.sniff = Binary.sniff end local P_codecs_text_KeyValues: any = {} do -- codecs/text/KeyValues: isBinary -local KeyValues = P_codecs_text_KeyValues +local KeyValues = {} local Binary = P_codecs_text_KeyValues_Binary KeyValues.isBinary = Binary.sniff +P_codecs_text_KeyValues.isBinary = KeyValues.isBinary end local P_codecs_text_Nbt_Value: any = {} do -- codecs/text/Nbt/Value: NAMES -local Value = P_codecs_text_Nbt_Value +local Value = {} Value.NAMES = { [0] = "end", "byte", @@ -476,11 +494,12 @@ Value.IDS = {} :: { [string]: number } for id = 0, 12 do Value.IDS[Value.NAMES[id]] = id end +P_codecs_text_Nbt_Value.NAMES = Value.NAMES end local P_codecs_text_Nbt: any = {} do -- codecs/text/Nbt: peek -local Nbt = P_codecs_text_Nbt +local Nbt = {} local Deflate = P_codecs_compress_Deflate local Value = P_codecs_text_Nbt_Value type Peek = { @@ -568,11 +587,12 @@ function Nbt.peek(buf: buffer, offset: number?, length: number?): Peek? end return at(0, "big", false) or at(0, "little", false) end +P_codecs_text_Nbt.peek = Nbt.peek end local P_codecs_text_Text: any = {} do -- codecs/text/Text: toUtf8, trim, utf16 -local Text = P_codecs_text_Text +local Text = {} function Text.utf8char(c: number): string local char = string.char if c < 0x80 then @@ -640,11 +660,14 @@ function Text.toUtf8(text: string, warnings: { string }?): string end return table.concat(out) end +P_codecs_text_Text.toUtf8 = Text.toUtf8 +P_codecs_text_Text.trim = Text.trim +P_codecs_text_Text.utf16 = Text.utf16 end local P_containers_Fat: any = {} do -- containers/Fat: open -local Fat = P_containers_Fat +local Fat = {} local readu8, readu16, readu32 = buffer.readu8, buffer.readu16, buffer.readu32 type Volume = { b: buffer, @@ -766,11 +789,12 @@ function Fat.open(b: buffer, off: number, len: number, opts: OpenOptions?): (Vol end return nil, if o.partition then "no partition " .. o.partition else "no FAT partition" end +P_containers_Fat.open = Fat.open end local P_containers_IsoBmff: any = {} do -- containers/IsoBmff: sniff -local IsoBmff = P_containers_IsoBmff +local IsoBmff = {} local Bytes = require("@rosetta/core/Bytes") local TOP: { [string]: boolean } = { ftyp = true, moov = true, mdat = true, free = true, skip = true, wide = true, pnot = true, moof = true, @@ -793,11 +817,12 @@ function IsoBmff.sniff(r: Bytes.Reader): string? end return nil end +P_containers_IsoBmff.sniff = IsoBmff.sniff end local P_containers_Riff: any = {} do -- containers/Riff: sniff -local Riff = P_containers_Riff +local Riff = {} function Riff.sniff(r: any): string? local magic = r:peek(4) if magic ~= "RIFF" and magic ~= "RIFX" and magic ~= "RF64" and magic ~= "BW64" then @@ -806,11 +831,12 @@ function Riff.sniff(r: any): string? local form = r:peek(4, 8) return if #form == 4 then form else nil end +P_containers_Riff.sniff = Riff.sniff end local P_containers_Tar: any = {} do -- containers/Tar: valid -local Tar = P_containers_Tar +local Tar = {} local BLOCK = 512 local function zeros(b: buffer, o: number): boolean for i = 0, BLOCK - 1, 4 do @@ -853,19 +879,22 @@ function Tar.valid(b: buffer, o: number): boolean local u, s = checksum(b, o) return want == u or want == s end +P_containers_Tar.valid = Tar.valid end local P_model_fbx_Binary: any = {} do -- model/fbx/Binary: MAGIC -local Binary = P_model_fbx_Binary +local Binary = {} local MAGIC = "Kaydara FBX Binary \0" Binary.MAGIC = MAGIC +P_model_fbx_Binary.MAGIC = Binary.MAGIC end local P_model_ms3d_Read: any = {} do -- model/ms3d/Read: MAGIC -local Read = P_model_ms3d_Read +local Read = {} Read.MAGIC = "MS3D000000" +P_model_ms3d_Read.MAGIC = Read.MAGIC end do -- image/ani diff --git a/src/Rosetta/codecs/compress/Brotli/Decode.luau b/src/Rosetta/codecs/compress/Brotli/Decode.luau index 6eef497..69d3ddb 100644 --- a/src/Rosetta/codecs/compress/Brotli/Decode.luau +++ b/src/Rosetta/codecs/compress/Brotli/Decode.luau @@ -888,13 +888,12 @@ function Decode.decompress(src: buffer, off: number, len: number, maxBytes: numb end local ws = w if wl > 0 then - if dict == nil then - dict = S.dictionary() - if dict == nil then - return nil, NO_DICTIONARY - end + local d = dict or S.dictionary() + if d == nil then + return nil, NO_DICTIONARY end - bcopy(WORD, w, dict, wo, wl) + dict = d + bcopy(WORD, w, d, wo, wl) w += wl end if ttype == 10 then diff --git a/src/Rosetta/init.luau b/src/Rosetta/init.luau index ab7b81d..cc95a91 100644 --- a/src/Rosetta/init.luau +++ b/src/Rosetta/init.luau @@ -7,10 +7,6 @@ local Bytes = require("@rosetta/core/Bytes") local Input = require("@rosetta/core/Input") local Types = require("@rosetta/Types") local Registry = require("@rosetta/Registry") -local Video = require("@rosetta/codecs/video/Video") -local AudioWrap = require("@rosetta/containers/AudioWrap") -local Rbx = require("@rosetta/codecs/model/Rbx") -local ImageOps = require("@rosetta/ops/ImageOps") local host = require("@rosetta/host") local F = {} @@ -19,7 +15,6 @@ F.version = "0.1.0" F.Err = Err F.Types = Types F.Bytes = Bytes -F.Rbx = Rbx F.null = Types.null F.host = host F.plugins = {} :: { [string]: any } -- injected optional dependencies (plugins.brep for cad/step) @@ -338,7 +333,7 @@ end -- api hooks (a format never requires another format): opts.decodeImage / encodeImage, opts.plugins, opts.decodeModule, -- opts.openAudio (containers/AudioWrap: PCM -> WAV, Opus / Vorbis -> Ogg, AAC -> ADTS, MP3 / FLAC / AC-3 as they are) local function openAudio(demuxer: any, track: any, sbr: boolean?): (any, Err.Err?) - local buf, fmt, err = AudioWrap.wrap(demuxer, track) + local buf, fmt, err = require("@rosetta/containers/AudioWrap").wrap(demuxer, track) if not buf then return nil, err end @@ -350,7 +345,7 @@ local function openAudio(demuxer: any, track: any, sbr: boolean?): (any, Err.Err local skip = if type(track.codecDelay) == "number" and track.codecDelay > 0 then math.floor(track.codecDelay * dec.sampleRate + 0.5) else 0 local length = if type(track.playDuration) == "number" and track.playDuration > 0 then math.floor(track.playDuration * dec.sampleRate + 0.5) else nil if skip > 0 or length then - dec = AudioWrap.trim(dec, skip, length) + dec = require("@rosetta/containers/AudioWrap").trim(dec, skip, length) end end return dec, oerr @@ -530,7 +525,7 @@ local function videoToImage(v: any, o: Options): (any, Err.Err?) if #images == 0 then return nil, Err.new(Err.ARG, "save: the video has no frames") end - local img, ierr = ImageOps.fromFrames(images, delays) + local img, ierr = require("@rosetta/ops/ImageOps").fromFrames(images, delays) if not img then return nil, ierr end @@ -816,7 +811,7 @@ F.video.fromImage = function(img: any, opts: Options?): (any, Err.Err?) end local frames, delays = { img }, { 0.1 } if type(img.frames) == "table" and #img.frames > 0 then - local list, cerr = ImageOps.coalesce(img) + local list, cerr = require("@rosetta/ops/ImageOps").coalesce(img) if not list then return nil, cerr end @@ -826,19 +821,18 @@ F.video.fromImage = function(img: any, opts: Options?): (any, Err.Err?) delays[i] = if type(f.delay) == "number" and f.delay > 0 then f.delay else 0.1 end elseif img.format ~= "rgba8" and img.format ~= "yuv420p" then - local c, cerr = ImageOps.convert(img, "rgba8") + local c, cerr = require("@rosetta/ops/ImageOps").convert(img, "rgba8") if not c then return nil, cerr end frames = { c } end local src = type(img.meta) == "table" and img.meta.source - return Video.fromFrames(frames, delays, { format = type(src) == "table" and src.format or "image", loops = img.loops, meta = img.meta }) + return require("@rosetta/codecs/video/Video").fromFrames(frames, delays, { format = type(src) == "table" and src.format or "image", loops = img.loops, meta = img.meta }) end F.video.fromFrames = function(images: any, delays: any?, opts: Options?): (any, Err.Err?) - return Video.fromFrames(images, delays, opts) + return require("@rosetta/codecs/video/Video").fromFrames(images, delays, opts) end -F.video.codecs = Video F.model.loadTextures = function(scene: any, opts: Options?): (any, { [number]: Err.Err }) local errs: { [number]: Err.Err } = {} @@ -867,7 +861,7 @@ end local OPS: { [string]: () -> any } = { image = function() - return ImageOps + return require("@rosetta/ops/ImageOps") end, mesh = function() return require("@rosetta/ops/MeshOps") @@ -912,4 +906,26 @@ F.ops = setmetatable({}, { end, }) :: any +-- F.Rbx (codecs/model/Rbx), F.video.codecs (codecs/video/Video): required on first use +setmetatable(F, { + __index = function(t: any, k: string): any + if k == "Rbx" then + local m = require("@rosetta/codecs/model/Rbx") + rawset(t, k, m) + return m + end + return nil + end, +}) +setmetatable(F.video, { + __index = function(t: any, k: string): any + if k == "codecs" then + local m = require("@rosetta/codecs/video/Video") + rawset(t, k, m) + return m + end + return nil + end, +}) + return F diff --git a/tools/bundle.py b/tools/bundle.py index 2384cfc..406f072 100644 --- a/tools/bundle.py +++ b/tools/bundle.py @@ -249,12 +249,15 @@ def bundle_roblox(): # module with no entry yet requires its chunk (require(script:FindFirstChild(name)); under the luau CLI, with no # `script`, require("@self/" .. name) over the same files in build/_modules/chunked/Rosetta). So requiring the root # loads Core (what the root runs at load time) and every other chunk on first use, per Actor. -# Chunks: Core; Detect (DETECT: what F.detect runs, apart from Core); one per hot codec (HOT); the rest packed per family -# (top folder, or codecs/) in path order. +# Chunks: Core; Detect (DETECT: what F.detect runs, apart from Core); one per hot codec (HOT); then one per unit (a +# format folder, a codec or container with its submodules), small neighbours of a family (top folder, or +# codecs/) packed up to UNIT_PACK bytes; a chunk is named after its first unit (image_png, containers_Riff). +# So opening a format compiles its own modules and what they use, not its family. # A --!native module's functions get @native (a chunk can mix native and non-native modules); a chunk with no native # module has none. Outputs: build/Rosetta.rbxm (LZ4, written by model/rbxm under the luau CLI), build/Rosetta.rbxmx, # build/Rosetta.rbxm.linemap.json ({chunk: [[first line, source file], ...]}). CHUNK_SRC_MAX = 256 * 1024 +UNIT_PACK = 32 * 1024 CHUNK_IR_MAX = 1 << 18 CHUNK_ASM_MAX = 4 << 20 CHUNKED = os.path.join(MODULES, "chunked", "Rosetta") @@ -305,6 +308,13 @@ def eager(src): return {m.group(1) for line in src.split("\n") if line[:1] not in ("\t", " ") for m in INCLUDES.finditer(line)} +def unit(key): + """what one format or shared module brings: its folder (image/png, containers/IsoBmff, codecs/text/Text), or the + module itself at the top level""" + parts = key.split("/") + return "/".join(parts[:3] if parts[0] == "codecs" else parts[:2]) + + def plan_chunks(mods): """[(chunk name, [module keys])], deterministic: Core, HOT, then the rest packed per family""" left = dict(mods) @@ -345,11 +355,19 @@ def plan_chunks(mods): if not keys: sys.exit("bundle: HOT chunk %s matches no module" % name) pack(name, keys) - fams = {} + units = {} for k in left: - fams.setdefault(family(k), []).append(k) - for f in sorted(fams): - pack(f, fams[f]) + units.setdefault(unit(k), []).append(k) + run, size = [], 0 + for u in sorted(units, key=lambda u: (family(u), u)): + sz = sum(len(mods[k][0]) for k in units[u]) + if run and (family(run[0]) != family(u) or size + sz > UNIT_PACK): + pack(run[0].replace("/", "_"), [k for x in run for k in units[x]]) + run, size = [], 0 + run.append(u) + size += sz + if run: + pack(run[0].replace("/", "_"), [k for x in run for k in units[x]]) return chunks diff --git a/tools/sniff_extract.py b/tools/sniff_extract.py index 39cef69..2dd0743 100644 --- a/tools/sniff_extract.py +++ b/tools/sniff_extract.py @@ -372,8 +372,9 @@ def shared_lines(): out.append("local %s: any = {}" % name) if copied: out.append("do -- %s: %s" % (mod, ", ".join(sorted(copied)))) - out.append("local %s = %s" % (self_name, name)) + out.append("local %s = {}" % self_name) out.extend(body) + out.extend("%s.%s = %s.%s" % (name, f, self_name, f) for f in sorted(copied)) out.append("end") out.append("")