#include <Compression.h>
|
| static CORE_API uint32 | GetCompressorVersion (FName FormatName) |
| |
| static CORE_API bool | CompressMemoryBound (FName InFormatName, int64 &OutBufferSizeRequired, int64 InUncompressedSizeBytes, uintptr_t InCompressionData=0) |
| |
| static CORE_API int32 | CompressMemoryBound (FName FormatName, int32 UncompressedSize, ECompressionFlags Flags=COMPRESS_NoFlags, int32 CompressionData=0) |
| |
| static CORE_API bool | GetMaximumCompressedSize (FName InFormatName, int64 &OutMaxCompressedSize, int64 InUncompressedSizeBytes, uintptr_t InCompressionData=0) |
| |
| static CORE_API int32 | GetMaximumCompressedSize (FName FormatName, int32 UncompressedSize, ECompressionFlags Flags=COMPRESS_NoFlags, int32 CompressionData=0) |
| |
| static CORE_API bool | CompressMemory (FName FormatName, void *CompressedBuffer, int64 &CompressedSize, const void *UncompressedBuffer, int64 UncompressedSize, ECompressionFlags Flags=COMPRESS_NoFlags, uintptr_t CompressionData=0) |
| |
| static CORE_API bool | CompressMemory (FName FormatName, void *CompressedBuffer, int32 &CompressedSize, const void *UncompressedBuffer, int32 UncompressedSize, ECompressionFlags Flags=COMPRESS_NoFlags, int32 CompressionData=0) |
| |
| static CORE_API bool | CompressMemoryIfWorthDecompressing (FName FormatName, bool &bOutWasCompressed, int64 MinBytesSaved, int32 MinPercentSaved, void *CompressedBuffer, int64 &CompressedSize, const void *UncompressedBuffer, int64 UncompressedSize, ECompressionFlags Flags=COMPRESS_NoFlags, uintptr_t CompressionData=0) |
| |
| static CORE_API 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 CORE_API bool | UncompressMemory (FName FormatName, void *UncompressedBuffer, int64 UncompressedSize, const void *CompressedBuffer, int64 CompressedSize, ECompressionFlags Flags=COMPRESS_NoFlags, uintptr_t CompressionData=0) |
| |
| static CORE_API bool | UncompressMemoryStream (FName FormatName, void *UncompressedBuffer, int64 UncompressedSize, IMemoryReadStream *Stream, int64 StreamOffset, int64 CompressedSize, ECompressionFlags Flags=COMPRESS_NoFlags, uintptr_t CompressionData=0) |
| |
| static CORE_API FString | GetCompressorDDCSuffix (FName FormatName) |
| |
| static CORE_API bool | IsFormatValid (FName FormatName) |
| |
| static CORE_API bool | VerifyCompressionFlagsValid (int32 InCompressionFlags) |
| |
| static CORE_API FName | GetCompressionFormatFromDeprecatedFlags (ECompressionFlags DeprecatedFlags) |
| |
◆ CompressMemory() [1/2]
◆ CompressMemory() [2/2]
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 - see comments a top of FCompression struct. |
- Returns
- true if compression succeeds, false if it fails because CompressedBuffer was too small or other reasons
◆ CompressMemoryBound() [1/2]
◆ CompressMemoryBound() [2/2]
| bool FCompression::CompressMemoryBound |
( |
FName |
InFormatName, |
|
|
int64 & |
OutBufferSizeRequired, |
|
|
int64 |
InUncompressedSizeBytes, |
|
|
uintptr_t |
InCompressionData = 0 |
|
) |
| |
|
static |
Thread-safe abstract compression routine to query buffer 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.
Despite the name, this has nothing to do with how much memory will be allocated during compression.
- Parameters
-
| FormatName | Name of the compression format |
| UncompressedSize | Size of uncompressed data in bytes |
| CompressionData | Additional compression parameter - see comments a top of FCompression struct. |
| OutBufferSizeRequired | The maximum possible bytes needed for compression of a data buffer of the given size. |
- Returns
- false if the bounds couldn't be determined - e.g. the format is unknown or the size isn't supported by the format.
◆ CompressMemoryIfWorthDecompressing() [1/2]
Same as CompressMemory but evaluates if the compression gain is worth the runtime decode time.
- Parameters
-
| FormatName | Name of the compression format |
| bOutWasCompressed | [out] Whether the compression was worth it. The data is still compressed. |
| 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 - see comments a top of FCompression struct. |
- Returns
- true if compression succeeds, false if it fails because CompressedBuffer was too small or other reasons
◆ CompressMemoryIfWorthDecompressing() [2/2]
◆ GetCompressionFormatFromDeprecatedFlags()
◆ GetCompressorDDCSuffix()
| FString FCompression::GetCompressorDDCSuffix |
( |
FName |
FormatName | ) |
|
|
static |
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()
| uint32 FCompression::GetCompressorVersion |
( |
FName |
FormatName | ) |
|
|
static |
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() [1/2]
◆ GetMaximumCompressedSize() [2/2]
| bool FCompression::GetMaximumCompressedSize |
( |
FName |
InFormatName, |
|
|
int64 & |
OutMaxCompressedSize, |
|
|
int64 |
InUncompressedSizeBytes, |
|
|
uintptr_t |
InCompressionData = 0 |
|
) |
| |
|
static |
Thread-safe abstract compression routine to query maximum compressed size that could be made. This is used for making buffers that could hold any compressed buffer that started uncompressed with the given size. It's distinct from the buffer needed to compress! If you are calling CompressMemory then you need to pass a buffer sized based on CompressMemoryBound!
CompressMemoryBound is strictly greater equal GetMaximumCompressedSize.
- Parameters
-
| FormatName | Name of the compression format |
| OutMaxCompressedSize | The maximum possible size of valid compressed data made by this format |
| InUncompressedSizeBytes | Size of uncompressed data in bytes
|
| CompressionData | Additional compression parameter - see comments a top of FCompression struct. |
- Returns
- success
◆ IsFormatValid()
| bool FCompression::IsFormatValid |
( |
FName |
FormatName | ) |
|
|
static |
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()
Wraps UncompressMemory to provide access with a IMemoryReadStream interface, attempting to avoid copying in to a contiguous buffer doe decompression if the format supports it. If not, a CompressedSize temp buffer will be allocated.
◆ VerifyCompressionFlagsValid()
| bool FCompression::VerifyCompressionFlagsValid |
( |
int32 |
InCompressionFlags | ) |
|
|
static |
Verifies if the passed in value represents valid compression flags
- Parameters
-
| InCompressionFlags | Value to test |
◆ CompressorDstBytes
Number of bytes after compression.
Nubmer of bytes after compression.
◆ CompressorSrcBytes
Number of bytes before compression.
◆ CompressorTimeCycles
CompressionData is per-compressor data passed through this API and is interpreted by the codecs. For builtins: NAME_Zlib BitWindow NAME_LZ4 Unused NAME_Gzip Unused NAME_Oodle Unused Time spent compressing data in cycles.
Time spent compressing data in cycles.
The documentation for this struct was generated from the following files: