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 |
---|
16 | extern "C" { |
---|
17 | #endif |
---|
18 | |
---|
19 | typedef 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 | |
---|
28 | typedef 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 | |
---|
37 | typedef 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 | |
---|
48 | char* decompressGroupIDArray(unsigned char* bytes, size_t dataLength); |
---|
49 | |
---|
50 | short computeGroupNum_float(float value); |
---|
51 | short computeGroupNum_double(double value); |
---|
52 | |
---|
53 | void listAdd_double(double last3CmprsData[3], double value); |
---|
54 | void listAdd_float(float last3CmprsData[3], float value); |
---|
55 | void listAdd_int(int64_t last3CmprsData[3], int64_t value); |
---|
56 | void listAdd_float_group(float *groups, int *flags, char groupNum, float oriValue, float decValue, char* curGroupID); |
---|
57 | void listAdd_double_group(double *groups, int *flags, char groupNum, double oriValue, double decValue, char* curGroupID); |
---|
58 | |
---|
59 | int validPrediction_double(double minErr, double precision); |
---|
60 | int validPrediction_float(float minErr, float precision); |
---|
61 | double* generateGroupErrBounds(int errorBoundMode, double realPrecision, double pwrErrBound); |
---|
62 | int generateGroupMaxIntervalCount(double* groupErrBounds); |
---|
63 | |
---|
64 | void new_LossyCompressionElement(LossyCompressionElement *lce, int leadingNum, unsigned char* intMidBytes, |
---|
65 | int intMidBytes_Length, int resiMidBitsLength, int resiBits); |
---|
66 | void updateLossyCompElement_Double(unsigned char* curBytes, unsigned char* preBytes, |
---|
67 | int reqBytesLength, int resiBitsLength, LossyCompressionElement *lce); |
---|
68 | void 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 ----- */ |
---|