hallo
ich verwende folgende
zLIB http://www.dellapasqua.com/delphizlib/
Mein Code sieht so aus:
Delphi-Quellcode:
procedure Compress(InputFileName, OutputFileName: string);
var InputStream, OutputStream: TFileStream;
CompressionStream: TZCompressionStream;
begin
InputStream:=TFileStream.Create(InputFileName, fmOpenRead);
try
OutputStream:=TFileStream.Create(OutputFileName, fmCreate);
try
CompressionStream:=TZCompressionStream.Create(OutputStream, zcMax);
try
CompressionStream.CopyFrom(InputStream, InputStream.Size);
finally
CompressionStream.Free;
end;
finally
OutputStream.Free;
end;
finally
InputStream.Free;
end;
end;
procedure Decompress(InputFileName, OutputFileName: string);
var InputStream, OutputStream: TFileStream;
DeCompressionStream: TZDeCompressionStream;
Buf: array[0..4095] of Byte;
Count: Integer;
begin
InputStream:=TFileStream.Create(InputFileName, fmOpenRead);
try
OutputStream:=TFileStream.Create(OutputFileName, fmCreate);
try
DecompressionStream := TZDecompressionStream.Create(InputStream);
try
while true do
begin
Count := DecompressionStream.Read(Buf[0], SizeOf(Buf));
if Count = 0 then
break
else
OutputStream.Write(Buf[0], Count);
end;
finally
DecompressionStream.Free;
end;
finally
OutputStream.Free;
end;
finally
InputStream.Free;
end;
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
if Opendialog1.Execute and SaveDialog1.Execute then Compress(OpenDialog1.FileName,SaveDialog1.FileName);
end;
procedure TForm1.SpeedButton4Click(Sender: TObject);
begin
if Opendialog1.Execute and Savedialog2.Execute then DeCompress(OpenDialog1.FileName,SaveDialog2.FileName);
end;
Doch selbst bei angabe von zcMax ist der unterschied bei einer 1.57MB MP3 Datei gerademal ca 20kb ( nachher 1.55MB)
bei einem 70MB grossen Video sind es ca 3 MB.....
Ist die Komprimierungsrate von
zLIB tatsächlich so schlecht oder mache ich etwas falsch?
Hoffe ihr könnt mir helfen....
Danke schonmal