Skip to content

Commit

Permalink
Use LZ4 as external dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Jklawreszuk committed Jan 14, 2023
1 parent 7578342 commit fb373aa
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 2,502 deletions.
41 changes: 0 additions & 41 deletions sources/core/Stride.Core.Serialization/LZ4/ILZ4Service.cs

This file was deleted.

369 changes: 0 additions & 369 deletions sources/core/Stride.Core.Serialization/LZ4/LZ4Codec.cs

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using System.IO;
using System.IO.Compression;
using System.Runtime.CompilerServices;
using K4os.Compression.LZ4;

namespace Stride.Core.LZ4
{
Expand Down Expand Up @@ -234,9 +235,8 @@ private void FlushCurrentChunk()
if (bufferOffset <= 0) return;

var compressed = new byte[bufferOffset];
var compressedLength = highCompression
? LZ4Codec.EncodeHC(dataBuffer, 0, bufferOffset, compressed, 0, bufferOffset)
: LZ4Codec.Encode(dataBuffer, 0, bufferOffset, compressed, 0, bufferOffset);
LZ4Level level = (highCompression ? LZ4Level.L09_HC : LZ4Level.L00_FAST);
var compressedLength = LZ4Codec.Encode(dataBuffer, 0, bufferOffset, compressed, 0, bufferOffset, level);

if (compressedLength <= 0 || compressedLength >= bufferOffset)
{
Expand Down Expand Up @@ -296,7 +296,7 @@ private bool AcquireNextChunk()
var passes = (int)flags >> 2;
if (passes != 0)
throw new NotSupportedException("Chunks with multiple passes are not supported.");
LZ4Codec.Decode(compressedDataBuffer, 0, compressedLength, dataBuffer, 0, originalLength, true);
LZ4Codec.Decode(compressedDataBuffer, 0, compressedLength, dataBuffer, 0, originalLength);
bufferLength = originalLength;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using Stride.Core.LZ4;
using Stride.Core.Serialization;
using Stride.Core.Serialization.Contents;
using Stride.Core.Serialization.Serializers;

namespace Stride.Core.Storage
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<PackageReference Include="K4os.Compression.LZ4.Legacy" Version="1.2.16" />
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
Expand Down
26 changes: 0 additions & 26 deletions sources/core/Stride.Core/Native/lz4/NativeLZ4Base.cs

This file was deleted.

Loading

0 comments on commit fb373aa

Please sign in to comment.