How to uncompress?
-
- VIP member
- Posts: 185
- Joined: Mon Aug 28, 2006 2:07 pm
- Has thanked: 1 time
- Been thanked: 14 times
- Contact:
The files are compressed with a pretty standard LZSS variation. Try the attached program with the following command line:
It works on the files you presented, but might fail on others. Just come back if that happens ...
Code: Select all
delzss in.txt out.txt
You do not have the required permissions to view the files attached to this post.
-
- VIP member
- Posts: 185
- Joined: Mon Aug 28, 2006 2:07 pm
- Has thanked: 1 time
- Been thanked: 14 times
- Contact:
Well, in that case try the attached file. The first parameter should be the file specification (wildcards allowed), the second one should be an output directory. Example:astro wrote:but i need to uncompress more than 2000 files
Code: Select all
DeLZSS c:\compressed\*.* c:\decompressed
I am sure that would be quite easy to do, but I have neither the C# experience nor the development environment necessary to do that.astro wrote:i need source in visual C#
You will have to ask somebody else to translate the code. If you know how to program in C#, you should even be able to do that yourself. Delphi code is usually quite easy to read; in this case you only need to understand the procedure DecompressBlock.
Hope that helps ...
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 4057
- Joined: Wed Jan 15, 2003 6:45 pm
- Location: Dungeons of Doom
- Has thanked: 432 times
- Been thanked: 639 times
- Contact:
It's in the file! DPR, Delphi code!
By the way, Deniz, Good Job! Can I interest you in taking a crack at that RA compression? See the TAW Total Air War thread. That looks like a similar way, but with a dictionary saved before the compressed text. Would be really cool if you could figure that one out?
viewtopic.php?p=17481#17481
By the way, Deniz, Good Job! Can I interest you in taking a crack at that RA compression? See the TAW Total Air War thread. That looks like a similar way, but with a dictionary saved before the compressed text. Would be really cool if you could figure that one out?
viewtopic.php?p=17481#17481
-
- VIP member
- Posts: 185
- Joined: Mon Aug 28, 2006 2:07 pm
- Has thanked: 1 time
- Been thanked: 14 times
- Contact:
Now that you mention it, I see that I should have written that ...Mr.Mouse wrote:It's in the file! DPR, Delphi code!

Sure, I can try. I can't promise anything, however, since the winter term of my studies starts in a few days. But let's see ...Mr.Mouse wrote:Can I interest you in taking a crack at that RA compression? See the TAW Total Air War thread.

i've translated lzss decompressor code to C# but only half of file is decompressing correctly
maby i need to change this:
maby i need to change this:
Code: Select all
const byte NBits = 12;
const byte FBits = 4;
const byte Threshold = 3;
You do not have the required permissions to view the files attached to this post.
-
- VIP member
- Posts: 185
- Joined: Mon Aug 28, 2006 2:07 pm
- Has thanked: 1 time
- Been thanked: 14 times
- Contact:
No, the constants are correct that way. If you change them, the decompression will fail. (The deal is this: All references into the history buffer [also called "sliding window"] are 16 bits [i. e. two bytes] wide. NBits and FBits specify how many bits of those 16 are used for the length and offset values. The Threshold value tells you the minimum length of a compressed sequence -- since a buffer reference takes up two bytes, only longer sequences are compressed, thus the value of three.)astro wrote:i've translated lzss decompressor code to C# but only half of file is decompressing correctly
maby i need to change this:Code: Select all
const byte NBits = 12; const byte FBits = 4; const byte Threshold = 3;
By the way, I just noticed a bug in my code. Remove the lines
Code: Select all
if (Offset = 0) and (Len = 0) then
Exit;
On the first look, I cannot see any problem with your code. We could try some checks, though: Output the values of "Len" and "Offset" to the console right after they have been computed. In the case of the files you posted earlier, they should look like this:
Code: Select all
lifepoint_compressed.txt:
(3, 4078)
(4, 2)
(18, 10)
(18, 28)
(4, 4084)
(10, 114)
(6, 124)
match_compressed.txt:
(10, 4078)
(5, 4089)
(4, 7)
(5, 15)
(7, 21)
(3, 29)
(14, 37)
(5, 4089)
(3, 112)
(9, 65)
(3, 8)
(9, 39)
(7, 108)
(4, 127)
(4, 123)
(10, 4078)
(11, 108)
(18, 168)
(12, 186)
(12, 138)
(17, 151)
(12, 198)
(13, 149)
(12, 228)
(5, 274)
(12, 244)
(10, 291)
(6, 198)

Last edited by Deniz Oezmen on Wed Oct 11, 2006 11:24 pm, edited 1 time in total.
-
- VIP member
- Posts: 185
- Joined: Mon Aug 28, 2006 2:07 pm
- Has thanked: 1 time
- Been thanked: 14 times
- Contact:
Okay; you should first start by checking the most basic things. Have you verified that the input file has been read to memory correctly? (Examples: Is the first character of the input buffer within the DecompressBlock routine #255? Are the following characters correct? Does the buffer have the correct size?)astro wrote:my numbers are bad
-
- VIP member
- Posts: 185
- Joined: Mon Aug 28, 2006 2:07 pm
- Has thanked: 1 time
- Been thanked: 14 times
- Contact:
-
- VIP member
- Posts: 185
- Joined: Mon Aug 28, 2006 2:07 pm
- Has thanked: 1 time
- Been thanked: 14 times
- Contact: