VAPOR3 3.9.4
Compressor.h
Go to the documentation of this file.
1//
2// $Id$
3//
4
5#ifndef _Compressor_h_
6#define _Compressor_h_
7
8#include <vector>
9#include "SignificanceMap.h"
10#include "MatWaveWavedec.h"
11
12namespace VAPoR {
13
27//
29public:
45 //
46 Compressor(std::vector<size_t> dims, const string &wname, const string &mode);
47 Compressor(std::vector<size_t> dims, const string &wname);
48
49 virtual ~Compressor();
50
69 //
70 int Compress(const float *src_arr, float *dst_arr, size_t dst_arr_len, SignificanceMap *sigmap);
71 int Compress(const double *src_arr, double *dst_arr, size_t dst_arr_len, SignificanceMap *sigmap);
72 int Compress(const int *src_arr, int *dst_arr, size_t dst_arr_len, SignificanceMap *sigmap);
73 int Compress(const long *src_arr, long *dst_arr, size_t dst_arr_len, SignificanceMap *sigmap);
74
87 //
88 int Decompress(const float *src_arr, float *dst_arr, SignificanceMap *sigmap);
89 int Decompress(const double *src_arr, double *dst_arr, SignificanceMap *sigmap);
90 int Decompress(const int *src_arr, int *dst_arr, SignificanceMap *sigmap);
91 int Decompress(const long *src_arr, long *dst_arr, SignificanceMap *sigmap);
92
121 //
122 int Decompose(const float *src_arr, float *dst_arr, const vector<size_t> &dst_arr_lens, vector<SignificanceMap> &sigmaps);
123 int Decompose(const double *src_arr, double *dst_arr, const vector<size_t> &dst_arr_lens, vector<SignificanceMap> &sigmaps);
124 int Decompose(const int *src_arr, int *dst_arr, const vector<size_t> &dst_arr_lens, vector<SignificanceMap> &sigmaps);
125 int Decompose(const long *src_arr, long *dst_arr, const vector<size_t> &dst_arr_lens, vector<SignificanceMap> &sigmaps);
126
163 int Reconstruct(const float *src_arr, float *dst_arr, vector<SignificanceMap> &sigmaps, int l);
164 int Reconstruct(const double *src_arr, double *dst_arr, vector<SignificanceMap> &sigmaps, int l);
165 int Reconstruct(const int *src_arr, int *dst_arr, vector<SignificanceMap> &sigmaps, int l);
166 int Reconstruct(const long *src_arr, long *dst_arr, vector<SignificanceMap> &sigmaps, int l);
167
180 // static bool IsCompressible(
181 // std::vector <size_t> dims, const string &wavename, const string &mode
182 //);
183
195 void GetSigMapShape(std::vector<size_t> &dims) const
196 {
197 dims.clear();
198 dims.push_back(_CLen);
199 };
200
219 size_t GetNumWaveCoeffs() const { return (_CLen); };
220
228 size_t GetSigMapSize(size_t num_entries) const
229 {
230 std::vector<size_t> dims;
231 dims.push_back(GetNumWaveCoeffs());
232 return (SignificanceMap::GetMapSize(dims, num_entries));
233 };
234
249
250 void GetDimension(vector<size_t> &dims, int l) const;
251
261 //
262 int GetNumLevels() const { return (_nlevels); };
263
274 //
275 size_t GetMinCompression() const;
276
284 bool &KeepAppOnOff() { return (_keepapp); };
285
296 bool &ClampMinOnOff() { return (_clamp_min_flag); };
297
302 double &ClampMin() { return (_clamp_min); };
303
314 bool &ClampMaxOnOff() { return (_clamp_max_flag); };
315
320 double &ClampMax() { return (_clamp_max); };
321
332 bool &EpsilonOnOff() { return (_epsilon_flag); };
333
338 double &Epsilon() { return (_epsilon); };
339
340 static bool CompressionInfo(vector<size_t> dims, const string wavename, bool keepapp, size_t &nlevels, size_t &maxcratio);
341
342 friend std::ostream &operator<<(std::ostream &o, const Compressor &rhs);
343
344private:
345 vector<size_t> _dims; // dimensions of array
346 int _nlevels; // Number of wavelet transformation levels
347 vector<void *> _indexvec; // used to sort wavelet coefficients
348 size_t _nx;
349 size_t _ny;
350 size_t _nz;
351 double * _C; // storage for wavelet coefficients
352 size_t _CLen;
353 size_t * _L; // wavelet coefficient book keeping array
354 size_t _LLen;
355 bool _keepapp; // if true, approximation coeffs are not used in compression
356 bool _clamp_min_flag;
357 bool _clamp_max_flag;
358 bool _epsilon_flag;
359 double _clamp_min;
360 double _clamp_max;
361 double _epsilon;
362
363 void _Compressor(std::vector<size_t> dims);
364};
365
366} // namespace VAPoR
367
368#endif
A class for managing data set metadata.
Definition: Compressor.h:28
void GetSigMapShape(std::vector< size_t > &dims) const
Definition: Compressor.h:195
int Decompress(const float *src_arr, float *dst_arr, SignificanceMap *sigmap)
int Decompose(const double *src_arr, double *dst_arr, const vector< size_t > &dst_arr_lens, vector< SignificanceMap > &sigmaps)
int Compress(const long *src_arr, long *dst_arr, size_t dst_arr_len, SignificanceMap *sigmap)
int Decompose(const long *src_arr, long *dst_arr, const vector< size_t > &dst_arr_lens, vector< SignificanceMap > &sigmaps)
int Reconstruct(const int *src_arr, int *dst_arr, vector< SignificanceMap > &sigmaps, int l)
int GetNumLevels() const
Definition: Compressor.h:262
bool & KeepAppOnOff()
Definition: Compressor.h:284
virtual ~Compressor()
int Decompress(const long *src_arr, long *dst_arr, SignificanceMap *sigmap)
int Reconstruct(const long *src_arr, long *dst_arr, vector< SignificanceMap > &sigmaps, int l)
bool & ClampMaxOnOff()
Definition: Compressor.h:314
friend std::ostream & operator<<(std::ostream &o, const Compressor &rhs)
size_t GetNumWaveCoeffs() const
Definition: Compressor.h:219
Compressor(std::vector< size_t > dims, const string &wname, const string &mode)
int Compress(const float *src_arr, float *dst_arr, size_t dst_arr_len, SignificanceMap *sigmap)
int Decompress(const int *src_arr, int *dst_arr, SignificanceMap *sigmap)
int Reconstruct(const double *src_arr, double *dst_arr, vector< SignificanceMap > &sigmaps, int l)
void GetDimension(vector< size_t > &dims, int l) const
bool & ClampMinOnOff()
Definition: Compressor.h:296
int Decompose(const float *src_arr, float *dst_arr, const vector< size_t > &dst_arr_lens, vector< SignificanceMap > &sigmaps)
double & Epsilon()
Definition: Compressor.h:338
size_t GetMinCompression() const
int Compress(const double *src_arr, double *dst_arr, size_t dst_arr_len, SignificanceMap *sigmap)
static bool CompressionInfo(vector< size_t > dims, const string wavename, bool keepapp, size_t &nlevels, size_t &maxcratio)
Compressor(std::vector< size_t > dims, const string &wname)
bool & EpsilonOnOff()
Definition: Compressor.h:332
int Decompose(const int *src_arr, int *dst_arr, const vector< size_t > &dst_arr_lens, vector< SignificanceMap > &sigmaps)
double & ClampMin()
Definition: Compressor.h:302
int Reconstruct(const float *src_arr, float *dst_arr, vector< SignificanceMap > &sigmaps, int l)
double & ClampMax()
Definition: Compressor.h:320
int Decompress(const double *src_arr, double *dst_arr, SignificanceMap *sigmap)
int Compress(const int *src_arr, int *dst_arr, size_t dst_arr_len, SignificanceMap *sigmap)
size_t GetSigMapSize(size_t num_entries) const
Definition: Compressor.h:228
Implements a multi-level wavelet filter.
Implements a significance map.
#define WASP_API
Definition: common.h:74