PolyVox
0.3.0-dev
Open source voxel management library
|
Performs compression of data using the miniz library. More...
#include <MinizCompressor.h>
Public Member Functions | |
MinizCompressor (int iCompressionLevel=6) | |
Constructor. | |
~MinizCompressor () | |
Destructor. | |
uint32_t | getMaxCompressedSize (uint32_t uUncompressedInputSize) |
Computes a worst-case scenario for how big the output can be for a given input size. | |
uint32_t | compress (void *pSrcData, uint32_t uSrcLength, void *pDstData, uint32_t uDstLength) |
Compresses the data. | |
uint32_t | decompress (void *pSrcData, uint32_t uSrcLength, void *pDstData, uint32_t uDstLength) |
Decompresses the data. | |
Public Member Functions inherited from PolyVox::Compressor | |
Compressor () | |
Constructor. | |
virtual | ~Compressor () |
Destructor. | |
Performs compression of data using the miniz library.
This compressor implements the DEFLATE (http://en.wikipedia.org/wiki/Deflate) compression algorithm via the pubic domain 'miniz' library (https://code.google.com/p/miniz/). This is a general purpose compression algorithm, and within PolyVox it is intended for situations in which the alternative RLECompressor is not appropriate. It is a good default choice if you are not sure which compressor is best for your needs.
Definition at line 18 of file MinizCompressor.h.
PolyVox::MinizCompressor::MinizCompressor | ( | int | iCompressionLevel = 6 | ) |
Constructor.
You can specify a compression level when constructing this compressor.
This controls the tradeoff between speed and compression rate. Levels 0-9 are the standard zlib-style levels, 10 is best possible compression (not zlib compatible, and may be very slow).
iCompressionLevel | The desired compression level. |
Definition at line 37 of file MinizCompressor.cpp.
PolyVox::MinizCompressor::~MinizCompressor | ( | ) |
Destructor.
Definition at line 56 of file MinizCompressor.cpp.
|
virtual |
Compresses the data.
Performs compression of the data pointed to by pSrcData and stores the result in pDstData. The user is responsible for allocating both buffers and for making sure that the destination buffer is large enough to hold the result. If you don't know how big the compressed data will be (and you probably won't know this) then you can call getMaxCompressedSize() to get an upper bound. The actual compressed size is then returned by this function and you can use this to copy your compressed data to a more suitably size buffer.
pSrcData | A pointer to the data to be compressed. |
uSrcLength | The length of the data to be compressed. |
pDstData | A pointer to the memory where the result should be stored. |
uDstLength | The length of the destination buffer (compression will fail if this isn't big enough). |
Implements PolyVox::Compressor.
Definition at line 73 of file MinizCompressor.cpp.
|
virtual |
Decompresses the data.
Performs decompression of the data pointed to by pSrcData and stores the result in pDstData. The user is responsible for allocating both buffers and for making sure that the destination buffer is large enough to hold the result. This means you need to know how large the resulting data might be, so before you compress the data it may be worth storing this information somewhere. The actual decompressed size is then returned by this function
pSrcData | A pointer to the data to be decompressed. |
uSrcLength | The length of the data to be decompressed. |
pDstData | A pointer to the memory where the result should be stored. |
uDstLength | The length of the destination buffer (decompression will fail if this isn't big enough). |
Implements PolyVox::Compressor.
Definition at line 106 of file MinizCompressor.cpp.
Computes a worst-case scenario for how big the output can be for a given input size.
If necessary you can use this as a destination buffer size, though it may be somewhat wasteful. It is not guarenteed that compression actually shrinks the data, so the worst-case value returned by this function may be bigger than the input size.
uUncompressedInputSize | The size of the uncompressed input data |
Implements PolyVox::Compressor.
Definition at line 63 of file MinizCompressor.cpp.