Go to the documentation of this file.
52 #ifndef __PCL_Compression_h
53 #define __PCL_Compression_h
58 #include <pcl/Diagnostics.h>
104 float sizeReduction = 0;
105 double throughput = 0;
106 int numberOfThreads = 0;
155 virtual String AlgorithmName()
const = 0;
171 virtual int MaxCompressionLevel()
const = 0;
178 virtual int DefaultCompressionLevel()
const = 0;
187 return m_compressionLevel;
201 m_compressionLevel =
Range( level, 0, MaxCompressionLevel() );
214 SetCompressionLevel( 0 );
225 return m_byteShuffle;
243 m_byteShuffle = enable;
253 EnableByteShuffling( !disable );
286 return m_subblockSize;
331 m_checksums = enable;
341 EnableChecksums( !disable );
365 subblock_list Compress(
const void* data,
size_type size, Performance* perf =
nullptr )
const;
394 return Compress( data.Begin(), data.Size(), perf );
426 const subblock_list& subblocks, Performance* perf =
nullptr )
const;
450 for (
const Subblock& subblock : subblocks )
451 uncompressedSize += subblock.uncompressedSize;
453 (void)Uncompress( data.
Begin(), uncompressedSize, subblocks, perf );
475 int m_compressionLevel = 0;
478 bool m_byteShuffle =
true;
479 bool m_checksums =
true;
487 virtual size_type MinBlockSize()
const = 0;
493 virtual size_type MaxBlockSize()
const = 0;
510 const void* inputData,
size_type inputSize,
int level )
const = 0;
520 const void* inputData,
size_type inputSize )
const = 0;
530 if ( size > 0 && data !=
nullptr )
532 size_type numberOfItems = size / itemSize;
534 for (
size_type j = 0; j < itemSize; ++j )
537 for (
size_type i = 0; i < numberOfItems; ++i, ++s, u += itemSize )
540 ::memcpy( s, data + numberOfItems*itemSize, size % itemSize );
553 if ( size > 0 && data !=
nullptr )
555 size_type numberOfItems = size / itemSize;
557 for (
size_type j = 0; j < itemSize; ++j )
560 for (
size_type i = 0; i < numberOfItems; ++i, ++s, u += itemSize )
563 ::memcpy( unshuffled.
At( numberOfItems*itemSize ), s, size % itemSize );
575 if ( size > 0 && data !=
nullptr )
577 const ByteArray shuffled( data, data+size );
578 size_type numberOfItems = size / itemSize;
580 for (
size_type j = 0; j < itemSize; ++j )
583 for (
size_type i = 0; i < numberOfItems; ++i, ++s, u += itemSize )
593 void Throw(
const String& errorMessage )
const;
595 friend class PCL_CompressionEngine;
596 friend class PCL_DecompressionEngine;
638 int MaxCompressionLevel()
const override;
642 int DefaultCompressionLevel()
const override;
662 const void* inputData,
size_type inputSize,
int level )
const override;
667 const void* inputData,
size_type inputSize )
const override;
708 int MaxCompressionLevel()
const override;
712 int DefaultCompressionLevel()
const override;
732 const void* inputData,
size_type inputSize,
int level )
const override;
737 const void* inputData,
size_type inputSize )
const override;
779 int MaxCompressionLevel()
const override;
783 int DefaultCompressionLevel()
const override;
803 const void* inputData,
size_type inputSize,
int level )
const override;
808 const void* inputData,
size_type inputSize )
const override;
853 int MinCompressionLevel()
const override;
857 int MaxCompressionLevel()
const override;
861 int DefaultCompressionLevel()
const override;
880 const void* inputData,
size_type inputSize,
int level )
const override;
885 const void* inputData,
size_type inputSize )
const override;
892 #endif // __PCL_Compression_h
constexpr const T & Range(const T &x, const T &a, const T &b) noexcept
const uint8 * const_iterator
constexpr const T & Max(const T &a, const T &b) noexcept
Implementation of the LZ4 compression algorithm.
String AlgorithmName() const override
String AlgorithmName() const override
bool ByteShufflingEnabled() const
ByteArray compressedData
Sub-block compressed data.
ByteArray Uncompress(const ByteArray &compressedData, size_type uncompressedSize, Performance *perf=nullptr) const
void EnableByteShuffling(bool enable=true)
virtual int MinCompressionLevel() const
subblock_list Compress(const C &data, Performance *perf=nullptr) const
Abstract base class of data compression algorithm implementations.
A process using multiple concurrent execution threads.
static ByteArray Shuffle(const uint8 *data, size_type size, size_type itemSize)
String AlgorithmName() const override
unsigned long long uint64
static void InPlaceUnshuffle(uint8 *data, size_type size, size_type itemSize)
void DisableChecksums(bool disable=true)
void SetSubblockSize(size_type size)
void SetItemSize(size_type itemSize)
Implementation of the LZ4-HC compression algorithm.
void SetCompressionLevel(int level)
bool ChecksumsEnabled() const
size_type ItemSize() const
ByteArray Uncompress(const subblock_list &subblocks, Performance *perf=nullptr) const
void DisableByteShuffling(bool disable=true)
static ByteArray Unshuffle(const uint8 *data, size_type size, size_type itemSize)
Implementation of the Zstandard compression algorithm.
void EnableChecksums(bool enable=true)
size_type uncompressedSize
size in bytes of the uncompressed subblock.
String AlgorithmName() const override
size_type SubblockSize() const
void SetDefaultCompressionLevel()
Compression subblock data.
int CompressionLevel() const
Implementation of the ZLib/Deflate compression algorithm.