Page 1 of 1

Pascal LZMA usage sample?

Posted: Sun Jun 26, 2011 7:54 am
by mvandere
Has anyone got an example of using the Pascal LZMA library?

Something like the LZMA.EXE described in LZMA.txt, perhaps.

Re: Pascal LZMA usage sample?

Posted: Sun Jun 26, 2011 10:14 am
by alanbirtles
lzmaalone is included in the source code

Re: Pascal LZMA usage sample?

Posted: Sun Jun 26, 2011 11:42 pm
by mvandere
Uh, gee, I looked at that, but it didn't look like what I expected, guess I've never seen an object orientated command line program before :oops:

First off, GetInt should look like this, it doesn't work very well the way it is coded :(
function GetInt(const str:string;const offset:integer):integer;
var s:string;
begin
s:=GetStr(str,offset);
result:=strtoint(s);
end;

Secondly since I am using Delphi I think the $MODE at the start of LZMAALONE needs to be wrapped up a bit like this
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}

Now onto my main problem. What I need is a high compression rate with a low dictionary size (so I can decompress on a small embedded system), so I was trying to run LZMAALONE with dictionary sizes of 11 (2048 bytes) and 12 (4096 bytes).

But LZMAALONE seems to get access violations for any dictionary size below 17 (131,072 bytes), unfortunately Delphi isn't trapping this error at all so I can't 'easily' debug it.

Prehaps even worse, at that dictionary size it only gets about 4:1 compression on my data, which is well below my desired target compression for even a 2k dictionary size. (7z gets 10:1 on the same data, it says LZMA but I'm not sure my efforts to influence the dictionary size have been successful)

Would anyone know if LZMAAOLONE is using the dictionary sizes 'correctly'?

Re: Pascal LZMA usage sample?

Posted: Mon Jun 27, 2011 7:23 am
by alanbirtles
you are far better off using the c++ version of the lzma sdk. the pascal version is based on the java version and both are quite old compared to the c++