sajmon83
22-11-2026, 09:30
ROFZ – LZ compressor with texture / audio / raw-data models
ROFZ is a lossless compressor for repacking games: optimal-parsing LZ77 + range coder with a per-block literal mixer, plus its own models for the data LZ codes badly. It finds that data anywhere in the stream, by header or by content:
BC1–BC7 / DXT textures – DDS, IWI, VTF headers, and BC1/3/4/5 without any header. Textures are chained, and a texture can be coded against an earlier one that shares its blocks.
PCM audio (WAV / AIFF, 8/16/24-bit, float, PS2 SS2) – cascade of sign-LMS predictors.
ADPCM audio – IMA / MS / Xbox ADPCM (WAV, also sound banks with header stubs), PlayStation SPU ADPCM (VAG, SS2 / ADS, WAC, header-less), CD-XA (PS1 sectors), Nintendo DSP-ADPCM (BCSTM / BFSTM / BWAV), CRI ADX – the codec's decoder runs alongside the model.
Raw multi-channel data – uncompressed images, vertex / animation arrays (adaptive linear predictor + context mixing).
x86 filter, multithreaded compression and decompression, stdin/stdout for FreeArc.
Std-only, Windows x64, two builds: rofz_avx2.exe (AVX2 CPUs) and rofz_sse2.exe (any x86-64 CPU). Both write the same streams and each decodes the other's; streams also decode identically with any thread count.
Neural-network models (CPU only, integer arithmetic; trained offline on samples of 75 games other than Memoriapolis, so as not to skew the results)
Online mixing networks – the literal mixer, the BC pixel-index mixer and the raw-data model combine their context predictions with a single-layer logistic network that learns while coding (identically in encoder and decoder).
Pre-trained start states – the literal mixer and the raw-data model (weights, context cells, bias, APM) start from states learned on game data instead of even odds (~580 KB of tables in the exe), so small blocks and block starts code smaller.
Literal parameter network – a one-layer softmax network over 22 cheap statistics of a block (order-0/1 and position-context entropies, share of zeros, record-stride hints) proposes the two most promising literal-context settings for the encoder's test-coding (trained on 600 blocks from 75 game samples).
Texture classifier – a logistic regression (one neuron) over 18 statistics of a texture candidate predicts whether the texture model will beat LZ; rejected candidates skip the trial coding (faster compression).
The gains are small (0.02–0.1%) but free for the decoder. -nn turns all trained models off.
Levels
-l1 … -l4: fast-decoding model sets, fixed per level: 1–2 fast models, 3 + the literal mixer where it saves ≥ 0.5%, 4 + the mixed texture models; only the fast variants of the models (full models from -l5). Every level codes smaller and decodes slower than the one before. Default: -l4. -ds N keeps a decoding speed on any level (off by default since 0.18.0).
-l5 … -l8: full models, smallest output. -l5 compresses fastest, -l8 smallest.
-m = memory budget (% of RAM), -t = threads, -ds = decompression speed to keep (MB/s, any level).
Benchmark
Ryzen 7 5800X3D (8C/16T), 64 GB RAM, NVMe SSD, Windows 11. Command line, one run after another on an idle PC, all 16 threads; every output was decompressed and compared byte for byte with the input. MB/s refer to the compressor's input.
Settings
LOLZ ULTRA (DiskSpan's LOLZ_ULTRA alias): lolz -dtb1 -d263 -mtt1 -mt16 -mc1023, decoded with CLS-LOLZ_D_x64
TARZ 1.0.3 at its best (LOLZ-ULTRA-like settings): tarz c -t16 -d256 -mtt1 -tt16 -mc1023 -ow4096 -fb256, tarz d -t16
ROFZ 0.18.1: rofz c -lN -m85%, rofz d (defaults otherwise)
Inputs and precompression
Per-type sets: 46 files of up to 16 MB cut from game data samples (files of one kind put together): PCM audio, IMA / MS ADPCM audio and a sound bank, console audio (PS1 CD-XA, PS2 VAG / SS2 / ADS / WAC, Nintendo DSP-ADPCM, CRI ADX, Xbox ADPCM) and PS3 textures, BC1–BC7 / DXT textures (DDS, VTF, IWI, XBM and header-less), raw images (BMP / TGA / RAW / TIF), text, Unity / CR2W / Source structures, executables, meshes, animations, BSP maps, PAK / VPK archives. No precompression – the same file for every compressor.
Memoriapolis (Unity 2022.3, 7 832 files, 7 267 959 185 B): files in Arc order (by extension, then path); the LZ4 / LZ4HC blocks of the 4 713 UnityFS archives restored to raw data, only blocks that recompress bit for bit) → 9 119 658 087 B; then srep 4.90g-wip -hash- -m3f -a0/0 → 5 355 251 639 B, the input of every run. The whole-game results are still those of rofz 0.17.0; they will be measured again later.
PCM audio (WAV / AIFF; uncompressed samples): 67 108 864 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s
LOLZ ULTRA 39 127 417 58.30% - 50.4 s 1.33 1.62 s 42
TARZ (best) 40 183 818 59.88% +2.70% 191.2 s 0.35 2.70 s 25
rofz -l1 30 875 027 46.01% -21.09% 4.2 s 16.10 0.75 s 90
rofz -l2 30 875 004 46.01% -21.09% 4.4 s 15.20 0.76 s 88
rofz -l3 30 874 960 46.01% -21.09% 4.5 s 15.02 0.76 s 88
rofz -l4 30 874 907 46.01% -21.09% 4.5 s 14.94 0.73 s 92
rofz -l5 30 874 907 46.01% -21.09% 4.5 s 14.99 0.77 s 87
rofz -l6 30 874 327 46.01% -21.09% 7.6 s 8.85 0.74 s 91
rofz -l7 30 874 320 46.01% -21.09% 7.6 s 8.84 0.76 s 88
rofz -l8 30 874 332 46.01% -21.09% 7.6 s 8.82 0.74 s 91
ADPCM audio (IMA / MS ADPCM WAV, a sound bank): 40 372 544 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s
LOLZ ULTRA 26 204 819 64.91% - 35.3 s 1.14 1.02 s 40
TARZ (best) 26 118 840 64.69% -0.33% 174.8 s 0.23 1.25 s 32
rofz -l1 23 965 640 59.36% -8.54% 6.4 s 6.35 0.48 s 84
rofz -l2 23 954 877 59.33% -8.59% 6.9 s 5.87 0.48 s 84
rofz -l3 23 938 172 59.29% -8.65% 8.2 s 4.92 0.50 s 81
rofz -l4 23 924 204 59.26% -8.70% 9.0 s 4.50 0.50 s 81
rofz -l5 22 970 203 56.90% -12.34% 8.0 s 5.07 0.99 s 41
rofz -l6 22 919 769 56.77% -12.54% 10.1 s 3.99 1.07 s 38
rofz -l7 22 919 266 56.77% -12.54% 10.5 s 3.86 1.06 s 38
rofz -l8 22 918 738 56.77% -12.54% 11.5 s 3.50 1.04 s 39
console audio and textures (PS1 CD-XA, PS2 VAG / SS2 / ADS / WAC, Nintendo DSP-ADPCM, CRI ADX, Xbox ADPCM, PS3 textures): 104 242 992 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s
LOLZ ULTRA 60 565 348 58.10% - 80.6 s 1.29 2.30 s 45
TARZ (best) 59 907 663 57.47% -1.09% 194.5 s 0.54 3.38 s 31
rofz -l1 59 224 009 56.81% -2.21% 14.0 s 7.45 1.44 s 72
rofz -l2 59 017 649 56.62% -2.56% 17.2 s 6.04 1.45 s 72
rofz -l3 58 745 160 56.35% -3.01% 21.3 s 4.90 1.81 s 58
rofz -l4 58 502 725 56.12% -3.41% 23.4 s 4.46 2.09 s 50
rofz -l5 57 910 829 55.55% -4.38% 24.6 s 4.24 3.22 s 32
rofz -l6 55 329 654 53.08% -8.64% 32.7 s 3.18 3.48 s 30
rofz -l7 55 325 784 53.07% -8.65% 36.5 s 2.86 3.42 s 30
rofz -l8 55 324 441 53.07% -8.65% 42.6 s 2.45 3.40 s 31
textures (DDS / BC1-BC7 / VTF / IWI / XBM): 150 994 944 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s
LOLZ ULTRA 65 330 035 43.27% - 156.3 s 0.97 3.64 s 41
TARZ (best) 65 011 249 43.06% -0.49% 285.7 s 0.53 6.87 s 22
rofz -l1 65 073 479 43.10% -0.39% 27.3 s 5.54 3.03 s 50
rofz -l2 64 703 941 42.85% -0.96% 35.5 s 4.26 2.94 s 51
rofz -l3 64 277 087 42.57% -1.61% 49.5 s 3.05 3.32 s 45
rofz -l4 61 720 287 40.88% -5.53% 53.5 s 2.82 5.23 s 29
rofz -l5 61 425 183 40.68% -5.98% 52.0 s 2.90 6.25 s 24
rofz -l6 61 256 329 40.57% -6.24% 74.2 s 2.04 6.58 s 23
rofz -l7 61 193 745 40.53% -6.33% 89.0 s 1.70 6.55 s 23
rofz -l8 61 165 158 40.51% -6.38% 103.4 s 1.46 6.65 s 23
raw images (BMP / TGA / RAW / TIF): 83 886 080 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s
LOLZ ULTRA 21 323 178 25.42% - 78.9 s 1.06 1.60 s 52
TARZ (best) 20 755 681 24.74% -2.66% 437.9 s 0.19 2.56 s 33
rofz -l1 21 190 058 25.26% -0.62% 15.3 s 5.49 0.93 s 90
rofz -l2 21 159 023 25.22% -0.77% 16.8 s 5.00 0.90 s 94
rofz -l3 20 537 604 24.48% -3.68% 22.5 s 3.73 1.44 s 58
rofz -l4 20 500 695 24.44% -3.86% 25.6 s 3.28 1.41 s 60
rofz -l5 19 944 470 23.78% -6.47% 35.6 s 2.36 3.43 s 24
rofz -l6 19 733 680 23.52% -7.45% 45.6 s 1.84 3.48 s 24
rofz -l7 19 700 741 23.49% -7.61% 55.5 s 1.51 3.47 s 24
rofz -l8 19 676 059 23.46% -7.72% 73.8 s 1.14 3.43 s 24
text, structures, executables, meshes, maps: 266 556 789 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s
LOLZ ULTRA 95 836 113 35.95% - 267.1 s 1.00 3.27 s 82
TARZ (best) 95 749 915 35.92% -0.09% 1301.8 s 0.20 4.68 s 57
rofz -l1 103 234 022 38.73% +7.72% 36.9 s 7.22 2.23 s 119
rofz -l2 102 172 015 38.33% +6.61% 58.7 s 4.54 2.37 s 113
rofz -l3 99 774 966 37.43% +4.11% 110.2 s 2.42 5.01 s 53
rofz -l4 99 244 592 37.23% +3.56% 142.2 s 1.87 4.93 s 54
rofz -l5 99 190 908 37.21% +3.50% 143.2 s 1.86 5.37 s 50
rofz -l6 93 830 156 35.20% -2.09% 217.8 s 1.22 6.63 s 40
rofz -l7 93 270 573 34.99% -2.68% 303.0 s 0.88 7.18 s 37
rofz -l8 93 054 209 34.91% -2.90% 460.7 s 0.58 7.36 s 36
Memoriapolis, whole game (rofz 0.17.0: not measured again yet): 5 355 251 639 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s RAM to decompress
LOLZ ULTRA 1 758 818 797 32.84% - 1615.1 s 3.32 12.00 s 446 5 698 MB
TARZ (best) 1 772 775 068 33.10% +0.79% 5779.4 s 0.93 20.30 s 264 2 784 MB
rofz -l1 1 858 615 328 34.71% +5.67% 564.5 s 9.49 24.68 s 217 4 103 MB
rofz -l4 1 801 250 333 33.64% +2.41% 1302.6 s 4.11 27.01 s 198 4 081 MB
rofz -l5 1 763 133 782 32.92% +0.25% 1442.6 s 3.71 54.31 s 99 6 377 MB
rofz -l8 1 739 267 961 32.48% -1.11% 3545.8 s 1.51 82.51 s 65 8 847 MB
Per set (output bytes)
set LOLZ ULTRA TARZ (best) rofz -l1 rofz -l2 rofz -l3 rofz -l4 rofz -l5 rofz -l6 rofz -l7 rofz -l8
lit/text 1 939 745 1 920 604 2 276 931 2 241 877 2 203 430 2 200 847 2 200 847 1 872 491 1 872 269 1 872 050
lit/text_utf16 782 807 768 166 896 111 857 508 818 020 800 900 800 900 735 400 734 994 734 821
lit/struct_unity 4 622 416 4 613 608 4 849 278 4 751 920 4 658 957 4 608 528 4 620 495 4 555 619 4 530 982 4 518 108
lit/struct_cr2w 12 435 801 12 466 536 12 642 307 12 590 111 12 477 591 12 484 180 12 484 099 12 418 834 12 408 367 12 401 991
lit/struct_misc 1 646 195 1 642 642 2 567 578 2 442 974 2 329 771 2 309 090 2 300 616 1 667 094 1 650 638 1 646 317
lit/struct_source 12 877 500 12 860 749 12 995 671 12 980 473 12 680 523 12 642 857 12 642 857 12 473 329 12 368 150 12 345 867
lit/exe64 4 402 081 4 000 834 4 348 670 4 301 596 4 173 919 4 142 244 4 128 059 4 012 930 3 995 288 3 985 884
lit/exe32 9 230 031 9 100 271 11 300 627 11 260 205 11 148 412 11 188 555 11 187 425 9 053 196 9 050 002 9 048 305
lit/exe_net 3 619 668 3 589 282 3 814 151 3 774 163 3 668 818 3 646 090 3 646 090 3 540 346 3 576 593 3 533 296
lit/mesh 7 019 892 7 061 608 8 106 947 8 067 894 7 940 565 7 929 739 7 929 739 7 020 295 6 980 130 6 977 864
lit/anim 5 093 373 5 523 928 5 654 300 5 594 216 5 291 816 5 162 390 5 162 291 4 854 950 4 847 439 4 838 677
lit/map_bsp 2 044 624 2 073 579 2 928 667 2 813 764 2 620 778 2 529 597 2 452 433 2 413 875 2 111 453 2 029 725
lit/terrain_nav 5 181 137 5 001 339 5 356 031 5 261 473 5 057 718 5 010 374 5 010 374 4 955 239 4 924 901 4 901 003
lit/font 3 279 030 3 265 130 3 540 980 3 427 181 3 241 392 3 141 029 3 136 103 3 007 693 2 980 914 2 990 163
lit/shader 294 593 285 262 317 858 304 786 292 592 288 823 288 823 287 478 287 627 284 382
lit/pack_pak 9 394 270 9 534 756 9 561 099 9 531 863 9 452 292 9 450 969 9 450 969 9 325 380 9 320 878 9 319 437
lit/pack_vpk 11 972 950 12 041 621 12 076 816 11 970 011 11 718 372 11 708 380 11 748 788 11 636 007 11 629 948 11 626 319
audio/audio_pcm16 12 621 005 12 980 497 9 861 454 9 861 446 9 861 423 9 861 372 9 861 372 9 861 152 9 861 146 9 861 159
audio/WAV16 9 020 554 9 567 334 7 420 903 7 420 896 7 420 880 7 420 881 7 420 881 7 420 741 7 420 741 7 420 741
audio/WAV24 8 424 908 8 093 706 6 171 528 6 171 526 6 171 519 6 171 516 6 171 516 6 171 357 6 171 356 6 171 356
audio/AIFF 9 060 950 9 542 281 7 421 142 7 421 136 7 421 138 7 421 138 7 421 138 7 421 077 7 421 077 7 421 076
raw/img_raw 4 244 729 4 129 180 4 295 927 4 268 429 4 119 632 4 084 231 4 086 545 3 921 622 3 899 825 3 885 489
raw/BMP 4 286 406 4 176 200 4 130 523 4 129 802 4 016 469 4 015 894 3 984 867 3 965 947 3 959 895 3 955 456
raw/TGA 4 283 867 4 175 178 4 130 618 4 129 888 4 016 559 4 015 908 3 984 905 3 965 922 3 960 127 3 955 617
raw/RAW 4 254 850 4 126 583 4 535 256 4 535 170 4 411 919 4 411 760 4 158 900 4 151 612 4 152 170 4 150 835
raw/TIF 4 253 326 4 148 540 4 097 734 4 095 734 3 973 025 3 972 902 3 729 253 3 728 577 3 728 724 3 728 662
tex/tex_bc1 8 534 089 8 451 644 9 032 672 9 026 626 8 990 478 8 346 299 8 231 756 8 227 145 8 224 702 8 223 744
tex/tex_bc3 4 775 742 4 778 892 5 178 828 5 178 744 5 177 432 4 595 549 4 555 641 4 555 264 4 555 223 4 555 101
tex/tex_bc45 4 987 145 4 979 232 5 364 905 5 257 555 5 154 513 5 073 620 5 069 256 5 096 973 5 069 638 5 055 240
tex/tex_bc7 11 390 057 11 140 226 11 120 445 11 022 302 10 992 170 10 981 013 10 981 013 10 926 940 10 919 074 10 917 999
tex/tex_bc6 12 295 850 12 353 859 9 167 635 9 167 635 9 167 633 9 167 632 9 167 632 9 167 579 9 167 579 9 167 577
tex/dds 1 265 829 1 200 701 1 354 339 1 325 613 1 301 761 1 173 263 1 133 598 1 133 595 1 133 595 1 133 595
tex/tex_vtf 4 831 058 4 865 011 5 227 342 5 174 285 5 108 334 4 850 371 4 861 782 4 855 202 4 854 746 4 854 030
tex/tex_xbm 9 254 180 9 334 486 10 023 631 9 951 827 9 807 968 9 479 965 9 427 292 9 302 192 9 292 371 9 288 565
tex/tex_iwi 7 996 085 7 907 198 8 603 682 8 599 354 8 576 798 8 052 575 7 997 213 7 991 439 7 976 817 7 969 307
adpcm/ADPCM_IMA 7 954 668 7 967 607 7 284 744 7 282 921 7 268 028 7 258 877 6 914 897 6 882 864 6 882 714 6 882 588
adpcm/ADPCM_MS 6 682 707 6 589 698 6 139 670 6 131 058 6 131 841 6 128 161 5 964 473 5 946 451 5 946 311 5 946 156
adpcm/ADPCM_bank 11 567 444 11 561 535 10 541 226 10 540 898 10 538 303 10 537 166 10 090 833 10 090 454 10 090 241 10 089 994
console/ps1_xa 11 773 597 11 812 741 10 684 429 10 684 429 10 684 427 10 684 428 10 533 375 10 533 364 10 533 364 10 533 364
console/ps2_vag 12 536 619 12 155 144 11 403 206 11 401 733 11 363 451 11 354 503 11 290 954 11 290 946 11 290 946 11 290 946
console/ps2_ss2 11 290 759 10 980 981 10 041 915 10 041 915 10 041 914 10 041 914 9 885 711 9 885 708 9 885 708 9 885 708
console/ps2_wac 1 412 180 1 428 831 1 303 807 1 306 636 1 301 568 1 300 473 1 280 083 1 276 599 1 275 986 1 275 651
console/nds_dsp 5 309 310 5 361 988 8 151 524 7 951 216 7 746 079 7 735 672 7 735 672 5 245 836 5 244 989 5 245 089
console/cri_adx 14 136 460 14 096 396 13 062 179 13 062 178 13 062 175 13 062 174 12 903 585 12 903 575 12 903 574 12 903 574
console/xbox_adpcm 1 010 957 1 016 245 976 695 976 694 976 693 976 693 955 045 955 046 955 046 955 046
console/ps3_tex 3 095 466 3 055 337 3 600 254 3 592 848 3 568 853 3 346 868 3 326 404 3 238 580 3 236 171 3 235 063
FreeArc / DiskSpan (arc.ini):
[External compressor:rofz]
header = 0
packcmd = "rofz_avx2.exe" c {options} - - <stdin> <stdout>
unpackcmd = "rofz_avx2.exe" d - - <stdin> <stdout>
(rofz_sse2.exe on a CPU without AVX2; an installer for any PC can ship rofz_sse2.exe.)
Use e.g. -mrofz:l4:m65% after your precompressors. Presets: rofz:l2:m45% (fast), rofz:l4:m65% (normal), rofz:l7:m85% (high), rofz:l8:m85% (ultra). In an installer only the unpackcmd is needed (d -t100p - - <stdin> <stdout>).
Changes
0.18.1 (stream format v18 as 0.18.0: either version decodes the other's streams)
two builds in the package, rofz_avx2.exe and rofz_sse2.exe (for CPUs without AVX2), instead of rofz.exe; the same streams. Thanks to Joe Forster/STA for the naming idea.
a summary at the end of compression: the data found by kind (streams, bytes, how much its model kept and how much LZ coded smaller) and what coded it (model, regions, bytes in and out, ratio, share of the output); the RAM line gives the models per thread and the data apart.
a texture whose header claims more data than its file holds (a cut file) ends at the next file header (textures, audio, images, CR2W, Ogg, ZIP, PNG, UnityFS, FSB5, Wwise banks, tar): the files after it are found again (16 type sets put together: −1.4% at -l2; the PS3 texture set −0.25%).
audio regions and texture bands are cut into pieces of a segment's share per thread, 2–8 MB (8 MB before; large inputs as before), cube maps and texture arrays into their images: on the 16 MB sets ADPCM and console audio decode 2.5–3× and code 1.7× faster for +0.02…+0.09%, BC6H sky boxes decode 2.6× faster for +0.07%.
-l6 … -l8: blocks of a quarter of the segment, 4–32 MB (8–32 MB before; inputs of 32 MB and more as before): 16 MB files code 25% and decode 25% faster at -l8.
the match finder compares 8 bytes at a time (the same matches and streams): repetitive data codes up to 39% faster at -l1.
per-type sets against 0.18.0: size −0.04…+0.05% per level (single sets up to +1.2% at -l6 … -l8), compression −7…−25% of the time, decompression −20…−29% (-l1 80 MB/s instead of 57).
0.18.0 (stream format v18; v17 streams decode)
new audio models: PlayStation SPU ADPCM (VAG, PS2 SS2 / ADS with interleave, Ubisoft WAC, header-less frames), CD-XA ADPCM sectors (RIFF CDXA and CD images), Nintendo DSP-ADPCM (BCSTM / BFSTM either byte order, BWAV), CRI ADX; Xbox ADPCM WAV through the IMA model; PS2 SS2 PCM with block interleave. Game samples at -l8 against 0.17.2: VAG −12%, SS2 / ADS −10%, WAC −9%, XA −8…−10%, DSP −5…−8%, ADX −5%, SS2 PCM −22%.
images and other 2D data on the fast levels: a weighted predictor after JPEG XL's – eight sub-predictors (JPEG XL's four with one of its parameter sets, the median, the gradient, two from the word coded before in the pixel) weighted by their recent errors; the words of a pixel coded on their own, as differences or as YCoCg-R; -l3 / -l4 also mix each residual bit from four contexts. 20 BMP photos (55.8 MB): -l1 −18.3%, -l4 −19.2% = 13.42 MB (JPEG XL lossless e7 / e9: 13.28 / 13.09 MB, decoding about 5× slower); per-type sets −1.4%, raw images −14…−18%. -l5 … -l8: the full raw data model takes contexts from the same predictor: BMP photos −3.8% (-l8 12.98 MB, below JPEG XL e9), per-type sets −0.2%, raw images −1.8…−2.8%. The eight sub-predictors run in AVX2 lanes (image decoding −14% of the time at -l1, −9% at -l4).
fixed model sets for -l1 … -l4, no decoding budget by default (-ds still works): 1–2 fast models, 3 + the literal mixer where it saves ≥ 0.5%, 4 + the mixed texture models; only fast model variants on 1–4. Per-type sets: -l1 −2.8%, -l4 −4.9% against 0.17's default -ds 200; decompression slower where textures and ADPCM keep their models.
the audio check reads the stream's block rows for block-interleaved PCM.
header-less textures: sprite atlases with large empty areas and a constant alpha half in most BC3 blocks are no longer taken for BC7 and cut into thousands of pieces (a 16384 × 16384 DXT5 atlas slice: −17% at -l8, 10% below LOLZ).
a region whose content appears again later is kept only when it also pays for those copies (LZ never copies from a region): Memoriapolis texture / mesh data −4.3%, structure data up to −6%, ADPCM −0.5…−1.5%.
large textures (over 12 MB) are cut into row bands of about 8 MB that are coded and decoded side by side (on -l6 … -l8 only the ones that pass whole): a 32 MB DXT5 atlas slice decodes 3.3× faster for +0.13–0.18%; the texture classifier codes its candidates and their LZ yardsticks side by side (Memoriapolis texture data: compression −22% of the time); about 30 dead development switches and their code removed (streams unchanged).
texture variants (-l1 … -l5): a BC2 / BC3 / BC5 texture coded against an earlier one of the same size may take either half of a block (alpha or colour) from the same place in it; references are also found by shared halves (another colour over the same alpha). UFC 3 (PS3) menu textures: -l4 −13%.
ADPCM without a header: sound banks that keep a table of WAV header stubs and the data elsewhere (KaktoR's 208 MB bank: -l8 131 051 752 B, −8.6% against 0.17.2 and −5.1% against BCM). The stubs give the format, the data is found as runs of valid blocks. Thanks to KaktoR for the sample and the report.
the printed RAM to decompress now counts the real models per thread (levels 5–8 needed up to 2× more than shown).
a folder as input or output gives a clear error instead of "access denied".
0.17.2 (stream format v17: 0.17.0 / 0.17.1 streams decode; streams with fast ADPCM need 0.17.2)
fast ADPCM model for -l1 … -l4: the codec's own quantizer gives the expected nibble, one adaptive context instead of the mixer – 2.5× faster to decode, 2.4–3.9% larger than the full model. The decoding budget takes it where it fits and moves it up to the full model where room is left. Pure ADPCM sets at -l4: −1.7% (IMA) / −3.6% (MS) against 0.17.1; other data codes as in 0.17.1.
0.17.1 (stream format v17: 0.17.0 streams decode; streams made with -nw need 0.17.1)
switches for the single models and the trained models.
default level 4 (was 3)
fix: audio from a WAV / ADPCM header that claims more data than follows it (a cut or broken file) ran on over the next data and coded it as audio. Textures and images found by their headers are now taken out of the audio, and the last 32 KB of every audio stream are coded by the audio model and by LZ; where LZ wins, a binary search in 64 KB steps finds where the stream turns into other data and the audio ends there (cut-WAV test files: −2.8% at -l4, −15.5% at -l7). Normal audio codes as before. Found while looking into KaktoR's report.
0.17.0 first release
Download: rofz-0.18.1-win64.7z (rofz_avx2.exe + rofz_sse2.exe + README)
SHA-256: a1211b26bbf90bbcfe5b3cebae52cfac4afc9fba46c04ec79a 3aeda4a5b79f5a (1 246 115 B)
Feedback and results on other games are welcome, especially where it loses. And 200MB of samples ;)
ROFZ is a lossless compressor for repacking games: optimal-parsing LZ77 + range coder with a per-block literal mixer, plus its own models for the data LZ codes badly. It finds that data anywhere in the stream, by header or by content:
BC1–BC7 / DXT textures – DDS, IWI, VTF headers, and BC1/3/4/5 without any header. Textures are chained, and a texture can be coded against an earlier one that shares its blocks.
PCM audio (WAV / AIFF, 8/16/24-bit, float, PS2 SS2) – cascade of sign-LMS predictors.
ADPCM audio – IMA / MS / Xbox ADPCM (WAV, also sound banks with header stubs), PlayStation SPU ADPCM (VAG, SS2 / ADS, WAC, header-less), CD-XA (PS1 sectors), Nintendo DSP-ADPCM (BCSTM / BFSTM / BWAV), CRI ADX – the codec's decoder runs alongside the model.
Raw multi-channel data – uncompressed images, vertex / animation arrays (adaptive linear predictor + context mixing).
x86 filter, multithreaded compression and decompression, stdin/stdout for FreeArc.
Std-only, Windows x64, two builds: rofz_avx2.exe (AVX2 CPUs) and rofz_sse2.exe (any x86-64 CPU). Both write the same streams and each decodes the other's; streams also decode identically with any thread count.
Neural-network models (CPU only, integer arithmetic; trained offline on samples of 75 games other than Memoriapolis, so as not to skew the results)
Online mixing networks – the literal mixer, the BC pixel-index mixer and the raw-data model combine their context predictions with a single-layer logistic network that learns while coding (identically in encoder and decoder).
Pre-trained start states – the literal mixer and the raw-data model (weights, context cells, bias, APM) start from states learned on game data instead of even odds (~580 KB of tables in the exe), so small blocks and block starts code smaller.
Literal parameter network – a one-layer softmax network over 22 cheap statistics of a block (order-0/1 and position-context entropies, share of zeros, record-stride hints) proposes the two most promising literal-context settings for the encoder's test-coding (trained on 600 blocks from 75 game samples).
Texture classifier – a logistic regression (one neuron) over 18 statistics of a texture candidate predicts whether the texture model will beat LZ; rejected candidates skip the trial coding (faster compression).
The gains are small (0.02–0.1%) but free for the decoder. -nn turns all trained models off.
Levels
-l1 … -l4: fast-decoding model sets, fixed per level: 1–2 fast models, 3 + the literal mixer where it saves ≥ 0.5%, 4 + the mixed texture models; only the fast variants of the models (full models from -l5). Every level codes smaller and decodes slower than the one before. Default: -l4. -ds N keeps a decoding speed on any level (off by default since 0.18.0).
-l5 … -l8: full models, smallest output. -l5 compresses fastest, -l8 smallest.
-m = memory budget (% of RAM), -t = threads, -ds = decompression speed to keep (MB/s, any level).
Benchmark
Ryzen 7 5800X3D (8C/16T), 64 GB RAM, NVMe SSD, Windows 11. Command line, one run after another on an idle PC, all 16 threads; every output was decompressed and compared byte for byte with the input. MB/s refer to the compressor's input.
Settings
LOLZ ULTRA (DiskSpan's LOLZ_ULTRA alias): lolz -dtb1 -d263 -mtt1 -mt16 -mc1023, decoded with CLS-LOLZ_D_x64
TARZ 1.0.3 at its best (LOLZ-ULTRA-like settings): tarz c -t16 -d256 -mtt1 -tt16 -mc1023 -ow4096 -fb256, tarz d -t16
ROFZ 0.18.1: rofz c -lN -m85%, rofz d (defaults otherwise)
Inputs and precompression
Per-type sets: 46 files of up to 16 MB cut from game data samples (files of one kind put together): PCM audio, IMA / MS ADPCM audio and a sound bank, console audio (PS1 CD-XA, PS2 VAG / SS2 / ADS / WAC, Nintendo DSP-ADPCM, CRI ADX, Xbox ADPCM) and PS3 textures, BC1–BC7 / DXT textures (DDS, VTF, IWI, XBM and header-less), raw images (BMP / TGA / RAW / TIF), text, Unity / CR2W / Source structures, executables, meshes, animations, BSP maps, PAK / VPK archives. No precompression – the same file for every compressor.
Memoriapolis (Unity 2022.3, 7 832 files, 7 267 959 185 B): files in Arc order (by extension, then path); the LZ4 / LZ4HC blocks of the 4 713 UnityFS archives restored to raw data, only blocks that recompress bit for bit) → 9 119 658 087 B; then srep 4.90g-wip -hash- -m3f -a0/0 → 5 355 251 639 B, the input of every run. The whole-game results are still those of rofz 0.17.0; they will be measured again later.
PCM audio (WAV / AIFF; uncompressed samples): 67 108 864 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s
LOLZ ULTRA 39 127 417 58.30% - 50.4 s 1.33 1.62 s 42
TARZ (best) 40 183 818 59.88% +2.70% 191.2 s 0.35 2.70 s 25
rofz -l1 30 875 027 46.01% -21.09% 4.2 s 16.10 0.75 s 90
rofz -l2 30 875 004 46.01% -21.09% 4.4 s 15.20 0.76 s 88
rofz -l3 30 874 960 46.01% -21.09% 4.5 s 15.02 0.76 s 88
rofz -l4 30 874 907 46.01% -21.09% 4.5 s 14.94 0.73 s 92
rofz -l5 30 874 907 46.01% -21.09% 4.5 s 14.99 0.77 s 87
rofz -l6 30 874 327 46.01% -21.09% 7.6 s 8.85 0.74 s 91
rofz -l7 30 874 320 46.01% -21.09% 7.6 s 8.84 0.76 s 88
rofz -l8 30 874 332 46.01% -21.09% 7.6 s 8.82 0.74 s 91
ADPCM audio (IMA / MS ADPCM WAV, a sound bank): 40 372 544 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s
LOLZ ULTRA 26 204 819 64.91% - 35.3 s 1.14 1.02 s 40
TARZ (best) 26 118 840 64.69% -0.33% 174.8 s 0.23 1.25 s 32
rofz -l1 23 965 640 59.36% -8.54% 6.4 s 6.35 0.48 s 84
rofz -l2 23 954 877 59.33% -8.59% 6.9 s 5.87 0.48 s 84
rofz -l3 23 938 172 59.29% -8.65% 8.2 s 4.92 0.50 s 81
rofz -l4 23 924 204 59.26% -8.70% 9.0 s 4.50 0.50 s 81
rofz -l5 22 970 203 56.90% -12.34% 8.0 s 5.07 0.99 s 41
rofz -l6 22 919 769 56.77% -12.54% 10.1 s 3.99 1.07 s 38
rofz -l7 22 919 266 56.77% -12.54% 10.5 s 3.86 1.06 s 38
rofz -l8 22 918 738 56.77% -12.54% 11.5 s 3.50 1.04 s 39
console audio and textures (PS1 CD-XA, PS2 VAG / SS2 / ADS / WAC, Nintendo DSP-ADPCM, CRI ADX, Xbox ADPCM, PS3 textures): 104 242 992 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s
LOLZ ULTRA 60 565 348 58.10% - 80.6 s 1.29 2.30 s 45
TARZ (best) 59 907 663 57.47% -1.09% 194.5 s 0.54 3.38 s 31
rofz -l1 59 224 009 56.81% -2.21% 14.0 s 7.45 1.44 s 72
rofz -l2 59 017 649 56.62% -2.56% 17.2 s 6.04 1.45 s 72
rofz -l3 58 745 160 56.35% -3.01% 21.3 s 4.90 1.81 s 58
rofz -l4 58 502 725 56.12% -3.41% 23.4 s 4.46 2.09 s 50
rofz -l5 57 910 829 55.55% -4.38% 24.6 s 4.24 3.22 s 32
rofz -l6 55 329 654 53.08% -8.64% 32.7 s 3.18 3.48 s 30
rofz -l7 55 325 784 53.07% -8.65% 36.5 s 2.86 3.42 s 30
rofz -l8 55 324 441 53.07% -8.65% 42.6 s 2.45 3.40 s 31
textures (DDS / BC1-BC7 / VTF / IWI / XBM): 150 994 944 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s
LOLZ ULTRA 65 330 035 43.27% - 156.3 s 0.97 3.64 s 41
TARZ (best) 65 011 249 43.06% -0.49% 285.7 s 0.53 6.87 s 22
rofz -l1 65 073 479 43.10% -0.39% 27.3 s 5.54 3.03 s 50
rofz -l2 64 703 941 42.85% -0.96% 35.5 s 4.26 2.94 s 51
rofz -l3 64 277 087 42.57% -1.61% 49.5 s 3.05 3.32 s 45
rofz -l4 61 720 287 40.88% -5.53% 53.5 s 2.82 5.23 s 29
rofz -l5 61 425 183 40.68% -5.98% 52.0 s 2.90 6.25 s 24
rofz -l6 61 256 329 40.57% -6.24% 74.2 s 2.04 6.58 s 23
rofz -l7 61 193 745 40.53% -6.33% 89.0 s 1.70 6.55 s 23
rofz -l8 61 165 158 40.51% -6.38% 103.4 s 1.46 6.65 s 23
raw images (BMP / TGA / RAW / TIF): 83 886 080 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s
LOLZ ULTRA 21 323 178 25.42% - 78.9 s 1.06 1.60 s 52
TARZ (best) 20 755 681 24.74% -2.66% 437.9 s 0.19 2.56 s 33
rofz -l1 21 190 058 25.26% -0.62% 15.3 s 5.49 0.93 s 90
rofz -l2 21 159 023 25.22% -0.77% 16.8 s 5.00 0.90 s 94
rofz -l3 20 537 604 24.48% -3.68% 22.5 s 3.73 1.44 s 58
rofz -l4 20 500 695 24.44% -3.86% 25.6 s 3.28 1.41 s 60
rofz -l5 19 944 470 23.78% -6.47% 35.6 s 2.36 3.43 s 24
rofz -l6 19 733 680 23.52% -7.45% 45.6 s 1.84 3.48 s 24
rofz -l7 19 700 741 23.49% -7.61% 55.5 s 1.51 3.47 s 24
rofz -l8 19 676 059 23.46% -7.72% 73.8 s 1.14 3.43 s 24
text, structures, executables, meshes, maps: 266 556 789 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s
LOLZ ULTRA 95 836 113 35.95% - 267.1 s 1.00 3.27 s 82
TARZ (best) 95 749 915 35.92% -0.09% 1301.8 s 0.20 4.68 s 57
rofz -l1 103 234 022 38.73% +7.72% 36.9 s 7.22 2.23 s 119
rofz -l2 102 172 015 38.33% +6.61% 58.7 s 4.54 2.37 s 113
rofz -l3 99 774 966 37.43% +4.11% 110.2 s 2.42 5.01 s 53
rofz -l4 99 244 592 37.23% +3.56% 142.2 s 1.87 4.93 s 54
rofz -l5 99 190 908 37.21% +3.50% 143.2 s 1.86 5.37 s 50
rofz -l6 93 830 156 35.20% -2.09% 217.8 s 1.22 6.63 s 40
rofz -l7 93 270 573 34.99% -2.68% 303.0 s 0.88 7.18 s 37
rofz -l8 93 054 209 34.91% -2.90% 460.7 s 0.58 7.36 s 36
Memoriapolis, whole game (rofz 0.17.0: not measured again yet): 5 355 251 639 B input
compressor output (B) ratio vs LOLZ compression MB/s decompression MB/s RAM to decompress
LOLZ ULTRA 1 758 818 797 32.84% - 1615.1 s 3.32 12.00 s 446 5 698 MB
TARZ (best) 1 772 775 068 33.10% +0.79% 5779.4 s 0.93 20.30 s 264 2 784 MB
rofz -l1 1 858 615 328 34.71% +5.67% 564.5 s 9.49 24.68 s 217 4 103 MB
rofz -l4 1 801 250 333 33.64% +2.41% 1302.6 s 4.11 27.01 s 198 4 081 MB
rofz -l5 1 763 133 782 32.92% +0.25% 1442.6 s 3.71 54.31 s 99 6 377 MB
rofz -l8 1 739 267 961 32.48% -1.11% 3545.8 s 1.51 82.51 s 65 8 847 MB
Per set (output bytes)
set LOLZ ULTRA TARZ (best) rofz -l1 rofz -l2 rofz -l3 rofz -l4 rofz -l5 rofz -l6 rofz -l7 rofz -l8
lit/text 1 939 745 1 920 604 2 276 931 2 241 877 2 203 430 2 200 847 2 200 847 1 872 491 1 872 269 1 872 050
lit/text_utf16 782 807 768 166 896 111 857 508 818 020 800 900 800 900 735 400 734 994 734 821
lit/struct_unity 4 622 416 4 613 608 4 849 278 4 751 920 4 658 957 4 608 528 4 620 495 4 555 619 4 530 982 4 518 108
lit/struct_cr2w 12 435 801 12 466 536 12 642 307 12 590 111 12 477 591 12 484 180 12 484 099 12 418 834 12 408 367 12 401 991
lit/struct_misc 1 646 195 1 642 642 2 567 578 2 442 974 2 329 771 2 309 090 2 300 616 1 667 094 1 650 638 1 646 317
lit/struct_source 12 877 500 12 860 749 12 995 671 12 980 473 12 680 523 12 642 857 12 642 857 12 473 329 12 368 150 12 345 867
lit/exe64 4 402 081 4 000 834 4 348 670 4 301 596 4 173 919 4 142 244 4 128 059 4 012 930 3 995 288 3 985 884
lit/exe32 9 230 031 9 100 271 11 300 627 11 260 205 11 148 412 11 188 555 11 187 425 9 053 196 9 050 002 9 048 305
lit/exe_net 3 619 668 3 589 282 3 814 151 3 774 163 3 668 818 3 646 090 3 646 090 3 540 346 3 576 593 3 533 296
lit/mesh 7 019 892 7 061 608 8 106 947 8 067 894 7 940 565 7 929 739 7 929 739 7 020 295 6 980 130 6 977 864
lit/anim 5 093 373 5 523 928 5 654 300 5 594 216 5 291 816 5 162 390 5 162 291 4 854 950 4 847 439 4 838 677
lit/map_bsp 2 044 624 2 073 579 2 928 667 2 813 764 2 620 778 2 529 597 2 452 433 2 413 875 2 111 453 2 029 725
lit/terrain_nav 5 181 137 5 001 339 5 356 031 5 261 473 5 057 718 5 010 374 5 010 374 4 955 239 4 924 901 4 901 003
lit/font 3 279 030 3 265 130 3 540 980 3 427 181 3 241 392 3 141 029 3 136 103 3 007 693 2 980 914 2 990 163
lit/shader 294 593 285 262 317 858 304 786 292 592 288 823 288 823 287 478 287 627 284 382
lit/pack_pak 9 394 270 9 534 756 9 561 099 9 531 863 9 452 292 9 450 969 9 450 969 9 325 380 9 320 878 9 319 437
lit/pack_vpk 11 972 950 12 041 621 12 076 816 11 970 011 11 718 372 11 708 380 11 748 788 11 636 007 11 629 948 11 626 319
audio/audio_pcm16 12 621 005 12 980 497 9 861 454 9 861 446 9 861 423 9 861 372 9 861 372 9 861 152 9 861 146 9 861 159
audio/WAV16 9 020 554 9 567 334 7 420 903 7 420 896 7 420 880 7 420 881 7 420 881 7 420 741 7 420 741 7 420 741
audio/WAV24 8 424 908 8 093 706 6 171 528 6 171 526 6 171 519 6 171 516 6 171 516 6 171 357 6 171 356 6 171 356
audio/AIFF 9 060 950 9 542 281 7 421 142 7 421 136 7 421 138 7 421 138 7 421 138 7 421 077 7 421 077 7 421 076
raw/img_raw 4 244 729 4 129 180 4 295 927 4 268 429 4 119 632 4 084 231 4 086 545 3 921 622 3 899 825 3 885 489
raw/BMP 4 286 406 4 176 200 4 130 523 4 129 802 4 016 469 4 015 894 3 984 867 3 965 947 3 959 895 3 955 456
raw/TGA 4 283 867 4 175 178 4 130 618 4 129 888 4 016 559 4 015 908 3 984 905 3 965 922 3 960 127 3 955 617
raw/RAW 4 254 850 4 126 583 4 535 256 4 535 170 4 411 919 4 411 760 4 158 900 4 151 612 4 152 170 4 150 835
raw/TIF 4 253 326 4 148 540 4 097 734 4 095 734 3 973 025 3 972 902 3 729 253 3 728 577 3 728 724 3 728 662
tex/tex_bc1 8 534 089 8 451 644 9 032 672 9 026 626 8 990 478 8 346 299 8 231 756 8 227 145 8 224 702 8 223 744
tex/tex_bc3 4 775 742 4 778 892 5 178 828 5 178 744 5 177 432 4 595 549 4 555 641 4 555 264 4 555 223 4 555 101
tex/tex_bc45 4 987 145 4 979 232 5 364 905 5 257 555 5 154 513 5 073 620 5 069 256 5 096 973 5 069 638 5 055 240
tex/tex_bc7 11 390 057 11 140 226 11 120 445 11 022 302 10 992 170 10 981 013 10 981 013 10 926 940 10 919 074 10 917 999
tex/tex_bc6 12 295 850 12 353 859 9 167 635 9 167 635 9 167 633 9 167 632 9 167 632 9 167 579 9 167 579 9 167 577
tex/dds 1 265 829 1 200 701 1 354 339 1 325 613 1 301 761 1 173 263 1 133 598 1 133 595 1 133 595 1 133 595
tex/tex_vtf 4 831 058 4 865 011 5 227 342 5 174 285 5 108 334 4 850 371 4 861 782 4 855 202 4 854 746 4 854 030
tex/tex_xbm 9 254 180 9 334 486 10 023 631 9 951 827 9 807 968 9 479 965 9 427 292 9 302 192 9 292 371 9 288 565
tex/tex_iwi 7 996 085 7 907 198 8 603 682 8 599 354 8 576 798 8 052 575 7 997 213 7 991 439 7 976 817 7 969 307
adpcm/ADPCM_IMA 7 954 668 7 967 607 7 284 744 7 282 921 7 268 028 7 258 877 6 914 897 6 882 864 6 882 714 6 882 588
adpcm/ADPCM_MS 6 682 707 6 589 698 6 139 670 6 131 058 6 131 841 6 128 161 5 964 473 5 946 451 5 946 311 5 946 156
adpcm/ADPCM_bank 11 567 444 11 561 535 10 541 226 10 540 898 10 538 303 10 537 166 10 090 833 10 090 454 10 090 241 10 089 994
console/ps1_xa 11 773 597 11 812 741 10 684 429 10 684 429 10 684 427 10 684 428 10 533 375 10 533 364 10 533 364 10 533 364
console/ps2_vag 12 536 619 12 155 144 11 403 206 11 401 733 11 363 451 11 354 503 11 290 954 11 290 946 11 290 946 11 290 946
console/ps2_ss2 11 290 759 10 980 981 10 041 915 10 041 915 10 041 914 10 041 914 9 885 711 9 885 708 9 885 708 9 885 708
console/ps2_wac 1 412 180 1 428 831 1 303 807 1 306 636 1 301 568 1 300 473 1 280 083 1 276 599 1 275 986 1 275 651
console/nds_dsp 5 309 310 5 361 988 8 151 524 7 951 216 7 746 079 7 735 672 7 735 672 5 245 836 5 244 989 5 245 089
console/cri_adx 14 136 460 14 096 396 13 062 179 13 062 178 13 062 175 13 062 174 12 903 585 12 903 575 12 903 574 12 903 574
console/xbox_adpcm 1 010 957 1 016 245 976 695 976 694 976 693 976 693 955 045 955 046 955 046 955 046
console/ps3_tex 3 095 466 3 055 337 3 600 254 3 592 848 3 568 853 3 346 868 3 326 404 3 238 580 3 236 171 3 235 063
FreeArc / DiskSpan (arc.ini):
[External compressor:rofz]
header = 0
packcmd = "rofz_avx2.exe" c {options} - - <stdin> <stdout>
unpackcmd = "rofz_avx2.exe" d - - <stdin> <stdout>
(rofz_sse2.exe on a CPU without AVX2; an installer for any PC can ship rofz_sse2.exe.)
Use e.g. -mrofz:l4:m65% after your precompressors. Presets: rofz:l2:m45% (fast), rofz:l4:m65% (normal), rofz:l7:m85% (high), rofz:l8:m85% (ultra). In an installer only the unpackcmd is needed (d -t100p - - <stdin> <stdout>).
Changes
0.18.1 (stream format v18 as 0.18.0: either version decodes the other's streams)
two builds in the package, rofz_avx2.exe and rofz_sse2.exe (for CPUs without AVX2), instead of rofz.exe; the same streams. Thanks to Joe Forster/STA for the naming idea.
a summary at the end of compression: the data found by kind (streams, bytes, how much its model kept and how much LZ coded smaller) and what coded it (model, regions, bytes in and out, ratio, share of the output); the RAM line gives the models per thread and the data apart.
a texture whose header claims more data than its file holds (a cut file) ends at the next file header (textures, audio, images, CR2W, Ogg, ZIP, PNG, UnityFS, FSB5, Wwise banks, tar): the files after it are found again (16 type sets put together: −1.4% at -l2; the PS3 texture set −0.25%).
audio regions and texture bands are cut into pieces of a segment's share per thread, 2–8 MB (8 MB before; large inputs as before), cube maps and texture arrays into their images: on the 16 MB sets ADPCM and console audio decode 2.5–3× and code 1.7× faster for +0.02…+0.09%, BC6H sky boxes decode 2.6× faster for +0.07%.
-l6 … -l8: blocks of a quarter of the segment, 4–32 MB (8–32 MB before; inputs of 32 MB and more as before): 16 MB files code 25% and decode 25% faster at -l8.
the match finder compares 8 bytes at a time (the same matches and streams): repetitive data codes up to 39% faster at -l1.
per-type sets against 0.18.0: size −0.04…+0.05% per level (single sets up to +1.2% at -l6 … -l8), compression −7…−25% of the time, decompression −20…−29% (-l1 80 MB/s instead of 57).
0.18.0 (stream format v18; v17 streams decode)
new audio models: PlayStation SPU ADPCM (VAG, PS2 SS2 / ADS with interleave, Ubisoft WAC, header-less frames), CD-XA ADPCM sectors (RIFF CDXA and CD images), Nintendo DSP-ADPCM (BCSTM / BFSTM either byte order, BWAV), CRI ADX; Xbox ADPCM WAV through the IMA model; PS2 SS2 PCM with block interleave. Game samples at -l8 against 0.17.2: VAG −12%, SS2 / ADS −10%, WAC −9%, XA −8…−10%, DSP −5…−8%, ADX −5%, SS2 PCM −22%.
images and other 2D data on the fast levels: a weighted predictor after JPEG XL's – eight sub-predictors (JPEG XL's four with one of its parameter sets, the median, the gradient, two from the word coded before in the pixel) weighted by their recent errors; the words of a pixel coded on their own, as differences or as YCoCg-R; -l3 / -l4 also mix each residual bit from four contexts. 20 BMP photos (55.8 MB): -l1 −18.3%, -l4 −19.2% = 13.42 MB (JPEG XL lossless e7 / e9: 13.28 / 13.09 MB, decoding about 5× slower); per-type sets −1.4%, raw images −14…−18%. -l5 … -l8: the full raw data model takes contexts from the same predictor: BMP photos −3.8% (-l8 12.98 MB, below JPEG XL e9), per-type sets −0.2%, raw images −1.8…−2.8%. The eight sub-predictors run in AVX2 lanes (image decoding −14% of the time at -l1, −9% at -l4).
fixed model sets for -l1 … -l4, no decoding budget by default (-ds still works): 1–2 fast models, 3 + the literal mixer where it saves ≥ 0.5%, 4 + the mixed texture models; only fast model variants on 1–4. Per-type sets: -l1 −2.8%, -l4 −4.9% against 0.17's default -ds 200; decompression slower where textures and ADPCM keep their models.
the audio check reads the stream's block rows for block-interleaved PCM.
header-less textures: sprite atlases with large empty areas and a constant alpha half in most BC3 blocks are no longer taken for BC7 and cut into thousands of pieces (a 16384 × 16384 DXT5 atlas slice: −17% at -l8, 10% below LOLZ).
a region whose content appears again later is kept only when it also pays for those copies (LZ never copies from a region): Memoriapolis texture / mesh data −4.3%, structure data up to −6%, ADPCM −0.5…−1.5%.
large textures (over 12 MB) are cut into row bands of about 8 MB that are coded and decoded side by side (on -l6 … -l8 only the ones that pass whole): a 32 MB DXT5 atlas slice decodes 3.3× faster for +0.13–0.18%; the texture classifier codes its candidates and their LZ yardsticks side by side (Memoriapolis texture data: compression −22% of the time); about 30 dead development switches and their code removed (streams unchanged).
texture variants (-l1 … -l5): a BC2 / BC3 / BC5 texture coded against an earlier one of the same size may take either half of a block (alpha or colour) from the same place in it; references are also found by shared halves (another colour over the same alpha). UFC 3 (PS3) menu textures: -l4 −13%.
ADPCM without a header: sound banks that keep a table of WAV header stubs and the data elsewhere (KaktoR's 208 MB bank: -l8 131 051 752 B, −8.6% against 0.17.2 and −5.1% against BCM). The stubs give the format, the data is found as runs of valid blocks. Thanks to KaktoR for the sample and the report.
the printed RAM to decompress now counts the real models per thread (levels 5–8 needed up to 2× more than shown).
a folder as input or output gives a clear error instead of "access denied".
0.17.2 (stream format v17: 0.17.0 / 0.17.1 streams decode; streams with fast ADPCM need 0.17.2)
fast ADPCM model for -l1 … -l4: the codec's own quantizer gives the expected nibble, one adaptive context instead of the mixer – 2.5× faster to decode, 2.4–3.9% larger than the full model. The decoding budget takes it where it fits and moves it up to the full model where room is left. Pure ADPCM sets at -l4: −1.7% (IMA) / −3.6% (MS) against 0.17.1; other data codes as in 0.17.1.
0.17.1 (stream format v17: 0.17.0 streams decode; streams made with -nw need 0.17.1)
switches for the single models and the trained models.
default level 4 (was 3)
fix: audio from a WAV / ADPCM header that claims more data than follows it (a cut or broken file) ran on over the next data and coded it as audio. Textures and images found by their headers are now taken out of the audio, and the last 32 KB of every audio stream are coded by the audio model and by LZ; where LZ wins, a binary search in 64 KB steps finds where the stream turns into other data and the audio ends there (cut-WAV test files: −2.8% at -l4, −15.5% at -l7). Normal audio codes as before. Found while looking into KaktoR's report.
0.17.0 first release
Download: rofz-0.18.1-win64.7z (rofz_avx2.exe + rofz_sse2.exe + README)
SHA-256: a1211b26bbf90bbcfe5b3cebae52cfac4afc9fba46c04ec79a 3aeda4a5b79f5a (1 246 115 B)
Feedback and results on other games are welcome, especially where it loses. And 200MB of samples ;)