[2c47b73] | 1 | /** |
---|
| 2 | * @file dataCompression.h |
---|
| 3 | * @author Sheng Di |
---|
| 4 | * @date July, 2017 |
---|
| 5 | * @brief Header file for the dataCompression.c. |
---|
| 6 | * (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory. |
---|
| 7 | * See COPYRIGHT in top-level directory. |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | #ifndef _DataCompression_H |
---|
| 11 | #define _DataCompression_H |
---|
| 12 | |
---|
| 13 | #ifdef __cplusplus |
---|
| 14 | extern "C" { |
---|
| 15 | #endif |
---|
| 16 | |
---|
| 17 | #include "sz.h" |
---|
| 18 | #include <stdio.h> |
---|
| 19 | |
---|
| 20 | #define computeMinMax(data) \ |
---|
| 21 | for(i=1;i<size;i++)\ |
---|
| 22 | {\ |
---|
| 23 | data_ = data[i];\ |
---|
| 24 | if(min>data_)\ |
---|
| 25 | min = data_;\ |
---|
| 26 | else if(max<data_)\ |
---|
| 27 | max = data_;\ |
---|
| 28 | }\ |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | //dataCompression.c |
---|
| 32 | int computeByteSizePerIntValue(long valueRangeSize); |
---|
| 33 | long computeRangeSize_int(void* oriData, int dataType, size_t size, int64_t* valueRangeSize); |
---|
| 34 | double computeRangeSize_double(double* oriData, size_t size, double* valueRangeSize, double* medianValue); |
---|
| 35 | float computeRangeSize_float(float* oriData, size_t size, float* valueRangeSize, float* medianValue); |
---|
| 36 | float computeRangeSize_double_subblock(double* oriData, double* valueRangeSize, double* medianValue, |
---|
| 37 | size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, |
---|
| 38 | size_t s5, size_t s4, size_t s3, size_t s2, size_t s1, |
---|
| 39 | size_t e5, size_t e4, size_t e3, size_t e2, size_t e1); |
---|
| 40 | float computeRangeSize_float_subblock(float* oriData, float* valueRangeSize, float* medianValue, |
---|
| 41 | size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, |
---|
| 42 | size_t s5, size_t s4, size_t s3, size_t s2, size_t s1, |
---|
| 43 | size_t e5, size_t e4, size_t e3, size_t e2, size_t e1); |
---|
| 44 | double min_d(double a, double b); |
---|
| 45 | double max_d(double a, double b); |
---|
| 46 | float min_f(float a, float b); |
---|
| 47 | float max_f(float a, float b); |
---|
| 48 | double getRealPrecision_double(double valueRangeSize, int errBoundMode, double absErrBound, double relBoundRatio, int *status); |
---|
| 49 | double getRealPrecision_float(float valueRangeSize, int errBoundMode, double absErrBound, double relBoundRatio, int *status); |
---|
| 50 | double getRealPrecision_int(long valueRangeSize, int errBoundMode, double absErrBound, double relBoundRatio, int *status); |
---|
| 51 | void symTransform_8bytes(unsigned char data[8]); |
---|
| 52 | void symTransform_2bytes(unsigned char data[2]); |
---|
| 53 | void symTransform_4bytes(unsigned char data[4]); |
---|
| 54 | |
---|
| 55 | void compressInt8Value(int8_t tgtValue, int8_t minValue, int byteSize, unsigned char* bytes); |
---|
| 56 | void compressInt16Value(int16_t tgtValue, int16_t minValue, int byteSize, unsigned char* bytes); |
---|
| 57 | void compressInt32Value(int32_t tgtValue, int32_t minValue, int byteSize, unsigned char* bytes); |
---|
| 58 | void compressInt64Value(int64_t tgtValue, int64_t minValue, int byteSize, unsigned char* bytes); |
---|
| 59 | |
---|
| 60 | void compressUInt8Value(uint8_t tgtValue, uint8_t minValue, int byteSize, unsigned char* bytes); |
---|
| 61 | void compressUInt16Value(uint16_t tgtValue, uint16_t minValue, int byteSize, unsigned char* bytes); |
---|
| 62 | void compressUInt32Value(uint32_t tgtValue, uint32_t minValue, int byteSize, unsigned char* bytes); |
---|
| 63 | void compressUInt64Value(uint64_t tgtValue, uint64_t minValue, int byteSize, unsigned char* bytes); |
---|
| 64 | |
---|
| 65 | void compressSingleFloatValue(FloatValueCompressElement *vce, float tgtValue, float precision, float medianValue, |
---|
| 66 | int reqLength, int reqBytesLength, int resiBitsLength); |
---|
| 67 | void compressSingleDoubleValue(DoubleValueCompressElement *vce, double tgtValue, double precision, double medianValue, |
---|
| 68 | int reqLength, int reqBytesLength, int resiBitsLength); |
---|
| 69 | int compIdenticalLeadingBytesCount_double(unsigned char* preBytes, unsigned char* curBytes); |
---|
| 70 | int compIdenticalLeadingBytesCount_float(unsigned char* preBytes, unsigned char* curBytes); |
---|
| 71 | void addExactData(DynamicByteArray *exactMidByteArray, DynamicIntArray *exactLeadNumArray, |
---|
| 72 | DynamicIntArray *resiBitArray, LossyCompressionElement *lce); |
---|
| 73 | |
---|
| 74 | int getPredictionCoefficients(int layers, int dimension, int **coeff_array, int *status); |
---|
| 75 | |
---|
| 76 | int computeBlockEdgeSize_3D(int segmentSize); |
---|
| 77 | int computeBlockEdgeSize_2D(int segmentSize); |
---|
| 78 | int initRandomAccessBytes(unsigned char* raBytes); |
---|
| 79 | |
---|
[9ee2ce3] | 80 | int generateLossyCoefficients_float(float* oriData, double precision, size_t nbEle, int* reqBytesLength, int* resiBitsLength, float* medianValue, float* decData); |
---|
| 81 | int compressExactDataArray_float(float* oriData, double precision, size_t nbEle, unsigned char** leadArray, unsigned char** midArray, unsigned char** resiArray, |
---|
| 82 | int reqLength, int reqBytesLength, int resiBitsLength, float medianValue); |
---|
| 83 | |
---|
| 84 | void decompressExactDataArray_float(unsigned char* leadNum, unsigned char* exactMidBytes, unsigned char* residualMidBits, size_t nbEle, int reqLength, float medianValue, float** decData); |
---|
| 85 | |
---|
| 86 | int generateLossyCoefficients_double(double* oriData, double precision, size_t nbEle, int* reqBytesLength, int* resiBitsLength, double* medianValue, double* decData); |
---|
| 87 | int compressExactDataArray_double(double* oriData, double precision, size_t nbEle, unsigned char** leadArray, unsigned char** midArray, unsigned char** resiArray, |
---|
| 88 | int reqLength, int reqBytesLength, int resiBitsLength, double medianValue); |
---|
| 89 | |
---|
| 90 | void decompressExactDataArray_double(unsigned char* leadNum, unsigned char* exactMidBytes, unsigned char* residualMidBits, size_t nbEle, int reqLength, double medianValue, double** decData); |
---|
| 91 | |
---|
[2c47b73] | 92 | #ifdef __cplusplus |
---|
| 93 | } |
---|
| 94 | #endif |
---|
| 95 | |
---|
| 96 | #endif /* ----- #ifndef _DataCompression_H ----- */ |
---|
| 97 | |
---|