Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoDataCompressor Class Referenceabstract

Large Data Management Data compression More...

#include <LDM/compressors/SoDataCompressor.h>

+ Inheritance diagram for SoDataCompressor:

Classes

struct  TileInfo
 This structure contains the dimension and the type of the tile being processed. More...
 

Public Member Functions

 SoDataCompressor ()
 Constructor.
 
virtual ~SoDataCompressor ()
 Destructor.
 
virtual size_t compress (void *src, size_t srcLen, const TileInfo &tileInfo)=0
 Compresses the given buffer into the internal buffer.
 
virtual size_t uncompress (void *dest, size_t destLen, const TileInfo &tileInfo)=0
 Uncompresses data from the internal buffer to the given buffer.
 
virtual SbString getCompressionFormatName () const =0
 Returns the name of the compression algorithm used by this class.
 
virtual bool isLossless ()=0
 Returns true if the compression algorithm is lossless.
 
virtual void setCompressionLevel (size_t level)
 Sets the compression level.
 
virtual void * allocateCompressedBuffer (size_t size)
 Allocates the internal buffer to hold the compressed data.
 
virtual void * getCompressedBuffer ()
 Returns the compressed data.
 
virtual size_t getCompressionLevel ()
 Returns the compression level.
 
- Public Member Functions inherited from SoTypedObject
virtual SoType getTypeId () const =0
 Returns the type identifier for a specific instance.
 
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoDataCompressorgetAppropriateCompressor (const SbString &name)
 Create and return an instance of a compressor of the given type.
 
static SbStringList getAvailableCompressors ()
 Return a list of all available compressors.
 
static size_t crc32 (const void *buf, size_t len)
 Utility function to get the CRC32 of a buffer.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Detailed Description

Large Data Management Data compression

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.

SEE ALSO

SoGzipDataCompressor, SoJpegDataCompressor

Definition at line 65 of file SoDataCompressor.h.

Constructor & Destructor Documentation

◆ SoDataCompressor()

SoDataCompressor::SoDataCompressor ( )
inline

Constructor.

Definition at line 120 of file SoDataCompressor.h.

◆ ~SoDataCompressor()

virtual SoDataCompressor::~SoDataCompressor ( )
inlinevirtual

Destructor.

Definition at line 124 of file SoDataCompressor.h.

Member Function Documentation

◆ allocateCompressedBuffer()

virtual void * SoDataCompressor::allocateCompressedBuffer ( size_t  size)
inlinevirtual

Allocates the internal buffer to hold the compressed data.

Parameters
sizeis the size to allocate in bytes.

Definition at line 179 of file SoDataCompressor.h.

◆ compress()

virtual size_t SoDataCompressor::compress ( void *  src,
size_t  srcLen,
const TileInfo tileInfo 
)
pure virtual

Compresses the given buffer into the internal buffer.

Parameters
srca pointer to the data to compress.
srcLenthe size of the source buffer in bytes.
tileInfocontains information about the tile being processed.
Returns
The size in bytes of the compressed buffer.

Implemented in SoGzipDataCompressor, SoJp3dDataCompressor, and SoJpegDataCompressor.

◆ crc32()

static size_t SoDataCompressor::crc32 ( const void *  buf,
size_t  len 
)
static

Utility function to get the CRC32 of a buffer.

Parameters
bufa pointer to the data.
lenthe size of the buffer.
Returns
The CRC32 of the data.

◆ getAppropriateCompressor()

static SoDataCompressor * SoDataCompressor::getAppropriateCompressor ( const SbString name)
static

Create and return an instance of a compressor of the given type.

Parameters
nameThe name of the compressor.
Returns
A pointer to the newly created compressor. If this compressor is not available, returns NULL.

◆ getAvailableCompressors()

static SbStringList SoDataCompressor::getAvailableCompressors ( )
static

Return a list of all available compressors.

◆ getCompressedBuffer()

virtual void * SoDataCompressor::getCompressedBuffer ( )
inlinevirtual

Returns the compressed data.

This pointer must not be deleted.

Returns
A pointer to the compressed data.

Definition at line 194 of file SoDataCompressor.h.

◆ getCompressionFormatName()

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.

Returns
A SbString containing the name of the compression.

Implemented in SoGzipDataCompressor, SoJp3dDataCompressor, and SoJpegDataCompressor.

◆ getCompressionLevel()

virtual size_t SoDataCompressor::getCompressionLevel ( )
inlinevirtual

Returns the compression level.

Returns
The level of compression. See setCompressionLevel.

Definition at line 209 of file SoDataCompressor.h.

◆ isLossless()

virtual bool SoDataCompressor::isLossless ( )
pure virtual

Returns true if the compression algorithm is lossless.

Warning
It allows the converter to know if it must do CRC32 on original data or decompressed data when the '-C' option is enabled. Computing CRC32 on lossy compression is more costly than on lossless compression because data must be uncompressed before applying the CRC32 in order to have the real data stored in the file. Setting the environment variable LDM_COMPRESS_CHECK_CRC32 to 1 will force the LDM reader to check data integrity.
Returns
True if the compression is lossless.

Implemented in SoGzipDataCompressor, SoJp3dDataCompressor, and SoJpegDataCompressor.

◆ setCompressionLevel()

virtual void SoDataCompressor::setCompressionLevel ( size_t  level)
inlinevirtual

Sets the compression level.

Parameters
levelthe level of the compression used. Valid compression levels are specific to the compression algorithm.

Definition at line 172 of file SoDataCompressor.h.

◆ uncompress()

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.

Parameters
desta pointer to the destination buffer.
destLenthe size of the destination buffer in bytes.
tileInfocontains information about the tile being processed.
Returns
The number of uncompressed bytes.

Implemented in SoGzipDataCompressor, SoJpegDataCompressor, and SoJp3dDataCompressor.


The documentation for this class was generated from the following file: