source: thirdparty/SZ/sz/include/dataCompression.h @ 9ee2ce3

Revision 9ee2ce3, 5.1 KB checked in by Hal Finkel <hfinkel@…>, 6 years ago (diff)

importing new SZ files

  • Property mode set to 100644
RevLine 
[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
14extern "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
32int computeByteSizePerIntValue(long valueRangeSize);
33long computeRangeSize_int(void* oriData, int dataType, size_t size, int64_t* valueRangeSize);
34double computeRangeSize_double(double* oriData, size_t size, double* valueRangeSize, double* medianValue);
35float computeRangeSize_float(float* oriData, size_t size, float* valueRangeSize, float* medianValue);
36float computeRangeSize_double_subblock(double* oriData, double* valueRangeSize, double* medianValue,
37size_t r5, size_t r4, size_t r3, size_t r2, size_t r1,
38size_t s5, size_t s4, size_t s3, size_t s2, size_t s1,
39size_t e5, size_t e4, size_t e3, size_t e2, size_t e1);
40float computeRangeSize_float_subblock(float* oriData, float* valueRangeSize, float* medianValue,
41size_t r5, size_t r4, size_t r3, size_t r2, size_t r1,
42size_t s5, size_t s4, size_t s3, size_t s2, size_t s1,
43size_t e5, size_t e4, size_t e3, size_t e2, size_t e1);
44double min_d(double a, double b);
45double max_d(double a, double b);
46float min_f(float a, float b);
47float max_f(float a, float b);
48double getRealPrecision_double(double valueRangeSize, int errBoundMode, double absErrBound, double relBoundRatio, int *status);
49double getRealPrecision_float(float valueRangeSize, int errBoundMode, double absErrBound, double relBoundRatio, int *status);
50double getRealPrecision_int(long valueRangeSize, int errBoundMode, double absErrBound, double relBoundRatio, int *status);
51void symTransform_8bytes(unsigned char data[8]);
52void symTransform_2bytes(unsigned char data[2]);
53void symTransform_4bytes(unsigned char data[4]);
54
55void compressInt8Value(int8_t tgtValue, int8_t minValue, int byteSize, unsigned char* bytes);
56void compressInt16Value(int16_t tgtValue, int16_t minValue, int byteSize, unsigned char* bytes);
57void compressInt32Value(int32_t tgtValue, int32_t minValue, int byteSize, unsigned char* bytes);
58void compressInt64Value(int64_t tgtValue, int64_t minValue, int byteSize, unsigned char* bytes);
59
60void compressUInt8Value(uint8_t tgtValue, uint8_t minValue, int byteSize, unsigned char* bytes);
61void compressUInt16Value(uint16_t tgtValue, uint16_t minValue, int byteSize, unsigned char* bytes);
62void compressUInt32Value(uint32_t tgtValue, uint32_t minValue, int byteSize, unsigned char* bytes);
63void compressUInt64Value(uint64_t tgtValue, uint64_t minValue, int byteSize, unsigned char* bytes);
64
65void compressSingleFloatValue(FloatValueCompressElement *vce, float tgtValue, float precision, float medianValue, 
66                int reqLength, int reqBytesLength, int resiBitsLength);
67void compressSingleDoubleValue(DoubleValueCompressElement *vce, double tgtValue, double precision, double medianValue, 
68                int reqLength, int reqBytesLength, int resiBitsLength);
69int compIdenticalLeadingBytesCount_double(unsigned char* preBytes, unsigned char* curBytes);
70int compIdenticalLeadingBytesCount_float(unsigned char* preBytes, unsigned char* curBytes);
71void addExactData(DynamicByteArray *exactMidByteArray, DynamicIntArray *exactLeadNumArray, 
72                DynamicIntArray *resiBitArray, LossyCompressionElement *lce);
73
74int getPredictionCoefficients(int layers, int dimension, int **coeff_array, int *status);
75
76int computeBlockEdgeSize_3D(int segmentSize);
77int computeBlockEdgeSize_2D(int segmentSize);
78int initRandomAccessBytes(unsigned char* raBytes);
79
[9ee2ce3]80int generateLossyCoefficients_float(float* oriData, double precision, size_t nbEle, int* reqBytesLength, int* resiBitsLength, float* medianValue, float* decData);
81int compressExactDataArray_float(float* oriData, double precision, size_t nbEle, unsigned char** leadArray, unsigned char** midArray, unsigned char** resiArray, 
82int reqLength, int reqBytesLength, int resiBitsLength, float medianValue);
83
84void decompressExactDataArray_float(unsigned char* leadNum, unsigned char* exactMidBytes, unsigned char* residualMidBits, size_t nbEle, int reqLength, float medianValue, float** decData);
85
86int generateLossyCoefficients_double(double* oriData, double precision, size_t nbEle, int* reqBytesLength, int* resiBitsLength, double* medianValue, double* decData);
87int compressExactDataArray_double(double* oriData, double precision, size_t nbEle, unsigned char** leadArray, unsigned char** midArray, unsigned char** resiArray, 
88int reqLength, int reqBytesLength, int resiBitsLength, double medianValue);
89
90void 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
Note: See TracBrowser for help on using the repository browser.