merge ws/perf-core

This commit is contained in:
4DBug committed 2026-11-01 20:56:00 -06:00
commit de755ca036
37 files changed
+5317 -2562

No files matched your search

+896 -283
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
Binary file not shown.
+14 -14
View File
@@ -1,5 +1,5 @@
{ {
"Core_1": [[8, "src/Rosetta/init.luau"], [852, "src/Rosetta/Registry.luau"], [3261, "src/Rosetta/Types.luau"], [4344, "src/Rosetta/codecs/audio/Adpcm/init.luau"], [5098, "src/Rosetta/codecs/image/Yuv.luau"], [5366, "src/Rosetta/codecs/model/Rbx/init.luau"], [5603, "src/Rosetta/codecs/video/Video/init.luau"], [6160, "src/Rosetta/containers/AudioWrap.luau"], [6663, "src/Rosetta/containers/Ogg/Mux.luau"], [6858, "src/Rosetta/containers/Ogg/Page.luau"], [7027, "src/Rosetta/core/Bytes.luau"], [7554, "src/Rosetta/core/Crc32.luau"], [7666, "src/Rosetta/core/Err.luau"], [7748, "src/Rosetta/core/Input.luau"], [7824, "src/Rosetta/host/init.luau"]], "Core_1": [[8, "src/Rosetta/init.luau"], [888, "src/Rosetta/Registry.luau"], [3297, "src/Rosetta/Types.luau"], [4410, "src/Rosetta/codecs/audio/Adpcm/init.luau"], [5164, "src/Rosetta/codecs/image/Yuv.luau"], [5432, "src/Rosetta/codecs/model/Rbx/init.luau"], [5669, "src/Rosetta/codecs/video/Video/init.luau"], [6226, "src/Rosetta/containers/AudioWrap.luau"], [6729, "src/Rosetta/containers/Ogg/Mux.luau"], [6918, "src/Rosetta/core/Bytes.luau"], [7445, "src/Rosetta/core/Crc32.luau"], [7596, "src/Rosetta/core/Err.luau"], [7678, "src/Rosetta/core/Input.luau"], [7754, "src/Rosetta/host/init.luau"]],
"Core_2": [[8, "src/Rosetta/ops/ImageOps/init.luau"], [656, "src/Rosetta/ops/ImageOps/Kernels.luau"]], "Core_2": [[8, "src/Rosetta/ops/ImageOps/init.luau"], [656, "src/Rosetta/ops/ImageOps/Kernels.luau"]],
"Mpeg2": [[8, "src/Rosetta/codecs/video/Dsp.luau"], [731, "src/Rosetta/codecs/video/Mpeg1/init.luau"], [743, "src/Rosetta/codecs/video/Mpeg2/init.luau"], [1110, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], [2617, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], [2756, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"]], "Mpeg2": [[8, "src/Rosetta/codecs/video/Dsp.luau"], [731, "src/Rosetta/codecs/video/Mpeg1/init.luau"], [743, "src/Rosetta/codecs/video/Mpeg2/init.luau"], [1110, "src/Rosetta/codecs/video/Mpeg2/Decoder.luau"], [2617, "src/Rosetta/codecs/video/Mpeg2/Tables.luau"], [2756, "src/Rosetta/codecs/video/Mpeg2/Vlc.luau"]],
"H263": [[8, "src/Rosetta/codecs/video/H263/init.luau"], [164, "src/Rosetta/codecs/video/H263/Decoder.luau"], [1022, "src/Rosetta/codecs/video/H263/Tables.luau"]], "H263": [[8, "src/Rosetta/codecs/video/H263/init.luau"], [164, "src/Rosetta/codecs/video/H263/Decoder.luau"], [1022, "src/Rosetta/codecs/video/H263/Tables.luau"]],
@@ -12,10 +12,10 @@
"Vp8": [[8, "src/Rosetta/codecs/image/Vp8/init.luau"], [138, "src/Rosetta/codecs/image/Vp8/Decode.luau"], [2094, "src/Rosetta/codecs/image/Vp8/Predict.luau"], [2353, "src/Rosetta/codecs/image/Vp8/Tables.luau"], [2602, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], [2744, "src/Rosetta/codecs/image/Vp8L/init.luau"], [2848, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], [3788, "src/Rosetta/codecs/image/Vp8L/Encode.luau"]], "Vp8": [[8, "src/Rosetta/codecs/image/Vp8/init.luau"], [138, "src/Rosetta/codecs/image/Vp8/Decode.luau"], [2094, "src/Rosetta/codecs/image/Vp8/Predict.luau"], [2353, "src/Rosetta/codecs/image/Vp8/Tables.luau"], [2602, "src/Rosetta/codecs/image/Vp8/Yuv.luau"], [2744, "src/Rosetta/codecs/image/Vp8L/init.luau"], [2848, "src/Rosetta/codecs/image/Vp8L/Decode.luau"], [3788, "src/Rosetta/codecs/image/Vp8L/Encode.luau"]],
"Bcn": [[8, "src/Rosetta/codecs/image/Bcn/init.luau"], [115, "src/Rosetta/codecs/image/Bcn/Decode.luau"], [599, "src/Rosetta/codecs/image/Bcn/Encode.luau"]], "Bcn": [[8, "src/Rosetta/codecs/image/Bcn/init.luau"], [115, "src/Rosetta/codecs/image/Bcn/Decode.luau"], [599, "src/Rosetta/codecs/image/Bcn/Encode.luau"]],
"Png": [[8, "src/Rosetta/image/png/init.luau"], [588, "src/Rosetta/image/png/Apng.luau"], [668, "src/Rosetta/image/png/Decode.luau"], [1041, "src/Rosetta/image/png/Encode.luau"]], "Png": [[8, "src/Rosetta/image/png/init.luau"], [588, "src/Rosetta/image/png/Apng.luau"], [668, "src/Rosetta/image/png/Decode.luau"], [1041, "src/Rosetta/image/png/Encode.luau"]],
"Deflate": [[8, "src/Rosetta/codecs/compress/Deflate/init.luau"], [334, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], [754, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"]], "Deflate": [[8, "src/Rosetta/codecs/compress/Deflate/init.luau"], [334, "src/Rosetta/codecs/compress/Deflate/Compress.luau"], [816, "src/Rosetta/codecs/compress/Deflate/Inflate.luau"]],
"Brotli": [[8, "src/Rosetta/codecs/compress/Brotli/init.luau"], [95, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], [1064, "src/Rosetta/codecs/compress/Brotli/Static.luau"]], "Brotli": [[8, "src/Rosetta/codecs/compress/Brotli/init.luau"], [95, "src/Rosetta/codecs/compress/Brotli/Decode.luau"], [1071, "src/Rosetta/codecs/compress/Brotli/Static.luau"]],
"Lzma": [[8, "src/Rosetta/codecs/compress/Lzma/init.luau"], [548, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], [586, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], [1059, "src/Rosetta/codecs/compress/Lzma/Filters.luau"]], "Lzma": [[8, "src/Rosetta/codecs/compress/Lzma/init.luau"], [548, "src/Rosetta/codecs/compress/Lzma/Crc64.luau"], [615, "src/Rosetta/codecs/compress/Lzma/Decode.luau"], [1088, "src/Rosetta/codecs/compress/Lzma/Filters.luau"]],
"Zstd": [[8, "src/Rosetta/codecs/compress/Zstd/init.luau"], [65, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], [1023, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"]], "Zstd": [[8, "src/Rosetta/codecs/compress/Zstd/init.luau"], [65, "src/Rosetta/codecs/compress/Zstd/Decode.luau"], [1049, "src/Rosetta/codecs/compress/Zstd/Xxh64.luau"]],
"Mpa": [[8, "src/Rosetta/codecs/audio/Mpa/init.luau"], [22, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], [81, "src/Rosetta/codecs/audio/Mpa/Core.luau"], [1684, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], [1976, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], [2361, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], [3002, "src/Rosetta/codecs/audio/Mpa/Header.luau"], [3143, "src/Rosetta/codecs/audio/Mpa/Tables.luau"]], "Mpa": [[8, "src/Rosetta/codecs/audio/Mpa/init.luau"], [22, "src/Rosetta/codecs/audio/Mpa/Analysis.luau"], [81, "src/Rosetta/codecs/audio/Mpa/Core.luau"], [1684, "src/Rosetta/codecs/audio/Mpa/EncTables.luau"], [1976, "src/Rosetta/codecs/audio/Mpa/Encode2.luau"], [2361, "src/Rosetta/codecs/audio/Mpa/Encode3.luau"], [3002, "src/Rosetta/codecs/audio/Mpa/Header.luau"], [3143, "src/Rosetta/codecs/audio/Mpa/Tables.luau"]],
"Opus": [[8, "src/Rosetta/codecs/audio/Opus/init.luau"], [22, "src/Rosetta/codecs/audio/Opus/Celt.luau"], [1869, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], [2934, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], [2994, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], [3454, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], [3791, "src/Rosetta/codecs/audio/Opus/Packet.luau"], [4024, "src/Rosetta/codecs/audio/Opus/Silk.luau"], [6060, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"]], "Opus": [[8, "src/Rosetta/codecs/audio/Opus/init.luau"], [22, "src/Rosetta/codecs/audio/Opus/Celt.luau"], [1869, "src/Rosetta/codecs/audio/Opus/CeltEncoder.luau"], [2934, "src/Rosetta/codecs/audio/Opus/CeltTables.luau"], [2994, "src/Rosetta/codecs/audio/Opus/Decoder.luau"], [3454, "src/Rosetta/codecs/audio/Opus/Mdct.luau"], [3791, "src/Rosetta/codecs/audio/Opus/Packet.luau"], [4024, "src/Rosetta/codecs/audio/Opus/Silk.luau"], [6060, "src/Rosetta/codecs/audio/Opus/SilkTables.luau"]],
"Vorbis": [[8, "src/Rosetta/codecs/audio/Vorbis/init.luau"], [21, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], [405, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], [971, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], [1392, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"]], "Vorbis": [[8, "src/Rosetta/codecs/audio/Vorbis/init.luau"], [21, "src/Rosetta/codecs/audio/Vorbis/Codebook.luau"], [405, "src/Rosetta/codecs/audio/Vorbis/Packet.luau"], [971, "src/Rosetta/codecs/audio/Vorbis/Setup.luau"], [1392, "src/Rosetta/codecs/audio/Vorbis/Tables.luau"]],
@@ -32,15 +32,15 @@
"audio": [[8, "src/Rosetta/audio/aac/init.luau"], [214, "src/Rosetta/audio/ac3/init.luau"], [360, "src/Rosetta/audio/adpcm/init.luau"], [505, "src/Rosetta/audio/adx/init.luau"], [736, "src/Rosetta/audio/aiff/init.luau"], [1127, "src/Rosetta/audio/ape/init.luau"], [1255, "src/Rosetta/audio/au/init.luau"], [1416, "src/Rosetta/audio/brstm/init.luau"], [1707, "src/Rosetta/audio/caf/init.luau"], [2369, "src/Rosetta/audio/flac/init.luau"], [2517, "src/Rosetta/audio/flac/Meta.luau"], [2739, "src/Rosetta/audio/flac/Stream.luau"], [3109, "src/Rosetta/audio/m4a/init.luau"], [3443, "src/Rosetta/audio/mp3/init.luau"], [3703, "src/Rosetta/audio/mp3/Index.luau"], [3894, "src/Rosetta/audio/mp3/Stream.luau"], [4121, "src/Rosetta/audio/mp3/Tags.luau"], [4433, "src/Rosetta/audio/mpc/init.luau"], [4527, "src/Rosetta/audio/opus/init.luau"], [4905, "src/Rosetta/audio/opus/Encode.luau"], [5016, "src/Rosetta/audio/qoa/init.luau"], [5196, "src/Rosetta/audio/tta/init.luau"], [5314, "src/Rosetta/audio/vag/init.luau"], [5537, "src/Rosetta/audio/voc/init.luau"], [5812, "src/Rosetta/audio/vorbis/init.luau"], [6266, "src/Rosetta/audio/vorbis/Encode.luau"], [7079, "src/Rosetta/audio/wav/init.luau"], [7700, "src/Rosetta/audio/wav/Codecs.luau"], [7866, "src/Rosetta/audio/wavpack/init.luau"]], "audio": [[8, "src/Rosetta/audio/aac/init.luau"], [214, "src/Rosetta/audio/ac3/init.luau"], [360, "src/Rosetta/audio/adpcm/init.luau"], [505, "src/Rosetta/audio/adx/init.luau"], [736, "src/Rosetta/audio/aiff/init.luau"], [1127, "src/Rosetta/audio/ape/init.luau"], [1255, "src/Rosetta/audio/au/init.luau"], [1416, "src/Rosetta/audio/brstm/init.luau"], [1707, "src/Rosetta/audio/caf/init.luau"], [2369, "src/Rosetta/audio/flac/init.luau"], [2517, "src/Rosetta/audio/flac/Meta.luau"], [2739, "src/Rosetta/audio/flac/Stream.luau"], [3109, "src/Rosetta/audio/m4a/init.luau"], [3443, "src/Rosetta/audio/mp3/init.luau"], [3703, "src/Rosetta/audio/mp3/Index.luau"], [3894, "src/Rosetta/audio/mp3/Stream.luau"], [4121, "src/Rosetta/audio/mp3/Tags.luau"], [4433, "src/Rosetta/audio/mpc/init.luau"], [4527, "src/Rosetta/audio/opus/init.luau"], [4905, "src/Rosetta/audio/opus/Encode.luau"], [5016, "src/Rosetta/audio/qoa/init.luau"], [5196, "src/Rosetta/audio/tta/init.luau"], [5314, "src/Rosetta/audio/vag/init.luau"], [5537, "src/Rosetta/audio/voc/init.luau"], [5812, "src/Rosetta/audio/vorbis/init.luau"], [6266, "src/Rosetta/audio/vorbis/Encode.luau"], [7079, "src/Rosetta/audio/wav/init.luau"], [7700, "src/Rosetta/audio/wav/Codecs.luau"], [7866, "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"]], "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"], [167, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], [1052, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], [1153, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], [1455, "src/Rosetta/codecs/audio/Alac/init.luau"], [1689, "src/Rosetta/codecs/audio/Alac/Decode.luau"], [2108, "src/Rosetta/codecs/audio/Alac/Encode.luau"], [2520, "src/Rosetta/codecs/audio/Ape/init.luau"], [2735, "src/Rosetta/codecs/audio/Ape/Decode.luau"], [3496, "src/Rosetta/codecs/audio/ApeTag.luau"], [3593, "src/Rosetta/codecs/audio/Mdct/init.luau"], [3777, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], [3986, "src/Rosetta/codecs/audio/MidiRender.luau"], [4332, "src/Rosetta/codecs/audio/Pcm/init.luau"], [4595, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], [4892, "src/Rosetta/codecs/audio/Qoa/init.luau"], [5174, "src/Rosetta/codecs/audio/Resample/init.luau"], [5533, "src/Rosetta/codecs/audio/Stream.luau"], [5694, "src/Rosetta/codecs/audio/Tta/init.luau"], [5811, "src/Rosetta/codecs/audio/Tta/Decode.luau"], [6063, "src/Rosetta/codecs/audio/VorbisComment.luau"]], "codecs_audio": [[8, "src/Rosetta/codecs/audio/Ac3/init.luau"], [167, "src/Rosetta/codecs/audio/Ac3/Decode.luau"], [1052, "src/Rosetta/codecs/audio/Ac3/Tables.luau"], [1153, "src/Rosetta/codecs/audio/Adpcm/Decoder.luau"], [1455, "src/Rosetta/codecs/audio/Alac/init.luau"], [1689, "src/Rosetta/codecs/audio/Alac/Decode.luau"], [2108, "src/Rosetta/codecs/audio/Alac/Encode.luau"], [2520, "src/Rosetta/codecs/audio/Ape/init.luau"], [2735, "src/Rosetta/codecs/audio/Ape/Decode.luau"], [3496, "src/Rosetta/codecs/audio/ApeTag.luau"], [3593, "src/Rosetta/codecs/audio/Mdct/init.luau"], [3777, "src/Rosetta/codecs/audio/Mdct/Fft.luau"], [3986, "src/Rosetta/codecs/audio/MidiRender.luau"], [4332, "src/Rosetta/codecs/audio/Pcm/init.luau"], [4595, "src/Rosetta/codecs/audio/Pcm/Convert.luau"], [4892, "src/Rosetta/codecs/audio/Qoa/init.luau"], [5174, "src/Rosetta/codecs/audio/Resample/init.luau"], [5533, "src/Rosetta/codecs/audio/Stream.luau"], [5694, "src/Rosetta/codecs/audio/Tta/init.luau"], [5811, "src/Rosetta/codecs/audio/Tta/Decode.luau"], [6063, "src/Rosetta/codecs/audio/VorbisComment.luau"]],
"codecs_compress": [[8, "src/Rosetta/codecs/compress/Bzip2/init.luau"], [56, "src/Rosetta/codecs/compress/Bzip2/Decode.luau"], [572, "src/Rosetta/codecs/compress/Explode.luau"], [768, "src/Rosetta/codecs/compress/Lz4.luau"], [1037, "src/Rosetta/codecs/compress/Lzh/init.luau"], [1641, "src/Rosetta/codecs/compress/Lzw/init.luau"], [1909, "src/Rosetta/codecs/compress/Lzx.luau"], [2343, "src/Rosetta/codecs/compress/PackBits.luau"], [2433, "src/Rosetta/codecs/compress/Quantum.luau"], [2670, "src/Rosetta/codecs/compress/UnixCompress.luau"], [2974, "src/Rosetta/codecs/compress/Xxh32.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"], [290, "src/Rosetta/codecs/entropy/RangeCoder/init.luau"], [301, "src/Rosetta/codecs/entropy/RangeCoder/Decoder.luau"], [515, "src/Rosetta/codecs/entropy/RangeCoder/Encoder.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"], [520, "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_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_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_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"], [1350, "src/Rosetta/codecs/text/Json/Encode.luau"], [1652, "src/Rosetta/codecs/text/KeyValues/init.luau"], [2222, "src/Rosetta/codecs/text/KeyValues/Binary.luau"], [2528, "src/Rosetta/codecs/text/Lexer/init.luau"], [2660, "src/Rosetta/codecs/text/Nbt/init.luau"], [3013, "src/Rosetta/codecs/text/Nbt/Binary.luau"], [3705, "src/Rosetta/codecs/text/Nbt/Snbt.luau"], [4345, "src/Rosetta/codecs/text/Nbt/Value.luau"], [4583, "src/Rosetta/codecs/text/Text/init.luau"], [4674, "src/Rosetta/codecs/text/Url/init.luau"], [4879, "src/Rosetta/codecs/text/Xml/init.luau"], [5282, "src/Rosetta/codecs/text/Xml/Parse.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"]], "codecs_video": [[8, "src/Rosetta/codecs/video/Video/Source.luau"]],
"containers": [[8, "src/Rosetta/containers/Archive.luau"], [275, "src/Rosetta/containers/Avi/init.luau"], [827, "src/Rosetta/containers/Blend.luau"], [1566, "src/Rosetta/containers/Chunks.luau"], [1701, "src/Rosetta/containers/Cpio.luau"], [2129, "src/Rosetta/containers/Demux.luau"], [2404, "src/Rosetta/containers/Ebml/init.luau"], [2717, "src/Rosetta/containers/Fat.luau"], [3405, "src/Rosetta/containers/Iso9660.luau"], [3910, "src/Rosetta/containers/IsoBmff/init.luau"], [4080, "src/Rosetta/containers/IsoBmff/Box.luau"], [4268, "src/Rosetta/containers/IsoBmff/Demux.luau"], [5113, "src/Rosetta/containers/IsoBmff/Meta.luau"], [5634, "src/Rosetta/containers/IsoBmff/Mux.luau"], [6150, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], [6267, "src/Rosetta/containers/MacFile.luau"], [6416, "src/Rosetta/containers/Ogg/init.luau"], [6841, "src/Rosetta/containers/Riff/init.luau"], [7158, "src/Rosetta/containers/Tar.luau"], [7572, "src/Rosetta/containers/Zip/init.luau"]], "containers": [[8, "src/Rosetta/containers/Archive.luau"], [275, "src/Rosetta/containers/Avi/init.luau"], [827, "src/Rosetta/containers/Blend.luau"], [1566, "src/Rosetta/containers/Chunks.luau"], [1701, "src/Rosetta/containers/Cpio.luau"], [2129, "src/Rosetta/containers/Demux.luau"], [2404, "src/Rosetta/containers/Ebml/init.luau"], [2717, "src/Rosetta/containers/Fat.luau"], [3405, "src/Rosetta/containers/Iso9660.luau"], [3910, "src/Rosetta/containers/IsoBmff/init.luau"], [4080, "src/Rosetta/containers/IsoBmff/Box.luau"], [4268, "src/Rosetta/containers/IsoBmff/Demux.luau"], [5113, "src/Rosetta/containers/IsoBmff/Meta.luau"], [5634, "src/Rosetta/containers/IsoBmff/Mux.luau"], [6150, "src/Rosetta/containers/IsoBmff/QtPalette.luau"], [6267, "src/Rosetta/containers/MacFile.luau"], [6416, "src/Rosetta/containers/Ogg/init.luau"], [6841, "src/Rosetta/containers/Ogg/Page.luau"], [7007, "src/Rosetta/containers/Riff/init.luau"], [7324, "src/Rosetta/containers/Tar.luau"], [7738, "src/Rosetta/containers/Zip/init.luau"]],
"core": [[8, "src/Rosetta/core/Adler32.luau"], [54, "src/Rosetta/core/Base64.luau"], [213, "src/Rosetta/core/Bits.luau"], [506, "src/Rosetta/core/Crc16.luau"], [558, "src/Rosetta/core/Md5.luau"], [717, "src/Rosetta/core/Sniff.luau"]], "core": [[8, "src/Rosetta/core/Adler32.luau"], [68, "src/Rosetta/core/Base64.luau"], [296, "src/Rosetta/core/Bits.luau"], [589, "src/Rosetta/core/Crc16.luau"], [641, "src/Rosetta/core/Md5.luau"], [799, "src/Rosetta/core/Sniff.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"]], "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"]], "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"]], "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"]],
@@ -50,14 +50,14 @@
"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"], [5065, "src/Rosetta/model/blend/Anim.luau"], [5411, "src/Rosetta/model/blend/Material.luau"], [5763, "src/Rosetta/model/blend/Mesh.luau"], [6398, "src/Rosetta/model/blend/Normals.luau"], [6559, "src/Rosetta/model/blend/Prim.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"], [5065, "src/Rosetta/model/blend/Anim.luau"], [5411, "src/Rosetta/model/blend/Material.luau"], [5763, "src/Rosetta/model/blend/Mesh.luau"], [6398, "src/Rosetta/model/blend/Normals.luau"], [6559, "src/Rosetta/model/blend/Prim.luau"]],
"model_2": [[8, "src/Rosetta/model/blend/Read.luau"], [908, "src/Rosetta/model/bsp/init.luau"], [1099, "src/Rosetta/model/bsp/Lightmap.luau"], [1165, "src/Rosetta/model/bsp/Quake.luau"], [1554, "src/Rosetta/model/bsp/Quake3.luau"], [1783, "src/Rosetta/model/bsp/Tree.luau"], [2171, "src/Rosetta/model/buildmap/init.luau"], [2443, "src/Rosetta/model/buildmap/Geometry.luau"], [2846, "src/Rosetta/model/d3map/init.luau"], [3128, "src/Rosetta/model/d3map/Parse.luau"], [3326, "src/Rosetta/model/dae/init.luau"], [3515, "src/Rosetta/model/dae/Math.luau"], [3562, "src/Rosetta/model/dae/Read.luau"], [5412, "src/Rosetta/model/dae/Write.luau"], [5781, "src/Rosetta/model/fbx/init.luau"], [5929, "src/Rosetta/model/fbx/Ascii.luau"], [6199, "src/Rosetta/model/fbx/Binary.luau"]], "model_2": [[8, "src/Rosetta/model/blend/Read.luau"], [908, "src/Rosetta/model/bsp/init.luau"], [1099, "src/Rosetta/model/bsp/Lightmap.luau"], [1165, "src/Rosetta/model/bsp/Quake.luau"], [1554, "src/Rosetta/model/bsp/Quake3.luau"], [1783, "src/Rosetta/model/bsp/Tree.luau"], [2171, "src/Rosetta/model/buildmap/init.luau"], [2443, "src/Rosetta/model/buildmap/Geometry.luau"], [2846, "src/Rosetta/model/d3map/init.luau"], [3128, "src/Rosetta/model/d3map/Parse.luau"], [3326, "src/Rosetta/model/dae/init.luau"], [3515, "src/Rosetta/model/dae/Math.luau"], [3562, "src/Rosetta/model/dae/Read.luau"], [5412, "src/Rosetta/model/dae/Write.luau"], [5781, "src/Rosetta/model/fbx/init.luau"], [5929, "src/Rosetta/model/fbx/Ascii.luau"], [6199, "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"], [3433, "src/Rosetta/model/gltf/Write.luau"], [4113, "src/Rosetta/model/godot/init.luau"], [4204, "src/Rosetta/model/godot/Build.luau"], [4746, "src/Rosetta/model/godot/Primitives.luau"], [5021, "src/Rosetta/model/godot/Surface.luau"], [5506, "src/Rosetta/model/godot/Write.luau"], [5835, "src/Rosetta/model/iqm/init.luau"], [5911, "src/Rosetta/model/iqm/Read.luau"], [6266, "src/Rosetta/model/iqm/Write.luau"], [6953, "src/Rosetta/model/ldraw/init.luau"], [7031, "src/Rosetta/model/ldraw/Colors.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"], [3433, "src/Rosetta/model/gltf/Write.luau"], [4113, "src/Rosetta/model/godot/init.luau"], [4204, "src/Rosetta/model/godot/Build.luau"], [4746, "src/Rosetta/model/godot/Primitives.luau"], [5021, "src/Rosetta/model/godot/Surface.luau"], [5506, "src/Rosetta/model/godot/Write.luau"], [5835, "src/Rosetta/model/iqm/init.luau"], [5911, "src/Rosetta/model/iqm/Read.luau"], [6266, "src/Rosetta/model/iqm/Write.luau"], [6953, "src/Rosetta/model/ldraw/init.luau"], [7031, "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"], [6577, "src/Rosetta/model/obj/Mtl.luau"], [6864, "src/Rosetta/model/off/init.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"], [3785, "src/Rosetta/model/rbxmx/init.luau"], [4438, "src/Rosetta/model/robloxmesh/init.luau"], [5097, "src/Rosetta/model/robloxmesh/Parse.luau"], [5554, "src/Rosetta/model/robloxmesh/Write.luau"], [5663, "src/Rosetta/model/schematic/init.luau"], [5984, "src/Rosetta/model/schematic/Common.luau"], [6104, "src/Rosetta/model/schematic/Litematic.luau"], [6315, "src/Rosetta/model/schematic/Mcedit.luau"], [6559, "src/Rosetta/model/schematic/Sponge.luau"], [6688, "src/Rosetta/model/smd/init.luau"], [6755, "src/Rosetta/model/smd/Read.luau"], [7024, "src/Rosetta/model/smd/Write.luau"], [7267, "src/Rosetta/model/sourcemdl/init.luau"], [7438, "src/Rosetta/model/sourcemdl/Build.luau"], [7868, "src/Rosetta/model/sourcemdl/Material.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_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"]], "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"], [214, "src/Rosetta/music/ahx/init.luau"], [265, "src/Rosetta/music/far/init.luau"], [494, "src/Rosetta/music/hmp/init.luau"], [758, "src/Rosetta/music/hvl/init.luau"], [809, "src/Rosetta/music/it/init.luau"], [1227, "src/Rosetta/music/it/Itsex.luau"], [1343, "src/Rosetta/music/med/init.luau"], [1990, "src/Rosetta/music/midi/init.luau"], [2133, "src/Rosetta/music/midi/Smf.luau"], [2544, "src/Rosetta/music/mod/init.luau"], [2897, "src/Rosetta/music/mtm/init.luau"], [3119, "src/Rosetta/music/mus/init.luau"], [3276, "src/Rosetta/music/okt/init.luau"], [3557, "src/Rosetta/music/ptm/init.luau"], [3779, "src/Rosetta/music/s3m/init.luau"], [4015, "src/Rosetta/music/sf2/init.luau"], [4058, "src/Rosetta/music/stm/init.luau"], [4289, "src/Rosetta/music/ult/init.luau"], [4593, "src/Rosetta/music/umx/init.luau"], [4809, "src/Rosetta/music/xm/init.luau"], [5370, "src/Rosetta/music/xmi/init.luau"]], "music": [[8, "src/Rosetta/music/669/init.luau"], [214, "src/Rosetta/music/ahx/init.luau"], [265, "src/Rosetta/music/far/init.luau"], [494, "src/Rosetta/music/hmp/init.luau"], [758, "src/Rosetta/music/hvl/init.luau"], [809, "src/Rosetta/music/it/init.luau"], [1227, "src/Rosetta/music/it/Itsex.luau"], [1343, "src/Rosetta/music/med/init.luau"], [1990, "src/Rosetta/music/midi/init.luau"], [2133, "src/Rosetta/music/midi/Smf.luau"], [2544, "src/Rosetta/music/mod/init.luau"], [2897, "src/Rosetta/music/mtm/init.luau"], [3119, "src/Rosetta/music/mus/init.luau"], [3276, "src/Rosetta/music/okt/init.luau"], [3557, "src/Rosetta/music/ptm/init.luau"], [3779, "src/Rosetta/music/s3m/init.luau"], [4015, "src/Rosetta/music/sf2/init.luau"], [4058, "src/Rosetta/music/stm/init.luau"], [4289, "src/Rosetta/music/ult/init.luau"], [4593, "src/Rosetta/music/umx/init.luau"], [4809, "src/Rosetta/music/xm/init.luau"], [5370, "src/Rosetta/music/xmi/init.luau"]],
"ops": [[8, "src/Rosetta/ops/AudioOps.luau"], [457, "src/Rosetta/ops/LayerOps.luau"], [550, "src/Rosetta/ops/MeshOps/init.luau"], [1586, "src/Rosetta/ops/MeshOps/Greedy.luau"], [1753, "src/Rosetta/ops/MusicOps.luau"]], "ops": [[8, "src/Rosetta/ops/AudioOps.luau"], [457, "src/Rosetta/ops/LayerOps.luau"], [550, "src/Rosetta/ops/MeshOps/init.luau"], [1602, "src/Rosetta/ops/MeshOps/Greedy.luau"], [1769, "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"]], "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"]], "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"]], "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"], [3324, "src/Rosetta/video/ogv/init.luau"], [3719, "src/Rosetta/video/smk/init.luau"], [4028, "src/Rosetta/video/smk/Audio.luau"], [4148, "src/Rosetta/video/y4m/init.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"]]
} }
+1064 -451
View File
File diff suppressed because it is too large. Load diff
+928 -311
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+4
View File
@@ -573,6 +573,10 @@ do
if j < 0 then j = #s + j + 1 end if j < 0 then j = #s + j + 1 end
local n = 0 local n = 0
while i <= j do while i <= j do
local h = string.find(s, "[\128-\255]", i)
if not h or h > j then return n + j - i + 1 end
n = n + h - i
i = h
local c, l = dec(s, i) local c, l = dec(s, i)
if not c then return nil, i end if not c then return nil, i end
n = n + 1 n = n + 1
+43 -13
View File
@@ -652,23 +652,47 @@ Types.null = table.freeze(setmetatable({}, nullMeta))
-- Objects (maps) whose key order matters, and empty objects (which would otherwise read back as empty arrays), carry -- Objects (maps) whose key order matters, and empty objects (which would otherwise read back as empty arrays), carry
-- an "object" metatable with their key order. Decoders mark empty objects always and every object when asked -- an "object" metatable with their key order. Decoders mark empty objects always and every object when asked
-- (opts.ordered); encoders write an object's keys in that order (keys added later, or plain tables: sorted). -- (opts.ordered); encoders write an object's keys in that order (keys added later, or plain tables: sorted).
local OBJECT = { __object = true } -- The key order is the __keys field of the object's own metatable, or (for a table that came with a metatable of its
-- own) an entry in a weak map.
local objectMeta: { [any]: { any } } = setmetatable({}, { __mode = "k" }) :: any -- object -> its key order local objectMeta: { [any]: { any } } = setmetatable({}, { __mode = "k" }) :: any -- object -> its key order
local function orderOf(v: any): { any }?
local mt: any = getmetatable(v)
if type(mt) == "table" then
local k: any = rawget(mt, "__keys")
if k ~= nil then
return k
end
end
return objectMeta[v]
end
local NOKEYS: { any } = table.freeze({}) :: any
function Types.object(t: { [any]: any }?, keys: { any }?): { [any]: any } function Types.object(t: { [any]: any }?, keys: { any }?): { [any]: any }
local o: { [any]: any } = t or {} local o: { [any]: any } = t or {}
if getmetatable(o) == nil then local k: { any } = keys or NOKEYS
setmetatable(o, OBJECT) local mt: any = getmetatable(o)
if mt == nil or (type(mt) == "table" and rawget(mt, "__keys") ~= nil) then
setmetatable(o, { __object = true, __keys = k })
else
objectMeta[o] = k
end end
objectMeta[o] = keys or {}
return o return o
end end
function Types.isObject(v: any): boolean function Types.isObject(v: any): boolean
return type(v) == "table" and objectMeta[v] ~= nil return type(v) == "table" and orderOf(v) ~= nil
end end
function Types.set(o: { [any]: any }, k: any, v: any) function Types.set(o: { [any]: any }, k: any, v: any)
local order = objectMeta[o] local order = orderOf(o)
if order and o[k] == nil and v ~= nil then if order and o[k] == nil and v ~= nil then
table.insert(order, k) if order == NOKEYS then
local mt: any = getmetatable(o)
if type(mt) == "table" and rawget(mt, "__keys") == NOKEYS then
mt.__keys = { k }
else
objectMeta[o] = { k }
end
else
table.insert(order, k)
end
end end
o[k] = v o[k] = v
end end
@@ -702,25 +726,31 @@ function Types.isArray(t: { [any]: any }, emptyIsMap: boolean?): boolean
return c == n return c == n
end end
function Types.keys(t: { [any]: any }): { any } function Types.keys(t: { [any]: any }): { any }
local order = objectMeta[t] local order = orderOf(t)
local out, seen = {}, {} local out, seen = {}, {}
local n = 0
if order then if order then
for _, k in order do for _, k in order do
if t[k] ~= nil and not seen[k] then if t[k] ~= nil and not seen[k] then
seen[k] = true seen[k] = true
table.insert(out, k) n += 1
out[n] = k
end end
end end
end end
local rest = {} local rest: { any }? = nil
for k in next, t do for k in next, t do
if not seen[k] then if not seen[k] then
table.insert(rest, k) if rest then
table.insert(rest, k)
else
rest = { k }
end
end end
end end
if #rest > 0 then if rest then
table.sort(rest, keyLess) table.sort(rest, keyLess)
table.move(rest, 1, #rest, #out + 1, out) table.move(rest, 1, #rest, n + 1, out)
end end
return out return out
end end
@@ -202,6 +202,13 @@ function Decode.decompress(src: buffer, off: number, len: number, maxBytes: numb
local bb, bc = 0, 0 local bb, bc = 0, 0
local function fill() local function fill()
if bc <= 24 and ip + 4 <= lim then
bb = bor(bb, lshift(readu32(src, ip), bc))
local nb = rshift(32 - bc, 3)
ip += nb
bc += nb * 8
return
end
while bc <= 24 do while bc <= 24 do
local byte = 0 local byte = 0
if ip < lim then if ip < lim then
+8 -11
View File
@@ -11,9 +11,6 @@ local bcreate, bcopy, bfill, blen = buffer.create, buffer.copy, buffer.fill, buf
local Decode = {} local Decode = {}
-- CRC-32/BZIP2 table (polynomial 0x04C11DB7, not reflected: core/Crc32)
local CT = Crc32.MSB_TABLE
Decode.crcTable = CT
local MASK = table.create(33, 0) local MASK = table.create(33, 0)
for i = 0, 32 do for i = 0, 32 do
@@ -413,8 +410,12 @@ function Decode.decode(b: buffer, o: number, e: number, maxBytes: number): (buff
return nil, "block larger than its declared size", "corrupt" return nil, "block larger than its declared size", "corrupt"
end end
local v = MTF[idx + 1] local v = MTF[idx + 1]
for k = idx, 1, -1 do if idx > 8 then
MTF[k + 1] = MTF[k] table.move(MTF, 1, idx, 2)
else
for k = idx, 1, -1 do
MTF[k + 1] = MTF[k]
end
end end
MTF[1] = v MTF[1] = v
local ch = SEQ[v + 1] local ch = SEQ[v + 1]
@@ -447,7 +448,7 @@ function Decode.decode(b: buffer, o: number, e: number, maxBytes: number): (buff
out = grow(out, op, op + nblock + 4096) out = grow(out, op, op + nblock + 4096)
end end
local cap = blen(out) local cap = blen(out)
local crc = 0xFFFFFFFF local blockStart = op
local tPos = rshift(readu32(T, origPtr * 4), 8) local tPos = rshift(readu32(T, origPtr * 4), 8)
local last, run = -1, 0 local last, run = -1, 0
local i = 0 local i = 0
@@ -468,9 +469,6 @@ function Decode.decode(b: buffer, o: number, e: number, maxBytes: number): (buff
end end
bfill(out, op, last, ch) bfill(out, op, last, ch)
op += ch op += ch
for _ = 1, ch do
crc = bxor(lshift(crc, 8), CT[bxor(rshift(crc, 24), last) + 1])
end
end end
run = 0 run = 0
last = -1 last = -1
@@ -490,13 +488,12 @@ function Decode.decode(b: buffer, o: number, e: number, maxBytes: number): (buff
end end
writeu8(out, op, ch) writeu8(out, op, ch)
op += 1 op += 1
crc = bxor(lshift(crc, 8), CT[bxor(rshift(crc, 24), ch) + 1])
end end
end end
if op > maxBytes then if op > maxBytes then
return nil, "output larger than maxBytes", "limit" return nil, "output larger than maxBytes", "limit"
end end
crc = bxor(crc, 0xFFFFFFFF) local crc = bxor(Crc32.msb(out, blockStart, op - blockStart, 0xFFFFFFFF), 0xFFFFFFFF)
if crc ~= storedCrc then if crc ~= storedCrc then
return nil, string.format("block CRC mismatch (%08x, expected %08x)", crc, storedCrc), "checksum" return nil, string.format("block CRC mismatch (%08x, expected %08x)", crc, storedCrc), "checksum"
end end
+3 -7
View File
@@ -3,6 +3,7 @@
-- Written from the format description (no third-party code); randomised blocks (bzip2 0.9.0 and older) are unsupported. -- Written from the format description (no third-party code); randomised blocks (bzip2 0.9.0 and older) are unsupported.
local Err = require("@rosetta/core/Err") local Err = require("@rosetta/core/Err")
local Bytes = require("@rosetta/core/Bytes") local Bytes = require("@rosetta/core/Bytes")
local Crc32 = require("@rosetta/core/Crc32")
local Decode = require("@rosetta/codecs/compress/Bzip2/Decode") local Decode = require("@rosetta/codecs/compress/Bzip2/Decode")
local Bzip2 = {} local Bzip2 = {}
@@ -33,14 +34,9 @@ function Bzip2.decompress(buf: buffer | string, offset: number?, length: number?
end end
function Bzip2.crc(buf: buffer, offset: number?, length: number?): number function Bzip2.crc(buf: buffer, offset: number?, length: number?): number
local CT = Decode.crcTable
local o = offset or 0 local o = offset or 0
local e = o + (length or (buffer.len(buf) - o)) local n = length or (buffer.len(buf) - o)
local c = 0xFFFFFFFF return bit32.bxor(Crc32.msb(buf, o, n, 0xFFFFFFFF), 0xFFFFFFFF)
for i = o, e - 1 do
c = bit32.bxor(bit32.lshift(c, 8), CT[bit32.bxor(bit32.rshift(c, 24), buffer.readu8(buf, i)) + 1])
end
return bit32.bxor(c, 0xFFFFFFFF)
end end
return Bzip2 return Bzip2
@@ -5,7 +5,7 @@
-- block the cheapest of stored / fixed / dynamic Huffman, as zlib's levels. -- block the cheapest of stored / fixed / dynamic Huffman, as zlib's levels.
local Huffman = require("@rosetta/codecs/entropy/Huffman") local Huffman = require("@rosetta/codecs/entropy/Huffman")
local readu8, writeu8, writeu16 = buffer.readu8, buffer.writeu8, buffer.writeu16 local readu8, readu32, writeu8, writeu16 = buffer.readu8, buffer.readu32, buffer.writeu8, buffer.writeu16
local bcreate, bcopy, blen = buffer.create, buffer.copy, buffer.len local bcreate, bcopy, blen = buffer.create, buffer.copy, buffer.len
local floor = math.floor local floor = math.floor
@@ -136,27 +136,72 @@ local function storedBlock(o: Out, src: buffer, s: number, e: number, final: boo
end end
local function emitSymbols(o: Out, L: { number }, D: { number }, nsym: number, lcode: { number }, llen: { number }, dcodes: { number }, dlen: { number }) local function emitSymbols(o: Out, L: { number }, D: { number }, nsym: number, lcode: { number }, llen: { number }, dcodes: { number }, dlen: { number })
ensure(o, nsym * 6 + 8) -- at most 15 + 5 + 15 + 13 bits a symbol
local buf, op, acc, cnt = o.buf, o.op, o.acc, o.cnt
-- acc holds cnt < 16 pending bits; each field is at most 15 bits, so acc stays below 2^31
for i = 1, nsym do for i = 1, nsym do
local l = L[i] local l = L[i]
if l < 256 then if l < 256 then
put(o, lcode[l + 1], llen[l + 1]) acc += lcode[l + 1] * POW[cnt + 1]
cnt += llen[l + 1]
if cnt >= 16 then
writeu16(buf, op, acc % 65536)
acc //= 65536
op += 2
cnt -= 16
end
else else
local len = l - 256 local len = l - 256
local c = LCODE[len] local c = LCODE[len]
put(o, lcode[c + 1], llen[c + 1]) acc += lcode[c + 1] * POW[cnt + 1]
cnt += llen[c + 1]
if cnt >= 16 then
writeu16(buf, op, acc % 65536)
acc //= 65536
op += 2
cnt -= 16
end
local xb = LEXTRA[len] local xb = LEXTRA[len]
if xb > 0 then if xb > 0 then
put(o, len - LBASEOF[len], xb) acc += (len - LBASEOF[len]) * POW[cnt + 1]
cnt += xb
if cnt >= 16 then
writeu16(buf, op, acc % 65536)
acc //= 65536
op += 2
cnt -= 16
end
end end
local d = D[i] local d = D[i]
local dc = dcode(d) local dc = if d <= 256 then DSMALL[d] else DLARGE[(d - 1) // 128 + 1]
put(o, dcodes[dc + 1], dlen[dc + 1]) acc += dcodes[dc + 1] * POW[cnt + 1]
cnt += dlen[dc + 1]
if cnt >= 16 then
writeu16(buf, op, acc % 65536)
acc //= 65536
op += 2
cnt -= 16
end
xb = DEXT[dc + 1] xb = DEXT[dc + 1]
if xb > 0 then if xb > 0 then
put(o, d - DBASE[dc + 1], xb) acc += (d - DBASE[dc + 1]) * POW[cnt + 1]
cnt += xb
if cnt >= 16 then
writeu16(buf, op, acc % 65536)
acc //= 65536
op += 2
cnt -= 16
end
end end
end end
end end
while cnt >= 8 do
writeu8(buf, op, acc % 256)
acc //= 256
op += 1
cnt -= 8
end
o.op, o.acc, o.cnt = op, acc, cnt
put(o, lcode[257], llen[257]) -- end of block put(o, lcode[257], llen[257]) -- end of block
end end
@@ -319,11 +364,6 @@ function Compress.raw(src: buffer, off: number, len: number, level: number): buf
local function hash(p: number): number local function hash(p: number): number
return ((readu8(src, p) * 251 + readu8(src, p + 1)) * 251 + readu8(src, p + 2)) % HSIZE return ((readu8(src, p) * 251 + readu8(src, p + 1)) * 251 + readu8(src, p + 2)) % HSIZE
end end
local function insert(p: number)
local h = hash(p) + 1
prev[p % WSIZE + 1] = head[h]
head[h] = p
end
local function find(p: number, steps: number): (number, number) local function find(p: number, steps: number): (number, number)
local maxLen = math.min(MAXMATCH, e - p) local maxLen = math.min(MAXMATCH, e - p)
if maxLen < 3 then if maxLen < 3 then
@@ -332,9 +372,20 @@ function Compress.raw(src: buffer, off: number, len: number, level: number): buf
local best, bestDist = 2, 0 local best, bestDist = 2, 0
local c = head[hash(p) + 1] local c = head[hash(p) + 1]
local limit = p - WSIZE local limit = p - WSIZE
while c >= 0 and c > limit and steps > 0 do local p0, pb = readu8(src, p), readu8(src, p + 2)
if readu8(src, c + best) == readu8(src, p + best) and readu8(src, c) == readu8(src, p) then local max4 = maxLen - 4
if limit < -1 then
limit = -1
end
for _ = 1, steps do
if c <= limit then
break
end
if readu8(src, c + best) == pb and readu8(src, c) == p0 then
local k = 1 local k = 1
while k <= max4 and readu32(src, c + k) == readu32(src, p + k) do
k += 4
end
while k < maxLen and readu8(src, c + k) == readu8(src, p + k) do while k < maxLen and readu8(src, c + k) == readu8(src, p + k) do
k += 1 k += 1
end end
@@ -343,6 +394,7 @@ function Compress.raw(src: buffer, off: number, len: number, level: number): buf
if k >= nice or k >= maxLen then if k >= nice or k >= maxLen then
break break
end end
pb = readu8(src, p + k)
end end
end end
local nc = prev[c % WSIZE + 1] local nc = prev[c % WSIZE + 1]
@@ -350,7 +402,6 @@ function Compress.raw(src: buffer, off: number, len: number, level: number): buf
break break
end end
c = nc c = nc
steps -= 1
end end
if best < 3 then if best < 3 then
return 0, 0 return 0, 0
@@ -369,7 +420,9 @@ function Compress.raw(src: buffer, off: number, len: number, level: number): buf
local mlen, mdist = 0, 0 local mlen, mdist = 0, 0
if p <= stop3 then if p <= stop3 then
mlen, mdist = find(p, maxChain) mlen, mdist = find(p, maxChain)
insert(p) local h = ((readu8(src, p) * 251 + readu8(src, p + 1)) * 251 + readu8(src, p + 2)) % HSIZE + 1
prev[p % WSIZE + 1] = head[h]
head[h] = p
if mlen >= 3 and mlen < lazyMax and p + 1 <= stop3 then if mlen >= 3 and mlen < lazyMax and p + 1 <= stop3 then
local l2, d2 = find(p + 1, if mlen >= good then maxChain // 4 else maxChain) local l2, d2 = find(p + 1, if mlen >= good then maxChain // 4 else maxChain)
if l2 > mlen then if l2 > mlen then
@@ -377,7 +430,9 @@ function Compress.raw(src: buffer, off: number, len: number, level: number): buf
L[nsym] = readu8(src, p) L[nsym] = readu8(src, p)
D[nsym] = 0 D[nsym] = 0
p += 1 p += 1
insert(p) h = ((readu8(src, p) * 251 + readu8(src, p + 1)) * 251 + readu8(src, p + 2)) % HSIZE + 1
prev[p % WSIZE + 1] = head[h]
head[h] = p
mlen, mdist = l2, d2 mlen, mdist = l2, d2
end end
end end
@@ -388,9 +443,16 @@ function Compress.raw(src: buffer, off: number, len: number, level: number): buf
D[nsym] = mdist D[nsym] = mdist
local q = p + 1 local q = p + 1
local qe = math.min(p + mlen, stop3 + 1) local qe = math.min(p + mlen, stop3 + 1)
while q < qe do if q < qe then
insert(q) local b1, b2 = readu8(src, q), readu8(src, q + 1)
q += 1 while q < qe do
local b3 = readu8(src, q + 2)
local h = ((b1 * 251 + b2) * 251 + b3) % HSIZE + 1
prev[q % WSIZE + 1] = head[h]
head[h] = q
b1, b2 = b2, b3
q += 1
end
end end
p += mlen p += mlen
else else
@@ -23,6 +23,19 @@ local DEXT = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
-- RFC 1951 3.2.7: the order the code-length code lengths are sent in -- RFC 1951 3.2.7: the order the code-length code lengths are sent in
local CLORDER = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 } local CLORDER = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }
-- table symbols: literals 0..255, end of block 256, invalid 257..511 (codes 286 / 287), lengths 512 + base * 8 + extra
-- bits; distances base * 16 + extra bits
local LMAP, DMAP = table.create(288, 300), table.create(30, 0)
for i = 0, 256 do
LMAP[i + 1] = i
end
for i = 1, 29 do
LMAP[257 + i] = 512 + LBASE[i] * 8 + LEXT[i]
end
for i = 1, 30 do
DMAP[i] = DBASE[i] * 16 + DEXT[i]
end
local LITCAP = Huffman.capacity(288, LITBITS, 15) local LITCAP = Huffman.capacity(288, LITBITS, 15)
local DISTCAP = Huffman.capacity(32, DISTBITS, 15) local DISTCAP = Huffman.capacity(32, DISTBITS, 15)
local CLCAP = Huffman.capacity(19, CLBITS, 7) local CLCAP = Huffman.capacity(19, CLBITS, 7)
@@ -35,12 +48,15 @@ do
bfill(l, 144, 9, 112) bfill(l, 144, 9, 112)
bfill(l, 256, 7, 24) bfill(l, 256, 7, 24)
bfill(l, 280, 8, 8) bfill(l, 280, 8, 8)
FLITS = Huffman.buildLsb(l, 0, 288, FLIT, LITBITS) FLITS = Huffman.buildLsbMap(l, 0, 288, FLIT, LITBITS, LMAP)
local d = bcreate(30) local d = bcreate(30)
bfill(d, 0, 5, 30) bfill(d, 0, 5, 30)
FDISTS = Huffman.buildLsb(d, 0, 30, FDIST, DISTBITS) FDISTS = Huffman.buildLsbMap(d, 0, 30, FDIST, DISTBITS, DMAP)
end end
-- scratch tables for dynamic blocks, shared by every call (raw never yields)
local SLIT, SDIST, SCL, SLENS = bcreate(LITCAP * 4), bcreate(DISTCAP * 4), bcreate(CLCAP * 4), bcreate(320)
local Inflate = {} local Inflate = {}
local function grow(out: buffer, op: number, need: number): (buffer, number) local function grow(out: buffer, op: number, need: number): (buffer, number)
@@ -62,9 +78,9 @@ function Inflate.raw(src: buffer, start: number, endpos: number, cap: number, ex
end end
local pos = start local pos = start
local bitbuf, bitcnt, over = 0, 0, 0 local bitbuf, bitcnt, over = 0, 0, 0
local lt, dt = bcreate(LITCAP * 4), bcreate(DISTCAP * 4) :: buffer local lt, dt = SLIT, SDIST
local clt = bcreate(CLCAP * 4) local clt = SCL
local lens = bcreate(320) local lens = SLENS
local final = 0 local final = 0
repeat repeat
-- block header (3 bits); also up to 14 bits of a dynamic header -- block header (3 bits); also up to 14 bits of a dynamic header
@@ -133,9 +149,7 @@ function Inflate.raw(src: buffer, start: number, endpos: number, cap: number, ex
lt, dt = FLIT, FDIST lt, dt = FLIT, FDIST
lsub, dsub = FLITS, FDISTS lsub, dsub = FLITS, FDISTS
elseif btype == 2 then elseif btype == 2 then
if lt == FLIT then lt, dt = SLIT, SDIST
lt, dt = bcreate(LITCAP * 4), bcreate(DISTCAP * 4) :: buffer
end
local hlit = band(bitbuf, 31) + 257 local hlit = band(bitbuf, 31) + 257
local hdist = band(rshift(bitbuf, 5), 31) + 1 local hdist = band(rshift(bitbuf, 5), 31) + 1
local hclen = band(rshift(bitbuf, 10), 15) + 4 local hclen = band(rshift(bitbuf, 10), 15) + 4
@@ -240,8 +254,8 @@ function Inflate.raw(src: buffer, start: number, endpos: number, cap: number, ex
if readu8(lens, 256) == 0 then if readu8(lens, 256) == 0 then
return nil, "missing end-of-block code" return nil, "missing end-of-block code"
end end
lsub = Huffman.buildLsb(lens, 0, hlit, lt, LITBITS) lsub = Huffman.buildLsbMap(lens, 0, hlit, lt, LITBITS, LMAP)
dsub = Huffman.buildLsb(lens, hlit, hdist, dt, DISTBITS) dsub = Huffman.buildLsbMap(lens, hlit, hdist, dt, DISTBITS, DMAP)
if lsub < 0 or dsub < 0 then if lsub < 0 or dsub < 0 then
return nil, "invalid literal/length or distance code set" return nil, "invalid literal/length or distance code set"
end end
@@ -299,13 +313,12 @@ function Inflate.raw(src: buffer, start: number, endpos: number, cap: number, ex
end end
writeu8(out, op, sym) writeu8(out, op, sym)
op += 1 op += 1
elseif sym == 256 then elseif sym < 512 then
break if sym == 256 then
else break
sym -= 256
if sym > 29 then
return nil, "invalid literal/length code"
end end
return nil, "invalid literal/length code"
else
if bitcnt < 20 then if bitcnt < 20 then
if pos + 4 <= endpos then if pos + 4 <= endpos then
bitbuf = bor(bitbuf, lshift(readu32(src, pos), bitcnt)) bitbuf = bor(bitbuf, lshift(readu32(src, pos), bitcnt))
@@ -327,8 +340,8 @@ function Inflate.raw(src: buffer, start: number, endpos: number, cap: number, ex
end end
end end
end end
local len = LBASE[sym] local len = rshift(sym, 3) - 64
local xb = LEXT[sym] local xb = band(sym, 7)
if xb > 0 then if xb > 0 then
len += band(bitbuf, lshift(1, xb) - 1) len += band(bitbuf, lshift(1, xb) - 1)
bitbuf = rshift(bitbuf, xb) bitbuf = rshift(bitbuf, xb)
@@ -348,12 +361,9 @@ function Inflate.raw(src: buffer, start: number, endpos: number, cap: number, ex
end end
bitbuf = rshift(bitbuf, l) bitbuf = rshift(bitbuf, l)
bitcnt -= l bitcnt -= l
local dsym = rshift(e, 5) + 1 local dsym = rshift(e, 5)
if dsym > 30 then local dist = rshift(dsym, 4)
return nil, "invalid distance code" xb = band(dsym, 15)
end
local dist = DBASE[dsym]
xb = DEXT[dsym]
if xb > 0 then if xb > 0 then
if bitcnt < 13 then if bitcnt < 13 then
if pos + 4 <= endpos then if pos + 4 <= endpos then
@@ -394,8 +404,11 @@ function Inflate.raw(src: buffer, start: number, endpos: number, cap: number, ex
end end
local s = op - dist local s = op - dist
if dist >= len then if dist >= len then
if len <= 16 and op + 16 <= cap then if len <= 8 and op + 8 <= cap then
-- straight-line 16-byte copy for simple LuaJIT traces; it reads only bytes before op or already copied ones -- straight-line 8- / 16-byte copies for simple LuaJIT traces; they read only bytes before op or already copied ones
writeu32(out, op, readu32(out, s))
writeu32(out, op + 4, readu32(out, s + 4))
elseif len <= 16 and op + 16 <= cap then
writeu32(out, op, readu32(out, s)) writeu32(out, op, readu32(out, s))
writeu32(out, op + 4, readu32(out, s + 4)) writeu32(out, op + 4, readu32(out, s + 4))
writeu32(out, op + 8, readu32(out, s + 8)) writeu32(out, op + 8, readu32(out, s + 8))
+31 -2
View File
@@ -4,7 +4,7 @@
-- codecs/compress/Lzma/Crc64: CRC-64/XZ (ECMA-182 polynomial, reflected: 0xC96C5795D7870F42), xz check type 4. -- codecs/compress/Lzma/Crc64: CRC-64/XZ (ECMA-182 polynomial, reflected: 0xC96C5795D7870F42), xz check type 4.
-- Written from the xz file format specification; the 64-bit value is kept as two u32 halves (hi, lo). -- Written from the xz file format specification; the 64-bit value is kept as two u32 halves (hi, lo).
local band, bxor, rshift, lshift, bor = bit32.band, bit32.bxor, bit32.rshift, bit32.lshift, bit32.bor local band, bxor, rshift, lshift, bor = bit32.band, bit32.bxor, bit32.rshift, bit32.lshift, bit32.bor
local readu8 = buffer.readu8 local readu8, readu32 = buffer.readu8, buffer.readu32
local THI, TLO = table.create(256, 0), table.create(256, 0) local THI, TLO = table.create(256, 0), table.create(256, 0)
for n = 0, 255 do for n = 0, 255 do
@@ -21,14 +21,43 @@ for n = 0, 255 do
THI[n + 1], TLO[n + 1] = hi, lo THI[n + 1], TLO[n + 1] = hi, lo
end end
-- slice-by-4: H[k] / L[k][n] = the register after byte n and k zero bytes
local H1, H2, H3 = table.create(256, 0), table.create(256, 0), table.create(256, 0)
local L1, L2, L3 = table.create(256, 0), table.create(256, 0), table.create(256, 0)
for n = 0, 255 do
local hi, lo = THI[n + 1], TLO[n + 1]
for k = 1, 3 do
local idx = band(lo, 255) + 1
lo = bxor(TLO[idx], bor(rshift(lo, 8), lshift(band(hi, 255), 24)))
hi = bxor(THI[idx], rshift(hi, 8))
if k == 1 then
H1[n + 1], L1[n + 1] = hi, lo
elseif k == 2 then
H2[n + 1], L2[n + 1] = hi, lo
else
H3[n + 1], L3[n + 1] = hi, lo
end
end
end
local Crc64 = {} local Crc64 = {}
function Crc64.of(b: buffer, o: number, n: number): (number, number) function Crc64.of(b: buffer, o: number, n: number): (number, number)
local hi, lo = 0xFFFFFFFF, 0xFFFFFFFF local hi, lo = 0xFFFFFFFF, 0xFFFFFFFF
for i = o, o + n - 1 do local i, e = o, o + n
local e4 = e - 4
while i <= e4 do
local w = bxor(lo, readu32(b, i))
local a, c, d, f = band(w, 255) + 1, band(rshift(w, 8), 255) + 1, band(rshift(w, 16), 255) + 1, rshift(w, 24) + 1
lo = bxor(L3[a], L2[c], L1[d], TLO[f], hi)
hi = bxor(H3[a], H2[c], H1[d], THI[f])
i += 4
end
while i < e do
local idx = band(bxor(lo, readu8(b, i)), 255) + 1 local idx = band(bxor(lo, readu8(b, i)), 255) + 1
lo = bxor(TLO[idx], bor(rshift(lo, 8), lshift(band(hi, 255), 24))) lo = bxor(TLO[idx], bor(rshift(lo, 8), lshift(band(hi, 255), 24)))
hi = bxor(THI[idx], rshift(hi, 8)) hi = bxor(THI[idx], rshift(hi, 8))
i += 1
end end
return bxor(hi, 0xFFFFFFFF), bxor(lo, 0xFFFFFFFF) return bxor(hi, 0xFFFFFFFF), bxor(lo, 0xFFFFFFFF)
end end
+36 -10
View File
@@ -659,14 +659,24 @@ local function block(b: buffer, p: number, e: number, st: any): (string?, string
local ml = ML_BASE[mlCode] local ml = ML_BASE[mlCode]
local nb = ML_BITS[mlCode] local nb = ML_BITS[mlCode]
if nb > 0 then if nb > 0 then
ml += peek(b, s, off, nb) local lo = off - nb
off -= nb if lo >= 0 and s + rshift(lo, 3) <= fastEnd then
ml += band(rshift(readu32(b, s + rshift(lo, 3)), band(lo, 7)), lshift(1, nb) - 1)
else
ml += peek(b, s, off, nb)
end
off = lo
end end
local ll = LL_BASE[llCode] local ll = LL_BASE[llCode]
nb = LL_BITS[llCode] nb = LL_BITS[llCode]
if nb > 0 then if nb > 0 then
ll += peek(b, s, off, nb) local lo = off - nb
off -= nb if lo >= 0 and s + rshift(lo, 3) <= fastEnd then
ll += band(rshift(readu32(b, s + rshift(lo, 3)), band(lo, 7)), lshift(1, nb) - 1)
else
ll += peek(b, s, off, nb)
end
off = lo
end end
-- repeat offsets -- repeat offsets
local offset local offset
@@ -699,15 +709,31 @@ local function block(b: buffer, p: number, e: number, st: any): (string?, string
end end
-- state updates (not after the last sequence): LL, ML, OF -- state updates (not after the last sequence): LL, ML, OF
if i < nbSeq then if i < nbSeq then
local lo
nb = band(rshift(llE, 8), 255) nb = band(rshift(llE, 8), 255)
llS = rshift(llE, 16) + peek(b, s, off, nb) lo = off - nb
off -= nb if lo >= 0 and s + rshift(lo, 3) <= fastEnd then
llS = rshift(llE, 16) + band(rshift(readu32(b, s + rshift(lo, 3)), band(lo, 7)), lshift(1, nb) - 1)
else
llS = rshift(llE, 16) + peek(b, s, off, nb)
end
off = lo
nb = band(rshift(mlE, 8), 255) nb = band(rshift(mlE, 8), 255)
mlS = rshift(mlE, 16) + peek(b, s, off, nb) lo = off - nb
off -= nb if lo >= 0 and s + rshift(lo, 3) <= fastEnd then
mlS = rshift(mlE, 16) + band(rshift(readu32(b, s + rshift(lo, 3)), band(lo, 7)), lshift(1, nb) - 1)
else
mlS = rshift(mlE, 16) + peek(b, s, off, nb)
end
off = lo
nb = band(rshift(ofE, 8), 255) nb = band(rshift(ofE, 8), 255)
ofS = rshift(ofE, 16) + peek(b, s, off, nb) lo = off - nb
off -= nb if lo >= 0 and s + rshift(lo, 3) <= fastEnd then
ofS = rshift(ofE, 16) + band(rshift(readu32(b, s + rshift(lo, 3)), band(lo, 7)), lshift(1, nb) - 1)
else
ofS = rshift(ofE, 16) + peek(b, s, off, nb)
end
off = lo
end end
-- execute -- execute
if lp + ll > litEnd then if lp + ll > litEnd then
+7 -2
View File
@@ -38,7 +38,7 @@ end
local count = table.create(MAXLEN + 1, 0) local count = table.create(MAXLEN + 1, 0)
local nextc = table.create(MAXLEN + 1, 0) local nextc = table.create(MAXLEN + 1, 0)
local function build(lens: buffer, off: number, n: number, tab: buffer, P: number, msb: boolean): number local function build(lens: buffer, off: number, n: number, tab: buffer, P: number, msb: boolean, map: { number }?): number
for i = 1, MAXLEN + 1 do for i = 1, MAXLEN + 1 do
count[i] = 0 count[i] = 0
end end
@@ -76,7 +76,7 @@ local function build(lens: buffer, off: number, n: number, tab: buffer, P: numbe
if l > 0 then if l > 0 then
local c = nextc[l] local c = nextc[l]
nextc[l] = c + 1 nextc[l] = c + 1
local entry = s * 32 + l local entry = (if map then map[s + 1] else s) * 32 + l
if l <= P then if l <= P then
if msb then if msb then
local first = lshift(c, P - l) local first = lshift(c, P - l)
@@ -136,6 +136,11 @@ function Huffman.buildLsb(lens: buffer, off: number, n: number, tab: buffer, P:
return build(lens, off, n, tab, P, false) return build(lens, off, n, tab, P, false)
end end
-- map[s + 1] replaces symbol s in the entries (values < 2^27)
function Huffman.buildLsbMap(lens: buffer, off: number, n: number, tab: buffer, P: number, map: { number }): number
return build(lens, off, n, tab, P, false, map)
end
function Huffman.buildMsb(lens: buffer, off: number, n: number, tab: buffer, P: number): number function Huffman.buildMsb(lens: buffer, off: number, n: number, tab: buffer, P: number): number
return build(lens, off, n, tab, P, true) return build(lens, off, n, tab, P, true)
end end
+28 -7
View File
@@ -29,6 +29,8 @@ local ESC: { [number]: string } = {
[116] = "\t", [116] = "\t",
} }
local WS: { [number]: boolean } = { [32] = true, [9] = true, [10] = true, [13] = true }
local utf8char = Text.utf8char local utf8char = Text.utf8char
Decode.utf8char = utf8char Decode.utf8char = utf8char
@@ -164,7 +166,9 @@ function Decode.value(s: string, i: number, opts: Options?): (any, any, number?)
local value: any local value: any
while true do while true do
i = match(s, "^[ \t\n\r]*()", i) :: any if WS[byte(s, i) or 0] then
i = match(s, "^[ \t\n\r]*()", i) :: any
end
local c = byte(s, i) local c = byte(s, i)
local haveValue = true local haveValue = true
if c == 123 then -- { if c == 123 then -- {
@@ -172,7 +176,10 @@ function Decode.value(s: string, i: number, opts: Options?): (any, any, number?)
if depth > maxDepth then if depth > maxDepth then
return nil, "nested deeper than " .. maxDepth, i - 1 return nil, "nested deeper than " .. maxDepth, i - 1
end end
i = match(s, "^[ \t\n\r]*()", i + 1) :: any i = i + 1
if WS[byte(s, i) or 0] then
i = match(s, "^[ \t\n\r]*()", i) :: any
end
local t = {} local t = {}
c = byte(s, i) c = byte(s, i)
if c == 125 then if c == 125 then
@@ -184,7 +191,10 @@ function Decode.value(s: string, i: number, opts: Options?): (any, any, number?)
if k == nil then if k == nil then
return nil, ni, at return nil, ni, at
end end
i = match(s, "^[ \t\n\r]*()", ni) :: any i = ni
if WS[byte(s, i) or 0] then
i = match(s, "^[ \t\n\r]*()", i) :: any
end
if byte(s, i) ~= 58 then if byte(s, i) ~= 58 then
return nil, if i > n then "truncated object" else "expected ':'", i - 1 return nil, if i > n then "truncated object" else "expected ':'", i - 1
end end
@@ -200,7 +210,10 @@ function Decode.value(s: string, i: number, opts: Options?): (any, any, number?)
if depth > maxDepth then if depth > maxDepth then
return nil, "nested deeper than " .. maxDepth, i - 1 return nil, "nested deeper than " .. maxDepth, i - 1
end end
i = match(s, "^[ \t\n\r]*()", i + 1) :: any i = i + 1
if WS[byte(s, i) or 0] then
i = match(s, "^[ \t\n\r]*()", i) :: any
end
if byte(s, i) == 93 then if byte(s, i) == 93 then
i += 1 i += 1
depth -= 1 depth -= 1
@@ -256,10 +269,15 @@ function Decode.value(s: string, i: number, opts: Options?): (any, any, number?)
t[cnt] = value t[cnt] = value
stackK[depth] = cnt stackK[depth] = cnt
end end
i = match(s, "^[ \t\n\r]*()", i) :: any if WS[byte(s, i) or 0] then
i = match(s, "^[ \t\n\r]*()", i) :: any
end
c = byte(s, i) c = byte(s, i)
if c == 44 then -- , if c == 44 then -- ,
i = match(s, "^[ \t\n\r]*()", i + 1) :: any i = i + 1
if WS[byte(s, i) or 0] then
i = match(s, "^[ \t\n\r]*()", i) :: any
end
if ord then if ord then
if byte(s, i) ~= 34 then if byte(s, i) ~= 34 then
return nil, if i > n then "truncated object" else "expected a key", i - 1 return nil, if i > n then "truncated object" else "expected a key", i - 1
@@ -268,7 +286,10 @@ function Decode.value(s: string, i: number, opts: Options?): (any, any, number?)
if k == nil then if k == nil then
return nil, ni, at return nil, ni, at
end end
i = match(s, "^[ \t\n\r]*()", ni) :: any i = ni
if WS[byte(s, i) or 0] then
i = match(s, "^[ \t\n\r]*()", i) :: any
end
if byte(s, i) ~= 58 then if byte(s, i) ~= 58 then
return nil, if i > n then "truncated object" else "expected ':'", i - 1 return nil, if i > n then "truncated object" else "expected ':'", i - 1
end end
+71 -28
View File
@@ -140,18 +140,23 @@ type State = {
maxDepth: number, maxDepth: number,
null: any, null: any,
err: string?, err: string?,
nls: { string }, -- "\n" .. indent * (i - 1)
} }
local function put(st: State, s: string) local function newline(st: State, depth: number): string
local n = st.n + 1 local r = "\n" .. string.rep(st.indent :: string, depth)
st.out[n] = s st.nls[depth + 1] = r
st.n = n return r
end end
local function value(st: State, v: any, depth: number): boolean local function value(st: State, v: any, depth: number): boolean
local tv = type(v) local tv = type(v)
local out = st.out
local n: number
if tv == "string" then if tv == "string" then
put(st, quote(v, st.ascii, st.slash)) n = st.n + 1
out[n] = quote(v, st.ascii, st.slash)
st.n = n
elseif tv == "number" then elseif tv == "number" then
local s = number(v) local s = number(v)
if not s then if not s then
@@ -161,14 +166,22 @@ local function value(st: State, v: any, depth: number): boolean
end end
s = "null" s = "null"
end end
put(st, s) n = st.n + 1
out[n] = s
st.n = n
elseif tv == "boolean" then elseif tv == "boolean" then
put(st, if v then "true" else "false") n = st.n + 1
out[n] = if v then "true" else "false"
st.n = n
elseif v == nil or v == st.null or v == Types.null then elseif v == nil or v == st.null or v == Types.null then
put(st, "null") n = st.n + 1
out[n] = "null"
st.n = n
elseif tv == "table" then elseif tv == "table" then
if Types.Date.is(v) then if Types.Date.is(v) then
put(st, '"' .. tostring(v) .. '"') n = st.n + 1
out[n] = '"' .. tostring(v) .. '"'
st.n = n
return true return true
end end
if depth >= st.maxDepth then if depth >= st.maxDepth then
@@ -178,31 +191,44 @@ local function value(st: State, v: any, depth: number): boolean
local ind = st.indent local ind = st.indent
local nl, nl2 = "", "" local nl, nl2 = "", ""
if ind then if ind then
nl = "\n" .. string.rep(ind, depth + 1) local nls = st.nls
nl2 = "\n" .. string.rep(ind, depth) nl = nls[depth + 2] or newline(st, depth + 1)
nl2 = nls[depth + 1] or newline(st, depth)
end end
if kind(v, st.emptyObject) == "array" then if kind(v, st.emptyObject) == "array" then
local n = #v local len = #v
if n == 0 then if len == 0 then
put(st, "[]") n = st.n + 1
out[n] = "[]"
st.n = n
return true return true
end end
put(st, "[") n = st.n + 1
for i = 1, n do out[n] = "["
st.n = n
for i = 1, len do
if i > 1 then if i > 1 then
put(st, ",") n = st.n + 1
out[n] = ","
st.n = n
end end
if ind then if ind then
put(st, nl) n = st.n + 1
out[n] = nl
st.n = n
end end
if not value(st, v[i], depth + 1) then if not value(st, v[i], depth + 1) then
return false return false
end end
end end
if ind then if ind then
put(st, nl2) n = st.n + 1
out[n] = nl2
st.n = n
end end
put(st, "]") n = st.n + 1
out[n] = "]"
st.n = n
else else
local keys: { any } local keys: { any }
if Types.isObject(v) then if Types.isObject(v) then
@@ -222,17 +248,25 @@ local function value(st: State, v: any, depth: number): boolean
end end
end end
if #keys == 0 then if #keys == 0 then
put(st, "{}") n = st.n + 1
out[n] = "{}"
st.n = n
return true return true
end end
put(st, "{") n = st.n + 1
out[n] = "{"
st.n = n
local sep = if ind then ": " else ":" local sep = if ind then ": " else ":"
for i, k in keys do for i, k in keys do
if i > 1 then if i > 1 then
put(st, ",") n = st.n + 1
out[n] = ","
st.n = n
end end
if ind then if ind then
put(st, nl) n = st.n + 1
out[n] = nl
st.n = n
end end
local ks: string local ks: string
if type(k) == "string" then if type(k) == "string" then
@@ -243,16 +277,24 @@ local function value(st: State, v: any, depth: number): boolean
st.err = "object key of type " .. type(k) st.err = "object key of type " .. type(k)
return false return false
end end
put(st, quote(ks, st.ascii, st.slash)) n = st.n + 1
put(st, sep) out[n] = quote(ks, st.ascii, st.slash)
st.n = n
n = st.n + 1
out[n] = sep
st.n = n
if not value(st, v[k], depth + 1) then if not value(st, v[k], depth + 1) then
return false return false
end end
end end
if ind then if ind then
put(st, nl2) n = st.n + 1
out[n] = nl2
st.n = n
end end
put(st, "}") n = st.n + 1
out[n] = "}"
st.n = n
end end
elseif tv == "buffer" then elseif tv == "buffer" then
st.err = "cannot encode a buffer (encode it as base64 or an array first)" st.err = "cannot encode a buffer (encode it as base64 or an array first)"
@@ -284,6 +326,7 @@ local function state(opts: Options?, nullv: any?): State
maxDepth = o.maxDepth or 1000, maxDepth = o.maxDepth or 1000,
null = nullv, null = nullv,
err = nil, err = nil,
nls = {},
} }
end end
Encode.state = state Encode.state = state
+68 -4
View File
@@ -18,6 +18,8 @@ export type Options = {
} }
local NAME = "^[%a_:\128-\255][%w_:%.%-\128-\255]*" local NAME = "^[%a_:\128-\255][%w_:%.%-\128-\255]*"
local TEXT = "^([^<&%]%z\1-\8\11\12\14-\31]*)()<"
local ATTR = '^[ \t\n]+([%a_:\128-\255][%w_:%.%-\128-\255]*)[ \t\n]*=[ \t\n]*"([^"<&%c]*)"()'
local PREDEF: { [string]: string } = { lt = "<", gt = ">", amp = "&", quot = '"', apos = "'" } local PREDEF: { [string]: string } = { lt = "<", gt = ">", amp = "&", quot = '"', apos = "'" }
local utf8char = Text.utf8char local utf8char = Text.utf8char
@@ -85,7 +87,7 @@ function Parse.toUtf8(s: string): (string?, string)
if enc then if enc then
local e = lower(enc) local e = lower(enc)
if e == "utf-8" or e == "utf8" or e == "us-ascii" or e == "ascii" then if e == "utf-8" or e == "utf8" or e == "us-ascii" or e == "ascii" then
if find(s, "[\128-\255]") and not utf8.len(s) then if not utf8.len(s) then
return nil, "invalid UTF-8" return nil, "invalid UTF-8"
end end
return s, e return s, e
@@ -100,7 +102,7 @@ function Parse.toUtf8(s: string): (string?, string)
end end
return nil, "unsupported encoding " .. enc return nil, "unsupported encoding " .. enc
end end
if find(s, "[\128-\255]") and not utf8.len(s) then if not utf8.len(s) then
return nil, "invalid UTF-8" return nil, "invalid UTF-8"
end end
return s, "utf-8" return s, "utf-8"
@@ -494,11 +496,33 @@ function Parse.events(s: string, opts: Options?): () -> (string?, any, any, any)
return nil return nil
end end
local c = byte(s, i) local c = byte(s, i)
if c ~= 60 and depth > 0 and not keepWs and not preserve[depth] then
local w = match(s, "^[ \t\n]*()", i) :: number
local cw = byte(s, w)
if cw == 60 then
i = w
c = 60
elseif cw then
-- text with a non-blank at w and no ']', '&' or control characters before the next '<'
local raw, e = match(s, TEXT, i)
if raw then
i = e
return "text", raw
end
end
end
if c ~= 60 then -- text if c ~= 60 then -- text
local e = find(s, "<", i, true) or (n + 1) local e = find(s, "<", i, true) or (n + 1)
local raw = sub(s, i, e - 1) local raw = sub(s, i, e - 1)
local start = i local start = i
i = e i = e
if depth > 0 and not find(raw, "[%]&%z\1-\8\11\12\14-\31]") then
-- no ']]>', control characters or references
if keepWs or preserve[depth] or find(raw, "[^ \t\n]") then
return "text", raw
end
continue
end
local wsOnly = not find(raw, "[^ \t\n]") local wsOnly = not find(raw, "[^ \t\n]")
if depth == 0 then if depth == 0 then
if not wsOnly then if not wsOnly then
@@ -524,6 +548,21 @@ function Parse.events(s: string, opts: Options?): () -> (string?, any, any, any)
end end
local c2 = byte(s, i + 1) local c2 = byte(s, i + 1)
if c2 == 47 then -- </ if c2 == 47 then -- </
local top = stack[depth]
if top then
local tl = #top
if byte(s, i + 2 + tl) == 62 and sub(s, i + 2, i + 1 + tl) == top then
i += 3 + tl
stack[depth] = nil
nsStack[depth] = nil
preserve[depth] = nil
depth -= 1
if depth == 0 then
rootDone = true
end
return "end", top
end
end
local name = match(s, NAME, i + 2) local name = match(s, NAME, i + 2)
if not name then if not name then
return fail("bad end tag", i) return fail("bad end tag", i)
@@ -617,11 +656,35 @@ function Parse.events(s: string, opts: Options?): () -> (string?, any, any, any)
end end
local at = i local at = i
local p = i + 1 + #name local p = i + 1 + #name
local attrs = Types.object() local attrs = {}
local order = {} local order = {}
local na = 0
local closed = false local closed = false
local nsMap: { [string]: string }? = nil local nsMap: { [string]: string }? = nil
while true do while true do
if byte(s, p) == 62 then
p += 1
break
end
-- the common attribute: name="value" with no references, controls or '<' in the value
local an, av, ae = match(s, ATTR, p)
if an then
if attrs[an] ~= nil then
return fail("duplicate attribute " .. an, match(s, "^[ \t\n]*()", p) :: number)
end
attrs[an] = av
na += 1
order[na] = an
if nsOn then
if an == "xmlns" or sub(an, 1, 6) == "xmlns:" then
local m: { [string]: string } = nsMap or {}
nsMap = m
m[if an == "xmlns" then "" else sub(an, 7)] = av
end
end
p = ae
continue
end
local q = match(s, "^[ \t\n]*()", p) :: any local q = match(s, "^[ \t\n]*()", p) :: any
local cc = byte(s, q) local cc = byte(s, q)
if cc == 62 then if cc == 62 then
@@ -675,7 +738,8 @@ function Parse.events(s: string, opts: Options?): () -> (string?, any, any, any)
return fail("duplicate attribute " .. an, q) return fail("duplicate attribute " .. an, q)
end end
attrs[an] = v attrs[an] = v
table.insert(order, an) na += 1
order[na] = an
if nsOn then if nsOn then
if an == "xmlns" or sub(an, 1, 6) == "xmlns:" then if an == "xmlns" or sub(an, 1, 6) == "xmlns:" then
local m: { [string]: string } = nsMap or {} local m: { [string]: string } = nsMap or {}
+63 -16
View File
@@ -78,7 +78,16 @@ function Xml.decode(src: string | buffer, opts: DecodeOptions?): (Node?, Err.Err
local cur: any = doc local cur: any = doc
local stack = { doc } local stack = { doc }
local depth = 1 local depth = 1
for ev, a, b, c in Xml.events(src, o) do local s, terr = text(src)
local u, enc = nil, ""
if s then
u, enc = Parse.toUtf8(s)
end
if not u then
return nil, terr or Err.new(if find(enc, "unsupported", 1, true) then Err.UNSUPPORTED else Err.CORRUPT, enc)
end
local str: string = u
for ev, a, b, c in Parse.events(str, o) do
if ev == "start" then if ev == "start" then
local node: any = { name = a, attrs = b, children = {}, parent = if parents then cur else nil } local node: any = { name = a, attrs = b, children = {}, parent = if parents then cur else nil }
if c then if c then
@@ -118,7 +127,7 @@ function Xml.decode(src: string | buffer, opts: DecodeOptions?): (Node?, Err.Err
elseif ev == "doctype" then elseif ev == "doctype" then
doc.doctype = { raw = a, name = b.name, publicId = b.publicId, systemId = b.systemId, entities = b.entities } doc.doctype = { raw = a, name = b.name, publicId = b.publicId, systemId = b.systemId, entities = b.entities }
elseif ev == "error" then elseif ev == "error" then
return nil, a return nil, Err.new(errCode(a, b, #str), a, b)
end end
end end
return doc, nil return doc, nil
@@ -126,7 +135,7 @@ end
function Xml.element(name: string, attrs: { [string]: string }?, children: { any }?): Node function Xml.element(name: string, attrs: { [string]: string }?, children: { any }?): Node
local a = attrs or Types.object() local a = attrs or Types.object()
if not Types.isObject(a) then if attrs and not Types.isObject(a) then
local keys = {} local keys = {}
for k in next, a do for k in next, a do
table.insert(keys, k) table.insert(keys, k)
@@ -161,24 +170,27 @@ function Xml.setAttr(node: Node, name: string, value: string?)
Types.set(node.attrs, name, value) Types.set(node.attrs, name, value)
end end
-- name == nil: any element; a name without a prefix also matches prefixed names with that local part
local function matches(cn: string, name: string?, plain: boolean): boolean
return name == nil or cn == name or (plain and find(cn, ":", 1, true) ~= nil and match(cn, ":(.*)$") == name)
end
function Xml.children(node: Node, name: string?): { Node } function Xml.children(node: Node, name: string?): { Node }
local out = {} local out = {}
local plain = name ~= nil and not find(name, ":", 1, true)
for _, ch in node.children do for _, ch in node.children do
if type(ch) == "table" and string.byte(ch.name) ~= 35 then if type(ch) == "table" and string.byte(ch.name) ~= 35 and matches(ch.name, name, plain) then
if name == nil or ch.name == name or (not find(name, ":", 1, true) and match(ch.name, ":(.*)$") == name) then table.insert(out, ch)
table.insert(out, ch)
end
end end
end end
return out return out
end end
function Xml.child(node: Node, name: string?): Node? function Xml.child(node: Node, name: string?): Node?
local plain = name ~= nil and not find(name, ":", 1, true)
for _, ch in node.children do for _, ch in node.children do
if type(ch) == "table" and string.byte(ch.name) ~= 35 then if type(ch) == "table" and string.byte(ch.name) ~= 35 and matches(ch.name, name, plain) then
if name == nil or ch.name == name or (not find(name, ":", 1, true) and match(ch.name, ":(.*)$") == name) then return ch
return ch
end
end end
end end
return nil return nil
@@ -186,10 +198,11 @@ end
function Xml.descendants(node: Node, name: string?): { Node } function Xml.descendants(node: Node, name: string?): { Node }
local out = {} local out = {}
local plain = name ~= nil and not find(name, ":", 1, true)
local function walk(n: Node) local function walk(n: Node)
for _, ch in n.children do for _, ch in n.children do
if type(ch) == "table" and string.byte(ch.name) ~= 35 then if type(ch) == "table" and string.byte(ch.name) ~= 35 then
if name == nil or ch.name == name or (not find(name :: string, ":", 1, true) and match(ch.name, ":(.*)$") == name) then if matches(ch.name, name, plain) then
table.insert(out, ch) table.insert(out, ch)
end end
walk(ch) walk(ch)
@@ -207,6 +220,13 @@ function Xml.text(node: any): string
if node.name == "#cdata" then if node.name == "#cdata" then
return node.text or "" return node.text or ""
end end
local kids = node.children
local nk = #kids
if nk == 0 then
return ""
elseif nk == 1 and type(kids[1]) == "string" then
return kids[1]
end
local parts = {} local parts = {}
local function walk(n: any) local function walk(n: any)
for _, ch in n.children do for _, ch in n.children do
@@ -251,14 +271,32 @@ local TEXT_ESC = { ["&"] = "&amp;", ["<"] = "&lt;", [">"] = "&gt;", ["\r"] = "&#
local ATTR_ESC = { ["&"] = "&amp;", ["<"] = "&lt;", [">"] = "&gt;", ['"'] = "&quot;", ["\t"] = "&#9;", ["\n"] = "&#10;", ["\r"] = "&#13;" } local ATTR_ESC = { ["&"] = "&amp;", ["<"] = "&lt;", [">"] = "&gt;", ['"'] = "&quot;", ["\t"] = "&#9;", ["\n"] = "&#10;", ["\r"] = "&#13;" }
function Xml.escape(s: string): string function Xml.escape(s: string): string
if not find(s, "[&<>\r]") then
return s
end
return (gsub(s, "[&<>\r]", TEXT_ESC)) return (gsub(s, "[&<>\r]", TEXT_ESC))
end end
function Xml.escapeAttr(s: string): string function Xml.escapeAttr(s: string): string
if not find(s, '[&<>"\t\n\r]') then
return s
end
return (gsub(s, '[&<>"\t\n\r]', ATTR_ESC)) return (gsub(s, '[&<>"\t\n\r]', ATTR_ESC))
end end
local goodNames: { [string]: boolean } = {}
local nGood = 0
local function badName(name: any): boolean local function badName(name: any): boolean
return type(name) ~= "string" or not match(name, "^[%a_:\128-\255][%w_:%.%-\128-\255]*$") if goodNames[name] then
return false
end
if type(name) ~= "string" or not match(name, "^[%a_:\128-\255][%w_:%.%-\128-\255]*$") then
return true
end
if nGood < 4096 then
goodNames[name] = true
nGood += 1
end
return false
end end
function Xml.encode(node: Node, opts: EncodeOptions?): (string?, Err.Err?) function Xml.encode(node: Node, opts: EncodeOptions?): (string?, Err.Err?)
@@ -270,6 +308,15 @@ function Xml.encode(node: Node, opts: EncodeOptions?): (string?, Err.Err?)
ind = o.indent ind = o.indent
end end
local selfClose = o.selfClose ~= false local selfClose = o.selfClose ~= false
local indents: { string } = {}
local function indent(depth: number): string
local r = indents[depth + 1]
if not r then
r = "\n" .. string.rep(ind :: string, depth)
indents[depth + 1] = r
end
return r
end
local out: { string } = {} local out: { string } = {}
local err: string? = nil local err: string? = nil
local seen: { [any]: boolean } = {} local seen: { [any]: boolean } = {}
@@ -324,7 +371,7 @@ function Xml.encode(node: Node, opts: EncodeOptions?): (string?, Err.Err?)
end end
table.insert(out, "<" .. name) table.insert(out, "<" .. name)
local attrs = n.attrs or {} local attrs = n.attrs or {}
for _, k in Types.keys(attrs) do for _, k in (if next(attrs) == nil then attrs else Types.keys(attrs)) do
local v = attrs[k] local v = attrs[k]
if badName(k) then if badName(k) then
err = "bad attribute name " .. tostring(k) err = "bad attribute name " .. tostring(k)
@@ -355,12 +402,12 @@ function Xml.encode(node: Node, opts: EncodeOptions?): (string?, Err.Err?)
end end
for _, c in ch do for _, c in ch do
if pretty then if pretty then
table.insert(out, "\n" .. string.rep(ind :: string, depth + 1)) table.insert(out, indent(depth + 1))
end end
write(c, depth + 1) write(c, depth + 1)
end end
if pretty then if pretty then
table.insert(out, "\n" .. string.rep(ind :: string, depth)) table.insert(out, indent(depth))
end end
table.insert(out, "</" .. name .. ">") table.insert(out, "</" .. name .. ">")
end end
+3 -9
View File
@@ -8,11 +8,9 @@
-- of a multiplexed file come first when every stream's first packet is written (with flush) before any other. -- 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. -- Never throws: a bad argument returns false, Err.
local Err = require("@rosetta/core/Err") local Err = require("@rosetta/core/Err")
local Page = require("@rosetta/containers/Ogg/Page") local Crc32 = require("@rosetta/core/Crc32")
local CRC = Page.CRC_TABLE local writeu8, writeu32, writei32 = buffer.writeu8, buffer.writeu32, buffer.writei32
local readu8, writeu8, writeu32, writei32 = buffer.readu8, buffer.writeu8, buffer.writeu32, buffer.writei32
local bxor, lshift, rshift = bit32.bxor, bit32.lshift, bit32.rshift
local Mux = {} local Mux = {}
Mux.__index = Mux Mux.__index = Mux
@@ -63,11 +61,7 @@ end
-- the CRC of a page (the crc field written as zero) -- the CRC of a page (the crc field written as zero)
local function crc(b: buffer, n: number): number local function crc(b: buffer, n: number): number
local c = 0 return Crc32.msb(b, 0, n, 0)
for i = 0, n - 1 do
c = bxor(lshift(c, 8), CRC[bxor(rshift(c, 24), readu8(b, i)) + 1])
end
return c
end end
function Stream._flush(self: any, eos: boolean) function Stream._flush(self: any, eos: boolean)
+1 -4
View File
@@ -32,10 +32,7 @@ local CRC = Crc32.MSB_TABLE
Page.CRC_TABLE = CRC Page.CRC_TABLE = CRC
local function crcRange(b: buffer, from: number, to: number, crc: number): number local function crcRange(b: buffer, from: number, to: number, crc: number): number
for i = from, to - 1 do return Crc32.msb(b, from, to - from, crc)
crc = bxor(lshift(crc, 8), CRC[bxor(rshift(crc, 24), readu8(b, i)) + 1])
end
return crc
end end
-- the Ogg CRC-32 of arbitrary data (the crc field is not zeroed) -- the Ogg CRC-32 of arbitrary data (the crc field is not zeroed)
+25 -11
View File
@@ -2,24 +2,38 @@
--!native --!native
-- core/Adler32: Adler-32 (RFC 1950, the zlib checksum). Absorbed from deflate-luau src/Deflate/Checksum.luau (same author; -- core/Adler32: Adler-32 (RFC 1950, the zlib checksum). Absorbed from deflate-luau src/Deflate/Checksum.luau (same author;
-- no third-party code). Never throws: the range is clamped. -- no third-party code). Never throws: the range is clamped.
local readu8 = buffer.readu8 local readu8, readu32 = buffer.readu8, buffer.readu32
local band, rshift = bit32.band, bit32.rshift
local function adler32(buf: buffer, off: number, len: number, adler: number?): number local function adler32(buf: buffer, off: number, len: number, adler: number?): number
local a0 = adler or 1 local a0 = adler or 1
local a, b = a0 % 65536, a0 // 65536 local a, b = a0 % 65536, a0 // 65536
local i, e = off, off + len local i, e = off, off + len
while i < e do -- 88-byte blocks, two bytes per 16-bit lane of each u32: pl / ph sum bytes 0, 2 / 1, 3 of the words, ql / qh sum
-- zlib NMAX: the largest n with 255 n (n + 1) / 2 + (n + 1) (BASE - 1) < 2^32 -- those prefix sums (each lane stays below 2^16 over 22 words). Byte t of word j (of m) weighs 4 (m - j) - t in b.
local stop = math.min(e, i + 5552) local e88 = e - 88
while i < stop do while i <= e88 do
a += readu8(buf, i) local pl, ph, ql, qh = 0, 0, 0, 0
b += a for j = i, i + 84, 4 do
i += 1 local w = readu32(buf, j)
pl += band(w, 0x00FF00FF)
ph += band(rshift(w, 8), 0x00FF00FF)
ql += pl
qh += ph
end end
a %= 65521 i += 88
b %= 65521 local s0, s2 = pl % 65536, pl // 65536
local s1, s3 = ph % 65536, ph // 65536
local q = ql % 65536 + ql // 65536 + qh % 65536 + qh // 65536
b = (b + 88 * a + 4 * q - s1 - 2 * s2 - 3 * s3) % 65521
a = (a + s0 + s1 + s2 + s3) % 65521
end end
return b * 65536 + a while i < e do
a += readu8(buf, i)
b += a
i += 1
end
return (b % 65521) * 65536 + a % 65521
end end
local function range(buf: buffer, offset: number?, length: number?): (number, number) local function range(buf: buffer, offset: number?, length: number?): (number, number)
+72 -3
View File
@@ -29,7 +29,19 @@ for _, c in { 9, 10, 11, 12, 13, 32 } do
end end
buffer.writeu8(DEC, string.byte("="), 65) buffer.writeu8(DEC, string.byte("="), 65)
local readu8, writeu8 = buffer.readu8, buffer.writeu8 local readu8, writeu8, readu16, readu32, writeu16 = buffer.readu8, buffer.writeu8, buffer.readu16, buffer.readu32, buffer.writeu16
local band, bor, rshift, byteswap = bit32.band, bit32.bor, bit32.rshift, bit32.byteswap
local writeu32 = buffer.writeu32
-- two output characters per 12 input bits (u16, first character in the low byte)
local function pairs12(alpha: string): buffer
local t = buffer.create(8192)
for i = 0, 4095 do
buffer.writeu16(t, i * 2, string.byte(alpha, i // 64 + 1) + string.byte(alpha, i % 64 + 1) * 256)
end
return t
end
local ENC2, ENC2_URL = pairs12(ALPHA), pairs12(ALPHA_URL)
function Base64.encode(data: buffer | string, opts: EncodeOptions?, offset: number?, length: number?): string function Base64.encode(data: buffer | string, opts: EncodeOptions?, offset: number?, length: number?): string
local buf: buffer = if type(data) == "string" then buffer.fromstring(data) else data local buf: buffer = if type(data) == "string" then buffer.fromstring(data) else data
@@ -47,6 +59,24 @@ function Base64.encode(data: buffer | string, opts: EncodeOptions?, offset: numb
local out = buffer.create(textLen + breaks) local out = buffer.create(textLen + breaks)
local p = 0 local p = 0
local col = 0 local col = 0
if wrap == 0 then
local enc2 = if opts and opts.url then ENC2_URL else ENC2
local fast = if o + full * 3 + 1 <= total then full else full - 1 -- readu32 reads one byte past the group
for i = 0, fast - 1 do
local v = rshift(byteswap(readu32(buf, o + i * 3)), 8)
writeu16(out, p, readu16(enc2, rshift(v, 12) * 2))
writeu16(out, p + 2, readu16(enc2, band(v, 4095) * 2))
p += 4
end
for i = math.max(fast, 0), full - 1 do
local q = o + i * 3
local v = readu8(buf, q) * 65536 + readu8(buf, q + 1) * 256 + readu8(buf, q + 2)
writeu16(out, p, readu16(enc2, rshift(v, 12) * 2))
writeu16(out, p + 2, readu16(enc2, band(v, 4095) * 2))
p += 4
end
full = 0
end
for i = 0, full - 1 do for i = 0, full - 1 do
if wrap > 0 then if wrap > 0 then
if col == wrap then if col == wrap then
@@ -69,7 +99,7 @@ function Base64.encode(data: buffer | string, opts: EncodeOptions?, offset: numb
writeu8(out, p, 10) writeu8(out, p, 10)
p += 1 p += 1
end end
local q = o + full * 3 local q = o + (n - rest)
local v = readu8(buf, q) * 65536 + (if rest == 2 then readu8(buf, q + 1) * 256 else 0) local v = readu8(buf, q) * 65536 + (if rest == 2 then readu8(buf, q + 1) * 256 else 0)
writeu8(out, p, readu8(enc, v // 262144)) writeu8(out, p, readu8(enc, v // 262144))
writeu8(out, p + 1, readu8(enc, (v // 4096) % 64)) writeu8(out, p + 1, readu8(enc, (v // 4096) % 64))
@@ -85,13 +115,51 @@ function Base64.encode(data: buffer | string, opts: EncodeOptions?, offset: numb
return buffer.tostring(out) return buffer.tostring(out)
end end
-- 12 bits per two input characters (u16 index, first character in the low byte); 0xFFFF unless both are alphabet
local DEC2: buffer? = nil
local function pairDecoder(): buffer
local t = buffer.create(131072)
buffer.fill(t, 0, 255)
for a = 0, 255 do
local da = buffer.readu8(DEC, a)
if da < 64 then
for b = 0, 255 do
local db = buffer.readu8(DEC, b)
if db < 64 then
buffer.writeu16(t, (a + b * 256) * 2, da * 64 + db)
end
end
end
end
DEC2 = t
return t
end
function Base64.decode(s: string | buffer): (buffer?, string?) function Base64.decode(s: string | buffer): (buffer?, string?)
local src: buffer = if type(s) == "string" then buffer.fromstring(s) else s local src: buffer = if type(s) == "string" then buffer.fromstring(s) else s
local n = buffer.len(src) local n = buffer.len(src)
local out = buffer.create((n // 4 + 1) * 3) local out = buffer.create((n // 4 + 1) * 3)
local acc, bits, p = 0, 0, 0 local acc, bits, p = 0, 0, 0
local padded = false local padded = false
for i = 0, n - 1 do local i = 0
while i < n do
if bits == 0 and not padded then
-- whole groups of four alphabet characters; out has room for the fourth byte each u32 write adds
local dec2 = DEC2 or pairDecoder()
while i + 4 <= n do
local w = readu32(src, i)
local x, y = readu16(dec2, band(w, 65535) * 2), readu16(dec2, rshift(w, 16) * 2)
if bor(x, y) >= 4096 then
break
end
writeu32(out, p, rshift(byteswap(x * 4096 + y), 8))
p += 3
i += 4
end
if i >= n then
break
end
end
local d = readu8(DEC, readu8(src, i)) local d = readu8(DEC, readu8(src, i))
if d < 64 then if d < 64 then
if padded then if padded then
@@ -112,6 +180,7 @@ function Base64.decode(s: string | buffer): (buffer?, string?)
elseif d ~= 64 then elseif d ~= 64 then
return nil, string.format("bad base64 character 0x%02x at %d", readu8(src, i), i) return nil, string.format("bad base64 character 0x%02x at %d", readu8(src, i), i)
end end
i += 1
end end
if bits >= 6 then if bits >= 6 then
return nil, "truncated base64 (a single character in the last group)" return nil, "truncated base64 (a single character in the last group)"
+41 -2
View File
@@ -2,7 +2,7 @@
--!native --!native
-- core/Crc32: CRC-32 (IEEE 802.3, the zlib / gzip / zip / PNG polynomial 0xEDB88320, reflected), slice-by-8. -- 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. -- Absorbed from deflate-luau src/Deflate/Checksum.luau (same author; no third-party code). Never throws.
local band, bxor, rshift, lshift = bit32.band, bit32.bxor, bit32.rshift, bit32.lshift local band, bxor, rshift, lshift, byteswap = bit32.band, bit32.bxor, bit32.rshift, bit32.lshift, bit32.byteswap
local readu8, readu32 = buffer.readu8, buffer.readu32 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 T0, T1, T2, T3 = table.create(256, 0), table.create(256, 0), table.create(256, 0), table.create(256, 0)
@@ -99,10 +99,49 @@ for n = 0, 255 do
end end
Crc32.MSB_TABLE = MSB 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
function Crc32.msb(buf: buffer, off: number, len: number, init: number?): number function Crc32.msb(buf: buffer, off: number, len: number, init: number?): number
local c = init or 0 local c = init or 0
for i = off, off + len - 1 do 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]) c = bxor(lshift(c, 8), MSB[bxor(rshift(c, 24), readu8(buf, i)) + 1])
i += 1
end end
return c return c
end end
+15 -16
View File
@@ -51,22 +51,21 @@ local function compress(st: State, blk: buffer, o: number)
M[i + 1] = readu32(blk, o + i * 4) M[i + 1] = readu32(blk, o + i * 4)
end end
local a, b, c, d = st.a, st.b, st.c, st.d local a, b, c, d = st.a, st.b, st.c, st.d
for i = 0, 63 do for i = 1, 16 do
local f local f = bor(band(b, c), band(bnot(b), d))
if i < 16 then a, b, c, d = d, (b + lrotate(a + f + K[i] + M[G[i] + 1], S[i])) % 4294967296, b, c
f = bor(band(b, c), band(bnot(b), d)) end
elseif i < 32 then for i = 17, 32 do
f = bor(band(d, b), band(bnot(d), c)) local f = bor(band(d, b), band(bnot(d), c))
elseif i < 48 then a, b, c, d = d, (b + lrotate(a + f + K[i] + M[G[i] + 1], S[i])) % 4294967296, b, c
f = bxor(b, c, d) end
else for i = 33, 48 do
f = bxor(c, bor(b, bnot(d))) local f = bxor(b, c, d)
end a, b, c, d = d, (b + lrotate(a + f + K[i] + M[G[i] + 1], S[i])) % 4294967296, b, c
local tmp = d end
d = c for i = 49, 64 do
c = b local f = bxor(c, bor(b, bnot(d)))
b = (b + lrotate((a + f + K[i + 1] + M[G[i + 1] + 1]) % 4294967296, S[i + 1])) % 4294967296 a, b, c, d = d, (b + lrotate(a + f + K[i] + M[G[i] + 1], S[i])) % 4294967296, b, c
a = tmp
end end
st.a = (st.a + a) % 4294967296 st.a = (st.a + a) % 4294967296
st.b = (st.b + b) % 4294967296 st.b = (st.b + b) % 4294967296
+40 -4
View File
@@ -76,6 +76,8 @@ local function find(key: string, category: string?): Registry.Entry?
return nil return nil
end end
local LATE: { [string]: number } = { br = 0.3 } -- archive/br: a trial decode of up to 256 KB
local function detect(buf: buffer, name: string?, category: string?, format: string?): (Registry.Entry?, Err.Err?) local function detect(buf: buffer, name: string?, category: string?, format: string?): (Registry.Entry?, Err.Err?)
if format then if format then
local e = find(format, category) local e = find(format, category)
@@ -86,18 +88,52 @@ local function detect(buf: buffer, name: string?, category: string?, format: str
end end
local ext = Input.extension(name) local ext = Input.extension(name)
local best: Registry.Entry? = nil local best: Registry.Entry? = nil
local bestScore = 0 local bestScore, bestIdx = 0, 0
for _, e in Registry do -- sniffs score 0..1 (core/Sniff); the extension's format scoring 1 cannot be beaten. Formats with a costly sniff
-- (LATE: the most they score) run last, and only when they could still win; ties go to registry order.
local late: { number }? = nil
for idx, e in Registry do
if inCategory(e, category) and (e.caps.decode or e.caps.open) then if inCategory(e, category) and (e.caps.decode or e.caps.open) then
local cap = LATE[e.name]
if cap then
late = late or {}
table.insert(late :: { number }, idx)
continue
end
local m = module(e) local m = module(e)
if m and m.sniff then if m and m.sniff then
local ok, score = pcall(m.sniff, Bytes.reader(buf)) local ok, score = pcall(m.sniff, Bytes.reader(buf))
if ok and type(score) == "number" and score > 0 then if ok and type(score) == "number" and score > 0 then
if ext and table.find(e.extensions, ext) then local extHit = ext and table.find(e.extensions, ext)
if extHit then
score += 0.01 -- ties go to the extension score += 0.01 -- ties go to the extension
end end
if score > bestScore then if score > bestScore then
best, bestScore = e, score best, bestScore, bestIdx = e, score, idx
if extHit and score >= 1.01 then
return e, nil
end
end
end
end
end
end
if late then
for _, idx in late do
local e = Registry[idx]
local extHit = ext and table.find(e.extensions, ext)
local cap = LATE[e.name] + (if extHit then 0.01 else 0)
if cap > bestScore or (cap == bestScore and idx < bestIdx) then
local m = module(e)
if m and m.sniff then
local ok, score = pcall(m.sniff, Bytes.reader(buf))
if ok and type(score) == "number" and score > 0 then
if extHit then
score += 0.01
end
if score > bestScore or (score == bestScore and idx < bestIdx) then
best, bestScore, bestIdx = e, score, idx
end
end end
end end
end end
+2 -1
View File
@@ -151,11 +151,12 @@ function Mtl.toMaterial(e: Entry, texture: (Map) -> number): Types.Material
return m return m
end end
local NUM_FORMATS = { "%.6g", "%.9g", "%.17g" }
local function num(v: number): string local function num(v: number): string
if v == math.floor(v) and math.abs(v) < 1e15 then if v == math.floor(v) and math.abs(v) < 1e15 then
return string.format("%d", v) return string.format("%d", v)
end end
for _, f in { "%.6g", "%.9g", "%.17g" } do for _, f in NUM_FORMATS do
local s = string.format(f, v) local s = string.format(f, v)
if tonumber(s) == v then if tonumber(s) == v then
return s return s
+122 -46
View File
@@ -89,6 +89,11 @@ type Prim = {
} }
type Section = { object: string?, group: string?, prims: { Prim }, byKey: { [string]: Prim }, smoothing: string? } type Section = { object: string?, group: string?, prims: { Prim }, byKey: { [string]: Prim }, smoothing: string? }
local TOK = "[ \t]+([^%s#\\]+)"
local V2 = "^" .. TOK .. TOK .. "[ \t]*\r?\n()"
local V3 = "^" .. TOK .. TOK .. TOK .. "[ \t]*\r?\n()"
local V4 = "^" .. TOK .. TOK .. TOK .. TOK .. "[ \t]*\r?\n()"
function Obj.decode(r: Bytes.Reader, opts: DecodeOptions?): (Types.Scene?, Err.Err?) function Obj.decode(r: Bytes.Reader, opts: DecodeOptions?): (Types.Scene?, Err.Err?)
local triangulate = not (opts and opts.triangulate == false) local triangulate = not (opts and opts.triangulate == false)
local flipV = not (opts and opts.flipV == false) local flipV = not (opts and opts.flipV == false)
@@ -164,7 +169,117 @@ function Obj.decode(r: Bytes.Reader, opts: DecodeOptions?): (Types.Scene?, Err.E
return vi, ti, ni return vi, ti, ni
end end
local fs: { string } = {} local fs: { string } = {}
local SV, ST, SN = {}, {}, {}
local function element(key: string, k: number): Err.Err?
local mode = if key == "f" then (if triangulate then "triangles" else "polygons") elseif key == "l" then "lines" else "points"
if (key == "f" and k < 3) or (key == "l" and k < 2) or k < 1 then
return Err.new(Err.CORRUPT, "an element with too few corners on line " .. lineNo)
end
corners += k
if corners > maxV * 4 then
return Err.new(Err.LIMIT, "too many face corners")
end
local p = prim(mode)
for i = 1, k do
local tok = fs[i]
local vi, ti, ni = corner(tok)
if not vi then
return Err.new(Err.CORRUPT, "bad index '" .. tok .. "' on line " .. lineNo)
end
SV[i], ST[i], SN[i] = vi, ti, ni
if ti >= 0 then
p.hasT = true
end
if ni >= 0 then
p.hasN = true
end
end
local cv, ct, cn = p.cv, p.ct, p.cn
local o = #cv
if mode == "triangles" then
for a = 2, k - 1 do
cv[o + 1], ct[o + 1], cn[o + 1] = SV[1], ST[1], SN[1]
cv[o + 2], ct[o + 2], cn[o + 2] = SV[a], ST[a], SN[a]
cv[o + 3], ct[o + 3], cn[o + 3] = SV[a + 1], ST[a + 1], SN[a + 1]
o += 3
end
elseif mode == "lines" then
for a = 1, k - 1 do
cv[o + 1], ct[o + 1], cn[o + 1] = SV[a], ST[a], SN[a]
cv[o + 2], ct[o + 2], cn[o + 2] = SV[a + 1], ST[a + 1], SN[a + 1]
o += 2
end
else
for i = 1, k do
cv[o + i], ct[o + i], cn[o + i] = SV[i], ST[i], SN[i]
end
if mode == "polygons" then
table.insert(p.faces, k)
end
end
return nil
end
while pos <= len do while pos <= len do
-- plain "v x y z", "vt u v", "vn x y z" and three- / four-corner "f" lines; anything else takes the general path
local c0 = string.byte(text, pos)
if c0 == 118 then -- v
local c1 = string.byte(text, pos + 1)
if c1 == 32 or c1 == 9 then
local x, y, z, ne = string.match(text, V3, pos + 1)
if x then
local fx, fy, fz = tonumber(x), tonumber(y), tonumber(z)
if fx and fy and fz and np < maxV then
P[np * 3 + 1], P[np * 3 + 2], P[np * 3 + 3] = fx, fy, fz
np += 1
lineNo += 1
pos = ne
continue
end
end
elseif c1 == 110 then -- vn
local x, y, z, ne = string.match(text, V3, pos + 2)
if x then
local fx, fy, fz = tonumber(x), tonumber(y), tonumber(z)
if fx and fy and fz and nn < maxV then
N[nn * 3 + 1], N[nn * 3 + 2], N[nn * 3 + 3] = fx, fy, fz
nn += 1
lineNo += 1
pos = ne
continue
end
end
elseif c1 == 116 then -- vt
local u, v, ne = string.match(text, V2, pos + 2)
if u then
local fu, fv = tonumber(u), tonumber(v)
if fu and fv and nt < maxV then
UV[nt * 2 + 1], UV[nt * 2 + 2] = fu, if flipV then 1 - fv else fv
nt += 1
lineNo += 1
pos = ne
continue
end
end
end
elseif c0 == 102 then -- f
local a, b, c, ne = string.match(text, V3, pos + 1)
local k = 3
local d = nil
if not a then
a, b, c, d, ne = string.match(text, V4, pos + 1)
k = 4
end
if a then
fs[1], fs[2], fs[3], fs[4] = a, b, c, d
lineNo += 1
local err = element("f", k)
if err then
return nil, err
end
pos = ne
continue
end
end
local e = string.find(text, "\n", pos, true) or (len + 1) local e = string.find(text, "\n", pos, true) or (len + 1)
local line = string.sub(text, pos, e - 1) local line = string.sub(text, pos, e - 1)
pos = e + 1 pos = e + 1
@@ -229,50 +344,9 @@ function Obj.decode(r: Bytes.Reader, opts: DecodeOptions?): (Types.Scene?, Err.E
for tok in string.gmatch(rest, "%S+") do for tok in string.gmatch(rest, "%S+") do
table.insert(fs, tok) table.insert(fs, tok)
end end
local k = #fs local err = element(key, #fs)
local mode = if key == "f" then (if triangulate then "triangles" else "polygons") elseif key == "l" then "lines" else "points" if err then
if (key == "f" and k < 3) or (key == "l" and k < 2) or k < 1 then return nil, err
return nil, Err.new(Err.CORRUPT, "an element with too few corners on line " .. lineNo)
end
corners += k
if corners > maxV * 4 then
return nil, Err.new(Err.LIMIT, "too many face corners")
end
local p = prim(mode)
local base = #p.cv
for i, tok in fs do
local vi, ti, ni = corner(tok)
if not vi then
return nil, Err.new(Err.CORRUPT, "bad index '" .. tok .. "' on line " .. lineNo)
end
p.cv[base + i], p.ct[base + i], p.cn[base + i] = vi, ti, ni
if ti >= 0 then
p.hasT = true
end
if ni >= 0 then
p.hasN = true
end
end
if mode == "triangles" and k > 3 then
local cv, ct, cn = table.move(p.cv, base + 1, base + k, 1, {}), table.move(p.ct, base + 1, base + k, 1, {}), table.move(p.cn, base + 1, base + k, 1, {})
local o = base
for a = 2, k - 1 do
for _, j in { 1, a, a + 1 } do
o += 1
p.cv[o], p.ct[o], p.cn[o] = cv[j], ct[j], cn[j]
end
end
elseif mode == "lines" then
local cv, ct, cn = table.move(p.cv, base + 1, base + k, 1, {}), table.move(p.ct, base + 1, base + k, 1, {}), table.move(p.cn, base + 1, base + k, 1, {})
local o = base
for a = 1, k - 1 do
for _, j in { a, a + 1 } do
o += 1
p.cv[o], p.ct[o], p.cn[o] = cv[j], ct[j], cn[j]
end
end
elseif mode == "polygons" then
table.insert(p.faces, k)
end end
elseif key == "o" then elseif key == "o" then
object = rest object = rest
@@ -471,6 +545,7 @@ end
-- ------------------------------------------------------------------------------------------------ encode -- ------------------------------------------------------------------------------------------------ encode
local probe = buffer.create(4) local probe = buffer.create(4)
local F32_FORMATS = { "%.6g", "%.7g", "%.8g" }
local function f32str(v: number): string local function f32str(v: number): string
if v ~= v or v == math.huge or v == -math.huge then if v ~= v or v == math.huge or v == -math.huge then
return "0" return "0"
@@ -480,7 +555,7 @@ local function f32str(v: number): string
end end
buffer.writef32(probe, 0, v) buffer.writef32(probe, 0, v)
local want = buffer.readf32(probe, 0) local want = buffer.readf32(probe, 0)
for _, f in { "%.6g", "%.7g", "%.8g" } do for _, f in F32_FORMATS do
local s = string.format(f, v) local s = string.format(f, v)
buffer.writef32(probe, 0, tonumber(s) :: number) buffer.writef32(probe, 0, tonumber(s) :: number)
if buffer.readf32(probe, 0) == want then if buffer.readf32(probe, 0) == want then
@@ -658,7 +733,8 @@ function Obj.encode(scene: Types.Scene, opts: EncodeOptions?): (buffer?, Err.Err
local mode = prim.mode or "triangles" local mode = prim.mode or "triangles"
if mode == "triangles" then if mode == "triangles" then
for t = 0, count // 3 - 1 do for t = 0, count // 3 - 1 do
face({ at(t * 3), at(t * 3 + 1), at(t * 3 + 2) }) local a, b, c = ref(at(t * 3)), ref(at(t * 3 + 1)), ref(at(t * 3 + 2))
table.insert(out, if mirror then "f " .. c .. " " .. b .. " " .. a else "f " .. a .. " " .. b .. " " .. c)
end end
elseif mode == "polygons" then elseif mode == "polygons" then
local F = if prim.faces then Types.Scene.reader(prim.faces) else nil local F = if prim.faces then Types.Scene.reader(prim.faces) else nil
+8 -7
View File
@@ -244,12 +244,13 @@ function Rbxm.decode(r: Bytes.Reader, opts: DecodeOptions?): (Rbx.Tree?, Err.Err
local vals, msg = Binary.decode(t, body, q + 1, be, n, ctx) local vals, msg = Binary.decode(t, body, q + 1, be, n, ctx)
if vals then if vals then
local tname = Rbx.TYPE_NAMES[t] local tname = Rbx.TYPE_NAMES[t]
for i, ref in cls.refs do if pname == "Name" and t == 0x01 then
local inst = byRef[ref] for i, ref in cls.refs do
if pname == "Name" and t == 0x01 then byRef[ref].name = vals[i]
inst.name = vals[i] end
else else
inst.properties[pname] = { type = tname, value = vals[i] } for i, ref in cls.refs do
byRef[ref].properties[pname] = { type = tname, value = vals[i] }
end end
end end
elseif msg == "unknown" then elseif msg == "unknown" then
@@ -322,7 +323,7 @@ local function columnType(insts: { Rbx.Instance }, pname: string): (number?, str
local id, tname = nil, nil local id, tname = nil, nil
for _, inst in insts do for _, inst in insts do
local v = inst.properties[pname] local v = inst.properties[pname]
if v then if v and (type(v) ~= "table" or tname == nil or v.type ~= tname) then
if type(v) ~= "table" or type(v.type) ~= "string" then if type(v) ~= "table" or type(v.type) ~= "string" then
return nil, "property " .. pname .. " of " .. inst.className .. " is not a { type, value } table" return nil, "property " .. pname .. " of " .. inst.className .. " is not a { type, value } table"
end end
+29 -6
View File
@@ -81,6 +81,10 @@ local function num(s: string?): number
if s == nil then if s == nil then
return 0 return 0
end end
local v = tonumber(s)
if v then
return v
end
local t = string.lower((string.gsub(s, "^%s+", ""))) local t = string.lower((string.gsub(s, "^%s+", "")))
t = string.gsub(t, "%s+$", "") t = string.gsub(t, "%s+$", "")
if t == "inf" or t == "+inf" or t == "infinity" then if t == "inf" or t == "+inf" or t == "infinity" then
@@ -100,8 +104,27 @@ end
local function comps(node: Xml.Node?, names: { string }): { number } local function comps(node: Xml.Node?, names: { string }): { number }
local out = table.create(#names, 0) local out = table.create(#names, 0)
if node then if node then
-- the children in order, element i usually named names[i]
local kids = node.children
local k = 1
for i, n in names do for i, n in names do
out[i] = num(childText(node, n)) local c = nil
while k <= #kids do
local ch = kids[k]
if type(ch) == "table" then
if ch.name == n then
c = ch
end
break
end
k += 1
end
if c then
k += 1
else
c = Xml.child(node, n)
end
out[i] = num(if c then Xml.text(c) else nil)
end end
end end
return out return out
@@ -117,10 +140,10 @@ end
local CF_NAMES = { "X", "Y", "Z", "R00", "R01", "R02", "R10", "R11", "R12", "R20", "R21", "R22" } local CF_NAMES = { "X", "Y", "Z", "R00", "R01", "R02", "R10", "R11", "R12", "R20", "R21", "R22" }
local PHYS_NAMES = { "Density", "Friction", "Elasticity", "FrictionWeight", "ElasticityWeight" } local PHYS_NAMES = { "Density", "Friction", "Elasticity", "FrictionWeight", "ElasticityWeight" }
local function readRaw(node: Xml.Node, shared: { [string]: string }, key: string): (string, any) local function readRaw(node: Xml.Node, shared: { [string]: string }, cls: string, pname: string): (string, any)
local tag = node.name local tag = node.name
local scalar = SCALAR_TAGS[tag] local scalar = SCALAR_TAGS[tag]
if tag == "int" and BRICKCOLOR[key] then if tag == "int" and BRICKCOLOR[cls .. "." .. pname] then
scalar = "BrickColor" scalar = "BrickColor"
end end
if scalar then if scalar then
@@ -264,8 +287,8 @@ local function round32(v: any, which: any): any
end end
return v return v
end end
local function readValue(node: Xml.Node, shared: { [string]: string }, key: string): (string, any) local function readValue(node: Xml.Node, shared: { [string]: string }, cls: string, pname: string): (string, any)
local t, v = readRaw(node, shared, key) local t, v = readRaw(node, shared, cls, pname)
local which = F32[t] local which = F32[t]
if which then if which then
v = round32(v, which) v = round32(v, which)
@@ -316,7 +339,7 @@ function Rbxmx.decode(r: Bytes.Reader, opts: DecodeOptions?): (Rbx.Tree?, Err.Er
if type(pnode) == "table" and string.sub(pnode.name, 1, 1) ~= "#" then if type(pnode) == "table" and string.sub(pnode.name, 1, 1) ~= "#" then
local pname = pnode.attrs.name local pname = pnode.attrs.name
if type(pname) == "string" then if type(pname) == "string" then
local t, v = readValue(pnode, shared, cls .. "." .. pname) local t, v = readValue(pnode, shared, cls, pname)
if pname == "Name" and (t == "String" or t == "ProtectedString") then if pname == "Name" and (t == "String" or t == "ProtectedString") then
inst.name = v inst.name = v
else else
+29 -13
View File
@@ -438,11 +438,16 @@ function MeshOps.computeNormals(prim: Primitive, opts: { flat: boolean? }?): (Pr
local e2x, e2y, e2z = readf32(pd, c * 12) - ax, readf32(pd, c * 12 + 4) - ay, readf32(pd, c * 12 + 8) - az local e2x, e2y, e2z = readf32(pd, c * 12) - ax, readf32(pd, c * 12 + 4) - ay, readf32(pd, c * 12 + 8) - az
-- the cross product is twice the area times the unit normal: area weighting for free -- the cross product is twice the area times the unit normal: area weighting for free
local nx, ny, nz = e1y * e2z - e1z * e2y, e1z * e2x - e1x * e2z, e1x * e2y - e1y * e2x local nx, ny, nz = e1y * e2z - e1z * e2y, e1z * e2x - e1x * e2z, e1x * e2y - e1y * e2x
for _, v in { a, b, c } do a, b, c = a * 3, b * 3, c * 3
acc[v * 3 + 1] += nx acc[a + 1] += nx
acc[v * 3 + 2] += ny acc[a + 2] += ny
acc[v * 3 + 3] += nz acc[a + 3] += nz
end acc[b + 1] += nx
acc[b + 2] += ny
acc[b + 3] += nz
acc[c + 1] += nx
acc[c + 2] += ny
acc[c + 3] += nz
end end
local out = buffer.create(nv * 12) local out = buffer.create(nv * 12)
for v = 0, nv - 1 do for v = 0, nv - 1 do
@@ -500,14 +505,25 @@ function MeshOps.computeTangents(prim: Primitive, opts: { texCoord: number? }?):
local r = 1 / den local r = 1 / den
local tx, ty, tz = (t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r, (t2 * z1 - t1 * z2) * r local tx, ty, tz = (t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r, (t2 * z1 - t1 * z2) * r
local bx, by, bz = (s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r, (s1 * z2 - s2 * z1) * r local bx, by, bz = (s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r, (s1 * z2 - s2 * z1) * r
for _, v in { a, b, c } do local a3, b3, c3 = a * 3, b * 3, c * 3
tan[v * 3 + 1] += tx tan[a3 + 1] += tx
tan[v * 3 + 2] += ty tan[a3 + 2] += ty
tan[v * 3 + 3] += tz tan[a3 + 3] += tz
bit[v * 3 + 1] += bx bit[a3 + 1] += bx
bit[v * 3 + 2] += by bit[a3 + 2] += by
bit[v * 3 + 3] += bz bit[a3 + 3] += bz
end tan[b3 + 1] += tx
tan[b3 + 2] += ty
tan[b3 + 3] += tz
bit[b3 + 1] += bx
bit[b3 + 2] += by
bit[b3 + 3] += bz
tan[c3 + 1] += tx
tan[c3 + 2] += ty
tan[c3 + 3] += tz
bit[c3 + 1] += bx
bit[c3 + 2] += by
bit[c3 + 3] += bz
end end
end end
local out = buffer.create(nv * 16) local out = buffer.create(nv * 16)
+23 -15
View File
@@ -47,27 +47,35 @@ local CODEC: { [string]: string } = {
-- ------------------------------------------------------------------------------------------------ sniff -- ------------------------------------------------------------------------------------------------ sniff
-- 188 or 192 (M2TS): three sync bytes a packet apart (fewer in a short file) within the first 2 KB -- 188 or 192 (M2TS): three sync bytes a packet apart (fewer in a short file) within the first 2 KB
local SIZES = { 188, 192 }
local function packetSize(r: Bytes.Reader): (number, number) local function packetSize(r: Bytes.Reader): (number, number)
local n = r:remaining() local n = r:remaining()
for start = 0, math.min(n, 2048) - 1 do local head = r:peek(2048 + 2 * 192)
if r:peekU8(start) == 0x47 then local lim = math.min(n, 2048)
for _, size in { 188, 192 } do local start = 0
local hits, need = 0, math.min(3, (n - start - 1) // size + 1) while start < lim do
for k = 0, 2 do local f = string.find(head, "G", start + 1, true) -- 0x47
local at = start + k * size if not f or f > lim then
if at < n and r:peekU8(at) == 0x47 then break
hits += 1 end
end start = f - 1
for _, size in SIZES do
local hits, need = 0, math.min(3, (n - start - 1) // size + 1)
for k = 0, 2 do
local at = start + k * size
if at < n and string.byte(head, at + 1) == 0x47 then
hits += 1
end end
if hits >= need and (need >= 2 or start == 0) then end
if size == 192 and start >= 4 then if hits >= need and (need >= 2 or start == 0) then
return 192, start - 4 if size == 192 and start >= 4 then
elseif size == 188 then return 192, start - 4
return 188, start elseif size == 188 then
end return 188, start
end end
end end
end end
start += 1
end end
return 0, 0 return 0, 0
end end
+12 -2
View File
@@ -1,9 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Timings (bash tools/bench.sh): tools/bench.luau under luau --codegen -O2 and under LuaJIT (the module build, build/_modules/luajit). # Timings (bash tools/bench.sh [core [filter]]): tools/bench.luau under luau --codegen -O2 and under LuaJIT (the module build,
# build/_modules/luajit). "core" runs tools/bench_core.luau (inflate / deflate, checksums, rbxm / rbxmx, json / xml,
# F.detect, gltf / obj, the other decompressors) under luau -O2, luau --codegen -O2 and LuaJIT; a filter keeps the lines
# whose label contains it.
cd "$(dirname "$0")/.." || exit 1 cd "$(dirname "$0")/.." || exit 1
LUAU=${LUAU:-$(command -v luau || nix shell nixpkgs#luau -c sh -c 'command -v luau')} LUAU=${LUAU:-$(command -v luau || nix shell nixpkgs#luau -c sh -c 'command -v luau')}
LUAJIT=${LUAJIT:-$(command -v luajit || nix shell nixpkgs#luajit -c sh -c 'command -v luajit')} LUAJIT=${LUAJIT:-$(command -v luajit || nix shell nixpkgs#luajit -c sh -c 'command -v luajit')}
python3 -I tools/fixtures.py > /dev/null || exit 1 python3 -I tools/fixtures.py > /dev/null || exit 1
python3 -I tools/build.py luajit > /dev/null || exit 1 python3 -I tools/build.py luajit > /dev/null || exit 1
LJPATH='package.path = "build/_modules/luajit/?.lua;build/_modules/luajit/?/init.lua;" .. package.path'
if [ "$1" = core ]; then
"$LUAU" -O2 tools/bench_core.luau -a "$2"
"$LUAU" --codegen -O2 tools/bench_core.luau -a "$2"
"$LUAJIT" -e "$LJPATH" build/_modules/luajit/tools/bench_core.lua "$2"
exit 0
fi
"$LUAU" --codegen -O2 tools/bench.luau "$LUAU" --codegen -O2 tools/bench.luau
"$LUAJIT" -e 'package.path = "build/_modules/luajit/?.lua;build/_modules/luajit/?/init.lua;" .. package.path' build/_modules/luajit/tools/bench.lua "$LUAJIT" -e "$LJPATH" build/_modules/luajit/tools/bench.lua
+285
View File
@@ -0,0 +1,285 @@
-- Throughput of the core codecs (bash tools/bench.sh core): inflate / deflate, checksums, rbxm / rbxmx, json / xml,
-- F.detect, gltf / obj and the other compressors. MB/s are of the decoded side, best of n runs.
local Deflate = require("@rosetta/codecs/compress/Deflate")
local Crc32 = require("@rosetta/core/Crc32")
local Adler32 = require("@rosetta/core/Adler32")
local Base64 = require("@rosetta/core/Base64")
local Md5 = require("@rosetta/core/Md5")
local Bytes = require("@rosetta/core/Bytes")
local Types = require("@rosetta/Types")
local B = require("@tests/gen/deflate_bench")
local runtime = if (_G :: any).jit ~= nil then "luajit" else "luau"
local filter: string? = (...) :: any
if filter == "" then
filter = nil
end
local function want(labels: string): boolean
return filter == nil or string.find(labels, filter :: string, 1, true) ~= nil
end
local function bench(label: string, n: number, bytes: number, f: () -> ())
if filter and not string.find(label, filter, 1, true) then
return 0
end
f()
local dt, spent, i = math.huge, 0, 0
while i < n or (spent < 1.5 and i < 40) do -- best of n, and of at least 1.5 s: the machine is shared
local t0 = os.clock()
f()
local d = os.clock() - t0
dt, spent, i = math.min(dt, d), spent + d, i + 1
end
print(string.format("%-8s %-36s %8.2f ms %7.1f MB/s", runtime, label, dt * 1000, bytes / dt / 1e6))
return dt
end
local z = buffer.fromstring(B.zlib)
local g = buffer.fromstring(B.gzip)
local out = assert(Deflate.zlib(z))
assert(buffer.len(out) == B.size and Crc32.of(out) == B.crc, "bench corpus mismatch")
bench("inflate (growing output)", 5, B.size, function()
Deflate.inflate(z, 2, buffer.len(z) - 6)
end)
bench("inflate (exact size)", 5, B.size, function()
Deflate.inflate(z, 2, buffer.len(z) - 6, B.size)
end)
bench("zlib (+ adler32)", 5, B.size, function()
Deflate.zlib(z)
end)
bench("gunzip (+ crc32)", 5, B.size, function()
Deflate.gunzip(g)
end)
bench("crc32", 10, B.size, function()
Crc32.of(out)
end)
bench("adler32", 10, B.size, function()
Adler32.of(out)
end)
if want("compress -6 text compress -1 text compress -6 f32 inflate f32") then
local part = buffer.create(1500000)
buffer.copy(part, 0, out, 0, 1500000)
local c6 = assert(Deflate.compress(part, { level = 6 }))
bench("compress -6 text (1.5 MB in)", 2, 1500000, function()
Deflate.compress(part, { level = 6 })
end)
bench("compress -1 text (1.5 MB in)", 2, 1500000, function()
Deflate.compress(part, { level = 1 })
end)
-- f32 vertex data: a smooth surface sampled on a grid (positions, normals, uvs), as glTF / mesh writers emit
local N = 180
local fl = buffer.create(N * N * 32)
for y = 0, N - 1 do
for x = 0, N - 1 do
local o = (y * N + x) * 32
local h = math.sin(x * 0.07) * math.cos(y * 0.05) * 3
buffer.writef32(fl, o, x * 0.25)
buffer.writef32(fl, o + 4, h)
buffer.writef32(fl, o + 8, y * 0.25)
buffer.writef32(fl, o + 12, -math.cos(x * 0.07) * 0.2)
buffer.writef32(fl, o + 16, 0.97)
buffer.writef32(fl, o + 20, math.sin(y * 0.05) * 0.15)
buffer.writef32(fl, o + 24, x / N)
buffer.writef32(fl, o + 28, y / N)
end
end
local cf = assert(Deflate.compress(fl, { level = 6 }))
bench("compress -6 f32 (" .. buffer.len(fl) // 1000 .. " KB in)", 2, buffer.len(fl), function()
Deflate.compress(fl, { level = 6 })
end)
bench("inflate f32", 5, buffer.len(fl), function()
Deflate.inflate(cf, 0, buffer.len(cf))
end)
if not filter then
print(string.format("%-8s compress -6 sizes: text %d (zlib -6 ref %s), f32 %d", runtime, buffer.len(c6), tostring((B :: any).z6 or "?"), buffer.len(cf)))
end
end
if want("base64 encode base64 decode md5") then
local s = buffer.create(3000000)
buffer.copy(s, 0, out, 0, 3000000)
local enc = Base64.encode(s)
bench("base64 encode", 5, 3000000, function()
Base64.encode(s)
end)
bench("base64 decode", 5, 3000000, function()
Base64.decode(enc)
end)
bench("md5", 5, 3000000, function()
Md5.of(s)
end)
end
if want("rbxm decode rbxm encode rbxmx decode rbxmx encode") then
local Rbx = require("@rosetta/codecs/model/Rbx")
local Rbxm = require("@rosetta/model/rbxm")
local Rbxmx = require("@rosetta/model/rbxmx")
local tree = Rbx.tree()
local folder = Rbx.add(tree, Rbx.instance("Folder", "Parts"))
for i = 1, 20000 do
local p = Rbx.add(folder, Rbx.instance("Part", "P" .. i))
Rbx.set(p, "CFrame", "CFrame", { i, i % 7, -i, 1, 0, 0, 0, 1, 0, 0, 0, 1 })
Rbx.set(p, "size", "Vector3", { 4, 1, 2 + i % 3 })
Rbx.set(p, "Color3uint8", "Color3uint8", { i % 256, 128, 255 - i % 256 })
Rbx.set(p, "Anchored", "Bool", i % 2 == 0)
Rbx.set(p, "Transparency", "Float32", (i % 4) / 4)
Rbx.set(p, "Material", "Enum", 256)
end
local bin = Rbxm.encode(tree) :: buffer
local xml = Rbxmx.encode(tree) :: buffer
bench("rbxm decode (20k parts)", 3, buffer.len(bin), function()
Rbxm.decode(Bytes.reader(bin))
end)
bench("rbxm encode (20k parts)", 3, buffer.len(bin), function()
Rbxm.encode(tree)
end)
bench("rbxmx decode (20k parts)", 3, buffer.len(xml), function()
Rbxmx.decode(Bytes.reader(xml))
end)
bench("rbxmx encode (20k parts)", 3, buffer.len(xml), function()
Rbxmx.encode(tree)
end)
end
if want("json decode (indented) json decode (compact) json encode") then
local Json = require("@rosetta/codecs/text/Json")
local JB = require("@tests/gen/json_bench")
local v = assert(Json.decode(JB.text))
bench("json decode (indented)", 5, #JB.text, function()
Json.decode(JB.text)
end)
bench("json decode (compact)", 5, #JB.compact, function()
Json.decode(JB.compact)
end)
bench("json encode (compact, sorted)", 5, #JB.compact, function()
Json.encode(v)
end)
end
if want("xml decode (DOM) xml events xml encode") then
local Xml = require("@rosetta/codecs/text/Xml")
local XB = require("@tests/gen/xml_bench")
local doc = assert(Xml.decode(XB.text))
bench("xml decode (DOM)", 5, #XB.text, function()
Xml.decode(XB.text)
end)
bench("xml events", 5, #XB.text, function()
for _ in Xml.events(XB.text) do
end
end)
bench("xml encode", 5, #XB.text, function()
Xml.encode(doc)
end)
end
if want("F.detect png F.detect unknown") then
-- F.detect: content sniffing over every registered format (MB/s here = thousands of detects per second)
local F = require("@rosetta")
local PB = require("@tests/gen/png_bench")
local png = buffer.fromstring(PB[1].data)
local junk = buffer.create(4096)
for i = 0, 4095 do
buffer.writeu8(junk, i, (i * 7919) % 251)
end
local t0 = os.clock()
F.detect(junk)
if not filter then
print(string.format("%-8s %-36s %8.2f ms", runtime, "F.detect first call (loads modules)", (os.clock() - t0) * 1000))
end
bench("F.detect png (k/s)", 5, 1000, function()
for _ = 1, 100 do
F.detect(png)
end
end)
bench("F.detect png + name (k/s)", 5, 1000, function()
for _ = 1, 100 do
F.detect(png, { name = "a.png" })
end
end)
bench("F.detect unknown (k/s)", 5, 1000, function()
for _ = 1, 100 do
F.detect(junk)
end
end)
end
if want("meshops computeNormals gltf glb decode gltf glb encode gltf json+base64 decode obj decode obj encode") then
local MeshOps = require("@rosetta/ops/MeshOps")
local Gltf = require("@rosetta/model/gltf")
local Obj = require("@rosetta/model/obj")
local N = 400
local pos = Types.Scene.accessor(nil, "f32", 3, N * N)
local uv = Types.Scene.accessor(nil, "f32", 2, N * N)
for y = 0, N - 1 do
for x = 0, N - 1 do
local i = y * N + x
buffer.writef32(pos.data, i * 12, x / N)
buffer.writef32(pos.data, i * 12 + 4, math.sin(x * 0.1) * math.cos(y * 0.1) * 0.05)
buffer.writef32(pos.data, i * 12 + 8, y / N)
buffer.writef32(uv.data, i * 8, x / N)
buffer.writef32(uv.data, i * 8 + 4, y / N)
end
end
local ind = Types.Scene.accessor(nil, "u32", 1, (N - 1) * (N - 1) * 6)
local k = 0
for y = 0, N - 2 do
for x = 0, N - 2 do
local a = y * N + x
for _, v in { a, a + N, a + 1, a + 1, a + N, a + N + 1 } do
buffer.writeu32(ind.data, k * 4, v)
k += 1
end
end
end
local prim = { attributes = { POSITION = pos, TEXCOORD_0 = uv }, indices = ind, mode = "triangles" } :: any
MeshOps.computeNormals(prim)
local scene = Types.Scene.fromPrimitive(prim, "grid")
bench("meshops computeNormals 318k tris", 3, buffer.len(pos.data), function()
MeshOps.computeNormals(prim)
end)
local glb = assert(Gltf.encode(scene, { binary = true }))
bench("gltf glb decode", 5, buffer.len(glb), function()
Gltf.decode(Bytes.reader(glb))
end)
bench("gltf glb encode", 3, buffer.len(glb), function()
Gltf.encode(scene, { binary = true })
end)
local gltf = assert(Gltf.encode(scene, { binary = false }))
bench("gltf json+base64 decode", 3, buffer.len(gltf), function()
Gltf.decode(Bytes.reader(gltf))
end)
local obj = assert(Obj.encode(scene))
bench("obj decode", 2, buffer.len(obj), function()
Obj.decode(Bytes.reader(obj))
end)
bench("obj encode", 2, buffer.len(obj), function()
Obj.encode(scene)
end)
end
if want("zstd -3 lz4 block brotli bzip2 xz -6") then
local Zstd = require("@rosetta/codecs/compress/Zstd")
local ZB = require("@tests/gen/zstd_bench")
local z3 = buffer.fromstring(ZB.data3)
bench("zstd -3 (no checksum)", 3, ZB.size, function()
Zstd.decompress(z3, nil, nil, { verify = false })
end)
local Lz4 = require("@rosetta/codecs/compress/Lz4")
local LB = require("@tests/gen/lz4_bench")
local lz = buffer.fromstring(LB.data)
bench("lz4 block decompress (hc9)", 5, LB.size, function()
Lz4.decompress(lz, nil, nil, LB.size)
end)
local Brotli = require("@rosetta/codecs/compress/Brotli")
local BB = require("@tests/gen/brotli_bench")
local bz = buffer.fromstring(BB.data)
bench("brotli decompress (q9 w22)", 3, BB.size, function()
Brotli.decompress(bz)
end)
local Bzip2 = require("@rosetta/codecs/compress/Bzip2")
local BZ = require("@tests/gen/bzip2_bench")
local b2 = buffer.fromstring(BZ.data)
bench("bzip2 decompress -9", 3, BZ.size, function()
Bzip2.decompress(b2)
end)
local Lzma = require("@rosetta/codecs/compress/Lzma")
local XB = require("@tests/gen/lzma_bench")
local lx = buffer.fromstring(XB.xz)
bench("xz -6 (lzma2 + crc64)", 3, XB.size, function()
Lzma.xz(lx)
end)
end
+1 -1
View File
@@ -1 +1 @@
92 91