How the LZS compression works?

  • Thread starter Thread starter bspbsp
  • Start date Start date
Status
Not open for further replies.
B

bspbsp

Guest
As it mentioned in the readme,Ficedula's ficelzs uses Haruhiko compression as its default compression method.i want to know how it works on compression,but i am not able to read the delphi code of Cosmo.who can give me a copy of Haruhiko compression algorithm or a discription of it?Thanks. :)
 
many thanks!
but i have already read that document and it's about how to decompression,what i'm looking for is Haruhiko compression.Qhimm also have his own version in eight and garden,but it seems not effect as the Haruhiko compression.
 
I think there was a thread about LZS compressions, and how to make them better ... wait a sec, i'll search . . . . here: FF7 Translation. Im not sure if it helps, but word "Haruhiko" is used at least 13 times there :D
 
bspbsp: Well, the idea was that you (theoretically) could reverse the decompression info given back into the Haruhiko compression scheme. As far as I can tell, enough info for that is in Ficedula's doc. You just have to reverse engineer something that was already reverse engineered. =P

I don't know what else to tell you. As a last resort you can try this.
-Srethron
 
now i understand the Haruhiko compression that ficedula mentioned  is the original LZSS compression,thanks to mirex!
and to Srethron Askvelhtnod:also thanks to your google site! i have found some source codes there.may raise new questions if i have any
 
Yeah, but there's a diffrence between Haruhiko LZSS and FF7 LZSS alghoritm. I'm looking for Delphi source to compress files using FF7 LZSS alghoritm. Does anyone have some ? .

Edit: I've developed a tool that can compress and decompress them (finally ;)), and it works pretty well. Win32 app. Link:
http://mav.pix.pl/personal/Lzss.zip
 
good news!!
i've found the differences between Haruhiko LZSS and the method SQUARESOFT used to compress their files.
this is a c source code about standard LZSS compression:
http://sprite.phys.ncku.edu.tw/NCKUtech/DCM/pub/DCM_CODE_ASM/lzss.c
then make some changes:
1.initialize the ring buffer with NUL chars instead of space(standard LZSS),both in encode() and decode().
2.add a dword at the head of the file indicating the length of the whole block,encoded or decoded,not so difficult,i think. :wink:
complete,now it works as a compressing method which SQUARESOFT uses
 
@bspbsp

What do you exactly mean with "2.". I don't understand, sorry.

When I get 32 bits from infile before decoding it, the decompressed file has the same size as the decompressed file produced by ficedulas lzs.exe.

When I put 32 bits to outfile before encoding the infile into it, it ends up with a different size as the original LZS file.
 
Bspbsp: Yes, i know this diffrences and they're applied to my program. If you want, you can use it, and I can send you a Delphi source eventually ;).
 
to Haruhiko:
what i mean is add a length dword at the beginning of the file,you can add it during the runtime

to M4v3R:
i'm totally new to Delphi :lol:
if you can give me a C++ copy ,i'd very appreciate. :D
 
Hm, I had modified lzss.c exactly this way by my own. But Encode() produces "garbage":

ENEMY000.LZS (512 Bytes) => Decode() => Encode() => ENEMY000.LZS (511 Bytes).
 
Can someone post the first four DWORDs (32 bits each) of the decompressed ENEMY000.LZS (hex-values) please? It's little-endian right? (MSVS .NET 2003 shows me some confusing values...  :isee:
 
to Haruhiko:
if you have been using the lzss compression,you can try to delete the first DWORD of the ENEMY000.LZS,then decode/encode it,then add a new DWORD at the beginning of the new file(simply a length)
to M4v3R:
of course!! it's of great help! :D
 
Now I understand the way how MSVS displays binary files.

e.g.:

10 00 00 00 = 16 dec
00 10 00 00 = 10 00 = 4096 dec

:evil:
 
Indeed, and not only MSVS but this is a standard in saving integers to file. You have allways read them from right ;). But when you write programs to read this integers, program reads it in good way, so it's no problem :).
 
Status
Not open for further replies.
Back
Top