PolyVox
0.3.0-dev
Open source voxel management library
|
Provides an interface for performing compression of data. More...
#include <Compressor.h>
Public Member Functions | |
Compressor () | |
Constructor. | |
virtual | ~Compressor () |
Destructor. | |
virtual uint32_t | getMaxCompressedSize (uint32_t uUncompressedInputSize)=0 |
Computes a worst-case scenario for how big the output can be for a given input size. | |
virtual uint32_t | compress (void *pSrcData, uint32_t uSrcLength, void *pDstData, uint32_t uDstLength)=0 |
Compresses the data. | |
virtual uint32_t | decompress (void *pSrcData, uint32_t uSrcLength, void *pDstData, uint32_t uDstLength)=0 |
Decompresses the data. | |
Provides an interface for performing compression of data.
This class provides an interface which can be implemented by derived classes which perform data compression. The main purpose of this is to allow the user to change the compression algorithm which is used by a LargeVolume, based on the kind of voxel data it is storing. Users may also wish to use Compressor subclasses in more general compression-related scenarios but this is not well tested.
If you wish to implement your own compression algorithms for use in PolyVox then you should begin by subclassing this class.
Definition at line 43 of file Compressor.h.
|
inline |
Constructor.
Definition at line 47 of file Compressor.h.
|
inlinevirtual |
Destructor.
Definition at line 49 of file Compressor.h.
|
pure 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). |
Implemented in PolyVox::RLECompressor< ValueType, LengthType >, and PolyVox::MinizCompressor.
Referenced by PolyVox::Block< VoxelType >::compress().
|
pure 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). |
Implemented in PolyVox::RLECompressor< ValueType, LengthType >, and PolyVox::MinizCompressor.
Referenced by PolyVox::Block< VoxelType >::uncompress().
|
pure virtual |
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 |
Implemented in PolyVox::RLECompressor< ValueType, LengthType >, and PolyVox::MinizCompressor.
Referenced by PolyVox::Block< VoxelType >::compress().