Data compression More...
#include <LDM/compressors/SoDataCompressor.h>
Classes | |
struct | TileInfo |
This structure contains the dimension and the type of the tile being processed. More... | |
Public Member Functions | |
SoDataCompressor () | |
virtual | ~SoDataCompressor () |
virtual size_t | compress (void *src, size_t srcLen, const TileInfo &tileInfo)=0 |
virtual size_t | uncompress (void *dest, size_t destLen, const TileInfo &tileInfo)=0 |
virtual SbString | getCompressionFormatName () const =0 |
virtual bool | isLossless ()=0 |
virtual void | setCompressionLevel (size_t level) |
virtual void * | allocateCompressedBuffer (size_t size) |
virtual void * | getCompressedBuffer () |
virtual size_t | getCompressionLevel () |
Static Public Member Functions | |
static SoDataCompressor * | getAppropriateCompressor (const SbString &name) |
static SbStringList | getAvailableCompressors () |
static size_t | crc32 (const void *buf, size_t len) |
This is an abstract class which is only needed for advanced users who intend to add a new LDM data compression technique.
By implementing each virtual method of this class, it is possible to create a new compression algorithm. As with a custom node, the initClass of the custom compressor must be called before creating and instantiating an instance of the custom class. After you call initClass, the compression algorithm will be available in the '-c' option of SoConverter.
SoGzipDataCompressor, SoJpegDataCompressor, SoJp3dDataCompressor
SoDataCompressor::SoDataCompressor | ( | ) | [inline] |
Constructor.
virtual SoDataCompressor::~SoDataCompressor | ( | ) | [inline, virtual] |
Destructor.
virtual void* SoDataCompressor::allocateCompressedBuffer | ( | size_t | size | ) | [inline, virtual] |
Allocates the internal buffer to hold the compressed data.
size | is the size to allocate in bytes. |
virtual size_t SoDataCompressor::compress | ( | void * | src, | |
size_t | srcLen, | |||
const TileInfo & | tileInfo | |||
) | [pure virtual] |
Compresses the given buffer into the internal buffer.
src | a pointer to the data to compress. | |
srcLen | the size of the source buffer in bytes. | |
tileInfo | contains information about the tile being processed. |
Implemented in SoGzipDataCompressor, SoJp3dDataCompressor, and SoJpegDataCompressor.
static size_t SoDataCompressor::crc32 | ( | const void * | buf, | |
size_t | len | |||
) | [static] |
Utility function to get the CRC32 of a buffer.
buf | a pointer to the data. | |
len | the size of the buffer. |
static SoDataCompressor* SoDataCompressor::getAppropriateCompressor | ( | const SbString & | name | ) | [static] |
Create and return an instance of a compressor of the given type.
name | The name of the compressor. |
static SbStringList SoDataCompressor::getAvailableCompressors | ( | ) | [static] |
Return a list of all available compressors.
virtual void* SoDataCompressor::getCompressedBuffer | ( | ) | [inline, virtual] |
Returns the compressed data.
This pointer must not be deleted.
virtual SbString SoDataCompressor::getCompressionFormatName | ( | ) | const [pure virtual] |
Returns the name of the compression algorithm used by this class.
This is the name the user will pass to the "-c" option of the converter, so it should be something simple and clear.
Implemented in SoGzipDataCompressor, SoJp3dDataCompressor, and SoJpegDataCompressor.
virtual size_t SoDataCompressor::getCompressionLevel | ( | ) | [inline, virtual] |
Returns the compression level.
virtual bool SoDataCompressor::isLossless | ( | ) | [pure virtual] |
Returns true if the compression algorithm is lossless.
Implemented in SoGzipDataCompressor, SoJp3dDataCompressor, and SoJpegDataCompressor.
virtual void SoDataCompressor::setCompressionLevel | ( | size_t | level | ) | [inline, virtual] |
Sets the compression level.
level | the level of the compression used. Valid compression levels are specific to the compression algorithm. |
virtual size_t SoDataCompressor::uncompress | ( | void * | dest, | |
size_t | destLen, | |||
const TileInfo & | tileInfo | |||
) | [pure virtual] |
Uncompresses data from the internal buffer to the given buffer.
dest | a pointer to the destination buffer. | |
destLen | the size of the destination buffer in bytes. | |
tileInfo | contains information about the tile being processed. |
Implemented in SoGzipDataCompressor, SoJp3dDataCompressor, and SoJpegDataCompressor.