summaryrefslogtreecommitdiff
path: root/src/common/zstd_compression.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/zstd_compression.h')
-rw-r--r--src/common/zstd_compression.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/common/zstd_compression.h b/src/common/zstd_compression.h
new file mode 100644
index 000000000..e9de941c8
--- /dev/null
+++ b/src/common/zstd_compression.h
@@ -0,0 +1,44 @@
1// Copyright 2019 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <vector>
8
9#include "common/common_types.h"
10
11namespace Common::Compression {
12
13/**
14 * Compresses a source memory region with Zstandard and returns the compressed data in a vector.
15 *
16 * @param source the uncompressed source memory region.
17 * @param source_size the size in bytes of the uncompressed source memory region.
18 * @param compression_level the used compression level. Should be between 1 and 22.
19 *
20 * @return the compressed data.
21 */
22std::vector<u8> CompressDataZSTD(const u8* source, std::size_t source_size, s32 compression_level);
23
24/**
25 * Compresses a source memory region with Zstandard with the default compression level and returns
26 * the compressed data in a vector.
27 *
28 * @param source the uncompressed source memory region.
29 * @param source_size the size in bytes of the uncompressed source memory region.
30 *
31 * @return the compressed data.
32 */
33std::vector<u8> CompressDataZSTDDefault(const u8* source, std::size_t source_size);
34
35/**
36 * Decompresses a source memory region with Zstandard and returns the uncompressed data in a vector.
37 *
38 * @param compressed the compressed source memory region.
39 *
40 * @return the decompressed data.
41 */
42std::vector<u8> DecompressDataZSTD(const std::vector<u8>& compressed);
43
44} // namespace Common::Compression \ No newline at end of file