mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 12:01:50 +00:00
add /coders/compression module
This commit is contained in:
parent
0f53d5b835
commit
7d193941a4
7 changed files with 170 additions and 86 deletions
30
src/coders/compression.hpp
Normal file
30
src/coders/compression.hpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "typedefs.hpp"
|
||||
|
||||
namespace compression {
|
||||
enum class Method {
|
||||
NONE, EXTRLE8, GZIP
|
||||
};
|
||||
|
||||
/// @brief Compress buffer
|
||||
/// @param src source buffer
|
||||
/// @param srclen length of the source buffer
|
||||
/// @param len (out argument) length of result buffer
|
||||
/// @param method compression method
|
||||
/// @return compressed bytes array
|
||||
/// @throws std::invalid_argument if compression method is NONE
|
||||
std::unique_ptr<ubyte[]> compress(
|
||||
const ubyte* src, size_t srclen, size_t& len, Method method
|
||||
);
|
||||
|
||||
/// @brief Decompress buffer
|
||||
/// @param src compressed buffer
|
||||
/// @param srclen length of compressed buffer
|
||||
/// @param dstlen max expected length of source buffer
|
||||
/// @return decompressed bytes array
|
||||
std::unique_ptr<ubyte[]> decompress(
|
||||
const ubyte* src, size_t srclen, size_t dstlen, Method method);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue