added option to change recompression level to be used by reflate

This commit is contained in:
Razor12911 2022-02-17 08:21:42 +02:00
parent 97c6b15949
commit d7fdc2b45c
1 changed files with 3 additions and 5 deletions

View File

@ -38,6 +38,7 @@ var
ZStream2: array of array [0 .. 7] of z_stream; ZStream2: array of array [0 .. 7] of z_stream;
ZWinBits: Integer = Z_WINBITS; ZWinBits: Integer = Z_WINBITS;
RefInst1, RefInst2: TArray<Pointer>; RefInst1, RefInst2: TArray<Pointer>;
RLevel: Integer = R_LEVEL;
CodecAvailable, CodecEnabled: TArray<Boolean>; CodecAvailable, CodecEnabled: TArray<Boolean>;
Storage: TArray<TMemoryStream>; Storage: TArray<TMemoryStream>;
Scan2Pos: TArray<Integer>; Scan2Pos: TArray<Integer>;
@ -91,8 +92,7 @@ begin
CodecEnabled[REFLATE_CODEC] := True; CodecEnabled[REFLATE_CODEC] := True;
if Funcs^.GetParam(Command, X, 'l') <> '' then if Funcs^.GetParam(Command, X, 'l') <> '' then
for I := Low(SOList) to High(SOList) do for I := Low(SOList) to High(SOList) do
SOList[I][REFLATE_CODEC].Update RLevel := StrToInt(Funcs^.GetParam(Command, X, 'l'));
([StrToInt(Funcs^.GetParam(Command, X, 'l'))], True);
end end
else if (CompareText(S, ZlibCodecs[PREFLATE_CODEC]) = 0) and PreflateDLL.DLLLoaded else if (CompareText(S, ZlibCodecs[PREFLATE_CODEC]) = 0) and PreflateDLL.DLLLoaded
then then
@ -143,8 +143,6 @@ begin
for I := 11 to 99 do for I := 11 to 99 do
if I mod 10 <> 0 then if I mod 10 <> 0 then
Insert(I, Options, Length(Options)); Insert(I, Options, Length(Options));
REFLATE_CODEC:
Options := [R_LEVEL];
end; end;
if SOList[X, Y].Count = 0 then if SOList[X, Y].Count = 0 then
SOList[X, Y].Update(Options); SOList[X, Y].Update(Options);
@ -530,7 +528,7 @@ begin
if StreamInfo^.Status = TStreamStatus.Predicted then if StreamInfo^.Status = TStreamStatus.Predicted then
L := GetBits(StreamInfo^.Option, 5, 7) L := GetBits(StreamInfo^.Option, 5, 7)
else else
L := R_LEVEL; L := RLevel;
if L > 9 then if L > 9 then
L := L div 10; L := L div 10;
L := EnsureRange(L, 1, 9); L := EnsureRange(L, 1, 9);