source: thirdparty/SZ/sz/include/CompressElement.h @ 2c47b73

Revision 2c47b73, 2.5 KB checked in by Hal Finkel <hfinkel@…>, 6 years ago (diff)

more work on adding SZ (latest version)

  • Property mode set to 100644
Line 
1/**
2 *  @file CompressElement.h
3 *  @author Sheng Di
4 *  @date April, 2016
5 *  @brief Header file for Compress Elements such as DoubleCompressELement.
6 *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
7 *      See COPYRIGHT in top-level directory.
8 */
9
10#include <stdint.h>
11
12#ifndef _CompressElement_H
13#define _CompressElement_H
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19typedef struct DoubleValueCompressElement
20{
21        double data;
22        long curValue;
23        unsigned char curBytes[8]; //big_endian
24        int reqBytesLength;
25        int resiBitsLength;
26} DoubleValueCompressElement;
27
28typedef struct FloatValueCompressElement
29{
30        float data;
31        int curValue;
32        unsigned char curBytes[4]; //big_endian
33        int reqBytesLength;
34        int resiBitsLength;
35} FloatValueCompressElement;
36
37typedef struct LossyCompressionElement
38{
39        int leadingZeroBytes; //0,1,2,or 3
40        unsigned char integerMidBytes[8];
41        int integerMidBytes_Length; //they are mid_bits actually
42        //char curBytes[8];
43        //int curBytes_Length; //4 for single_precision or 8 for double_precision       
44        int resMidBitsLength;
45        int residualMidBits;
46} LossyCompressionElement;
47
48char* decompressGroupIDArray(unsigned char* bytes, size_t dataLength);
49
50short computeGroupNum_float(float value);
51short computeGroupNum_double(double value);
52
53void listAdd_double(double last3CmprsData[3], double value);
54void listAdd_float(float last3CmprsData[3], float value);
55void listAdd_int(int64_t last3CmprsData[3], int64_t value);
56void listAdd_float_group(float *groups, int *flags, char groupNum, float oriValue, float decValue, char* curGroupID);
57void listAdd_double_group(double *groups, int *flags, char groupNum, double oriValue, double decValue, char* curGroupID);
58
59int validPrediction_double(double minErr, double precision);
60int validPrediction_float(float minErr, float precision);
61double* generateGroupErrBounds(int errorBoundMode, double realPrecision, double pwrErrBound);
62int generateGroupMaxIntervalCount(double* groupErrBounds);
63
64void new_LossyCompressionElement(LossyCompressionElement *lce, int leadingNum, unsigned char* intMidBytes, 
65                int intMidBytes_Length, int resiMidBitsLength, int resiBits);
66void updateLossyCompElement_Double(unsigned char* curBytes, unsigned char* preBytes, 
67                int reqBytesLength, int resiBitsLength,  LossyCompressionElement *lce);
68void updateLossyCompElement_Float(unsigned char* curBytes, unsigned char* preBytes, 
69                int reqBytesLength, int resiBitsLength,  LossyCompressionElement *lce);
70
71#ifdef __cplusplus
72}
73#endif
74
75#endif /* ----- #ifndef _CompressElement_H  ----- */
Note: See TracBrowser for help on using the repository browser.