Pascal LZMA usage sample?

General discussion of the site and my programs
Post Reply
mvandere
Posts: 2
Joined: Sun Jun 26, 2011 7:49 am

Pascal LZMA usage sample?

Post by mvandere » Sun Jun 26, 2011 7:54 am

Has anyone got an example of using the Pascal LZMA library?

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

alanbirtles
Site Admin
Posts: 495
Joined: Mon Sep 06, 2004 4:44 pm

Re: Pascal LZMA usage sample?

Post by alanbirtles » Sun Jun 26, 2011 10:14 am

lzmaalone is included in the source code

mvandere
Posts: 2
Joined: Sun Jun 26, 2011 7:49 am

Re: Pascal LZMA usage sample?

Post by mvandere » Sun Jun 26, 2011 11:42 pm

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'?

alanbirtles
Site Admin
Posts: 495
Joined: Mon Sep 06, 2004 4:44 pm

Re: Pascal LZMA usage sample?

Post by alanbirtles » Mon Jun 27, 2011 7:23 am

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++

Post Reply