#include <CompressionStrategy.h>
A basic adaptive compression strategy.
This strategy selects the most appropriate compression algorithm at extension creation according to simple criteria such as the pixel type and raster shape, as well as the requested losslessness of the compression.
Small images (less than a FITS block size) are not compressed. Otherwise, the following algorithms are tried in this order: Plio
, HCompress
, Rice
. If none of them is suitable (e.g. because lossless compression was requested even for floats), then the ShuffledGzip
is returned.
Public Member Functions | |
Construction | |
CompressAuto (CompressionType type=CompressionType::Lossless) | |
Constructor. | |
Operations | |
template<typename T > | |
bool | apply (fitsfile *fptr, const ImageHdu::Initializer< T > &init) |
Compress if possible. | |
template<typename T > | |
std::unique_ptr< Compress< ShuffledGzip > > | gzip (const ImageHdu::Initializer< T > &init) |
Create a ShuffledGzip action if compatible. | |
template<typename T > | |
std::unique_ptr< Compress< Rice > > | rice (const ImageHdu::Initializer< T > &init) |
Create a Rice action if compatible. | |
template<typename T > | |
std::unique_ptr< Compress< HCompress > > | hcompress (const ImageHdu::Initializer< T > &init) |
Create a HCompress action if compatible. | |
template<typename T > | |
std::unique_ptr< Compress< Plio > > | plio (const ImageHdu::Initializer< T > &init) |
Create a Plio action if compatible. | |
Public Member Functions inherited from CompressionActionMixin< CompressAuto > | |
CompressionActionMixin ()=default | |
Public Member Functions inherited from CompressionAction | |
CompressionAction ()=default | |