wyvern
https://github.com/pokemium/wyvern のデータと改善案のメモ
data
code:cenotaph.sh
# wyvern v1.1.2
❯ ./wyvern -v ./test/cenotaph.atr
...
Byte: 11, Word: 0, LongString: 6, ShortString: 22, Trash: 23
Compression: 360 Bytes => 199 Bytes (55%)
Decompression: 27684 Cycles
❯ ./wyvern -v ./test/cenotaph.chr
...
Byte: 6, Word: 27, LongString: 116, ShortString: 41, Trash: 153
Compression: 4000 Bytes => 3417 Bytes (85%)
Decompression: 189384 Cycles
❯ ./wyvern -v ./test/cenotaph.map
...
Byte: 4, Word: 0, LongString: 2, ShortString: 1, Trash: 11
Compression: 360 Bytes => 338 Bytes (93%)
Decompression: 14948 Cycles
❯ ./wyvern -v ./test/pokecrystal/chris.2bpp
Byte: 14, Word: 2, LongString: 6, ShortString: 7, Trash: 18
Byte length list: 4 3 3 3 4 4 4 3 5 4 3 5 4 6
Word length list: 64 56
LongString length list: 4 5 16 4 18 4
LongString offset list: -134 -246 -558 -134 -584 -258
ShortString length list: 42 55 12 4 4 22 6
Trash length list: 11 7 37 2 11 4 10 58 8 12 1 10 61 27 2 18 12 2
Compression: 784 Bytes => 378 Bytes (48%)
❯ ./wyvern -v ./test/pokecrystal/diploma.2bpp
Byte: 15, Word: 27, LongString: 91, ShortString: 27, Trash: 102
Byte length list: 4 6 3 12 3 9 4 8 17 4 4 6 4 4 4
Word length list: 3 3 3 4 3 3 5 3 5 4 12 4 4 8 3 4 4 7 3 4 5 3 5 4 4 3 4
LongString length list: 5 4 4 7 6 7 7 7 6 4 8 4 4 4 7 5 4 5 13 5 4 4 6 13 5 12 4 8 5 4 4 4 4 5 5 12 4 7 5 10 14 4 7 5 16 4 4 4 7 5 7 4 4 6 4 4 7 5 4 12 5 4 6 8 7 10 5 5 5 7 8 4 8 27 6 5 4 4 11 5 4 29 7 9 7 7 5 15 4 4 8
LongString offset list: -161 -256 -272 -274 -290 -306 -322 -340 -338 -368 -197 -183 -260 -524 -252 -258 -572 -588 -250 -620 -582 -614 -630 -640 -256 -533 -262 -740 -512 -748 -987 -570 -808 -552 -536 -816 -878 -880 -1043 -683 -624 -650 -733 -934 -374 -372 -428 -306 -738 -578 -851 -810 -1028 -208 -643 -664 -216 -682 -624 -967 -1345 -488 -1222 -590 -358 -614 -533 -789 -1457 -818 -1105 -842 -192 -1360 -669 -826 -134 -550 -1132 -272 -604 -1243 -1650 -1392 -1682 -1698 -1740 -1452 -1772 -1460 -1468
ShortString length list: 7 7 7 7 7 9 7 7 10 4 9 4 7 7 14 19 6 6 6 7 4 6 5 4 8 5 5
Trash length list: 6 2 10 9 9 1 2 1 7 1 2 9 17 1 16 1 4 3 3 12 12 9 3 3 19 2 10 12 15 12 10 1 3 3 3 3 6 4 11 22 23 3 2 2 10 10 4 9 4 10 1 1 2 2 6 1 3 6 1 11 6 9 1 12 16 6 10 3 9 13 10 1 16 6 10 1 4 1 11 12 1 7 11 8 4 1 15 1 12 3 5 3 4 1 3 7 9 5 3 1 7 3
Compression: 1792 Bytes => 1202 Bytes (67%)
❯ ./wyvern -v ./test/pokecrystal/ditto.2bpp
Byte: 0, Word: 11, LongString: 63, ShortString: 13, Trash: 38
Byte length list: []
Word length list: 32 3 4 4 3 4 34 5 39 5 5
LongString length list: 7 11 5 6 13 4 6 4 9 12 5 5 4 5 4 17 10 5 5 4 6 4 4 11 5 11 5 4 10 8 7 4 6 6 13 8 8 6 8 8 16 5 20 6 45 8 4 7 7 6 8 4 7 12 9 4 6 8 5 11 19 10 4
LongString offset list: -143 -151 -163 -169 -207 -252 -149 -336 -240 -256 -140 -312 -194 -153 -308 -260 -258 -186 -241 -200 -254 -380 -355 -463 -224 -479 -288 -354 -538 -608 -512 -497 -399 -452 -502 -520 -309 -186 -264 -376 -256 -224 -512 -619 -764 -816 -708 -857 -784 -648 -401 -770 -492 -768 -764 -939 -508 -766 -736 -975 -784 -619 -851
ShortString length list: 8 6 10 4 4 4 4 4 14 4 6 12 4
Trash length list: 10 7 11 10 1 1 1 2 7 3 5 7 10 1 2 1 2 2 2 4 7 4 4 4 1 2 3 3 6 2 6 5 3 2 2 3 2 2
Compression: 1024 Bytes => 437 Bytes (42%)
❯ ./wyvern -v ./test/pokecrystal/suicune_jump.2bpp
Byte: 6, Word: 13, LongString: 70, ShortString: 41, Trash: 85
Byte length list: 22 6 5 4 6 40
Word length list: 3 6 3 8 5 3 3 6 4 3 3 3 3
LongString length list: 8 7 6 14 8 7 5 5 11 4 5 7 5 5 7 5 11 4 4 12 10 7 4 10 4 6 6 4 7 11 4 8 13 8 18 17 4 5 4 4 11 6 4 4 14 5 4 12 23 9 4 4 6 5 24 4 16 9 4 4 4 8 8 15 4 7 7 6 6 4
LongString offset list: -208 -160 -230 -240 -222 -282 -146 -252 -130 -244 -244 -252 -284 -544 -284 -378 -356 -668 -266 -678 -464 -512 -502 -590 -616 -616 -360 -1002 -623 -1013 -1036 -724 -1123 -854 -132 -1279 -1042 -1290 -1098 -622 -270 -130 -872 -244 -1546 -1004 -890 -897 -136 -298 -130 -130 -1018 -256 -257 -244 -690 -1831 -1668 -548 -1786 -1660 -1818 -130 -1082 -1961 -944 -1788 -350 -1996
ShortString length list: 8 4 6 10 9 4 14 36 4 8 5 16 4 4 5 4 6 6 4 8 16 5 4 5 16 16 6 22 9 4 46 17 6 8 19 9 4 21 7 5 48
Trash length list: 10 8 12 10 5 4 2 24 8 7 4 2 44 11 3 9 17 2 11 13 6 8 12 1 6 8 19 3 4 4 3 4 2 9 1 13 20 17 4 16 11 28 16 4 8 9 1 8 12 12 40 35 9 11 7 10 36 7 8 25 18 6 17 1 2 10 4 8 3 15 55 1 15 3 1 2 5 8 1 3 16 5 1 2 1
Compression: 2048 Bytes => 1295 Bytes (63%)
memo
0b11xx_xxxxはtrash 0b11xx_xxxx + byte0 + byte1 + byte2 + byte3 + ...
0b101x_xxxxはlong string 0b101x_xxxx + lower_off + upper_off
0b100x_xxxxはshort string 0b100x_xxxx + lower_off
0b01xx_xxxxはword 0b01xx_xxxx + lower_byte + upper_byte
0b00xx_xxxxはbyte 0b00xx_xxxx + byte