#include <Compression.h>
|
static uint32 | GetCompressorVersion (FName FormatName) |
|
static int32 | CompressMemoryBound (FName FormatName, int32 UncompressedSize, ECompressionFlags Flags=COMPRESS_NoFlags, int32 CompressionData=0) |
|
static int32 | GetMaximumCompressedSize (FName FormatName, int32 UncompressedSize, ECompressionFlags Flags=COMPRESS_NoFlags, int32 CompressionData=0) |
|
static bool | CompressMemory (FName FormatName, void *CompressedBuffer, int32 &CompressedSize, const void *UncompressedBuffer, int32 UncompressedSize, ECompressionFlags Flags=COMPRESS_NoFlags, int32 CompressionData=0) |
|
static bool | CompressMemoryIfWorthDecompressing (FName FormatName, int32 MinBytesSaved, int32 MinPercentSaved, void *CompressedBuffer, int32 &CompressedSize, const void *UncompressedBuffer, int32 UncompressedSize, ECompressionFlags Flags=COMPRESS_NoFlags, int32 CompressionData=0) |
|
static bool | UncompressMemory (FName FormatName, void *UncompressedBuffer, int32 UncompressedSize, const void *CompressedBuffer, int32 CompressedSize, ECompressionFlags Flags=COMPRESS_NoFlags, int32 CompressionData=0) |
|
static bool | UncompressMemoryStream (FName FormatName, void *UncompressedBuffer, int32 UncompressedSize, IMemoryReadStream *Stream, int64 StreamOffset, int32 CompressedSize, ECompressionFlags Flags=COMPRESS_NoFlags, int32 CompressionData=0) |
|
static FString | GetCompressorDDCSuffix (FName FormatName) |
|
static bool | IsFormatValid (FName FormatName) |
|
static bool | VerifyCompressionFlagsValid (int32 InCompressionFlags) |
|
static FName | GetCompressionFormatFromDeprecatedFlags (ECompressionFlags DeprecatedFlags) |
|
Definition at line 28 of file Compression.h.
◆ CompressMemory()
Thread-safe abstract compression routine. Compresses memory from uncompressed buffer and writes it to compressed buffer. Updates CompressedSize with size of compressed data. Compression controlled by the passed in flags. CompressMemory is expected to return true and write valid data even if it expanded bytes. Always check CompressedSize >= UncompressedSize and fall back to uncompressed, or use CompressMemoryIfWorthDecompressing
- Parameters
-
FormatName | Name of the compression format |
CompressedBuffer | Buffer compressed data is going to be written to |
CompressedSize | [in/out] Size of CompressedBuffer, at exit will be size of compressed data |
UncompressedBuffer | Buffer containing uncompressed data |
UncompressedSize | Size of uncompressed data in bytes |
Flags | Flags to control what method to use and optionally control memory vs speed |
CompressionData | Additional compression parameter (specifies BitWindow value for ZLIB compression format) |
- Returns
- true if compression succeeds, false if it fails because CompressedBuffer was too small or other reasons
◆ CompressMemoryBound()
Thread-safe abstract compression routine to query memory requirements for a compression operation. This is the minimize size to allocate the buffer for CompressMemory (encoding). Use GetMaximumCompressedSize at decode to know how large a compressed buffer may be.
- Parameters
-
FormatName | Name of the compression format |
UncompressedSize | Size of uncompressed data in bytes |
Flags | Flags to control what method to use and optionally control memory vs speed |
CompressionData | Additional compression parameter (specifies BitWindow value for ZLIB compression format) |
- Returns
- The maximum possible bytes needed for compression of data buffer of size UncompressedSize
◆ CompressMemoryIfWorthDecompressing()
Same as CompressMemory but evaluates if the compression gain is worth the runtime decode time returns false if the size saving is not worth it (also if CompressedSize >= UncompressedSize) if false is returned, send the data uncompressed instead
- Parameters
-
FormatName | Name of the compression format |
MinBytesSaved | Minimum amount of bytes which should be saved when performing compression, otherwise false is returned |
MinPercentSaved | Minimum percentage of the buffer which should be saved when performing compression, otherwise false is returned |
CompressedBuffer | Buffer compressed data is going to be written to |
CompressedSize | [in/out] Size of CompressedBuffer, at exit will be size of compressed data |
UncompressedBuffer | Buffer containing uncompressed data |
UncompressedSize | Size of uncompressed data in bytes |
Flags | Flags to control what method to use and optionally control memory vs speed |
CompressionData | Additional compression parameter (specifies BitWindow value for ZLIB compression format) |
- Returns
- true if compression succeeds, false if it fails because CompressedBuffer was too small or other reasons
◆ GetCompressionFormat()
Find a compression format module by name, returning nullptr if no module found
◆ GetCompressionFormatFromDeprecatedFlags()
◆ GetCompressorDDCSuffix()
Returns a string which can be used to identify if a format has become out of date
- Parameters
-
FormatName | name of the format to retrieve the DDC suffix for |
- Returns
- unique DDC key string which will be different when the format is changed / updated
◆ GetCompressorVersion()
Returns a version number for a specified format
- Parameters
-
FormatName | Compressor format name (eg NAME_Zlib) |
- Returns
- An interpretation of an internal version number for a specific format (different formats will have different layouts) this should change if a version is updated
◆ GetMaximumCompressedSize()
Thread-safe abstract compression routine to query maximum compressed size that could be made. CompressMemoryBound is strictly greater equal GetMaximumCompressedSize.
- Parameters
-
FormatName | Name of the compression format |
UncompressedSize | Size of uncompressed data in bytes |
Flags | Flags to control what method to use and optionally control memory vs speed |
CompressionData | Additional compression parameter (specifies BitWindow value for ZLIB compression format) |
- Returns
- The maximum possible size of valid compressed data made by this format
◆ IsFormatValid()
Checks to see if a format will be usable, so that a fallback can be used
- Parameters
-
FormatName | The name of the format to test |
◆ UncompressMemory()
Thread-safe abstract decompression routine. Uncompresses memory from compressed buffer and writes it to uncompressed buffer. UncompressedSize is expected to be the exact size of the data after decompression.
- Parameters
-
FormatName | Name of the compression format |
UncompressedBuffer | Buffer containing uncompressed data |
UncompressedSize | Size of uncompressed data in bytes |
CompressedBuffer | Buffer compressed data is going to be read from |
CompressedSize | Size of CompressedBuffer data in bytes |
Flags | Flags to control what method to use to decompress |
CompressionData | Additional decompression parameter (specifies BitWindow value for ZLIB compression format) |
- Returns
- true if compression succeeds, false if it fails because CompressedBuffer was too small or other reasons
◆ UncompressMemoryStream()
◆ VerifyCompressionFlagsValid()
static bool FCompression::VerifyCompressionFlagsValid |
( |
int32 | InCompressionFlags | ) |
|
|
static |
Verifies if the passed in value represents valid compression flags
- Parameters
-
InCompressionFlags | Value to test |
◆ CompressionFormats
Mapping of Compression FNames to their compressor objects
Definition at line 153 of file Compression.h.
◆ CompressionFormatsCriticalSection
◆ CompressorDstBytes
Number of bytes after compression.
Definition at line 35 of file Compression.h.
◆ CompressorSrcBytes
Number of bytes before compression.
Definition at line 33 of file Compression.h.
◆ CompressorTimeCycles
Time spent compressing data in cycles.
Definition at line 31 of file Compression.h.
The documentation for this struct was generated from the following file:
- C:/Users/lachl/Downloads/ArkServerAPI_NEW/ASA/AsaApi/AsaApi/Core/Public/API/UE/Misc/Compression.h