HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StreamCompression.h File Reference

Convenience wrappers to using Blosc and reading and writing of Paged data. More...

#include <openvdb/io/io.h>
#include <tbb/spin_mutex.h>
#include <memory>
#include <string>
+ Include dependency graph for StreamCompression.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  openvdb::OPENVDB_VERSION_NAME::compression::Page
 Stores a variable-size, compressed, delayed-load Page of data that is loaded into memory when accessed. Access to the Page is thread-safe as loading and decompressing the data is protected by a mutex. More...
 
class  openvdb::OPENVDB_VERSION_NAME::compression::PageHandle
 A PageHandle holds a unique ptr to a Page and a specific stream pointer to a point within the decompressed Page buffer. More...
 
class  openvdb::OPENVDB_VERSION_NAME::compression::PagedInputStream
 A Paging wrapper to std::istream that is responsible for reading from a given input stream and creating Page objects and PageHandles that reference those pages for delayed reading. More...
 
class  openvdb::OPENVDB_VERSION_NAME::compression::PagedOutputStream
 A Paging wrapper to std::ostream that is responsible for writing from a given output stream at intervals set by the PageSize. As Pages are variable in size, they are flushed to disk as soon as sufficiently large. More...
 

Namespaces

 openvdb
 
 openvdb::OPENVDB_VERSION_NAME
 
 openvdb::OPENVDB_VERSION_NAME::compression
 

Functions

OPENVDB_API bool openvdb::OPENVDB_VERSION_NAME::compression::bloscCanCompress ()
 Returns true if compression is available. More...
 
OPENVDB_API size_t openvdb::OPENVDB_VERSION_NAME::compression::bloscUncompressedSize (const char *buffer)
 Retrieves the uncompressed size of buffer when uncompressed. More...
 
OPENVDB_API void openvdb::OPENVDB_VERSION_NAME::compression::bloscCompress (char *compressedBuffer, size_t &compressedBytes, const size_t bufferBytes, const char *uncompressedBuffer, const size_t uncompressedBytes)
 Compress into the supplied buffer. More...
 
OPENVDB_API std::unique_ptr
< char[]> 
openvdb::OPENVDB_VERSION_NAME::compression::bloscCompress (const char *buffer, const size_t uncompressedBytes, size_t &compressedBytes, const bool resize=true)
 Compress and return the heap-allocated compressed buffer. More...
 
OPENVDB_API size_t openvdb::OPENVDB_VERSION_NAME::compression::bloscCompressedSize (const char *buffer, const size_t uncompressedBytes)
 Convenience wrapper to retrieve the compressed size of buffer when compressed. More...
 
OPENVDB_API void openvdb::OPENVDB_VERSION_NAME::compression::bloscDecompress (char *uncompressedBuffer, const size_t expectedBytes, const size_t bufferBytes, const char *compressedBuffer)
 Decompress into the supplied buffer. Will throw if decompression fails or uncompressed buffer has insufficient space in which to decompress. More...
 
OPENVDB_API std::unique_ptr
< char[]> 
openvdb::OPENVDB_VERSION_NAME::compression::bloscDecompress (const char *buffer, const size_t expectedBytes, const bool resize=true)
 Decompress and return the the heap-allocated uncompressed buffer. More...
 

Detailed Description

Convenience wrappers to using Blosc and reading and writing of Paged data.

Author
Dan Bailey

Blosc is most effective with large (> ~256KB) blocks of data. Writing the entire data block contiguously would provide the most optimal compression, however would limit the ability to use delayed-loading as the whole block would be required to be loaded from disk at once. To balance these two competing factors, Paging is used to write out blocks of data that are a reasonable size for Blosc. These Pages are loaded lazily, tracking the input stream pointers and creating Handles that reference portions of the buffer. When the Page buffer is accessed, the data will be read from the stream.

Definition in file StreamCompression.h.