Skip to content

Commit

Permalink
Allow Zstandard compression level to be configured.
Browse files Browse the repository at this point in the history
  • Loading branch information
connormanning committed Mar 8, 2019
1 parent c9dbb39 commit 055044b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pdal/compression/ZstdCompression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class ZstdCompressorImpl
char m_tmpbuf[CHUNKSIZE];
BlockCb m_cb;

ZstdCompressorImpl(BlockCb cb) : m_cb(cb)
ZstdCompressorImpl(BlockCb cb, int compressionLevel) : m_cb(cb)
{
m_strm = ZSTD_createCStream();
ZSTD_initCStream(m_strm, 15);
ZSTD_initCStream(m_strm, compressionLevel);
}

~ZstdCompressorImpl()
Expand Down Expand Up @@ -92,7 +92,12 @@ class ZstdCompressorImpl
};

ZstdCompressor::ZstdCompressor(BlockCb cb) :
m_impl(new ZstdCompressorImpl(cb))
ZstdCompressor(cb, 15)
{}


ZstdCompressor::ZstdCompressor(BlockCb cb, int compressionLevel) :
m_impl(new ZstdCompressorImpl(cb, compressionLevel))
{}


Expand Down
1 change: 1 addition & 0 deletions pdal/compression/ZstdCompression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ZstdCompressor : public Compressor
{
public:
PDAL_DLL ZstdCompressor(BlockCb cb);
PDAL_DLL ZstdCompressor(BlockCb cb, int compressionLevel);
PDAL_DLL ~ZstdCompressor();

PDAL_DLL void compress(const char *buf, size_t bufsize);
Expand Down

0 comments on commit 055044b

Please sign in to comment.