121 lines
2.8 KiB
C++
121 lines
2.8 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: CompressionInfo.hpp
|
|
Date: 2021-7-14
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
namespace Aurora::Compression
|
|
{
|
|
struct CompressionInfo
|
|
{
|
|
AU_COPY_MOVE_DEF(CompressionInfo);
|
|
|
|
ECompressionType type;
|
|
|
|
/**
|
|
* @brief
|
|
*
|
|
* ZSTD: -5 <= level <= 22
|
|
* recommended: ZSTD_CLEVEL_DEFAULT
|
|
* LZMA: 0 <= level <= 9
|
|
* LZ4 : N/A
|
|
* Deflate: 0 <= x >= 9,
|
|
* recommended: 6
|
|
* Zip: 0 <= x >= 9,
|
|
* recommended: 6
|
|
* GZip: 0 <= x >= 9,
|
|
* recommended: 6
|
|
* BZIP: 0 <= x >= 9
|
|
*
|
|
*/
|
|
AuInt8 compressionLevel {6};
|
|
|
|
/**
|
|
* @brief LZMA: 5 <= fb <= 273, default = 32
|
|
*/
|
|
AuUInt32 fbWordSize {32};
|
|
|
|
/**
|
|
* LZMA only
|
|
* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
|
|
* (1 << 12) <= dictSize <= (3 << 29) for 64-bit version
|
|
* default = (1 << 24)
|
|
*/
|
|
AuUInt32 dictSize{};
|
|
|
|
/**
|
|
* @brief 64KiB is a recommended "small" block size
|
|
*/
|
|
AuUInt16 lz4BlockSize {};
|
|
|
|
bool hasWindowbits {true};
|
|
|
|
/**
|
|
* @brief DEFLATE related variabl
|
|
*
|
|
* Deflate: 0 <= x >= 15,
|
|
* recommended: 15
|
|
* Zip: 0 <= x >= 15,
|
|
* recommended: 15
|
|
* GZip: 0 <= x >= 15,
|
|
* recommended: 15
|
|
*/
|
|
AuUInt8 windowBits {15};
|
|
|
|
/**
|
|
* @brief Internal output buffer size.
|
|
* Internal swap page is undefined.
|
|
*/
|
|
AuUInt32 internalStreamSize {4096};
|
|
|
|
AuUInt8 threads {1};
|
|
|
|
inline CompressionInfo(ECompressionType alg) : type(alg)
|
|
{
|
|
|
|
}
|
|
|
|
inline CompressionInfo(ECompressionType alg, AuUInt32 bufferSize) : type(alg), internalStreamSize(bufferSize)
|
|
{
|
|
|
|
}
|
|
; };
|
|
|
|
struct DecompressInfo
|
|
{
|
|
AU_COPY_MOVE(DecompressInfo);
|
|
|
|
/**
|
|
* @brief algorithm
|
|
*/
|
|
ECompressionType alg {ECompressionType::eDeflate};
|
|
|
|
/**
|
|
* @brief Internal output buffer size. Internal swap page is undefined.
|
|
*/
|
|
AuUInt32 internalStreamSize {4096};
|
|
|
|
/**
|
|
* @brief Flag for headerless decompression streams
|
|
*/
|
|
bool hasWindowbits {true};
|
|
|
|
/**
|
|
* @brief Flag for headerless decompression streams
|
|
*/
|
|
AuInt8 windowBits {15};
|
|
|
|
inline DecompressInfo(ECompressionType alg) : alg(alg)
|
|
{
|
|
|
|
}
|
|
|
|
inline DecompressInfo(ECompressionType alg, AuUInt32 bufferSize) : alg(alg), internalStreamSize(bufferSize)
|
|
{
|
|
|
|
}
|
|
};
|
|
} |