Carefully dismanteling compression related code.

This commit is contained in:
David Williams 2014-09-13 11:30:52 +02:00
parent 4781ca5c42
commit bfe03142b7
6 changed files with 12 additions and 12 deletions

View File

@ -40,7 +40,7 @@ namespace PolyVox
BlockCompressor() {}; BlockCompressor() {};
virtual ~BlockCompressor() {}; virtual ~BlockCompressor() {};
virtual void compress(UncompressedBlock<VoxelType>* pSrcBlock, CompressedBlock<VoxelType>* pDstBlock) = 0; virtual void compressData(UncompressedBlock<VoxelType>* pSrcBlock, CompressedBlock<VoxelType>* pDstBlock) = 0;
virtual void decompress(CompressedBlock<VoxelType>* pSrcBlock, UncompressedBlock<VoxelType>* pDstBlock) = 0; virtual void decompress(CompressedBlock<VoxelType>* pSrcBlock, UncompressedBlock<VoxelType>* pDstBlock) = 0;
}; };
} }

View File

@ -33,12 +33,12 @@ freely, subject to the following restrictions:
// Diable things we don't need, and in particular the zlib compatible names which // Diable things we don't need, and in particular the zlib compatible names which
// would cause conflicts if a user application is using both PolyVox and zlib. // would cause conflicts if a user application is using both PolyVox and zlib.
#define MINIZ_NO_STDIO //#define MINIZ_NO_STDIO
#define MINIZ_NO_ARCHIVE_APIS //#define MINIZ_NO_ARCHIVE_APIS
#define MINIZ_NO_TIME //#define MINIZ_NO_TIME
#define MINIZ_NO_ZLIB_APIS //#define MINIZ_NO_ZLIB_APIS
#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES //#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES
#define MINIZ_NO_MALLOC //#define MINIZ_NO_MALLOC
// Include only the declarations of the functions in miniz.c. Don't include // Include only the declarations of the functions in miniz.c. Don't include
// the actual definitions, as this 'MinizWrapper.h' may be included from multiple // the actual definitions, as this 'MinizWrapper.h' may be included from multiple

View File

@ -40,10 +40,10 @@ namespace PolyVox
MinizBlockCompressor(int iCompressionLevel = 6); // Miniz defines MZ_DEFAULT_LEVEL = 6 so we use the same here MinizBlockCompressor(int iCompressionLevel = 6); // Miniz defines MZ_DEFAULT_LEVEL = 6 so we use the same here
~MinizBlockCompressor(); ~MinizBlockCompressor();
void compress(UncompressedBlock<VoxelType>* pSrcBlock, CompressedBlock<VoxelType>* pDstBlock); void compressData(UncompressedBlock<VoxelType>* pSrcBlock, CompressedBlock<VoxelType>* pDstBlock);
void decompress(CompressedBlock<VoxelType>* pSrcBlock, UncompressedBlock<VoxelType>* pDstBlock); void decompress(CompressedBlock<VoxelType>* pSrcBlock, UncompressedBlock<VoxelType>* pDstBlock);
private: public:
uint32_t getExpectedCompressedSize(uint32_t uUncompressedInputSize); uint32_t getExpectedCompressedSize(uint32_t uUncompressedInputSize);
uint32_t getMaxCompressedSize(uint32_t uUncompressedInputSize); uint32_t getMaxCompressedSize(uint32_t uUncompressedInputSize);
uint32_t compressWithMiniz(const void* pSrcData, size_t uSrcLength, void* pDstData, size_t uDstLength); uint32_t compressWithMiniz(const void* pSrcData, size_t uSrcLength, void* pDstData, size_t uDstLength);

View File

@ -57,7 +57,7 @@ namespace PolyVox
} }
template <typename VoxelType> template <typename VoxelType>
void MinizBlockCompressor<VoxelType>::compress(UncompressedBlock<VoxelType>* pSrcBlock, CompressedBlock<VoxelType>* pDstBlock) void MinizBlockCompressor<VoxelType>::compressData(UncompressedBlock<VoxelType>* pSrcBlock, CompressedBlock<VoxelType>* pDstBlock)
{ {
// The uncompressed data will be read straight out of the block // The uncompressed data will be read straight out of the block
void* pSrcData = reinterpret_cast<void*>(pSrcBlock->getData()); void* pSrcData = reinterpret_cast<void*>(pSrcBlock->getData());

View File

@ -49,7 +49,7 @@ namespace PolyVox
RLEBlockCompressor(); RLEBlockCompressor();
~RLEBlockCompressor(); ~RLEBlockCompressor();
void compress(UncompressedBlock<VoxelType>* pSrcBlock, CompressedBlock<VoxelType>* pDstBlock); void compressData(UncompressedBlock<VoxelType>* pSrcBlock, CompressedBlock<VoxelType>* pDstBlock);
void decompress(CompressedBlock<VoxelType>* pSrcBlock, UncompressedBlock<VoxelType>* pDstBlock); void decompress(CompressedBlock<VoxelType>* pSrcBlock, UncompressedBlock<VoxelType>* pDstBlock);
}; };
} }

View File

@ -36,7 +36,7 @@ namespace PolyVox
} }
template <typename VoxelType> template <typename VoxelType>
void RLEBlockCompressor<VoxelType>::compress(UncompressedBlock<VoxelType>* pSrcBlock, CompressedBlock<VoxelType>* pDstBlock) void RLEBlockCompressor<VoxelType>::compressData(UncompressedBlock<VoxelType>* pSrcBlock, CompressedBlock<VoxelType>* pDstBlock)
{ {
void* pSrcData = reinterpret_cast<void*>(pSrcBlock->getData()); void* pSrcData = reinterpret_cast<void*>(pSrcBlock->getData());
uint32_t uSrcLength = pSrcBlock->getDataSizeInBytes(); uint32_t uSrcLength = pSrcBlock->getDataSizeInBytes();