diff options
Diffstat (limited to 'src/common/lz4_compression.h')
| -rw-r--r-- | src/common/lz4_compression.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/common/lz4_compression.h b/src/common/lz4_compression.h index 088ff5c91..87a4be1b0 100644 --- a/src/common/lz4_compression.h +++ b/src/common/lz4_compression.h | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <span> | ||
| 8 | #include <vector> | 7 | #include <vector> |
| 9 | 8 | ||
| 10 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| @@ -14,11 +13,12 @@ namespace Common::Compression { | |||
| 14 | /** | 13 | /** |
| 15 | * Compresses a source memory region with LZ4 and returns the compressed data in a vector. | 14 | * Compresses a source memory region with LZ4 and returns the compressed data in a vector. |
| 16 | * | 15 | * |
| 17 | * @param source the uncompressed source memory region. | 16 | * @param source The uncompressed source memory region. |
| 17 | * @param source_size The size of the uncompressed source memory region. | ||
| 18 | * | 18 | * |
| 19 | * @return the compressed data. | 19 | * @return the compressed data. |
| 20 | */ | 20 | */ |
| 21 | [[nodiscard]] std::vector<u8> CompressDataLZ4(std::span<const u8> source); | 21 | [[nodiscard]] std::vector<u8> CompressDataLZ4(const u8* source, std::size_t source_size); |
| 22 | 22 | ||
| 23 | /** | 23 | /** |
| 24 | * Utilizes the LZ4 subalgorithm LZ4HC with the specified compression level. Higher compression | 24 | * Utilizes the LZ4 subalgorithm LZ4HC with the specified compression level. Higher compression |
| @@ -26,21 +26,24 @@ namespace Common::Compression { | |||
| 26 | * compression level has almost no impact on decompression speed. Data compressed with LZ4HC can | 26 | * compression level has almost no impact on decompression speed. Data compressed with LZ4HC can |
| 27 | * also be decompressed with the default LZ4 decompression. | 27 | * also be decompressed with the default LZ4 decompression. |
| 28 | * | 28 | * |
| 29 | * @param source the uncompressed source memory region. | 29 | * @param source The uncompressed source memory region. |
| 30 | * @param compression_level the used compression level. Should be between 3 and 12. | 30 | * @param source_size The size of the uncompressed source memory region. |
| 31 | * @param compression_level The used compression level. Should be between 3 and 12. | ||
| 31 | * | 32 | * |
| 32 | * @return the compressed data. | 33 | * @return the compressed data. |
| 33 | */ | 34 | */ |
| 34 | [[nodiscard]] std::vector<u8> CompressDataLZ4HC(std::span<const u8> source, s32 compression_level); | 35 | [[nodiscard]] std::vector<u8> CompressDataLZ4HC(const u8* source, std::size_t source_size, |
| 36 | s32 compression_level); | ||
| 35 | 37 | ||
| 36 | /** | 38 | /** |
| 37 | * Utilizes the LZ4 subalgorithm LZ4HC with the highest possible compression level. | 39 | * Utilizes the LZ4 subalgorithm LZ4HC with the highest possible compression level. |
| 38 | * | 40 | * |
| 39 | * @param source the uncompressed source memory region. | 41 | * @param source The uncompressed source memory region. |
| 42 | * @param source_size The size of the uncompressed source memory region | ||
| 40 | * | 43 | * |
| 41 | * @return the compressed data. | 44 | * @return the compressed data. |
| 42 | */ | 45 | */ |
| 43 | [[nodiscard]] std::vector<u8> CompressDataLZ4HCMax(std::span<const u8> source); | 46 | [[nodiscard]] std::vector<u8> CompressDataLZ4HCMax(const u8* source, std::size_t source_size); |
| 44 | 47 | ||
| 45 | /** | 48 | /** |
| 46 | * Decompresses a source memory region with LZ4 and returns the uncompressed data in a vector. | 49 | * Decompresses a source memory region with LZ4 and returns the uncompressed data in a vector. |