Brett Kosinski format How things works.
#16
Posted 12 November 2004 - 12:28 PM
Argh! Don't quote a two-page-long post to write three frikkin lines! >_<
#19
Posted 12 November 2004 - 03:17 PM
I'm on 1024x768 and I can scroll past it in two or three mousewheel swathes. Now if it took enough time for the human race to become extinct to scroll past it, THAT would be too long.
#20
Posted 12 November 2004 - 04:03 PM
While overblown by Bob, I really don't think the whole thing needed to be quoted. Didn't bother me but hey.
#23
Posted 26 November 2004 - 04:33 AM
Update about the Separate compression.
There is something to add under the Separate compression. It's the DDDDD value.
The first post has been edited as well.
Separate compression:
This is when there is 01 under the bitfield.
The separate compression uses at least 2 bytes, and sometimes 3 (the last is optional). In a binary form:
NN DC (CC) = NNNN NNNN DDDD DCCC (CCCC CCCC)
NN is another negative value. Unlike IC, this one will tell the game where to read/copy the (uncompressed) data from. Writing FF for NN will read/copy the previous byte only. Writing another value will read/copy the previous bytes this value refers to, until you have CC of them.
DD is again a negative value on 5 bits. This is an addon to NN. Take NN and substract 256 (100 in hex) * |DD+1|. Take the result as your new NN value.
DD = 11111 = -1 --> NN = NN - (256 * |-1+1|) = NN (Do nothing)
DD = 11110 = -2 --> NN = NN - (256 * |-2+1|) = NN - 256
DD = 11101 = -3 --> NN = NN - (256 * |-3+1|) = NN - 256 * 2 = NN - 512
DD = 11100 = -4 --> NN = NN - (256 * |-4+1|) = NN - 256 * 3 = NN - 768
...
DD = 00000 = -32 --> NN = NN - (256 * |-32+1|) = NN - 256 * 31 = NN - 7936
Example:
66 67 FF F8 0D --> NN = -1 and DD = 11111 --> NN = -1, we are starting at 67.
66 67 FE F8 0D --> NN = -2 and DD = 11111 --> NN = -2, we are starting at 66.
...
66 67 FF F0 0D --> NN = -1 and DD = 11110 --> NN = -257, we are starting 257 bytes before.
66 67 FD E7 --> NN = -3 and DD = 11100 --> NN = -771, we are starting 771 bytes before.
CC: Count.
If you have no more than 9 bytes to read/copy, then the last CC byte is useless.
F0 --> Like F8, be careful of the DD value.
F1 --> Copy the read data for 3 bytes, be careful of the DD value.
F2 --> Copy the read data for 4 bytes, be careful of the DD value.
F3 --> Copy the read data for 5 bytes, be careful of the DD value.
F4 --> Copy the read data for 6 bytes, be careful of the DD value.
F5 --> Copy the read data for 7 bytes, be careful of the DD value.
F6 --> Copy the read data for 8 bytes, be careful of the DD value.
F7 --> Copy the read data for 9 bytes, be careful of the DD value.
F8 --> Read next.
F9 --> Copy the read data for 3 bytes.
FA --> Copy the read data for 4 bytes.
FB --> Copy the read data for 5 bytes.
FC --> Copy the read data for 6 bytes.
FD --> Copy the read data for 7 bytes.
FE --> Copy the read data for 8 bytes.
FF --> Copy the read data for 9 bytes.
Else, write F8 = 1111 1000 (CCC = 000) for the first count, and use the last byte to actually write your count (-1):
F8 09 --> Copy the read data for 10 bytes.
F8 0A --> Copy the read data for 11 bytes.
...
Writing 00 F8 00 (NN = 00 and both counts are 00's) will end the compressed data.
In our example:
53 FB 01 23 FE 67 FF F8 0D 98 FF FD 65 98 75 FB B2 00 15...
We have 2 SC: FF F8 0D and FF FD.
67 FF F8 0D = 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 (67 + 0Ex67)
98 FF FD = 98 98 98 98 98 98 98 98 (98 + 07x98)
Another: 12 34 56 78 9A BC DE 10 FA F9 = 12 34 56 78 9A BC DE 10 56 78 9A
There is something to add under the Separate compression. It's the DDDDD value.
The first post has been edited as well.
Separate compression:
This is when there is 01 under the bitfield.
The separate compression uses at least 2 bytes, and sometimes 3 (the last is optional). In a binary form:
NN DC (CC) = NNNN NNNN DDDD DCCC (CCCC CCCC)
NN is another negative value. Unlike IC, this one will tell the game where to read/copy the (uncompressed) data from. Writing FF for NN will read/copy the previous byte only. Writing another value will read/copy the previous bytes this value refers to, until you have CC of them.
DD is again a negative value on 5 bits. This is an addon to NN. Take NN and substract 256 (100 in hex) * |DD+1|. Take the result as your new NN value.
DD = 11111 = -1 --> NN = NN - (256 * |-1+1|) = NN (Do nothing)
DD = 11110 = -2 --> NN = NN - (256 * |-2+1|) = NN - 256
DD = 11101 = -3 --> NN = NN - (256 * |-3+1|) = NN - 256 * 2 = NN - 512
DD = 11100 = -4 --> NN = NN - (256 * |-4+1|) = NN - 256 * 3 = NN - 768
...
DD = 00000 = -32 --> NN = NN - (256 * |-32+1|) = NN - 256 * 31 = NN - 7936
Example:
66 67 FF F8 0D --> NN = -1 and DD = 11111 --> NN = -1, we are starting at 67.
66 67 FE F8 0D --> NN = -2 and DD = 11111 --> NN = -2, we are starting at 66.
...
66 67 FF F0 0D --> NN = -1 and DD = 11110 --> NN = -257, we are starting 257 bytes before.
66 67 FD E7 --> NN = -3 and DD = 11100 --> NN = -771, we are starting 771 bytes before.
CC: Count.
If you have no more than 9 bytes to read/copy, then the last CC byte is useless.
F0 --> Like F8, be careful of the DD value.
F1 --> Copy the read data for 3 bytes, be careful of the DD value.
F2 --> Copy the read data for 4 bytes, be careful of the DD value.
F3 --> Copy the read data for 5 bytes, be careful of the DD value.
F4 --> Copy the read data for 6 bytes, be careful of the DD value.
F5 --> Copy the read data for 7 bytes, be careful of the DD value.
F6 --> Copy the read data for 8 bytes, be careful of the DD value.
F7 --> Copy the read data for 9 bytes, be careful of the DD value.
F8 --> Read next.
F9 --> Copy the read data for 3 bytes.
FA --> Copy the read data for 4 bytes.
FB --> Copy the read data for 5 bytes.
FC --> Copy the read data for 6 bytes.
FD --> Copy the read data for 7 bytes.
FE --> Copy the read data for 8 bytes.
FF --> Copy the read data for 9 bytes.
Else, write F8 = 1111 1000 (CCC = 000) for the first count, and use the last byte to actually write your count (-1):
F8 09 --> Copy the read data for 10 bytes.
F8 0A --> Copy the read data for 11 bytes.
...
Writing 00 F8 00 (NN = 00 and both counts are 00's) will end the compressed data.
In our example:
53 FB 01 23 FE 67 FF F8 0D 98 FF FD 65 98 75 FB B2 00 15...
We have 2 SC: FF F8 0D and FF FD.
67 FF F8 0D = 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 (67 + 0Ex67)
98 FF FD = 98 98 98 98 98 98 98 98 (98 + 07x98)
Another: 12 34 56 78 9A BC DE 10 FA F9 = 12 34 56 78 9A BC DE 10 56 78 9A
#26
Posted 30 October 2007 - 04:46 PM
Oh god oh god a bump in a dead forum this disrupts the sanctity of the entire board
#29
Posted 03 November 2007 - 02:50 PM
Taking advantage of the bump: would you like to keep calling it Kosinski or not? Seriously. After examining Allegro's packfiles, Kosinski format turned out to be just a somewhat improved version of LZSS (improved by the fact that small offsets require less bytes). I'm not kidding. Go and check the LZSS file in Allegro sources and read the start comment. It describes how does the packfile compression works. It's way similar.
#30
Posted 03 November 2007 - 04:38 PM
Sik, on Nov 3 2007, 08:50 PM, said:
Taking advantage of the bump: would you like to keep calling it Kosinski or not? Seriously. After examining Allegro's packfiles, Kosinski format turned out to be just a somewhat improved version of LZSS (improved by the fact that small offsets require less bytes). I'm not kidding. Go and check the LZSS file in Allegro sources and read the start comment. It describes how does the packfile compression works. It's way similar.
It doesn't matter who invented the compression format. If we followed your line of reasoning, all compression formats we don't know the origins of we would have to name '???1', '???2' etc.
The point in naming a compression format after the person who cracked it is that by doing this, you show your gratitude towards the cracker for doing it. I, for one, am very grateful to Kosinski and Nemesis for cracking their formats. If it wasn't for them, we probably wouldn't be where we are as a community. Surely someone else would have cracked the formats later (say, I), but they made it possible first.
We already know what these compressions are really called, anyway.

00