|
libassetmap
1.0.0
Hash-table based archive format containing compressed data
|


Public Member Functions | |
| ZSTD (both_t, float dictRatio=0.01f) | |
| Construct an instance of ZSTD for compression and decompression. More... | |
| ZSTD (compress_t, float dictRatio=0.01f) | |
| Construct an instance of ZSTD for compression. More... | |
| ZSTD (decompress_t) | |
| Construct an instance of ZSTD for decompression. More... | |
| ZSTD (const ZSTD &)=delete | |
| ZSTD (ZSTD &&rhs) noexcept | |
| ZSTD & | operator= (ZSTD &&rhs) noexcept |
| size_t | Compress (const uint8_t *src, size_t srcLen, uint8_t *dst, size_t dstLen) override |
| Compresses data from src into dst. More... | |
| size_t | Decompress (const uint8_t *src, size_t srcLen, uint8_t *dst, size_t dstLen) override |
| Decompresses data from src into dst. More... | |
| size_t | CalcCompressSize (size_t len) const noexcept override |
| Calculates the worst-case size needed to compress the data. More... | |
| size_t | CalcDecompressSize (const uint8_t *src, size_t len) const noexcept override |
| Calculates the number of bytes needed to decompress the data. More... | |
| bool | CreateDictionary (std::filesystem::directory_entry samplesDir) override |
| Creates a dictionary from a directory of samples. More... | |
| void | UseDictionary (const uint8_t *dict, size_t len) noexcept override |
| References a dictionary for (de)compression purposes. More... | |
| void | UseDictionary (std::filesystem::directory_entry ent) |
| Reads a file into memory and uses it as a dictionary. More... | |
| void | SetCompressLevel (int level) noexcept |
| Sets the desired compression level. More... | |
| void | SetStrategyLevel (int level) noexcept |
| std::pair< const uint8_t *, size_t > | Dictionary () const noexcept override |
Static Public Member Functions | |
| static int | MinCompressLevel () noexcept |
| static int | MaxCompressLevel () noexcept |
| static int | DefaultCompressLevel () noexcept |
| static int | MinStrategyLevel () noexcept |
| static int | MaxStrategyLevel () noexcept |
| static const char * | StrategyInfo () noexcept |
Static Public Attributes | |
| static constexpr compress_t | compress {} |
| static constexpr decompress_t | decompress {} |
| static constexpr both_t | both {} |
|
explicit |
Construct an instance of ZSTD for compression and decompression.
| dictRatio | optionally specifies the desired dictionary size. defaults to 1% (0.01) |
|
explicit |
Construct an instance of ZSTD for compression.
| dictRatio | optionally specifies the desired dictionary size. defaults to 1% (0.01) |
|
explicit |
Construct an instance of ZSTD for decompression.
| dictRatio | optionally specifies the desired dictionary size. defaults to 1% (0.01) |
|
overridevirtualnoexcept |
Calculates the worst-case size needed to compress the data.
| len | The size of the input data |
Implements AssetMap::ICompress.
|
overridevirtualnoexcept |
Calculates the number of bytes needed to decompress the data.
| src | A pointer to the input data. |
| len | the size (in bytes) of the input data. |
Implements AssetMap::IDecompress.
|
overridevirtual |
Compresses data from src into dst.
| src | The source buffer to compress data from. |
| srcLen | The length in bytes to compress. |
| dst | The destination buffer to place compressed data in. |
| dstLen | The total space available. Should be at least CalcCompressSize() |
Implements AssetMap::ICompress.
|
overridevirtual |
Creates a dictionary from a directory of samples.
A non-trivial amount of memory is typically required to generate a dictionary. All samples are copied into memory.
| samplesDir | A valid directory that will be iterated recursively. |
Implements AssetMap::ICompress.
|
overridevirtual |
Decompresses data from src into dst.
| src | The source buffer to decompress data from. |
| srcLen | The length in bytes to decompress. |
| dst | The destination buffer to place decompressed data in. |
| dstLen | The total space available. Ideally at least CalcDecompressSize() |
Implements AssetMap::IDecompress.
|
staticnoexcept |
|
overridevirtualnoexcept |
Implements AssetMap::ICompress.
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
staticnoexcept |
|
noexcept |
Sets the desired compression level.
| level | The desired compression level. Must be in the range MinCompressionLevel() <= level <= MaxCompressLevel() |
|
noexcept |
Sets the desired compression strategy.
| level | the strategy to use. Must be in the range MinStrategyLevel() <= level <= MaxStrategyLevel() |
|
staticnoexcept |
|
overridevirtualnoexcept |
References a dictionary for (de)compression purposes.
| dict | A buffer containing the dictionary to load. |
| len | The size of the dictionary (in bytes) |
Implements AssetMap::ICompress.
| void AssetMap::ZSTD::UseDictionary | ( | std::filesystem::directory_entry | ent | ) |
Reads a file into memory and uses it as a dictionary.
This function mainly exists for convenience; it is recommended to mmap the dictionary and use the non-owning overload.
| ent | A valid, regular file to read the dictionary from. |