update to 0.7.2
This commit is contained in:
@@ -29,7 +29,7 @@ const
|
||||
|
||||
var
|
||||
SOList: array of array [0 .. CODEC_COUNT - 1] of TSOList;
|
||||
WrkMem: array of array [0 .. L_WORKMEM - 1] of Byte;
|
||||
WrkMem: array of Pointer;
|
||||
LZO1XVariant: Integer = LZO1X_999;
|
||||
LZO2AVariant: Integer = LZO2A_999;
|
||||
LZO1CVariant: Integer = LZO1C_999;
|
||||
@@ -158,6 +158,11 @@ begin
|
||||
end;
|
||||
Inc(X);
|
||||
end;
|
||||
if CodecAvailable[LZO1X_CODEC] then
|
||||
begin
|
||||
for X := Low(WrkMem) to High(WrkMem) do
|
||||
WrkMem[X] := nil;
|
||||
end;
|
||||
SetLength(Options, 0);
|
||||
for I := 1 to 9 do
|
||||
Insert(I, Options, Length(Options));
|
||||
@@ -179,6 +184,12 @@ begin
|
||||
for X := Low(SOList) to High(SOList) do
|
||||
for Y := Low(SOList[X]) to High(SOList[X]) do
|
||||
SOList[X, Y].Free;
|
||||
if CodecAvailable[LZO1X_CODEC] then
|
||||
begin
|
||||
for X := Low(WrkMem) to High(WrkMem) do
|
||||
if Assigned(WrkMem[X]) then
|
||||
FreeMemory(WrkMem[X]);
|
||||
end;
|
||||
end;
|
||||
|
||||
function LZOParse(Command: PChar; Option: PInteger;
|
||||
@@ -384,6 +395,8 @@ begin
|
||||
end;
|
||||
end;
|
||||
Params := '';
|
||||
if not Assigned(WrkMem[Instance]) then
|
||||
WrkMem[Instance] := GetMemory(L_WORKMEM);
|
||||
Res1 := StreamInfo^.NewSize;
|
||||
case X of
|
||||
LZO1X_CODEC:
|
||||
@@ -394,7 +407,7 @@ begin
|
||||
GetBits(StreamInfo^.Option, 12, 12).ToString;
|
||||
if not Result then
|
||||
if not lzo1x_999_compress_level(NewInput, StreamInfo^.NewSize,
|
||||
Buffer, @Res1, @WrkMem[Instance, 0], nil, 0, nil, I) = 0 then
|
||||
Buffer, @Res1, WrkMem[Instance], nil, 0, nil, I) = 0 then
|
||||
Res1 := 0;
|
||||
end;
|
||||
end;
|
||||
@@ -405,7 +418,7 @@ begin
|
||||
Params := 'v' + GetBits(StreamInfo^.Option, 12, 12).ToString;
|
||||
if not Result then
|
||||
if not lzo2a_999_compress(NewInput, StreamInfo^.NewSize, Buffer,
|
||||
@Res1, @WrkMem[Instance, 0]) = 0 then
|
||||
@Res1, WrkMem[Instance]) = 0 then
|
||||
Res1 := 0;
|
||||
end;
|
||||
end;
|
||||
@@ -416,7 +429,7 @@ begin
|
||||
Params := 'v' + GetBits(StreamInfo^.Option, 12, 12).ToString;
|
||||
if not Result then
|
||||
if not lzo1c_999_compress(NewInput, StreamInfo^.NewSize, Buffer,
|
||||
@Res1, @WrkMem[Instance, 0]) = 0 then
|
||||
@Res1, WrkMem[Instance]) = 0 then
|
||||
Res1 := 0;
|
||||
end;
|
||||
end;
|
||||
@@ -467,6 +480,8 @@ begin
|
||||
exit;
|
||||
Params := '';
|
||||
Buffer := Funcs^.Allocator(Instance, StreamInfo.NewSize);
|
||||
if not Assigned(WrkMem[Instance]) then
|
||||
WrkMem[Instance] := GetMemory(L_WORKMEM);
|
||||
Res1 := StreamInfo.NewSize;
|
||||
case X of
|
||||
LZO1X_CODEC:
|
||||
@@ -476,8 +491,8 @@ begin
|
||||
Params := 'l' + GetBits(StreamInfo.Option, 5, 7).ToString + ':' +
|
||||
'v' + GetBits(StreamInfo.Option, 12, 12).ToString;
|
||||
if not lzo1x_999_compress_level(Input, StreamInfo.NewSize, Buffer,
|
||||
@Res1, @WrkMem[Instance, 0], nil, 0, nil,
|
||||
GetBits(StreamInfo.Option, 5, 7)) = 0 then
|
||||
@Res1, WrkMem[Instance], nil, 0, nil, GetBits(StreamInfo.Option,
|
||||
5, 7)) = 0 then
|
||||
Res1 := 0;
|
||||
end;
|
||||
end;
|
||||
@@ -487,7 +502,7 @@ begin
|
||||
begin
|
||||
Params := 'v' + GetBits(StreamInfo.Option, 12, 12).ToString;
|
||||
if not lzo2a_999_compress(Input, StreamInfo.NewSize, Buffer, @Res1,
|
||||
@WrkMem[Instance, 0]) = 0 then
|
||||
WrkMem[Instance]) = 0 then
|
||||
Res1 := 0;
|
||||
end;
|
||||
end;
|
||||
@@ -497,7 +512,7 @@ begin
|
||||
begin
|
||||
Params := 'v' + GetBits(StreamInfo.Option, 12, 12).ToString;
|
||||
if not lzo2a_999_compress(Input, StreamInfo.NewSize, Buffer, @Res1,
|
||||
@WrkMem[Instance, 0]) = 0 then
|
||||
WrkMem[Instance]) = 0 then
|
||||
Res1 := 0;
|
||||
end;
|
||||
end;
|
||||
|
@@ -17,6 +17,7 @@ uses
|
||||
|
||||
const
|
||||
XTOOL_PRECOMP = $304C5458;
|
||||
XTOOL_BSIZE = 4194304;
|
||||
|
||||
type
|
||||
PEncodeOptions = ^TEncodeOptions;
|
||||
@@ -28,14 +29,16 @@ type
|
||||
LowMem: Boolean;
|
||||
DBaseFile, ExtractDir: String;
|
||||
CThreads, CLevel: Integer;
|
||||
CDict: Integer;
|
||||
CDict, COverlap: Integer;
|
||||
CHighCompress: Boolean;
|
||||
end;
|
||||
|
||||
PDecodeOptions = ^TDecodeOptions;
|
||||
|
||||
TDecodeOptions = record
|
||||
Method: String;
|
||||
CacheSize, Threads: Integer;
|
||||
Threads: Integer;
|
||||
CacheSize: Int64;
|
||||
Depth: Integer;
|
||||
DedupSysMem: Int64;
|
||||
end;
|
||||
@@ -111,7 +114,9 @@ var
|
||||
VERBOSE: Boolean = False;
|
||||
EXTRACT: Boolean = False;
|
||||
NOVERIFY: Boolean = False;
|
||||
COMPRESS: Boolean = False;
|
||||
COMPRESS: Byte = 0;
|
||||
EXTCOMP: String = '';
|
||||
GPUMEM: Int64 = 0;
|
||||
NULLOUT: Boolean = False;
|
||||
DupSysMem: Int64 = 0;
|
||||
DecodeMemBlock: Int64 = 512 * 1024 * 1024;
|
||||
@@ -120,6 +125,16 @@ var
|
||||
ConTask: TTask;
|
||||
Stopwatch: TStopwatch;
|
||||
|
||||
function ExtractExec(S: String): String;
|
||||
begin
|
||||
Result := S.Substring(0, Pos('.exe', S) + 3);
|
||||
end;
|
||||
|
||||
function ExtractParams(S: String): String;
|
||||
begin
|
||||
Result := S.Substring(Pos('.exe', S) + 4);
|
||||
end;
|
||||
|
||||
procedure PrintHelp;
|
||||
var
|
||||
I, J: Integer;
|
||||
@@ -178,6 +193,17 @@ begin
|
||||
Options.Method := S;
|
||||
Inc(I);
|
||||
end;
|
||||
S := ArgParse.AsString('-g', 0, '0');
|
||||
S := ReplaceText(S, 'KB', '* 1024^1');
|
||||
S := ReplaceText(S, 'MB', '* 1024^2');
|
||||
S := ReplaceText(S, 'GB', '* 1024^3');
|
||||
S := ReplaceText(S, 'K', '* 1024^1');
|
||||
S := ReplaceText(S, 'M', '* 1024^2');
|
||||
S := ReplaceText(S, 'G', '* 1024^3');
|
||||
S := ReplaceText(S, 'p', '%');
|
||||
S := ReplaceText(S, '%', '%*' + GPUSize.ToString);
|
||||
GPUMEM := EnsureRange(Round(ExpParse.Evaluate(S)), 0,
|
||||
Max(0, GPUSize - 512 * 1024 * 1024));
|
||||
S := ArgParse.AsString('-c', 0, '16mb');
|
||||
S := ReplaceText(S, 'KB', '* 1024^1');
|
||||
S := ReplaceText(S, 'MB', '* 1024^2');
|
||||
@@ -185,7 +211,8 @@ begin
|
||||
S := ReplaceText(S, 'K', '* 1024^1');
|
||||
S := ReplaceText(S, 'M', '* 1024^2');
|
||||
S := ReplaceText(S, 'G', '* 1024^3');
|
||||
Options.ChunkSize := Max(4 * 1024 * 1024, Round(ExpParse.Evaluate(S)));
|
||||
Options.ChunkSize := EnsureRange(Round(ExpParse.Evaluate(S)),
|
||||
4 * 1024 * 1024, 2047 * 1024 * 1024);
|
||||
S := ArgParse.AsString('-t', 0, '50p');
|
||||
S := ReplaceText(S, 'p', '%');
|
||||
S := ReplaceText(S, '%', '%*' + CPUCount.ToString);
|
||||
@@ -197,7 +224,7 @@ begin
|
||||
S := ReplaceText(S, 'K', '* 1024^1');
|
||||
S := ReplaceText(S, 'M', '* 1024^2');
|
||||
S := ReplaceText(S, 'G', '* 1024^3');
|
||||
DecodeMemBlock := Max(32 * 1024 * 1024, Round(ExpParse.Evaluate(S))); }
|
||||
DecodeMemBlock := EnsureRange(Round(ExpParse.Evaluate(S)), 32 * 1024 * 1024, 2047 * 1024 * 1024); }
|
||||
StoreDD := -2;
|
||||
I := 0;
|
||||
while True do
|
||||
@@ -244,14 +271,24 @@ begin
|
||||
begin
|
||||
List := DecodeStr(S, ':');
|
||||
Options.CThreads := Options.Threads;
|
||||
Options.CLevel := StrToIntDef(List[0], 0);
|
||||
Options.CHighCompress := List[0].Contains('x');
|
||||
if List[0].Contains('x') then
|
||||
Options.CLevel :=
|
||||
StrToIntDef(Copy(List[0], 1, List[0].Length - 1), 0)
|
||||
else
|
||||
Options.CLevel := StrToIntDef(List[0], 0);
|
||||
Options.COverlap := 2;
|
||||
for J := Low(List) to High(List) do
|
||||
begin
|
||||
if List[J].StartsWith('d', False) then
|
||||
Options.CDict := EnsureRange(ConvertToBytes(List[J].Substring(1)
|
||||
), FL2_DICTSIZE_MIN, FL2_DICTSIZE_MAX);
|
||||
if List[J].StartsWith('o', False) then
|
||||
Options.COverlap :=
|
||||
EnsureRange(ConvertToBytes(List[J].Substring(1)),
|
||||
FL2_BLOCK_OVERLAP_MIN, FL2_BLOCK_OVERLAP_MAX);
|
||||
end;
|
||||
COMPRESS := InRange(Options.CLevel, 1, 10);
|
||||
COMPRESS := Byte(InRange(Options.CLevel, 1, 10));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@@ -264,6 +301,9 @@ begin
|
||||
Options.ExtractDir := ArgParse.AsString('-x');
|
||||
if Options.ExtractDir <> '' then
|
||||
EXTRACT := DirectoryExists(Options.ExtractDir);
|
||||
EXTCOMP := ArgParse.AsString('-e');
|
||||
if FileExists(ExpandPath(PluginsPath + ExtractExec(EXTCOMP), True)) then
|
||||
COMPRESS := 2;
|
||||
finally
|
||||
ArgParse.Free;
|
||||
ExpParse.Free;
|
||||
@@ -283,14 +323,27 @@ begin
|
||||
ExpParse := TExpressionParser.Create;
|
||||
try
|
||||
Options.Method := ArgParse.AsString('-m');
|
||||
S := ArgParse.AsString('-c', 0, '64mb');
|
||||
S := ArgParse.AsString('-g', 0, '0');
|
||||
S := ReplaceText(S, 'KB', '* 1024^1');
|
||||
S := ReplaceText(S, 'MB', '* 1024^2');
|
||||
S := ReplaceText(S, 'GB', '* 1024^3');
|
||||
S := ReplaceText(S, 'K', '* 1024^1');
|
||||
S := ReplaceText(S, 'M', '* 1024^2');
|
||||
S := ReplaceText(S, 'G', '* 1024^3');
|
||||
Options.CacheSize := Max(4 * 1024 * 1024, Round(ExpParse.Evaluate(S)));
|
||||
S := ReplaceText(S, 'p', '%');
|
||||
S := ReplaceText(S, '%', '%*' + GPUSize.ToString);
|
||||
GPUMEM := EnsureRange(Round(ExpParse.Evaluate(S)), 0,
|
||||
Max(0, GPUSize - 512 * 1024 * 1024));
|
||||
S := ArgParse.AsString('-c', 0, '25p');
|
||||
S := ReplaceText(S, 'KB', '* 1024^1');
|
||||
S := ReplaceText(S, 'MB', '* 1024^2');
|
||||
S := ReplaceText(S, 'GB', '* 1024^3');
|
||||
S := ReplaceText(S, 'K', '* 1024^1');
|
||||
S := ReplaceText(S, 'M', '* 1024^2');
|
||||
S := ReplaceText(S, 'G', '* 1024^3');
|
||||
S := ReplaceText(S, 'p', '%');
|
||||
S := ReplaceText(S, '%', '%*' + GPUMEM.ToString);
|
||||
Options.CacheSize := EnsureRange(Round(ExpParse.Evaluate(S)), 0, GPUSize);
|
||||
S := ArgParse.AsString('-t', 0, '50p');
|
||||
S := ReplaceText(S, 'p', '%');
|
||||
S := ReplaceText(S, '%', '%*' + CPUCount.ToString);
|
||||
@@ -310,6 +363,7 @@ begin
|
||||
Options.DedupSysMem := -Options.DedupSysMem;
|
||||
SrepMemCfg := ArgParse.AsString('-sm', 0, '75p').ToLower;
|
||||
VERBOSE := ArgParse.AsBoolean('-v');
|
||||
EXTCOMP := ArgParse.AsString('-e');
|
||||
finally
|
||||
ArgParse.Free;
|
||||
ExpParse.Free;
|
||||
@@ -1592,7 +1646,7 @@ var
|
||||
DupIdx1, DupIdx2, DupCount: Integer;
|
||||
DupTyp: TDuplicate2;
|
||||
ErrStream: TStringStream;
|
||||
|
||||
LOutput, LCache: TStream;
|
||||
procedure SaveResources;
|
||||
var
|
||||
C, D: Integer;
|
||||
@@ -1621,30 +1675,54 @@ var
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure UpdateInfo;
|
||||
begin
|
||||
if NULLOUT then
|
||||
if StoreDD > 0 then
|
||||
EncInfo.SrepSize := TProcessStream(TBufferedStream(LOutput)
|
||||
.Instance).OutSize;
|
||||
if COMPRESS = 1 then
|
||||
EncInfo.CompSize := TLZMACompressStream(Output).OutSize
|
||||
else if COMPRESS = 2 then
|
||||
EncInfo.CompSize := TProcessStream(TBufferedStream(Output)
|
||||
.Instance).OutSize;
|
||||
end;
|
||||
|
||||
begin
|
||||
if (Depth = 0) then
|
||||
begin
|
||||
LCache := nil;
|
||||
if GPUMEM > 0 then
|
||||
try
|
||||
LCache := TGPUMemoryStream.Create(GPUMEM);
|
||||
except
|
||||
LCache := nil;
|
||||
end;
|
||||
if Assigned(LCache) then
|
||||
LCache.Size := GPUMEM;
|
||||
ErrStream := TStringStream.Create;
|
||||
if NULLOUT then
|
||||
begin
|
||||
if StoreDD > 0 then
|
||||
begin
|
||||
TempOutput := TBufferedStream.Create
|
||||
LOutput := TBufferedStream.Create
|
||||
(TProcessStream.Create(ExpandPath(PluginsPath + 'srep.exe', True),
|
||||
'-m' + StoreDD.ToString + ' -s' + SrepInSize + ' - -', GetCurrentDir,
|
||||
nil, Output, ErrStream), False, 4194304);
|
||||
TProcessStream(TBufferedStream(TempOutput).Instance).Execute;
|
||||
nil, Output, ErrStream), False, XTOOL_BSIZE);
|
||||
TProcessStream(TBufferedStream(LOutput).Instance).Execute;
|
||||
end
|
||||
else
|
||||
TempOutput := Output;
|
||||
LOutput := Output;
|
||||
end
|
||||
else if StoreDD > -2 then
|
||||
TempOutput := TBufferedStream.Create
|
||||
LOutput := TBufferedStream.Create
|
||||
(TFileStream.Create
|
||||
(LowerCase(ChangeFileExt(ExtractFileName(Utils.GetModuleName),
|
||||
'-dd.tmp')), fmCreate or fmShareDenyNone), False, 4194304)
|
||||
'-dd.tmp')), fmCreate or fmShareDenyNone), False, XTOOL_BSIZE)
|
||||
else
|
||||
TempOutput := Output;
|
||||
LOutput := Output;
|
||||
TempOutput := TBufferedStream.Create(TCacheWriteStream.Create(LOutput,
|
||||
LCache), False, XTOOL_BSIZE);
|
||||
end
|
||||
else
|
||||
TempOutput := Output;
|
||||
@@ -1886,12 +1964,7 @@ begin
|
||||
end;
|
||||
if Depth = 0 then
|
||||
begin
|
||||
if NULLOUT then
|
||||
if StoreDD > 0 then
|
||||
EncInfo.SrepSize := TProcessStream(TBufferedStream(TempOutput)
|
||||
.Instance).OutSize;
|
||||
if COMPRESS then
|
||||
EncInfo.CompSize := TLZMACompressStream(Output).OutSize;
|
||||
UpdateInfo;
|
||||
TDataStore1(DataStore).LoadEx;
|
||||
if Length(Tasks) > 1 then
|
||||
WaitForAll(Tasks);
|
||||
@@ -1959,18 +2032,21 @@ begin
|
||||
begin
|
||||
if StoreDD > 0 then
|
||||
begin
|
||||
TBufferedStream(TempOutput).Flush;
|
||||
TProcessStream(TBufferedStream(TempOutput).Instance)
|
||||
.WriteBuffer(StoreDD, 0);
|
||||
TProcessStream(TBufferedStream(TempOutput).Instance).Wait;
|
||||
TProcessStream(TBufferedStream(TempOutput).Instance).Done;
|
||||
TempOutput.Free;
|
||||
TBufferedStream(LOutput).Flush;
|
||||
TProcessStream(TBufferedStream(LOutput).Instance)
|
||||
.WriteBuffer(StoreDD, 0);
|
||||
TProcessStream(TBufferedStream(LOutput).Instance).Wait;
|
||||
TProcessStream(TBufferedStream(LOutput).Instance).Done;
|
||||
UpdateInfo;
|
||||
LOutput.Free;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
S := TFileStream(TBufferedStream(TempOutput).Instance).FileName;
|
||||
TBufferedStream(TempOutput).Flush;
|
||||
S := TFileStream(TBufferedStream(LOutput).Instance).FileName;
|
||||
TempOutput.Free;
|
||||
TBufferedStream(LOutput).Flush;
|
||||
if StoreDD > 0 then
|
||||
begin
|
||||
with TProcessStream.Create(ExpandPath(PluginsPath + 'srep.exe', True),
|
||||
@@ -1992,16 +2068,20 @@ begin
|
||||
end;
|
||||
end
|
||||
else
|
||||
Output.CopyFrom(TBufferedStream(TempOutput).Instance, 0);
|
||||
TempOutput.Free;
|
||||
Output.CopyFrom(TBufferedStream(LOutput).Instance, 0);
|
||||
LOutput.Free;
|
||||
DeleteFile(S);
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
UpdateInfo;
|
||||
TempOutput.Free;
|
||||
try
|
||||
EncFree;
|
||||
finally
|
||||
end;
|
||||
end;
|
||||
S := 'Decompression memory is ';
|
||||
I := ErrStream.DataString.IndexOf(S);
|
||||
J := 0;
|
||||
@@ -2077,7 +2157,7 @@ var
|
||||
DDList2: TArray<TDuplicate2>;
|
||||
DDCount2: Integer;
|
||||
DDIndex1, DDIndex2: Integer;
|
||||
CacheSize: Integer;
|
||||
CacheSize: Int64;
|
||||
|
||||
procedure PrecompOutput2(Instance: Integer; const Buffer: Pointer;
|
||||
Size: Integer);
|
||||
@@ -2241,17 +2321,30 @@ end;
|
||||
procedure DecInit(Input, Output: TStream; Options: PDecodeOptions);
|
||||
var
|
||||
I, J, K: Integer;
|
||||
I64: Int64;
|
||||
B: Byte;
|
||||
Bytes: TBytes;
|
||||
UI32: UInt32;
|
||||
DupTyp: TDuplicate1;
|
||||
LResData: TResData;
|
||||
LStream: TStream;
|
||||
begin
|
||||
GlobalSync := TCriticalSection.Create;
|
||||
SetLength(ThreadSync, Options^.Threads);
|
||||
for I := Low(ThreadSync) to High(ThreadSync) do
|
||||
ThreadSync[I] := TCriticalSection.Create;
|
||||
DupSysMem := Options^.DedupSysMem;
|
||||
I64 := GPUMEM - Options^.CacheSize;
|
||||
if I64 > 0 then
|
||||
begin
|
||||
try
|
||||
LStream := TGPUMemoryStream.Create(I64);
|
||||
except
|
||||
I64 := 0;
|
||||
end;
|
||||
if I64 > 0 then
|
||||
NStream.Add(LStream, I64);
|
||||
end;
|
||||
NStream.Add(TypeInfo(TMemoryStream), CalcSysMem);
|
||||
NStream.Add(TypeInfo(TPrecompVMStream));
|
||||
Input.ReadBuffer(Options^.Depth, Options^.Depth.Size);
|
||||
@@ -2377,6 +2470,7 @@ var
|
||||
UI32: UInt32;
|
||||
I, J: Integer;
|
||||
LStream: TProcessStream;
|
||||
LCache: TStream;
|
||||
procedure LoadResources;
|
||||
var
|
||||
C, D: Integer;
|
||||
@@ -2419,6 +2513,15 @@ begin
|
||||
DDIndex2 := 0;
|
||||
end;
|
||||
LogInt64 := 0;
|
||||
LCache := nil;
|
||||
if CacheSize > 0 then
|
||||
try
|
||||
LCache := TGPUMemoryStream.Create(CacheSize);
|
||||
except
|
||||
LCache := nil;
|
||||
end;
|
||||
if Assigned(LCache) then
|
||||
LCache.Size := CacheSize;
|
||||
end;
|
||||
with ComVars2[Depth] do
|
||||
begin
|
||||
@@ -2428,10 +2531,12 @@ begin
|
||||
True), '-d -s -mem' + SrepMemCfg + ' - -', GetCurrentDir, Input, nil);
|
||||
if not LStream.Execute then
|
||||
raise EReadError.CreateRes(@SReadError);
|
||||
DecInput[Index] := TCacheStream.Create(LStream, CacheSize);
|
||||
DecInput[Index] := TBufferedStream.Create(TCacheReadStream.Create(LStream,
|
||||
LCache), True, XTOOL_BSIZE);
|
||||
end
|
||||
else if Depth = 0 then
|
||||
DecInput[Index] := TCacheStream.Create(Input, CacheSize)
|
||||
DecInput[Index] := TBufferedStream.Create(TCacheReadStream.Create(Input,
|
||||
LCache), True, XTOOL_BSIZE)
|
||||
else
|
||||
DecInput[Index] := Input;
|
||||
DecOutput[Index] := Output;
|
||||
@@ -2617,8 +2722,8 @@ var
|
||||
' >> ' + ConvertKB2TB((EncInfo.InflSize + EncInfo.DupSize2) div 1024), '')
|
||||
+ ' >> ' + ConvertKB2TB(EncInfo.InflSize div 1024) +
|
||||
IfThen(StoreDD > 0, ' >> ' + ConvertKB2TB((EncInfo.SrepSize) div 1024),
|
||||
'') + IfThen(COMPRESS, ' >> ' + ConvertKB2TB((EncInfo.CompSize) div 1024),
|
||||
'') + ' ';
|
||||
'') + IfThen(COMPRESS > 0, ' >> ' + ConvertKB2TB((EncInfo.CompSize)
|
||||
div 1024), '') + ' ';
|
||||
SetConsoleCursorPosition(FHandle, Coords);
|
||||
WriteConsole(FHandle, PChar(SL.Text), Length(SL.Text), ulLength, nil);
|
||||
end;
|
||||
@@ -2695,38 +2800,83 @@ end;
|
||||
|
||||
procedure Encode(Input, Output: TStream; Options: TEncodeOptions);
|
||||
var
|
||||
Compressed: Boolean;
|
||||
LOutput: TStream;
|
||||
Compressed: Byte;
|
||||
LInput, LOutput: TStream;
|
||||
LCache: TStream;
|
||||
begin
|
||||
LCache := nil;
|
||||
{ if GPUMEM > 0 then
|
||||
try
|
||||
LCache := TGPUMemoryStream.Create(GPUMEM);
|
||||
except
|
||||
LCache := nil;
|
||||
end; }
|
||||
if Assigned(LCache) then
|
||||
LCache.Size := GPUMEM;
|
||||
LInput := TCacheReadStream.Create(Input, LCache);
|
||||
NULLOUT := TBufferedStream(Output).Instance is TNullStream;
|
||||
FillChar(EncInfo, SizeOf(EncInfo), 0);
|
||||
ConTask := TTask.Create;
|
||||
if GPUMEM > 0 then
|
||||
WriteLn(ErrOutput, GPUName + ' (' + ConvertKB2TB(GPUMEM div 1024) +
|
||||
' loaded)');
|
||||
Stopwatch := TStopwatch.Create;
|
||||
Stopwatch.Start;
|
||||
ConTask.Perform(EncodeStats);
|
||||
if not VERBOSE then
|
||||
ConTask.Start;
|
||||
try
|
||||
EncInit(Input, Output, @Options);
|
||||
EncInit(LInput, Output, @Options);
|
||||
Compressed := COMPRESS;
|
||||
Output.WriteBuffer(Compressed, Compressed.Size);
|
||||
if COMPRESS then
|
||||
if COMPRESS > 0 then
|
||||
begin
|
||||
LOutput := TLZMACompressStream.Create(Output);
|
||||
with LOutput as TLZMACompressStream do
|
||||
begin
|
||||
Threads := Options.CThreads;
|
||||
Dictionary := Options.CDict;
|
||||
case COMPRESS of
|
||||
1:
|
||||
begin
|
||||
LOutput := TLZMACompressStream.Create(Output);
|
||||
with LOutput as TLZMACompressStream do
|
||||
begin
|
||||
Level := Options.CLevel;
|
||||
Threads := Options.CThreads;
|
||||
Dictionary := Options.CDict;
|
||||
Overlap := Options.COverlap;
|
||||
HighCompress := Options.CHighCompress
|
||||
end;
|
||||
end;
|
||||
2:
|
||||
begin
|
||||
LOutput := TBufferedStream.Create
|
||||
(TProcessStream.Create(ExpandPath(PluginsPath +
|
||||
ExtractExec(EXTCOMP), True), ExtractParams(EXTCOMP),
|
||||
GetCurrentDir, nil, Output), False, XTOOL_BSIZE);
|
||||
TProcessStream(TBufferedStream(LOutput).Instance).Execute;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
LOutput := Output;
|
||||
EncData(Input, LOutput, 0, 0);
|
||||
EncData(LInput, LOutput, 0, 0);
|
||||
finally
|
||||
if COMPRESS then
|
||||
if COMPRESS > 0 then
|
||||
begin
|
||||
TLZMACompressStream(LOutput).Flush;
|
||||
EncInfo.CompSize := TLZMACompressStream(LOutput).OutSize;
|
||||
case COMPRESS of
|
||||
1:
|
||||
TLZMACompressStream(LOutput).Flush;
|
||||
2:
|
||||
begin
|
||||
TBufferedStream(LOutput).Flush;
|
||||
TProcessStream(TBufferedStream(LOutput).Instance)
|
||||
.WriteBuffer(StoreDD, 0);
|
||||
TProcessStream(TBufferedStream(LOutput).Instance).Wait;
|
||||
TProcessStream(TBufferedStream(LOutput).Instance).Done;
|
||||
end;
|
||||
end;
|
||||
if COMPRESS = 1 then
|
||||
EncInfo.CompSize := TLZMACompressStream(LOutput).OutSize
|
||||
else if COMPRESS = 2 then
|
||||
EncInfo.CompSize := TProcessStream(TBufferedStream(LOutput)
|
||||
.Instance).OutSize;
|
||||
LOutput.Free;
|
||||
end;
|
||||
try
|
||||
@@ -2740,15 +2890,19 @@ begin
|
||||
EncodeStats;
|
||||
ConTask.Wait;
|
||||
ConTask.Free;
|
||||
LInput.Free;
|
||||
end;
|
||||
|
||||
procedure Decode(Input, Output: TStream; Options: TDecodeOptions);
|
||||
var
|
||||
Compressed: Boolean;
|
||||
Compressed: Byte;
|
||||
LInput: TStream;
|
||||
begin
|
||||
FillChar(EncInfo, SizeOf(EncInfo), 0);
|
||||
ConTask := TTask.Create;
|
||||
if GPUMEM > 0 then
|
||||
WriteLn(ErrOutput, GPUName + ' (' + ConvertKB2TB(GPUMEM div 1024) +
|
||||
' loaded)');
|
||||
Stopwatch := TStopwatch.Create;
|
||||
Stopwatch.Start;
|
||||
ConTask.Perform(DecodeStats);
|
||||
@@ -2758,14 +2912,29 @@ begin
|
||||
try
|
||||
DecInit(Input, Output, @Options);
|
||||
Input.ReadBuffer(Compressed, Compressed.Size);
|
||||
if Compressed then
|
||||
if Compressed = 1 then
|
||||
LInput := TLZMADecompressStream.Create(Input)
|
||||
else if Compressed = 2 then
|
||||
begin
|
||||
LInput := TProcessStream.Create
|
||||
(ExpandPath(PluginsPath + ExtractExec(EXTCOMP), True),
|
||||
ExtractParams(EXTCOMP), GetCurrentDir, Input);
|
||||
TProcessStream(LInput).Execute;
|
||||
end
|
||||
else
|
||||
LInput := Input;
|
||||
DecChunk(LInput, Output, 0, 0);
|
||||
finally
|
||||
if Compressed then
|
||||
if Compressed > 0 then
|
||||
begin
|
||||
if Compressed = 2 then
|
||||
with LInput as TProcessStream do
|
||||
begin
|
||||
Wait;
|
||||
Done;
|
||||
end;
|
||||
LInput.Free;
|
||||
end;
|
||||
try
|
||||
NStream.Free;
|
||||
DecFree;
|
||||
|
@@ -431,8 +431,8 @@ begin
|
||||
SetLength(dcd, Count);
|
||||
for X := Low(cctx) to High(cctx) do
|
||||
begin
|
||||
cctx[X] := FLAC__stream_encoder_new;
|
||||
dctx[X] := FLAC__stream_decoder_new;
|
||||
cctx[X] := nil;
|
||||
dctx[X] := nil;
|
||||
ccd[X].Output := TMemoryStreamEx.Create(False);
|
||||
dcd[X].Input := TMemoryStreamEx.Create(False);
|
||||
dcd[X].Output := TMemoryStreamEx.Create(False);
|
||||
@@ -442,7 +442,7 @@ begin
|
||||
begin
|
||||
SetLength(JJInst, Count);
|
||||
for X := Low(JJInst) to High(JJInst) do
|
||||
JJInst[X] := GetMemory(jojpeg_Size);
|
||||
JJInst[X] := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -454,8 +454,10 @@ begin
|
||||
begin
|
||||
for X := Low(cctx) to High(cctx) do
|
||||
begin
|
||||
FLAC__stream_encoder_delete(cctx[X]);
|
||||
FLAC__stream_decoder_delete(dctx[X]);
|
||||
if Assigned(cctx[X]) then
|
||||
FLAC__stream_encoder_delete(cctx[X]);
|
||||
if Assigned(dctx[X]) then
|
||||
FLAC__stream_decoder_delete(dctx[X]);
|
||||
ccd[X].Output.Free;
|
||||
dcd[X].Input.Free;
|
||||
dcd[X].Output.Free;
|
||||
@@ -463,7 +465,8 @@ begin
|
||||
end;
|
||||
if CodecAvailable[JOJPEG_CODEC] then
|
||||
for X := Low(JJInst) to High(JJInst) do
|
||||
FreeMemory(JJInst[X]);
|
||||
if Assigned(JJInst[X]) then
|
||||
FreeMemory(JJInst[X]);
|
||||
end;
|
||||
|
||||
function MediaParse(Command: PChar; Option: PInteger;
|
||||
@@ -729,6 +732,8 @@ begin
|
||||
begin
|
||||
Params := 'l' + FlacLevel.ToString;
|
||||
Y := Integer.Size + PInteger(NewInput)^;
|
||||
if not Assigned(cctx[Instance]) then
|
||||
cctx[Instance] := FLAC__stream_encoder_new;
|
||||
Res := StreamInfo.NewSize - Y;
|
||||
Res := FlacEncode(cctx[Instance], @ccd[Instance], OldInput,
|
||||
StreamInfo^.OldSize, PByte(NewInput) + Y, Res, FlacLevel);
|
||||
@@ -775,6 +780,8 @@ begin
|
||||
end;
|
||||
JOJPEG_CODEC:
|
||||
begin
|
||||
if not Assigned(JJInst[Instance]) then
|
||||
JJInst[Instance] := GetMemory(jojpeg_Size);
|
||||
ctx := JJInst[Instance];
|
||||
FillChar(ctx^, jojpeg_Size, 0);
|
||||
Buffer := Funcs^.Allocator(Instance, J_WORKMEM * 2);
|
||||
@@ -851,6 +858,8 @@ begin
|
||||
begin
|
||||
Buffer := Funcs^.Allocator(Instance, StreamInfo.OldSize);
|
||||
Y := Integer.Size + PInteger(Input)^;
|
||||
if not Assigned(dctx[Instance]) then
|
||||
dctx[Instance] := FLAC__stream_decoder_new;
|
||||
Res := StreamInfo.OldSize;
|
||||
Res := FlacDecode(dctx[Instance], @dcd[Instance], PByte(Input) + Y,
|
||||
StreamInfo.NewSize - Y, Buffer + PInteger(Input)^, Res);
|
||||
@@ -898,6 +907,8 @@ begin
|
||||
end;
|
||||
JOJPEG_CODEC:
|
||||
begin
|
||||
if not Assigned(JJInst[Instance]) then
|
||||
JJInst[Instance] := GetMemory(jojpeg_Size);
|
||||
ctx := JJInst[Instance];
|
||||
FillChar(ctx^, jojpeg_Size, 0);
|
||||
Buffer := Funcs^.Allocator(Instance, J_WORKMEM);
|
||||
|
@@ -293,11 +293,7 @@ begin
|
||||
for X := Low(ZStream1[W]) to High(ZStream1[W]) do
|
||||
for Y := Low(ZStream1[W, X]) to High(ZStream1[W, X]) do
|
||||
for Z := Low(ZStream1[W, X, Y]) to High(ZStream1[W, X, Y]) do
|
||||
begin
|
||||
FillChar(ZStream1[W, X, Y, Z], SizeOf(z_stream), 0);
|
||||
deflateInit2(ZStream1[W, X, Y, Z], X, Z_DEFLATED, -(Z + 8), Y,
|
||||
Z_DEFAULT_STRATEGY);
|
||||
end;
|
||||
end;
|
||||
if CodecAvailable[REFLATE_CODEC] then
|
||||
begin
|
||||
@@ -305,8 +301,8 @@ begin
|
||||
SetLength(RefInst2, Count);
|
||||
for X := Low(RefInst1) to High(RefInst1) do
|
||||
begin
|
||||
RefInst1[X] := raw2hif_Alloc;
|
||||
RefInst2[X] := hif2raw_Alloc;
|
||||
RefInst1[X] := nil;
|
||||
RefInst2[X] := nil;
|
||||
end;
|
||||
end;
|
||||
if not BoolArray(CodecAvailable, False) then
|
||||
@@ -314,10 +310,7 @@ begin
|
||||
SetLength(ZStream2, Count);
|
||||
for X := Low(ZStream2) to High(ZStream2) do
|
||||
for Y := Low(ZStream2[X]) to High(ZStream2[X]) do
|
||||
begin
|
||||
FillChar(ZStream2[X, Y], SizeOf(z_stream), 0);
|
||||
inflateInit2(ZStream2[X, Y], -(Y + 8));
|
||||
end;
|
||||
for X := Low(SOList) to High(SOList) do
|
||||
for Y := Low(SOList[X]) to High(SOList[X]) do
|
||||
begin
|
||||
@@ -349,21 +342,25 @@ begin
|
||||
for X := Low(ZStream1[W]) to High(ZStream1[W]) do
|
||||
for Y := Low(ZStream1[W, X]) to High(ZStream1[W, X]) do
|
||||
for Z := Low(ZStream1[W, X, Y]) to High(ZStream1[W, X, Y]) do
|
||||
deflateEnd(ZStream1[W, X, Y, Z]);
|
||||
if Assigned(ZStream1[W, X, Y, Z].zalloc) then
|
||||
deflateEnd(ZStream1[W, X, Y, Z]);
|
||||
end;
|
||||
if CodecAvailable[REFLATE_CODEC] then
|
||||
begin
|
||||
for X := Low(RefInst1) to High(RefInst1) do
|
||||
begin
|
||||
raw2hif_Free(RefInst1[X]);
|
||||
hif2raw_Free(RefInst2[X]);
|
||||
if Assigned(RefInst1[X]) then
|
||||
raw2hif_Free(RefInst1[X]);
|
||||
if Assigned(RefInst2[X]) then
|
||||
hif2raw_Free(RefInst2[X]);
|
||||
end;
|
||||
end;
|
||||
if not BoolArray(CodecAvailable, False) then
|
||||
begin
|
||||
for X := Low(ZStream2) to High(ZStream2) do
|
||||
for Y := Low(ZStream2[X]) to High(ZStream2[X]) do
|
||||
inflateEnd(ZStream2[X, Y]);
|
||||
if Assigned(ZStream2[X, Y].zalloc) then
|
||||
inflateEnd(ZStream2[X, Y]);
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -446,6 +443,9 @@ begin
|
||||
else if BoolArray(CodecEnabled, False) then
|
||||
if Assigned(Add) then
|
||||
exit;
|
||||
for I := Low(ZStream2[Instance]) to High(ZStream2[Instance]) do
|
||||
if not Assigned(ZStream2[Instance, I].zalloc) then
|
||||
inflateInit2(ZStream2[Instance, I], -(I + 8));
|
||||
Pos := 0;
|
||||
Buffer := Funcs^.Allocator(Instance, Z_WORKMEM);
|
||||
IsZlib := False;
|
||||
@@ -532,7 +532,7 @@ begin
|
||||
Res := inflate(ZStream^, Z_BLOCK);
|
||||
if not(Res in [Z_OK, Z_STREAM_END]) then
|
||||
begin
|
||||
if (Res <> Z_DATA_ERROR) and (LastIn >= Z_MINSIZE) then
|
||||
if { (Res <> Z_DATA_ERROR) and } (LastIn >= Z_MINSIZE) then
|
||||
Res := Z_STREAM_END;
|
||||
break;
|
||||
end;
|
||||
@@ -696,6 +696,9 @@ begin
|
||||
(GetBits(StreamInfo^.Option, 12, 3) + 8).ToString;
|
||||
ZStream := @ZStream1[Instance, L, M,
|
||||
GetBits(StreamInfo^.Option, 12, 3)];
|
||||
if not Assigned(ZStream^.zalloc) then
|
||||
deflateInit2(ZStream^, L, Z_DEFLATED,
|
||||
-(GetBits(StreamInfo^.Option, 12, 3) + 8), M, Z_DEFAULT_STRATEGY);
|
||||
if not Result then
|
||||
begin
|
||||
ZStream^.next_in := NewInput;
|
||||
@@ -746,6 +749,8 @@ begin
|
||||
begin
|
||||
Buffer := Funcs^.Allocator(Instance, R_WORKMEM * 2);
|
||||
J := 0;
|
||||
if not Assigned(RefInst1[Instance]) then
|
||||
RefInst1[Instance] := raw2hif_Alloc;
|
||||
HR := RefInst1[Instance];
|
||||
if StreamInfo^.Status >= TStreamStatus.Predicted then
|
||||
L := GetBits(StreamInfo^.Option, 5, 7)
|
||||
@@ -764,7 +769,6 @@ begin
|
||||
if (Res1 in [0, 2]) or (Res1 > 3) then
|
||||
begin
|
||||
Res2 := raw2hif_getoutlen(HR);
|
||||
// ShowMessage('enc: ' + Res2.ToString);
|
||||
Output(Instance, Buffer, Res2);
|
||||
Inc(J, Res2);
|
||||
raw2hif_addbuf(HR, Buffer, R_WORKMEM);
|
||||
@@ -791,13 +795,14 @@ begin
|
||||
begin
|
||||
if GetBits(StreamInfo^.Option, 15, 1) = 1 then
|
||||
begin
|
||||
if not Assigned(RefInst2[Instance]) then
|
||||
RefInst2[Instance] := hif2raw_Alloc;
|
||||
HR := RefInst2[Instance];
|
||||
I := 0;
|
||||
J := 0;
|
||||
M := 0;
|
||||
CRC := 0;
|
||||
Ptr := Funcs^.Storage(Instance, @M);
|
||||
// ShowMessage('dec: ' + M.ToString);
|
||||
hif2raw_Init(HR, L);
|
||||
while True do
|
||||
begin
|
||||
@@ -828,7 +833,6 @@ begin
|
||||
if (GetBits(StreamInfo^.Option, 15, 1) = 0) or
|
||||
(CRC = Hash32(0, OldInput, StreamInfo^.OldSize)) then
|
||||
begin
|
||||
// ShowMessage('Verified!');
|
||||
SetBits(StreamInfo^.Option, L, 5, 7);
|
||||
Result := True;
|
||||
end;
|
||||
@@ -889,6 +893,9 @@ begin
|
||||
Params := 'l' + GetBits(StreamInfo.Option, 5, 7).ToString + ':' + 'w' +
|
||||
(GetBits(StreamInfo.Option, 12, 3) + 8).ToString;
|
||||
ZStream := @ZStream1[Instance, L, M, GetBits(StreamInfo.Option, 12, 3)];
|
||||
if not Assigned(ZStream^.zalloc) then
|
||||
deflateInit2(ZStream^, L, Z_DEFLATED,
|
||||
-(GetBits(StreamInfo.Option, 12, 3) + 8), M, Z_DEFAULT_STRATEGY);
|
||||
ZStream^.next_in := Input;
|
||||
ZStream^.avail_in := StreamInfo.NewSize;
|
||||
deflateReset(ZStream^);
|
||||
@@ -910,6 +917,8 @@ begin
|
||||
REFLATE_CODEC:
|
||||
begin
|
||||
Buffer := Funcs^.Allocator(Instance, R_WORKMEM);
|
||||
if not Assigned(RefInst2[Instance]) then
|
||||
RefInst2[Instance] := hif2raw_Alloc;
|
||||
HR := RefInst2[Instance];
|
||||
I := 0;
|
||||
J := 0;
|
||||
|
@@ -71,8 +71,8 @@ begin
|
||||
SetLength(dctx, Count);
|
||||
for X := Low(cctx) to High(cctx) do
|
||||
begin
|
||||
cctx[X] := ZSTD_createCCtx;
|
||||
dctx[X] := ZSTD_createDCtx;
|
||||
cctx[X] := nil;
|
||||
dctx[X] := nil;
|
||||
end;
|
||||
end;
|
||||
SetLength(Options, 0);
|
||||
@@ -95,8 +95,10 @@ begin
|
||||
begin
|
||||
for X := Low(cctx) to High(cctx) do
|
||||
begin
|
||||
ZSTD_freeCCtx(cctx[X]);
|
||||
ZSTD_freeDCtx(dctx[X]);
|
||||
if Assigned(cctx[X]) then
|
||||
ZSTD_freeCCtx(cctx[X]);
|
||||
if Assigned(dctx[X]) then
|
||||
ZSTD_freeDCtx(dctx[X]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@@ -150,7 +152,11 @@ begin
|
||||
Buffer := Funcs^.Allocator(Instance, Y);
|
||||
case X of
|
||||
ZSTD_CODEC:
|
||||
Y := ZSTD_decompressDCtx(dctx[Instance], Buffer, Y, Input, X);
|
||||
begin
|
||||
if not Assigned(dctx[Instance]) then
|
||||
dctx[Instance] := ZSTD_createDCtx;
|
||||
Y := ZSTD_decompressDCtx(dctx[Instance], Buffer, Y, Input, X);
|
||||
end;
|
||||
end;
|
||||
if (Y > DI1.OldSize) then
|
||||
begin
|
||||
@@ -188,6 +194,8 @@ begin
|
||||
if Z <= 0 then
|
||||
Z := ZMaxSize;
|
||||
Buffer := Funcs^.Allocator(Instance, Z);
|
||||
if not Assigned(dctx[Instance]) then
|
||||
dctx[Instance] := ZSTD_createDCtx;
|
||||
Y := ZSTD_decompressDCtx(dctx[Instance], Buffer, Z, Input + Pos, X);
|
||||
// Y := ZSTD_decompress_usingDDict(dctx[Instance], Buffer, Z, Input + Pos, X, ddict);
|
||||
if (X < Y) then
|
||||
@@ -231,8 +239,12 @@ begin
|
||||
Buffer := Funcs^.Allocator(Instance, StreamInfo^.NewSize);
|
||||
case X of
|
||||
ZSTD_CODEC:
|
||||
Res := ZSTD_decompressDCtx(dctx[Instance], Buffer, StreamInfo^.NewSize,
|
||||
Input, StreamInfo^.OldSize);
|
||||
begin
|
||||
if not Assigned(dctx[Instance]) then
|
||||
dctx[Instance] := ZSTD_createDCtx;
|
||||
Res := ZSTD_decompressDCtx(dctx[Instance], Buffer, StreamInfo^.NewSize,
|
||||
Input, StreamInfo^.OldSize);
|
||||
end;
|
||||
end;
|
||||
if Res > StreamInfo^.OldSize then
|
||||
begin
|
||||
@@ -285,6 +297,8 @@ begin
|
||||
{ ZSTD_CCtx_reset(cctx[Instance], ZSTD_reset_session_and_parameters);
|
||||
ZSTD_CCtx_setParameter(cctx[Instance], ZSTD_c_strategy, 5);
|
||||
ZSTD_CCtx_setParameter(cctx[Instance], ZSTD_c_compressionLevel, I); }
|
||||
if not Assigned(cctx[Instance]) then
|
||||
cctx[Instance] := ZSTD_createCCtx;
|
||||
if not Result then
|
||||
Res1 := ZSTD_compressCCtx(cctx[Instance], Buffer,
|
||||
StreamInfo^.NewSize, NewInput, StreamInfo^.NewSize, I);
|
||||
@@ -330,6 +344,8 @@ begin
|
||||
A := Pred(I);
|
||||
for B := A downto 1 do
|
||||
begin
|
||||
if not Assigned(cctx[Instance]) then
|
||||
cctx[Instance] := ZSTD_createCCtx;
|
||||
Res1 := ZSTD_compressCCtx(cctx[Instance], Buffer, StreamInfo^.NewSize,
|
||||
NewInput, StreamInfo^.NewSize, B);
|
||||
if (Res1 = StreamInfo^.OldSize) and CompareMem(OldInput, Buffer,
|
||||
@@ -379,10 +395,14 @@ begin
|
||||
Params := 'l' + GetBits(StreamInfo.Option, 5, 7).ToString;
|
||||
case X of
|
||||
ZSTD_CODEC:
|
||||
Res1 := ZSTD_compressCCtx(cctx[Instance], Buffer, StreamInfo.NewSize,
|
||||
Input, StreamInfo.NewSize, GetBits(StreamInfo.Option, 5, 7));
|
||||
{ Res1 := ZSTD_compress_usingCDict(cctx[Instance], Buffer,
|
||||
StreamInfo.NewSize, Input, StreamInfo.NewSize, cdict); }
|
||||
begin
|
||||
if not Assigned(cctx[Instance]) then
|
||||
cctx[Instance] := ZSTD_createCCtx;
|
||||
Res1 := ZSTD_compressCCtx(cctx[Instance], Buffer, StreamInfo.NewSize,
|
||||
Input, StreamInfo.NewSize, GetBits(StreamInfo.Option, 5, 7));
|
||||
{ Res1 := ZSTD_compress_usingCDict(cctx[Instance], Buffer,
|
||||
StreamInfo.NewSize, Input, StreamInfo.NewSize, cdict); }
|
||||
end;
|
||||
end;
|
||||
Funcs^.LogRestore(ZSTDCodecs[GetBits(StreamInfo.Option, 0, 5)], PChar(Params),
|
||||
StreamInfo.OldSize, StreamInfo.NewSize, Res1, True);
|
||||
|
Reference in New Issue
Block a user