提交 9ee33606 编写于 作者: T tickduan

compare with td finished

上级 9ff80775
......@@ -88,7 +88,7 @@ void new_TightDataPointStorageD2(TightDataPointStorageD **self,
void convertTDPStoBytes_double(TightDataPointStorageD* tdps, unsigned char* bytes, unsigned char* dsLengthBytes, unsigned char sameByte);
void convertTDPStoBytes_double_reserve(TightDataPointStorageD* tdps, unsigned char* bytes, unsigned char* dsLengthBytes, unsigned char sameByte);
void convertTDPStoFlatBytes_double(TightDataPointStorageD *tdps, unsigned char** bytes, size_t *size);
void convertTDPStoFlatBytes_double(TightDataPointStorageD *tdps, unsigned char* bytes, size_t *size);
void convertTDPStoFlatBytes_double_args(TightDataPointStorageD *tdps, unsigned char* bytes, size_t *size);
void free_TightDataPointStorageD(TightDataPointStorageD *tdps);
......
......@@ -92,8 +92,7 @@ void new_TightDataPointStorageF2(TightDataPointStorageF **self,
unsigned char* pwrErrBoundBytes, size_t pwrErrBoundBytes_size, unsigned char radExpo);
void convertTDPStoBytes_float(TightDataPointStorageF* tdps, unsigned char* bytes, unsigned char* dsLengthBytes, unsigned char sameByte);
void convertTDPStoBytes_float_reserve(TightDataPointStorageF* tdps, unsigned char* bytes, unsigned char* dsLengthBytes, unsigned char sameByte);
void convertTDPStoFlatBytes_float(TightDataPointStorageF *tdps, unsigned char** bytes, size_t *size);
void convertTDPStoFlatBytes_float(TightDataPointStorageF *tdps, unsigned char* bytes, size_t *size);
void convertTDPStoFlatBytes_float_args(TightDataPointStorageF *tdps, unsigned char* bytes, size_t *size);
void free_TightDataPointStorageF(TightDataPointStorageF *tdps);
......
/**
* @file TightDataPointStorageI.h
* @author Sheng Di and Dingwen Tao
* @date Aug, 2017
* @brief Header file for the tight data point storage (TDPS).
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _TightDataPointStorageI_H
#define _TightDataPointStorageI_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include "pub.h"
typedef struct TightDataPointStorageI
{
size_t dataSeriesLength;
int allSameData;
double realPrecision; //it's used as the pwrErrBoundRatio when errBoundMode==PW_REL
size_t exactDataNum;
long minValue;
int exactByteSize;
int dataTypeSize; //the size of data type, e.g., it's 4 when data type is int32_t
int stateNum;
int allNodes;
unsigned char* typeArray; //its size is dataSeriesLength/4 (or xxx/4+1)
size_t typeArray_size;
unsigned char* exactDataBytes;
size_t exactDataBytes_size;
unsigned int intervals; //quantization_intervals
unsigned char isLossless; //a mark to denote whether it's lossless compression (1 is yes, 0 is no)
} TightDataPointStorageI;
int computeRightShiftBits(int exactByteSize, int dataType);
int convertDataTypeSizeCode(int dataTypeSizeCode);
int convertDataTypeSize(int dataTypeSize);
void new_TightDataPointStorageI_Empty(TightDataPointStorageI **self);
int new_TightDataPointStorageI_fromFlatBytes(TightDataPointStorageI **self, unsigned char* flatBytes, size_t flatBytesLength);
void new_TightDataPointStorageI(TightDataPointStorageI **self,
size_t dataSeriesLength, size_t exactDataNum, int byteSize,
int* type, unsigned char* exactDataBytes, size_t exactDataBytes_size,
double realPrecision, long minValue, int intervals, int dataType);
void convertTDPStoBytes_int(TightDataPointStorageI* tdps, unsigned char* bytes, unsigned char sameByte);
void convertTDPStoFlatBytes_int(TightDataPointStorageI *tdps, unsigned char** bytes, size_t *size);
void convertTDPStoFlatBytes_int_args(TightDataPointStorageI *tdps, unsigned char* bytes, size_t *size);
void free_TightDataPointStorageI(TightDataPointStorageI *tdps);
void free_TightDataPointStorageI2(TightDataPointStorageI *tdps);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _TightDataPointStorageI_H ----- */
......@@ -26,7 +26,7 @@ unsigned long zlib_compress(unsigned char* data, unsigned long dataLength, unsig
unsigned long zlib_compress2(unsigned char* data, unsigned long dataLength, unsigned char** compressBytes, int level);
unsigned long zlib_compress3(unsigned char* data, unsigned long dataLength, unsigned char* compressBytes, int level);
unsigned long zlib_compress4(unsigned char* data, unsigned long dataLength, unsigned char** compressBytes, int level);
unsigned long zlib_compress5(unsigned char* data, unsigned long dataLength, unsigned char** compressBytes, int level);
unsigned long zlib_compress5(unsigned char* data, unsigned long dataLength, unsigned char* compressBytes, int level);
unsigned long zlib_uncompress4(unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData, unsigned long targetOriSize);
unsigned long zlib_uncompress5(unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData, unsigned long targetOriSize);
......
......@@ -24,7 +24,7 @@
//prediction mode of temporal dimension based compression
#define SZ_PREVIOUS_VALUE_ESTIMATE 0
#define MIN_NUM_OF_ELEMENTS 0 //if the # elements <= 20, skip the compression
#define MIN_NUM_OF_ELEMENTS 50 //if the # elements <= 20, skip the compression
#define SZ_ABS 0
#define REL 1
......@@ -81,13 +81,14 @@
#define SZ_PERIO_TEMPORAL_COMPRESSION 2
//SUCCESS returning status
#define SZ_SCES 0 //successful
#define SZ_NSCS -1 //Not successful
#define SZ_SUCCESS 0 //successful
#define SZ_FAILED -1 //Not successful
#define SZ_FERR -2 //Failed to open input file
#define SZ_TERR -3 //wrong data type (should be only float or double)
#define SZ_DERR -4 //dimension error
#define SZ_MERR -5 //sz_mode error
#define SZ_BERR -6 //bound-mode error (should be only SZ_ABS, REL, ABS_AND_REL, ABS_OR_REL, or PW_REL)
#define SZ_LITTER_ELEMENT -7
#define SZ_MAINTAIN_VAR_DATA 0
#define SZ_DESTROY_WHOLE_VARSET 1
......
#ifndef EXAFELSZ_H
#define EXAFELSZ_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdlib.h>
typedef struct exafelSZ_params{
//uint8_t *peaks;
uint16_t *peaksSegs;
uint16_t *peaksRows;
uint16_t *peaksCols;
uint64_t numPeaks;
uint8_t *calibPanel;
uint8_t binSize; //Binning: (pr->binSize x pr->binSize) to (1 x 1)
double tolerance; //SZ pr->tolerance
uint8_t szDim; //1D/2D/3D compression/decompression
//uint8_t szBlockSize; //Currently unused
uint8_t peakSize; //MUST BE ODD AND NOT EVEN! Each peak will have size of: (peakSize x peakSize)
// uint64_t nEvents;
// uint64_t panels;
// uint64_t rows;
// uint64_t cols;
//CALCULATED VARIBALES:
uint64_t binnedRows;
uint64_t binnedCols;
uint8_t peakRadius; //Will be calculated using peakSize
} exafelSZ_params;
void exafelSZ_params_process(exafelSZ_params*pr, size_t panels, size_t rows, size_t cols);
void exafelSZ_params_checkDecomp(exafelSZ_params*pr, size_t panels, size_t rows, size_t cols);
void exafelSZ_params_checkComp(exafelSZ_params*pr, size_t panels, size_t rows, size_t cols);
unsigned char * exafelSZ_Compress(void* _pr,
void* _origData,
size_t events, size_t panels, size_t rows, size_t cols,
size_t *compressedSize);
void* exafelSZ_Decompress(void *_pr,
unsigned char*_compressedBuffer,
size_t events, size_t panels, size_t rows, size_t cols,
size_t compressedSize);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _EXAFELSZ_H ----- */
......@@ -22,29 +22,12 @@
#include "Huffman.h"
#include "TightDataPointStorageD.h"
#include "TightDataPointStorageF.h"
#include "TightDataPointStorageI.h"
#include "conf.h"
#include "dataCompression.h"
#include "ByteToolkit.h"
#include "TypeManager.h"
#include "sz_int8.h"
#include "sz_int16.h"
#include "sz_int32.h"
#include "sz_int64.h"
#include "sz_uint8.h"
#include "sz_uint16.h"
#include "sz_uint32.h"
#include "sz_uint64.h"
#include "sz_float.h"
#include "sz_double.h"
#include "szd_int8.h"
#include "szd_int16.h"
#include "szd_int32.h"
#include "szd_int64.h"
#include "szd_uint8.h"
#include "szd_uint16.h"
#include "szd_uint32.h"
#include "szd_uint64.h"
#include "szd_float.h"
#include "szd_double.h"
#include "sz_float_pwr.h"
......@@ -53,13 +36,10 @@
#include "callZlib.h"
#include "rw.h"
#include "pastri.h"
#include "sz_float_ts.h"
#include "szd_float_ts.h"
#include "utility.h"
#include "CacheTable.h"
#include "MultiLevelCacheTable.h"
#include "MultiLevelCacheTableWideInterval.h"
#include "exafelSZ.h"
#include "sz_stats.h"
#ifdef _WIN32
......@@ -208,86 +188,26 @@ extern pastri_params pastri_par;
//sz.h
HuffmanTree* SZ_Reset();
int SZ_Init(const char *configFilePath);
void SZ_Finalize();
int SZ_Init(const char *configFilePath);
int SZ_Init_Params(sz_params *params);
size_t computeDataLength(size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
int computeDimension(size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
int SZ_compress_args_float_subblock(unsigned char* compressedBytes, float *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1,
size_t s5, size_t s4, size_t s3, size_t s2, size_t s1,
size_t e5, size_t e4, size_t e3, size_t e2, size_t e1,
size_t *outSize, int errBoundMode, double absErr_Bound, double relBoundRatio);
int SZ_compress_args_double_subblock(unsigned char* compressedBytes, double *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1,
size_t s5, size_t s4, size_t s3, size_t s2, size_t s1,
size_t e5, size_t e4, size_t e3, size_t e2, size_t e1,
size_t *outSize, int errBoundMode, double absErr_Bound, double relBoundRatio);
unsigned char *SZ_compress(int dataType, void *data, size_t *outSize, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
unsigned char* SZ_compress_args(int dataType, void *data, size_t *outSize, int errBoundMode, double absErrBound,
double relBoundRatio, double pwrBoundRatio, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
int SZ_compress_args2(int dataType, void *data, unsigned char* compressed_bytes, size_t *outSize,
int errBoundMode, double absErrBound, double relBoundRatio, double pwrBoundRatio,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
int SZ_compress_args3(int dataType, void *data, unsigned char* compressed_bytes, size_t *outSize, int errBoundMode, double absErrBound, double relBoundRatio,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1,
size_t s5, size_t s4, size_t s3, size_t s2, size_t s1,
size_t e5, size_t e4, size_t e3, size_t e2, size_t e1);
unsigned char *SZ_compress_rev_args(int dataType, void *data, void *reservedValue, size_t *outSize, int errBoundMode, double absErrBound, double relBoundRatio,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
int SZ_compress_rev_args2(int dataType, void *data, void *reservedValue, unsigned char* compressed_bytes, size_t *outSize, int errBoundMode, double absErrBound, double relBoundRatio,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
unsigned char *SZ_compress_rev(int dataType, void *data, void *reservedValue, size_t *outSize, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
//
// compress output data to outData and return outSize
//
size_t SZ_compress_args(int dataType, void *data, size_t r1, unsigned char* outData, sz_params* params);
void SZ_Create_ParamsExe(sz_params** conf_params, sz_exedata** exe_params);
void *SZ_decompress(int dataType, unsigned char *bytes, size_t byteLength, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
size_t SZ_decompress_args(int dataType, unsigned char *bytes, size_t byteLength, void* decompressed_array, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
//
// decompress output data to outData and return outSize
//
size_t SZ_decompress(int dataType, unsigned char *bytes, size_t byteLength, size_t r1, unsigned char* outData);
sz_metadata* SZ_getMetadata(unsigned char* bytes, sz_exedata* pde_exe);
void SZ_printMetadata(sz_metadata* metadata);
void filloutDimArray(size_t* dim, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
size_t compute_total_batch_size();
void SZ_registerVar(int var_id, char* varName, int dataType, void* data,
int errBoundMode, double absErrBound, double relBoundRatio, double pwRelBoundRatio,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
int SZ_deregisterVar_ID(int var_id);
int SZ_deregisterVar(char* varName);
int SZ_deregisterAllVars();
int SZ_compress_ts_select_var(int cmprType, unsigned char* var_ids, unsigned char var_count, unsigned char** newByteData, size_t *outSize);
int SZ_compress_ts(int cmprType, unsigned char** newByteData, size_t *outSize);
void SZ_decompress_ts_select_var(unsigned char* var_ids, unsigned char var_count, unsigned char *bytes, size_t bytesLength);
void SZ_decompress_ts(unsigned char *bytes, size_t byteLength);
void SZ_Finalize();
void convertSZParamsToBytes(sz_params* params, unsigned char* result);
void convertBytesToSZParams(unsigned char* bytes, sz_params* params, sz_exedata* pde_exe);
unsigned char* SZ_compress_customize(const char* appName, void* userPara, int dataType, void* data, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, int *status);
unsigned char* SZ_compress_customize_threadsafe(const char* cmprName, void* userPara, int dataType, void* data, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, int *status);
void* SZ_decompress_customize(const char* appName, void* userPara, int dataType, unsigned char* bytes, size_t byteLength, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, int* status);
void* SZ_decompress_customize_threadsafe(const char* cmprName, void* userPara, int dataType, unsigned char* bytes, size_t byteLength, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, int *status);
#ifdef __cplusplus
}
#endif
......
......@@ -28,29 +28,17 @@ unsigned int optimize_intervals_double_1D_opt(double *oriData, size_t dataLength
unsigned int optimize_intervals_double_1D_opt_MSST19(double *oriData, size_t dataLength, double realPrecision);
TightDataPointStorageD* SZ_compress_double_1D_MDQ(double *oriData,
size_t dataLength, double realPrecision, double valueRangeSize, double medianValue_d);
void SZ_compress_args_double_StoreOriData(double* oriData, size_t dataLength, unsigned char** newByteData, size_t *outSize);
void SZ_compress_args_double_StoreOriData(double* oriData, size_t dataLength, unsigned char* newByteData, size_t *outSize);
char SZ_compress_args_double_NoCkRngeNoGzip_1D(int cmprType, unsigned char** newByteData, double *oriData, size_t dataLength, double realPrecision, size_t *outSize, double valueRangeSize, double medianValue_d);
char SZ_compress_args_double_NoCkRngeNoGzip_1D( unsigned char* newByteData, double *oriData, size_t dataLength, double realPrecision, size_t *outSize, double valueRangeSize, double medianValue_d);
TightDataPointStorageD* SZ_compress_double_1D_MDQ_MSST19(double *oriData, size_t dataLength, double realPrecision, double valueRangeSize, double medianValue_f);
void SZ_compress_args_double_withinRange(unsigned char** newByteData, double *oriData, size_t dataLength, size_t *outSize);
void SZ_compress_args_double_withinRange(unsigned char* newByteData, double *oriData, size_t dataLength, size_t *outSize);
/*int SZ_compress_args_double_wRngeNoGzip(unsigned char** newByteData, double *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio, double pwrErrRatio);*/
int SZ_compress_args_double(int cmprType, int withRegression, unsigned char** newByteData, double *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio, double pwRelBoundRatio);
int SZ_compress_args_double(double *oriData, size_t r1, unsigned char* newByteData, size_t *outSize, sz_params* params);
void SZ_compress_args_double_NoCkRnge_1D_subblock(unsigned char* compressedBytes, double *oriData, double realPrecision, size_t *outSize, double valueRangeSize, double medianValue_d,
size_t r1, size_t s1, size_t e1);
unsigned int optimize_intervals_double_1D_subblock(double *oriData, double realPrecision, size_t r1, size_t s1, size_t e1);
TightDataPointStorageD* SZ_compress_double_1D_MDQ_subblock(double *oriData, double realPrecision, double valueRangeSize, double medianValue_d,
size_t r1, size_t s1, size_t e1);
#ifdef __cplusplus
......
......@@ -19,17 +19,17 @@ extern "C" {
void compute_segment_precisions_double_1D(double *oriData, size_t dataLength, double* pwrErrBound, unsigned char* pwrErrBoundBytes, double globalPrecision);
unsigned int optimize_intervals_double_1D_pwr(double *oriData, size_t dataLength, double* pwrErrBound);
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr(unsigned char** newByteData, double *oriData, double globalPrecision, size_t dataLength, size_t *outSize, double min, double max);
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr(unsigned char* newByteData, double *oriData, double globalPrecision, size_t dataLength, size_t *outSize, double min, double max);
void createRangeGroups_double(double** posGroups, double** negGroups, int** posFlags, int** negFlags);
void compressGroupIDArray_double(char* groupID, TightDataPointStorageD* tdps);
TightDataPointStorageD* SZ_compress_double_1D_MDQ_pwrGroup(double* oriData, size_t dataLength, int errBoundMode,
double absErrBound, double relBoundRatio, double pwrErrRatio, double valueRangeSize, double medianValue_f);
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwrgroup(unsigned char** newByteData, double *oriData,
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwrgroup(unsigned char* newByteData, double *oriData,
size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio, double valueRangeSize, double medianValue_f, size_t *outSize);
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr_pre_log(unsigned char** newByteData, double *oriData, double globalPrecision, size_t dataLength, size_t *outSize, double min, double max);
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr_pre_log(unsigned char* newByteData, double *oriData, double globalPrecision, size_t dataLength, size_t *outSize, double min, double max);
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr_pre_log_MSST19(unsigned char** newByteData, double *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, double valueRangeSize, double medianValue_f,
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr_pre_log_MSST19(unsigned char* newByteData, double *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, double valueRangeSize, double medianValue_f,
unsigned char* signs, bool* positive, double min, double max, double nearZero);
#ifdef __cplusplus
......
/**
* @file sz_double_ts.h
* @author Sheng Di
* @date May, 2018
* @brief Header file for the sz_double_ts.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "TightDataPointStorageD.h"
#ifndef _SZ_Double_TS_H
#define _SZ_Double_TS_H
#ifdef __cplusplus
extern "C" {
#endif
unsigned int optimize_intervals_double_1D_ts(double *oriData, size_t dataLength, double* preData, double realPrecision);
TightDataPointStorageD* SZ_compress_double_1D_MDQ_ts(double *oriData, size_t dataLength, sz_multisteps* multisteps,
double realPrecision, double valueRangeSize, double medianValue_d);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZ_Double_TS_H ----- */
......@@ -29,9 +29,9 @@ unsigned int optimize_intervals_float_1D_opt_MSST19(float *oriData, size_t dataL
TightDataPointStorageF* SZ_compress_float_1D_MDQ(float *oriData,
size_t dataLength, float realPrecision, float valueRangeSize, float medianValue_f);
void SZ_compress_args_float_StoreOriData(float* oriData, size_t dataLength, unsigned char** newByteData, size_t *outSize);
void SZ_compress_args_float_StoreOriData(float* oriData, size_t dataLength, unsigned char* newByteData, size_t *outSize);
char SZ_compress_args_float_NoCkRngeNoGzip_1D(int cmprType, unsigned char** newByteData, float *oriData,
char SZ_compress_args_float_NoCkRngeNoGzip_1D( unsigned char* newByteData, float *oriData,
size_t dataLength, double realPrecision, size_t *outSize, float valueRangeSize, float medianValue_f);
size_t SZ_compress_float_1D_MDQ_RA_block(float * block_ori_data, float * mean, size_t dim_0, size_t block_dim_0, double realPrecision, int * type, float * unpredictable_data);
......@@ -40,36 +40,15 @@ size_t SZ_compress_float_1D_MDQ_RA_block_1D_pred(float * block_ori_data, float *
void SZ_blocked_regression(float * block_ori_data, size_t dim_0, size_t dim_1, size_t dim_2, size_t block_dim_0, size_t block_dim_1, size_t block_dim_2, float *params);
unsigned char * SZ_compress_float_1D_MDQ_RA(float *oriData, size_t r1, double realPrecision, size_t * comp_size);
unsigned char * SZ_compress_float_1D_MDQ_decompression_random_access_with_blocked_regression(float *oriData, size_t r1, double realPrecision, size_t * comp_size);
TightDataPointStorageF* SZ_compress_float_1D_MDQ_MSST19(float *oriData,
size_t dataLength, double realPrecision, float valueRangeSize, float medianValue_f);
void SZ_compress_args_float_withinRange(unsigned char** newByteData, float *oriData, size_t dataLength, size_t *outSize);
void SZ_compress_args_float_withinRange(unsigned char* newByteData, float *oriData, size_t dataLength, size_t *outSize);
/*int SZ_compress_args_float_wRngeNoGzip(unsigned char** newByteData, float *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio, double pwrErrRatio);*/
int SZ_compress_args_float(int cmprType, int withRegression, unsigned char** newByteData, float *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio, double pwRelBoundRatio);
int SZ_compress_args_float_subblock(unsigned char* compressedBytes, float *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1,
size_t s5, size_t s4, size_t s3, size_t s2, size_t s1,
size_t e5, size_t e4, size_t e3, size_t e2, size_t e1,
size_t *outSize, int errBoundMode, double absErr_Bound, double relBoundRatio);
void SZ_compress_args_float_NoCkRnge_1D_subblock(unsigned char* compressedBytes, float *oriData, double realPrecision, size_t *outSize, float valueRangeSize, float medianValue_f,
size_t r1, size_t s1, size_t e1);
unsigned int optimize_intervals_float_1D_subblock(float *oriData, double realPrecision, size_t r1, size_t s1, size_t e1);
TightDataPointStorageF* SZ_compress_float_1D_MDQ_subblock(float *oriData, double realPrecision, float valueRangeSize, float medianValue_f,
size_t r1, size_t s1, size_t e1);
int SZ_compress_args_float(float *oriData, size_t r1, unsigned char* newByteData, size_t *outSize, sz_params* params);
#ifdef __cplusplus
}
......
......@@ -19,7 +19,7 @@ extern "C" {
void compute_segment_precisions_float_1D(float *oriData, size_t dataLength, float* pwrErrBound, unsigned char* pwrErrBoundBytes, double globalPrecision);
unsigned int optimize_intervals_float_1D_pwr(float *oriData, size_t dataLength, float* pwrErrBound);
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr(unsigned char** newByteData, float *oriData, double globalPrecision, size_t dataLength, size_t *outSize, float min, float max);
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr(unsigned char* newByteData, float *oriData, double globalPrecision, size_t dataLength, size_t *outSize, float min, float max);
void createRangeGroups_float(float** posGroups, float** negGroups, int** posFlags, int** negFlags);
......@@ -28,11 +28,11 @@ int* generateGroupLowerBounds();
TightDataPointStorageF* SZ_compress_float_1D_MDQ_pwrGroup(float* oriData, size_t dataLength, int errBoundMode,
double absErrBound, double relBoundRatio, double pwrErrRatio, float valueRangeSize, float medianValue_f);
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwrgroup(unsigned char** newByteData, float *oriData,
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwrgroup(unsigned char* newByteData, float *oriData,
size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio, float valueRangeSize, float medianValue_f, size_t *outSize);
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr_pre_log(unsigned char** newByteData, float *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, float min, float max);
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr_pre_log_MSST19(unsigned char** newByteData, float *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, float valueRangeSize, float medianValue_f,
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr_pre_log(unsigned char* newByteData, float *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, float min, float max);
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr_pre_log_MSST19(unsigned char* newByteData, float *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, float valueRangeSize, float medianValue_f,
unsigned char* signs, bool* positive, float min, float max, float nearZero);
#ifdef __cplusplus
......
/**
* @file sz_float_ts.h
* @author Sheng Di
* @date May, 2018
* @brief Header file for the sz_float_ts.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "TightDataPointStorageF.h"
#ifndef _SZ_Float_TS_H
#define _SZ_Float_TS_H
#ifdef __cplusplus
extern "C" {
#endif
unsigned int optimize_intervals_float_1D_ts(float *oriData, size_t dataLength, float* preData, double realPrecision);
TightDataPointStorageF* SZ_compress_float_1D_MDQ_ts(float *oriData, size_t dataLength, sz_multisteps* multisteps,
double realPrecision, float valueRangeSize, float medianValue_f);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZ_Float_TS_H ----- */
/**
* @file sz_int16.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the sz_int16.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZ_Int16_H
#define _SZ_Int16_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
unsigned int optimize_intervals_int16_1D(int16_t *oriData, size_t dataLength, double realPrecision);
unsigned int optimize_intervals_int16_2D(int16_t *oriData, size_t r1, size_t r2, double realPrecision);
unsigned int optimize_intervals_int16_3D(int16_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
unsigned int optimize_intervals_int16_4D(int16_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
TightDataPointStorageI* SZ_compress_int16_1D_MDQ(int16_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int16_StoreOriData(int16_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
void SZ_compress_args_int16_NoCkRngeNoGzip_1D(unsigned char** newByteData, int16_t *oriData,
size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, int16_t minValue);
TightDataPointStorageI* SZ_compress_int16_2D_MDQ(int16_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_int16_3D_MDQ(int16_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int16_NoCkRngeNoGzip_3D(unsigned char** newByteData, int16_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_int16_4D_MDQ(int16_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int16_NoCkRngeNoGzip_4D(unsigned char** newByteData, int16_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision,
size_t *outSize, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int16_withinRange(unsigned char** newByteData, int16_t *oriData, size_t dataLength, size_t *outSize);
int SZ_compress_args_int16_wRngeNoGzip(unsigned char** newByteData, int16_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
int SZ_compress_args_int16(unsigned char** newByteData, int16_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZ_Int16_H ----- */
/**
* @file sz_int32.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the sz_int32.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZ_Int32_H
#define _SZ_Int32_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
unsigned int optimize_intervals_int32_1D(int32_t *oriData, size_t dataLength, double realPrecision);
unsigned int optimize_intervals_int32_2D(int32_t *oriData, size_t r1, size_t r2, double realPrecision);
unsigned int optimize_intervals_int32_3D(int32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
unsigned int optimize_intervals_int32_4D(int32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
TightDataPointStorageI* SZ_compress_int32_1D_MDQ(int32_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int32_StoreOriData(int32_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
void SZ_compress_args_int32_NoCkRngeNoGzip_1D(unsigned char** newByteData, int32_t *oriData,
size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, int32_t minValue);
TightDataPointStorageI* SZ_compress_int32_2D_MDQ(int32_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_int32_3D_MDQ(int32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int32_NoCkRngeNoGzip_3D(unsigned char** newByteData, int32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_int32_4D_MDQ(int32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int32_NoCkRngeNoGzip_4D(unsigned char** newByteData, int32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision,
size_t *outSize, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int32_withinRange(unsigned char** newByteData, int32_t *oriData, size_t dataLength, size_t *outSize);
int SZ_compress_args_int32_wRngeNoGzip(unsigned char** newByteData, int32_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
int SZ_compress_args_int32(unsigned char** newByteData, int32_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZ_Int32_H ----- */
/**
* @file sz_int64.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the sz_int64.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZ_Int64_H
#define _SZ_Int64_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
unsigned int optimize_intervals_int64_1D(int64_t *oriData, size_t dataLength, double realPrecision);
unsigned int optimize_intervals_int64_2D(int64_t *oriData, size_t r1, size_t r2, double realPrecision);
unsigned int optimize_intervals_int64_3D(int64_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
unsigned int optimize_intervals_int64_4D(int64_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
TightDataPointStorageI* SZ_compress_int64_1D_MDQ(int64_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int64_StoreOriData(int64_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
void SZ_compress_args_int64_NoCkRngeNoGzip_1D(unsigned char** newByteData, int64_t *oriData,
size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_int64_2D_MDQ(int64_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_int64_3D_MDQ(int64_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int64_NoCkRngeNoGzip_3D(unsigned char** newByteData, int64_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_int64_4D_MDQ(int64_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int64_NoCkRngeNoGzip_4D(unsigned char** newByteData, int64_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision,
size_t *outSize, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int64_withinRange(unsigned char** newByteData, int64_t *oriData, size_t dataLength, size_t *outSize);
int SZ_compress_args_int64_wRngeNoGzip(unsigned char** newByteData, int64_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
int SZ_compress_args_int64(unsigned char** newByteData, int64_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZ_Int64_H ----- */
/**
* @file sz_int8.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the sz_int8.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZ_Int8_H
#define _SZ_Int8_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
unsigned int optimize_intervals_int8_1D(int8_t *oriData, size_t dataLength, double realPrecision);
unsigned int optimize_intervals_int8_2D(int8_t *oriData, size_t r1, size_t r2, double realPrecision);
unsigned int optimize_intervals_int8_3D(int8_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
unsigned int optimize_intervals_int8_4D(int8_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
TightDataPointStorageI* SZ_compress_int8_1D_MDQ(int8_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int8_StoreOriData(int8_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
void SZ_compress_args_int8_NoCkRngeNoGzip_1D(unsigned char** newByteData, int8_t *oriData,
size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, int8_t minValue);
TightDataPointStorageI* SZ_compress_int8_2D_MDQ(int8_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_int8_3D_MDQ(int8_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int8_NoCkRngeNoGzip_3D(unsigned char** newByteData, int8_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_int8_4D_MDQ(int8_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int8_NoCkRngeNoGzip_4D(unsigned char** newByteData, int8_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision,
size_t *outSize, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_int8_withinRange(unsigned char** newByteData, int8_t *oriData, size_t dataLength, size_t *outSize);
int SZ_compress_args_int8_wRngeNoGzip(unsigned char** newByteData, int8_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
int SZ_compress_args_int8(unsigned char** newByteData, int8_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZ_Int8_H ----- */
/**
* @file sz_omp.h
* @author Xin Liang
* @date July, 2017
* @brief Header file for the sz_omp.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include <stdio.h>
#include <stdlib.h>
#ifdef _OPENMP
#include "omp.h"
#endif
#include "sz.h"
#ifndef _SZ_OMP_H
#define _SZ_OMP_H
#ifdef __cplusplus
extern "C" {
#endif
unsigned char * SZ_compress_float_1D_MDQ_openmp(float *oriData, size_t r1, double realPrecision, size_t * comp_size);
unsigned char * SZ_compress_float_2D_MDQ_openmp(float *oriData, size_t r1, size_t r2, double realPrecision, size_t * comp_size);
unsigned char * SZ_compress_float_3D_MDQ_openmp(float *oriData, size_t r1, size_t r2, size_t r3, float realPrecision, size_t * comp_size);
void decompressDataSeries_float_1D_openmp(float** data, size_t r1, unsigned char* comp_data);
void decompressDataSeries_float_3D_openmp(float** data, size_t r1, size_t r2, size_t r3, unsigned char* comp_data);
void decompressDataSeries_float_2D_openmp(float** data, size_t r1, size_t r2, unsigned char* comp_data);
unsigned char * SZ_compress_double_1D_MDQ_openmp(double *oriData, size_t r1, double realPrecision, size_t * comp_size);
unsigned char * SZ_compress_double_2D_MDQ_openmp(double *oriData, size_t r1, size_t r2, double realPrecision, size_t * comp_size);
unsigned char * SZ_compress_double_3D_MDQ_openmp(double *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t * comp_size);
void decompressDataSeries_double_1D_openmp(double** data, size_t r1, unsigned char* comp_data);
void decompressDataSeries_double_2D_openmp(double** data, size_t r1, size_t r2, unsigned char* comp_data);
void decompressDataSeries_double_3D_openmp(double** data, size_t r1, size_t r2, size_t r3, unsigned char* comp_data);
//void Huffman_init_openmp(HuffmanTree* huffmanTree, int *s, size_t length, int thread_num);
void Huffman_init_openmp(HuffmanTree* huffmanTree, int *s, size_t length, int thread_num, size_t * freq);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZ_OMP_H ----- */
......@@ -20,7 +20,7 @@ extern "C" {
* sz_opencl_* function.
*
* \param[out] state the sz opencl state
* \return SZ_SCES for success or SZ_NCES on error
* \return SZ_SUCCESS for success or SZ_NCES on error
*/
int sz_opencl_init(struct sz_opencl_state** state);
......@@ -28,7 +28,7 @@ extern "C" {
* deinitializes an opencl state
*
* \param[in] state the sz opencl state
* \return SZ_SCES
* \return SZ_SUCCESS
*/
int sz_opencl_release(struct sz_opencl_state** state);
......@@ -53,7 +53,7 @@ extern "C" {
* confirms that the sz opencl state is ready to use by performing a vector addition
*
* \param[in] state the sz opencl state
* \return SZ_SCES if the opencl implementation is functioning
* \return SZ_SUCCESS if the opencl implementation is functioning
*/
int sz_opencl_check(struct sz_opencl_state*);
......
/**
* @file sz_uint16.h
* @author Sheng Di
* @date Nov, 2017
* @brief Header file for the sz_uint16.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZ_UInt16_H
#define _SZ_UInt16_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
unsigned int optimize_intervals_uint16_1D(uint16_t *oriData, size_t dataLength, double realPrecision);
unsigned int optimize_intervals_uint16_2D(uint16_t *oriData, size_t r1, size_t r2, double realPrecision);
unsigned int optimize_intervals_uint16_3D(uint16_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
unsigned int optimize_intervals_uint16_4D(uint16_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
TightDataPointStorageI* SZ_compress_uint16_1D_MDQ(uint16_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_uint16_StoreOriData(uint16_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
void SZ_compress_args_uint16_NoCkRngeNoGzip_1D(unsigned char** newByteData, uint16_t *oriData,
size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, uint16_t minValue);
TightDataPointStorageI* SZ_compress_uint16_2D_MDQ(uint16_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_uint16_3D_MDQ(uint16_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_uint16_NoCkRngeNoGzip_3D(unsigned char** newByteData, uint16_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_uint16_4D_MDQ(uint16_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_uint16_NoCkRngeNoGzip_4D(unsigned char** newByteData, uint16_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision,
size_t *outSize, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_uint16_withinRange(unsigned char** newByteData, uint16_t *oriData, size_t dataLength, size_t *outSize);
int SZ_compress_args_uint16_wRngeNoGzip(unsigned char** newByteData, uint16_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
int SZ_compress_args_uint16(unsigned char** newByteData, uint16_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZ_UInt16_H ----- */
/**
* @file sz_uint32.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the sz_uint32.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZ_UInt32_H
#define _SZ_UInt32_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
unsigned int optimize_intervals_uint32_1D(uint32_t *oriData, size_t dataLength, double realPrecision);
unsigned int optimize_intervals_uint32_2D(uint32_t *oriData, size_t r1, size_t r2, double realPrecision);
unsigned int optimize_intervals_uint32_3D(uint32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
unsigned int optimize_intervals_uint32_4D(uint32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
TightDataPointStorageI* SZ_compress_uint32_1D_MDQ(uint32_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_uint32_StoreOriData(uint32_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
void SZ_compress_args_uint32_NoCkRngeNoGzip_1D(unsigned char** newByteData, uint32_t *oriData,
size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, uint32_t minValue);
TightDataPointStorageI* SZ_compress_uint32_2D_MDQ(uint32_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_uint32_3D_MDQ(uint32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_uint32_NoCkRngeNoGzip_3D(unsigned char** newByteData, uint32_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_uint32_4D_MDQ(uint32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_uint32_NoCkRngeNoGzip_4D(unsigned char** newByteData, uint32_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision,
size_t *outSize, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_uint32_withinRange(unsigned char** newByteData, uint32_t *oriData, size_t dataLength, size_t *outSize);
int SZ_compress_args_uint32_wRngeNoGzip(unsigned char** newByteData, uint32_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
int SZ_compress_args_uint32(unsigned char** newByteData, uint32_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZ_UInt32_H ----- */
/**
* @file sz_uint64.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the sz_uint64.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZ_UInt64_H
#define _SZ_UInt64_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
unsigned int optimize_intervals_uint64_1D(uint64_t *oriData, size_t dataLength, double realPrecision);
unsigned int optimize_intervals_uint64_2D(uint64_t *oriData, size_t r1, size_t r2, double realPrecision);
unsigned int optimize_intervals_uint64_3D(uint64_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
unsigned int optimize_intervals_uint64_4D(uint64_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
TightDataPointStorageI* SZ_compress_uint64_1D_MDQ(uint64_t *oriData, size_t dataLength, double realPrecision, uint64_t valueRangeSize, uint64_t minValue);
void SZ_compress_args_uint64_StoreOriData(uint64_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
void SZ_compress_args_uint64_NoCkRngeNoGzip_1D(unsigned char** newByteData, uint64_t *oriData,
size_t dataLength, double realPrecision, size_t *outSize, uint64_t valueRangeSize, uint64_t minValue);
TightDataPointStorageI* SZ_compress_uint64_2D_MDQ(uint64_t *oriData, size_t r1, size_t r2, double realPrecision, uint64_t valueRangeSize, uint64_t minValue);
TightDataPointStorageI* SZ_compress_uint64_3D_MDQ(uint64_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, uint64_t valueRangeSize, uint64_t minValue);
void SZ_compress_args_uint64_NoCkRngeNoGzip_3D(unsigned char** newByteData, uint64_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, uint64_t valueRangeSize, uint64_t minValue);
TightDataPointStorageI* SZ_compress_uint64_4D_MDQ(uint64_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, uint64_t valueRangeSize, uint64_t minValue);
void SZ_compress_args_uint64_NoCkRngeNoGzip_4D(unsigned char** newByteData, uint64_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision,
size_t *outSize, uint64_t valueRangeSize, uint64_t minValue);
void SZ_compress_args_uint64_withinRange(unsigned char** newByteData, uint64_t *oriData, size_t dataLength, size_t *outSize);
int SZ_compress_args_uint64_wRngeNoGzip(unsigned char** newByteData, uint64_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
int SZ_compress_args_uint64(unsigned char** newByteData, uint64_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZ_UInt64_H ----- */
/**
* @file sz_uint8.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the sz_uint8.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZ_UInt8_H
#define _SZ_UInt8_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
unsigned int optimize_intervals_uint8_1D(uint8_t *oriData, size_t dataLength, double realPrecision);
unsigned int optimize_intervals_uint8_2D(uint8_t *oriData, size_t r1, size_t r2, double realPrecision);
unsigned int optimize_intervals_uint8_3D(uint8_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision);
unsigned int optimize_intervals_uint8_4D(uint8_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision);
TightDataPointStorageI* SZ_compress_uint8_1D_MDQ(uint8_t *oriData, size_t dataLength, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_uint8_StoreOriData(uint8_t* oriData, size_t dataLength, TightDataPointStorageI* tdps, unsigned char** newByteData, size_t *outSize);
void SZ_compress_args_uint8_NoCkRngeNoGzip_1D(unsigned char** newByteData, uint8_t *oriData,
size_t dataLength, double realPrecision, size_t *outSize, int64_t valueRangeSize, uint8_t minValue);
TightDataPointStorageI* SZ_compress_uint8_2D_MDQ(uint8_t *oriData, size_t r1, size_t r2, double realPrecision, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_uint8_3D_MDQ(uint8_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_uint8_NoCkRngeNoGzip_3D(unsigned char** newByteData, uint8_t *oriData, size_t r1, size_t r2, size_t r3, double realPrecision, size_t *outSize, int64_t valueRangeSize, int64_t minValue);
TightDataPointStorageI* SZ_compress_uint8_4D_MDQ(uint8_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_uint8_NoCkRngeNoGzip_4D(unsigned char** newByteData, uint8_t *oriData, size_t r1, size_t r2, size_t r3, size_t r4, double realPrecision,
size_t *outSize, int64_t valueRangeSize, int64_t minValue);
void SZ_compress_args_uint8_withinRange(unsigned char** newByteData, uint8_t *oriData, size_t dataLength, size_t *outSize);
int SZ_compress_args_uint8_wRngeNoGzip(unsigned char** newByteData, uint8_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
int SZ_compress_args_uint8(unsigned char** newByteData, uint8_t *oriData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize,
int errBoundMode, double absErr_Bound, double relBoundRatio);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZ_UInt8_H ----- */
......@@ -16,13 +16,13 @@ extern "C" {
#include "TightDataPointStorageD.h"
void decompressDataSeries_double_1D(double** data, size_t dataSeriesLength, double* hist_data, TightDataPointStorageD* tdps);
void decompressDataSeries_double_1D(double* data, size_t dataSeriesLength, double* hist_data, TightDataPointStorageD* tdps);
void decompressDataSeries_double_1D_MSST19(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps);
void decompressDataSeries_double_1D_MSST19(double* data, size_t dataSeriesLength, TightDataPointStorageD* tdps);
void getSnapshotData_double_1D(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps, int errBoundMode, int compressionType, double* hist_data, sz_params* pde_params);
void getSnapshotData_double_1D(double* data, size_t dataSeriesLength, TightDataPointStorageD* tdps, int errBoundMode, int compressionType, double* hist_data, sz_params* pde_params);
int SZ_decompress_args_double(double** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize, int compressionType, double* hist_data, sz_exedata* pde_exe, sz_params* pde_params);
int SZ_decompress_args_double(double* newData, size_t r1, unsigned char* cmpBytes, size_t cmpSize, int compressionType, double* hist_data, sz_exedata* pde_exe, sz_params* pde_params);
#ifdef __cplusplus
}
......
......@@ -16,24 +16,16 @@ extern "C" {
#include "TightDataPointStorageF.h"
void decompressDataSeries_float_1D(float** data, size_t dataSeriesLength, float* hist_data, TightDataPointStorageF* tdps);
void decompressDataSeries_float_1D(float* data, size_t dataSeriesLength, float* hist_data, TightDataPointStorageF* tdps);
void decompressDataSeries_float_1D_MSST19(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
void decompressDataSeries_float_1D_MSST19(float* data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
void getSnapshotData_float_1D(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps, int errBoundMode, int compressionType, float* hist_data, sz_params* pde_params);
void getSnapshotData_float_1D(float* data, size_t dataSeriesLength, TightDataPointStorageF* tdps, int errBoundMode, int compressionType, float* hist_data, sz_params* pde_params);
size_t decompressDataSeries_float_1D_RA_block(float * data, float mean, size_t dim_0, size_t block_dim_0, double realPrecision, int * type, float * unpredictable_data);
int SZ_decompress_args_float(float* newData, size_t r1, unsigned char* cmpBytes, size_t cmpSize, int compressionType, float* hist_data, sz_exedata* pde_exe, sz_params* pde_params);
int SZ_decompress_args_float(float** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize, int compressionType, float* hist_data, sz_exedata* pde_exe, sz_params* pde_params);
void decompressDataSeries_float_1D_decompression_given_areas_with_blocked_regression(float** data, size_t r1, size_t s1, size_t e1, unsigned char* comp_data);
int SZ_decompress_args_randomaccess_float(float** newData,
size_t r5, size_t r4, size_t r3, size_t r2, size_t r1,
size_t s5, size_t s4, size_t s3, size_t s2, size_t s1, // start point
size_t e5, size_t e4, size_t e3, size_t e2, size_t e1, // end point
unsigned char* cmpBytes, size_t cmpSize);
#ifdef __cplusplus
}
......
......@@ -14,13 +14,13 @@
extern "C" {
#endif
void decompressDataSeries_float_1D_pwr(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
void decompressDataSeries_float_1D_pwr(float* data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
char* decompressGroupIDArray(unsigned char* bytes, size_t dataLength);
void decompressDataSeries_float_1D_pwrgroup(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
void decompressDataSeries_float_1D_pwr_pre_log(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
void decompressDataSeries_float_1D_pwrgroup(float* data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
void decompressDataSeries_float_1D_pwr_pre_log(float* data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
void decompressDataSeries_float_1D_pwr_pre_log_MSST19(float** data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
void decompressDataSeries_float_1D_pwr_pre_log_MSST19(float* data, size_t dataSeriesLength, TightDataPointStorageF* tdps);
#ifdef __cplusplus
}
......
/**
* @file szd_float_ts.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the szd_float_ts.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZD_Float_TS_H
#define _SZD_Float_TS_H
#ifdef __cplusplus
extern "C" {
#endif
#include "TightDataPointStorageF.h"
void decompressDataSeries_float_1D_ts(float** data, size_t dataSeriesLength, float* hist_data, TightDataPointStorageF* tdps);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZD_Float_TS_H ----- */
/**
* @file szd_int16.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the szd_int16.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZD_Int16_H
#define _SZD_Int16_H
#ifdef __cplusplus
extern "C" {
#endif
#include "TightDataPointStorageI.h"
#define SZ_INT16_MIN -32768
#define SZ_INT16_MAX 32767
void decompressDataSeries_int16_1D(int16_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
void decompressDataSeries_int16_2D(int16_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
void decompressDataSeries_int16_3D(int16_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
void decompressDataSeries_int16_4D(int16_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
void getSnapshotData_int16_1D(int16_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_int16_2D(int16_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_int16_3D(int16_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_int16_4D(int16_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
int SZ_decompress_args_int16(int16_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZD_Int16_H ----- */
/**
* @file szd_int32.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the szd_int32.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZD_Int32_H
#define _SZD_Int32_H
#ifdef __cplusplus
extern "C" {
#endif
#include "TightDataPointStorageI.h"
#define SZ_INT32_MIN -2147483648
#define SZ_INT32_MAX 2147483647
void decompressDataSeries_int32_1D(int32_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
void decompressDataSeries_int32_2D(int32_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
void decompressDataSeries_int32_3D(int32_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
void decompressDataSeries_int32_4D(int32_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
void getSnapshotData_int32_1D(int32_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_int32_2D(int32_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_int32_3D(int32_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_int32_4D(int32_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
int SZ_decompress_args_int32(int32_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZD_Int32_H ----- */
/**
* @file szd_int64.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the szd_int64.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZD_Int64_H
#define _SZD_Int64_H
#ifdef __cplusplus
extern "C" {
#endif
#include "TightDataPointStorageI.h"
void decompressDataSeries_int64_1D(int64_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
void decompressDataSeries_int64_2D(int64_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
void decompressDataSeries_int64_3D(int64_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
void decompressDataSeries_int64_4D(int64_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
void getSnapshotData_int64_1D(int64_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_int64_2D(int64_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_int64_3D(int64_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_int64_4D(int64_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
int SZ_decompress_args_int64(int64_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZD_Int64_H ----- */
/**
* @file szd_int8.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the szd_int8.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZD_Int8_H
#define _SZD_Int8_H
#ifdef __cplusplus
extern "C" {
#endif
#include "TightDataPointStorageI.h"
#define SZ_INT8_MIN -128
#define SZ_INT8_MAX 127
void decompressDataSeries_int8_1D(int8_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
void decompressDataSeries_int8_2D(int8_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
void decompressDataSeries_int8_3D(int8_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
void decompressDataSeries_int8_4D(int8_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
void getSnapshotData_int8_1D(int8_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_int8_2D(int8_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_int8_3D(int8_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_int8_4D(int8_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
int SZ_decompress_args_int8(int8_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZD_Int8_H ----- */
/**
* @file szd_uint16.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the szd_uint16.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZD_UInt16_H
#define _SZD_UInt16_H
#ifdef __cplusplus
extern "C" {
#endif
#include "TightDataPointStorageI.h"
#define SZ_UINT16_MIN 0
#define SZ_UINT16_MAX 65535
void decompressDataSeries_uint16_1D(uint16_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
void decompressDataSeries_uint16_2D(uint16_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
void decompressDataSeries_uint16_3D(uint16_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
void decompressDataSeries_uint16_4D(uint16_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
void getSnapshotData_uint16_1D(uint16_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_uint16_2D(uint16_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_uint16_3D(uint16_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_uint16_4D(uint16_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
int SZ_decompress_args_uint16(uint16_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZD_Int16_H ----- */
/**
* @file szd_uint32.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the szd_uint32.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZD_UInt32_H
#define _SZD_UInt32_H
#ifdef __cplusplus
extern "C" {
#endif
#include "TightDataPointStorageI.h"
#define SZ_UINT32_MIN 0
#define SZ_UINT32_MAX 4294967295
void decompressDataSeries_uint32_1D(uint32_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
void decompressDataSeries_uint32_2D(uint32_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
void decompressDataSeries_uint32_3D(uint32_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
void decompressDataSeries_uint32_4D(uint32_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
void getSnapshotData_uint32_1D(uint32_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_uint32_2D(uint32_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_uint32_3D(uint32_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_uint32_4D(uint32_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
int SZ_decompress_args_uint32(uint32_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZD_UInt32_H ----- */
/**
* @file szd_uint64.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the szd_uint64.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZD_UInt64_H
#define _SZD_UInt64_H
#ifdef __cplusplus
extern "C" {
#endif
#include "TightDataPointStorageI.h"
void decompressDataSeries_uint64_1D(uint64_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
void decompressDataSeries_uint64_2D(uint64_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
void decompressDataSeries_uint64_3D(uint64_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
void decompressDataSeries_uint64_4D(uint64_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
void getSnapshotData_uint64_1D(uint64_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_uint64_2D(uint64_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_uint64_3D(uint64_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_uint64_4D(uint64_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
int SZ_decompress_args_uint64(uint64_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZD_UInt64_H ----- */
/**
* @file szd_uint8.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the szd_uint8.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZD_UInt8_H
#define _SZD_UInt8_H
#ifdef __cplusplus
extern "C" {
#endif
#include "TightDataPointStorageI.h"
#define SZ_UINT8_MIN 0
#define SZ_UINT8_MAX 255
void decompressDataSeries_uint8_1D(uint8_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps);
void decompressDataSeries_uint8_2D(uint8_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps);
void decompressDataSeries_uint8_3D(uint8_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps);
void decompressDataSeries_uint8_4D(uint8_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps);
void getSnapshotData_uint8_1D(uint8_t** data, size_t dataSeriesLength, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_uint8_2D(uint8_t** data, size_t r1, size_t r2, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_uint8_3D(uint8_t** data, size_t r1, size_t r2, size_t r3, TightDataPointStorageI* tdps, int errBoundMode);
void getSnapshotData_uint8_4D(uint8_t** data, size_t r1, size_t r2, size_t r3, size_t r4, TightDataPointStorageI* tdps, int errBoundMode);
int SZ_decompress_args_uint8(uint8_t** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes, size_t cmpSize);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZD_UInt8_H ----- */
/**
* @file szf.h
* @author Sheng Di
* @date July, 2017
* @brief Header file for the szf.c.
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#ifndef _SZF_H
#define _SZF_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
//szf.c
void sz_init_c_(char *configFile,int *len,int *ierr);
void sz_finalize_c_();
void SZ_writeData_inBinary_d1_Float_(float* data, char *fileName, int *len);
void sz_compress_d1_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1);
void sz_compress_d1_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1);
void sz_compress_d2_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2);
void sz_compress_d2_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2);
void sz_compress_d3_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3);
void sz_compress_d3_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3);
void sz_compress_d4_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
void sz_compress_d4_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
void sz_compress_d5_float_(float* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
void sz_compress_d5_float_rev_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
void sz_compress_d1_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1);
void sz_compress_d1_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1);
void sz_compress_d2_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2);
void sz_compress_d2_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2);
void sz_compress_d3_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3);
void sz_compress_d3_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3);
void sz_compress_d4_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
void sz_compress_d4_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
void sz_compress_d5_double_(double* data, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
void sz_compress_d5_double_rev_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
void sz_compress_d1_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1);
void sz_compress_d2_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2);
void sz_compress_d3_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3);
void sz_compress_d4_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
void sz_compress_d5_float_args_(float* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
void sz_compress_d1_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1);
void sz_compress_d2_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2);
void sz_compress_d3_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3);
void sz_compress_d4_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
void sz_compress_d5_double_args_(double* data, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
void sz_compress_d1_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1);
void sz_compress_d2_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2);
void sz_compress_d3_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3);
void sz_compress_d4_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
void sz_compress_d5_float_rev_args_(float* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
void sz_compress_d1_double_rev_args_(double* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1);
void sz_compress_d2_double_rev_args_(double* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2);
void sz_compress_d3_double_rev_args_(double* data, float *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3);
void sz_compress_d4_double_rev_args_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
void sz_compress_d5_double_rev_args_(double* data, double *reservedValue, unsigned char *bytes, size_t *outSize, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
void sz_decompress_d1_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1);
void sz_decompress_d2_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1, size_t *r2);
void sz_decompress_d3_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1, size_t *r2, size_t *r3);
void sz_decompress_d4_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
void sz_decompress_d5_float_(unsigned char *bytes, size_t *byteLength, float *data, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
void sz_decompress_d1_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1);
void sz_decompress_d2_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1, size_t *r2);
void sz_decompress_d3_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1, size_t *r2, size_t *r3);
void sz_decompress_d4_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
void sz_decompress_d5_double_(unsigned char *bytes, size_t *byteLength, double *data, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
void sz_batchaddVar_d1_float_(int var_id, char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1);
void sz_batchaddvar_d2_float_(int var_id, char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2);
void sz_batchaddvar_d3_float_(int var_id, char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3);
void sz_batchaddvar_d4_float_(int var_id, char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
void sz_batchaddvar_d5_float_(int var_id, char* varName, int *len, float* data, int *errBoundMode, float *absErrBound, float *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
void sz_batchaddvar_d1_double_(int var_id, char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1);
void sz_batchaddvar_d2_double_(int var_id, char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2);
void sz_batchaddvar_d3_double_(int var_id, char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3);
void sz_batchaddvar_d4_double_(int var_id, char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4);
void sz_batchaddvar_d5_double_(int var_id, char* varName, int *len, double* data, int *errBoundMode, double *absErrBound, double *relBoundRatio, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
void sz_batchdelvar_c_(char* varName, int *len, int *errState);
void sz_batch_compress_c_(unsigned char* bytes, size_t *outSize);
void sz_batch_decompress_c_(unsigned char* bytes, size_t *byteLength, int *ierr);
void sz_getvardim_c_(char* varName, int *len, int *dim, size_t *r1, size_t *r2, size_t *r3, size_t *r4, size_t *r5);
void compute_total_batch_size_c_(size_t *totalSize);
void sz_getvardata_float_(char* varName, int *len, float* data);
void sz_getvardata_double_(char* varName, int *len, double* data);
void sz_freevarset_c_(int *mode);
#ifdef __cplusplus
}
#endif
#endif /* ----- #ifndef _SZF_H ----- */
......@@ -3,7 +3,6 @@
#define _TD_SZ_H
#include "defines.h"
#ifdef __cplusplus
extern "C" {
#endif
......
......@@ -16,27 +16,11 @@
extern "C" {
#endif
//sihuan added: use a assistant struct to do sorting and swap that are easy to implement: should
//consider optimizing the performance later.
typedef struct sort_ast_particle{
int64_t id;
float var[6];
} sort_ast_particle;
int compare_struct(const void* obj1, const void* obj2);//sihuan added: the compare function in the qsort parameter for 2 structures
void reorder_vars(SZ_VarSet* vset);//sihuan added: reorder the variables increasingly by their index
size_t intersectAndsort(int64_t* preIndex, size_t preLen, SZ_VarSet* curVar, size_t dataLen, unsigned char* bitarray);
//sihuan added: find intersection and keep new var sorted by id
void write_reordered_tofile(SZ_VarSet* curVar, size_t dataLen);
//sihuan added: write the reordered input to files for further decompression validation
float calculate_delta_t(size_t size);//sihuan added
int is_lossless_compressed_data(unsigned char* compressedBytes, size_t cmpSize);
unsigned long sz_lossless_compress(int losslessCompressor, int level, unsigned char* data, unsigned long dataLength, unsigned char** compressBytes);
unsigned long sz_lossless_compress(int losslessCompressor, int level, unsigned char* data, unsigned long dataLength, unsigned char* compressBytes);
unsigned long sz_lossless_decompress(int losslessCompressor, unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData, unsigned long targetOriSize);
unsigned long sz_lossless_decompress65536bytes(int losslessCompressor, unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData);
void* detransposeData(void* data, int dataType, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
void* transposeData(void* data, int dataType, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1);
#ifdef __cplusplus
}
......
......@@ -572,7 +572,7 @@ void convertTDPStoBytes_double_reserve(TightDataPointStorageD* tdps, unsigned ch
}
//Convert TightDataPointStorageD to bytes...
void convertTDPStoFlatBytes_double(TightDataPointStorageD *tdps, unsigned char** bytes, size_t *size)
void convertTDPStoFlatBytes_double(TightDataPointStorageD *tdps, unsigned char* bytes, size_t *size)
{
size_t i, k = 0;
unsigned char dsLengthBytes[8];
......@@ -596,20 +596,20 @@ void convertTDPStoFlatBytes_double(TightDataPointStorageD *tdps, unsigned char**
if(tdps->allSameData==1)
{
size_t totalByteLength = 3 + 1 + MetaDataByteLength_double + exe_params->SZ_SIZE_TYPE + tdps->exactMidBytes_size;
*bytes = (unsigned char *)malloc(sizeof(unsigned char)*totalByteLength);
//bytes = (unsigned char *)malloc(sizeof(unsigned char)*totalByteLength); // comment by tickduan
for (i = 0; i < 3; i++)//3
(*bytes)[k++] = versionNumber[i];
(*bytes)[k++] = sameByte;
bytes[k++] = versionNumber[i];
bytes[k++] = sameByte;
convertSZParamsToBytes(confparams_cpr, &((*bytes)[k]));
convertSZParamsToBytes(confparams_cpr, &(bytes[k]));
k = k + MetaDataByteLength_double;
for (i = 0; i < exe_params->SZ_SIZE_TYPE; i++)
(*bytes)[k++] = dsLengthBytes[i];
bytes[k++] = dsLengthBytes[i];
for (i = 0; i < tdps->exactMidBytes_size; i++)
(*bytes)[k++] = tdps->exactMidBytes[i];
bytes[k++] = tdps->exactMidBytes[i];
*size = totalByteLength;
}
......@@ -635,9 +635,9 @@ void convertTDPStoFlatBytes_double(TightDataPointStorageD *tdps, unsigned char**
if(confparams_cpr->errorBoundMode == PW_REL && confparams_cpr->accelerate_pw_rel_compression)
totalByteLength += (1+1); // for MSST19
*bytes = (unsigned char *)malloc(sizeof(unsigned char)*totalByteLength);
//*bytes = (unsigned char *)malloc(sizeof(unsigned char)*totalByteLength); comment by tickduan
convertTDPStoBytes_double(tdps, *bytes, dsLengthBytes, sameByte);
convertTDPStoBytes_double(tdps, bytes, dsLengthBytes, sameByte);
*size = totalByteLength;
}
......
......@@ -470,116 +470,8 @@ void convertTDPStoBytes_float(TightDataPointStorageF* tdps, unsigned char* bytes
}
}
/*deprecated*/
void convertTDPStoBytes_float_reserve(TightDataPointStorageF* tdps, unsigned char* bytes, unsigned char* dsLengthBytes, unsigned char sameByte)
{
size_t i, k = 0;
unsigned char intervalsBytes[4];
unsigned char typeArrayLengthBytes[8];
unsigned char rTypeLengthBytes[8];
unsigned char exactLengthBytes[8];
unsigned char exactMidBytesLength[8];
unsigned char realPrecisionBytes[8];
unsigned char reservedValueBytes[4];
unsigned char medianValueBytes[4];
unsigned char segment_sizeBytes[8];
unsigned char pwrErrBoundBytes_sizeBytes[4];
unsigned char max_quant_intervals_Bytes[4];
for(i = 0;i<3;i++)//3
bytes[k++] = versionNumber[i];
bytes[k++] = sameByte; //1
convertSZParamsToBytes(confparams_cpr, &(bytes[k]));
k = k + MetaDataByteLength;
for(i = 0;i<exe_params->SZ_SIZE_TYPE;i++)//ST
bytes[k++] = dsLengthBytes[i];
intToBytes_bigEndian(max_quant_intervals_Bytes, confparams_cpr->max_quant_intervals);
for(i = 0;i<4;i++)//4
bytes[k++] = max_quant_intervals_Bytes[i];
if(confparams_cpr->errorBoundMode>=PW_REL)
{
bytes[k++] = tdps->radExpo; //1 byte
sizeToBytes(segment_sizeBytes, confparams_cpr->segment_size);
for(i = 0;i<exe_params->SZ_SIZE_TYPE;i++)//ST
bytes[k++] = segment_sizeBytes[i];
intToBytes_bigEndian(pwrErrBoundBytes_sizeBytes, tdps->pwrErrBoundBytes_size);
for(i = 0;i<4;i++)//4
bytes[k++] = pwrErrBoundBytes_sizeBytes[i];
}
intToBytes_bigEndian(intervalsBytes, tdps->intervals);
for(i = 0;i<4;i++)//4
bytes[k++] = intervalsBytes[i];
floatToBytes(medianValueBytes, tdps->medianValue);
for (i = 0; i < 4; i++)// 4
bytes[k++] = medianValueBytes[i];
bytes[k++] = tdps->reqLength; //1 byte
floatToBytes(realPrecisionBytes, tdps->realPrecision);
for (i = 0; i < 8; i++)// 8
bytes[k++] = realPrecisionBytes[i];
sizeToBytes(typeArrayLengthBytes, tdps->typeArray_size);
for(i = 0;i<exe_params->SZ_SIZE_TYPE;i++)//ST
bytes[k++] = typeArrayLengthBytes[i];
sizeToBytes(rTypeLengthBytes, tdps->rtypeArray_size);
for(i = 0;i<exe_params->SZ_SIZE_TYPE;i++)//ST
bytes[k++] = rTypeLengthBytes[i];
sizeToBytes(exactLengthBytes, tdps->exactDataNum);
for(i = 0;i<exe_params->SZ_SIZE_TYPE;i++)//ST
bytes[k++] = exactLengthBytes[i];
sizeToBytes(exactMidBytesLength, tdps->exactMidBytes_size);
for(i = 0;i<exe_params->SZ_SIZE_TYPE;i++)//ST
bytes[k++] = exactMidBytesLength[i];
floatToBytes(reservedValueBytes, tdps->reservedValue);
for (i = 0; i < 4; i++)// 4
bytes[k++] = reservedValueBytes[i];
memcpy(&(bytes[k]), tdps->rtypeArray, tdps->rtypeArray_size);
k += tdps->rtypeArray_size;
if(confparams_cpr->errorBoundMode>=PW_REL)
{
floatToBytes(exactMidBytesLength, tdps->minLogValue);
for(i=0;i<4;i++)
bytes[k++] = exactMidBytesLength[i];
}
memcpy(&(bytes[k]), tdps->typeArray, tdps->typeArray_size);
k += tdps->typeArray_size;
if(confparams_cpr->errorBoundMode>=PW_REL)
{
memcpy(&(bytes[k]), tdps->pwrErrBoundBytes, tdps->pwrErrBoundBytes_size);
k += tdps->pwrErrBoundBytes_size;
}
memcpy(&(bytes[k]), tdps->leadNumArray, tdps->leadNumArray_size);
k += tdps->leadNumArray_size;
memcpy(&(bytes[k]), tdps->exactMidBytes, tdps->exactMidBytes_size);
k += tdps->exactMidBytes_size;
if(tdps->residualMidBits!=NULL)
{
memcpy(&(bytes[k]), tdps->residualMidBits, tdps->residualMidBits_size);
k += tdps->residualMidBits_size;
}
}
//convert TightDataPointStorageD to bytes...
void convertTDPStoFlatBytes_float(TightDataPointStorageF *tdps, unsigned char** bytes, size_t *size)
void convertTDPStoFlatBytes_float(TightDataPointStorageF *tdps, unsigned char* bytes, size_t *size)
{
size_t i, k = 0;
unsigned char dsLengthBytes[8];
......@@ -605,20 +497,23 @@ void convertTDPStoFlatBytes_float(TightDataPointStorageF *tdps, unsigned char**
if(tdps->allSameData==1)
{
size_t totalByteLength = 3 + 1 + MetaDataByteLength + exe_params->SZ_SIZE_TYPE + tdps->exactMidBytes_size;
*bytes = (unsigned char *)malloc(sizeof(unsigned char)*totalByteLength);
//*bytes = (unsigned char *)malloc(sizeof(unsigned char)*totalByteLength); // not need malloc comment by tickduan
// check output buffer enough
for (i = 0; i < 3; i++)//3
(*bytes)[k++] = versionNumber[i];
(*bytes)[k++] = sameByte;
bytes[k++] = versionNumber[i];
bytes[k++] = sameByte;
convertSZParamsToBytes(confparams_cpr, &((*bytes)[k]));
convertSZParamsToBytes(confparams_cpr, &(bytes[k]));
k = k + MetaDataByteLength;
for (i = 0; i < exe_params->SZ_SIZE_TYPE; i++)
(*bytes)[k++] = dsLengthBytes[i];
bytes[k++] = dsLengthBytes[i];
for (i = 0; i < tdps->exactMidBytes_size; i++)
(*bytes)[k++] = tdps->exactMidBytes[i];
bytes[k++] = tdps->exactMidBytes[i];
*size = totalByteLength;
}
......@@ -642,9 +537,9 @@ void convertTDPStoFlatBytes_float(TightDataPointStorageF *tdps, unsigned char**
if(confparams_cpr->errorBoundMode == PW_REL && confparams_cpr->accelerate_pw_rel_compression)
totalByteLength += (1+1); // for MSST19
*bytes = (unsigned char *)malloc(sizeof(unsigned char)*totalByteLength);
//*bytes = (unsigned char *)malloc(sizeof(unsigned char)*totalByteLength); // comment by tickduan
convertTDPStoBytes_float(tdps, *bytes, dsLengthBytes, sameByte);
convertTDPStoBytes_float(tdps, bytes, dsLengthBytes, sameByte);
*size = totalByteLength;
}
......
......@@ -119,7 +119,7 @@ int SZ_batchDelVar(char* varName)
int SZ_batchDelVar_ID_vset(SZ_VarSet* vset, int var_id)
{
int delSuccess = SZ_NSCS;
int delSuccess = SZ_FAILED;
SZ_Variable* p = vset->header;
SZ_Variable* q = p->next;
while(q != NULL)
......@@ -130,7 +130,7 @@ int SZ_batchDelVar_ID_vset(SZ_VarSet* vset, int var_id)
//free_Variable_all(q);
free_Variable_keepOriginalData(q);
vset->count --;
delSuccess = SZ_SCES;
delSuccess = SZ_SUCCESS;
if(q->next==NULL) //means that q is the last variable
vset->lastVar = p;
break;
......@@ -145,7 +145,7 @@ int SZ_batchDelVar_ID_vset(SZ_VarSet* vset, int var_id)
int SZ_batchDelVar_vset(SZ_VarSet* vset, char* varName)
{
int delSuccess = SZ_NSCS;
int delSuccess = SZ_FAILED;
SZ_Variable* p = vset->header;
SZ_Variable* q = p->next;
while(q != NULL)
......@@ -157,7 +157,7 @@ int SZ_batchDelVar_vset(SZ_VarSet* vset, char* varName)
//free_Variable_all(q);
free_Variable_keepOriginalData(q);
vset->count --;
delSuccess = SZ_SCES;
delSuccess = SZ_SUCCESS;
break;
}
p = p->next;
......
......@@ -23,7 +23,7 @@
#define CHECK_ERR(err, msg) { \
if (err != Z_OK && err != Z_STREAM_END) { \
fprintf(stderr, "%s error: %d\n", msg, err); \
return SZ_NSCS; \
return SZ_FAILED; \
} \
}
......@@ -202,7 +202,7 @@ unsigned long zlib_compress4(unsigned char* data, unsigned long dataLength, unsi
return c_stream.total_out;
}
unsigned long zlib_compress5(unsigned char* data, unsigned long dataLength, unsigned char** compressBytes, int level)
unsigned long zlib_compress5(unsigned char* data, unsigned long dataLength, unsigned char* compressBytes, int level)
{
int ret, flush;
unsigned have;
......@@ -222,7 +222,7 @@ unsigned long zlib_compress5(unsigned char* data, unsigned long dataLength, unsi
size_t p_size = 0, av_in = 0;
uLong estCmpLen = deflateBound(&strm, dataLength);
*compressBytes = (unsigned char*)malloc(sizeof(unsigned char)*estCmpLen);
//*compressBytes = (unsigned char*)malloc(sizeof(unsigned char)*estCmpLen); // comment by tickduan no need malloc
unsigned char* out = *compressBytes;
/* compress until end of file */
......@@ -296,7 +296,7 @@ unsigned long zlib_uncompress2 (unsigned char* compressBytes, unsigned long cmpS
{
printf("Error: zlib_uncompress2: stream.avail_in != cmpSize");
//exit(1);
return SZ_NSCS; //-1
return SZ_FAILED; //-1
}
stream.next_out = *oriData;
......@@ -309,7 +309,7 @@ unsigned long zlib_uncompress2 (unsigned char* compressBytes, unsigned long cmpS
if (err != Z_OK)
{
printf("Error: zlib_uncompress2: err != Z_OK\n");
return SZ_NSCS;
return SZ_FAILED;
}
err = inflate(&stream, Z_FINISH);
......
......@@ -135,13 +135,13 @@ int SZ_ReadConf(const char* sz_cfgFile) {
confparams_cpr->protectValueRange = 0;
return SZ_SCES;
return SZ_SUCCESS;
}
if (access(sz_cfgFile, F_OK) != 0)
{
printf("[SZ] Configuration file NOT accessible.\n");
return SZ_NSCS;
return SZ_FAILED;
}
//printf("[SZ] Reading SZ configuration file (%s) ...\n", sz_cfgFile);
......@@ -149,7 +149,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
if (ini == NULL)
{
printf("[SZ] Iniparser failed to parse the conf. file.\n");
return SZ_NSCS;
return SZ_FAILED;
}
endianTypeString = iniparser_getstring(ini, "ENV:dataEndianType", "LITTLE_ENDIAN_DATA");
......@@ -161,7 +161,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
{
printf("Error: Wrong dataEndianType: please set it correctly in sz.config.\n");
iniparser_freedict(ini);
return SZ_NSCS;
return SZ_FAILED;
}
// Reading/setting detection parameters
......@@ -178,7 +178,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
else{
printf("[SZ] Error: wrong solution name (please check sz.config file), sol=%s\n", sol_name);
iniparser_freedict(ini);
return SZ_NSCS;
return SZ_FAILED;
}
if(confparams_cpr->sol_ID==SZ || confparams_cpr->sol_ID==SZ_Transpose)
......@@ -208,7 +208,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
{
printf("Error: quantization_intervals must be an even number!\n");
iniparser_freedict(ini);
return SZ_NSCS;
return SZ_FAILED;
}
confparams_cpr->predThreshold = (float)iniparser_getdouble(ini, "PARAMETER:predThreshold", 0);
......@@ -219,7 +219,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
{
printf("[SZ] Error: Null szMode setting (please check sz.config file)\n");
iniparser_freedict(ini);
return SZ_NSCS;
return SZ_FAILED;
}
else if(strcmp(modeBuf, "SZ_BEST_SPEED")==0)
confparams_cpr->szMode = SZ_BEST_SPEED;
......@@ -231,7 +231,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
{
printf("[SZ] Error: Wrong szMode setting (please check sz.config file)\n");
iniparser_freedict(ini);
return SZ_NSCS;
return SZ_FAILED;
}
modeBuf = iniparser_getstring(ini, "PARAMETER:losslessCompressor", "ZSTD_COMPRESSOR");
......@@ -244,7 +244,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
printf("[SZ] Error: Wrong losslessCompressor setting (please check sz.config file)\n");\
printf("No Such a lossless compressor: %s\n", modeBuf);
iniparser_freedict(ini);
return SZ_NSCS;
return SZ_FAILED;
}
modeBuf = iniparser_getstring(ini, "PARAMETER:withLinearRegression", "YES");
......@@ -258,7 +258,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
{
printf("[SZ] Error: Null Gzip mode setting (please check sz.config file)\n");
iniparser_freedict(ini);
return SZ_NSCS;
return SZ_FAILED;
}
else if(strcmp(modeBuf, "Gzip_NO_COMPRESSION")==0)
confparams_cpr->gzipMode = 0;
......@@ -271,7 +271,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
else
{
printf("[SZ] Error: Wrong gzip Mode (please check sz.config file)\n");
return SZ_NSCS;
return SZ_FAILED;
}
modeBuf = iniparser_getstring(ini, "PARAMETER:zstdMode", "Zstd_HIGH_SPEED");
......@@ -279,7 +279,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
{
printf("[SZ] Error: Null Zstd mode setting (please check sz.config file)\n");
iniparser_freedict(ini);
return SZ_NSCS;
return SZ_FAILED;
}
else if(strcmp(modeBuf, "Zstd_BEST_SPEED")==0)
confparams_cpr->gzipMode = 1;
......@@ -294,7 +294,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
else
{
printf("[SZ] Error: Wrong zstd Mode (please check sz.config file)\n");
return SZ_NSCS;
return SZ_FAILED;
}
modeBuf = iniparser_getstring(ini, "PARAMETER:protectValueRange", "YES");
......@@ -313,7 +313,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
{
printf("[SZ] Error: Null error bound setting (please check sz.config file)\n");
iniparser_freedict(ini);
return SZ_NSCS;
return SZ_FAILED;
}
else if(strcmp(errBoundMode,"ABS")==0||strcmp(errBoundMode,"abs")==0)
confparams_cpr->errorBoundMode=SZ_ABS;
......@@ -343,7 +343,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
{
printf("[SZ] Error: Wrong error bound mode (please check sz.config file)\n");
iniparser_freedict(ini);
return SZ_NSCS;
return SZ_FAILED;
}
confparams_cpr->absErrBound = (double)iniparser_getdouble(ini, "PARAMETER:absErrBound", 0);
......@@ -366,7 +366,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
{
printf("[SZ] Error: Wrong pwr_type setting (please check sz.config file).\n");
iniparser_freedict(ini);
return SZ_NSCS;
return SZ_FAILED;
}
else //by default
confparams_cpr->pwr_type = SZ_PWR_AVG_TYPE;
......@@ -385,7 +385,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
}
iniparser_freedict(ini);
return SZ_SCES;
return SZ_SUCCESS;
}
/*-------------------------------------------------------------------------*/
......@@ -400,12 +400,12 @@ int SZ_ReadConf(const char* sz_cfgFile) {
/*-------------------------------------------------------------------------*/
int SZ_LoadConf(const char* sz_cfgFile) {
int res = SZ_ReadConf(sz_cfgFile);
if (res != SZ_SCES)
if (res != SZ_SUCCESS)
{
printf("[SZ] ERROR: Impossible to read configuration.\n");
return SZ_NSCS;
return SZ_FAILED;
}
return SZ_SCES;
return SZ_SUCCESS;
}
int checkVersion(char* version)
......
......@@ -284,7 +284,7 @@ float max_f(float a, float b)
double getRealPrecision_double(double valueRangeSize, int errBoundMode, double absErrBound, double relBoundRatio, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
double precision = 0;
if(errBoundMode==SZ_ABS||errBoundMode==ABS_OR_PW_REL||errBoundMode==ABS_AND_PW_REL)
precision = absErrBound;
......@@ -307,7 +307,7 @@ double getRealPrecision_double(double valueRangeSize, int errBoundMode, double a
double getRealPrecision_float(float valueRangeSize, int errBoundMode, double absErrBound, double relBoundRatio, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
double precision = 0;
if(errBoundMode==SZ_ABS||errBoundMode==ABS_OR_PW_REL||errBoundMode==ABS_AND_PW_REL)
precision = absErrBound;
......@@ -330,7 +330,7 @@ double getRealPrecision_float(float valueRangeSize, int errBoundMode, double abs
double getRealPrecision_int(long valueRangeSize, int errBoundMode, double absErrBound, double relBoundRatio, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
double precision = 0;
if(errBoundMode==SZ_ABS||errBoundMode==ABS_OR_PW_REL||errBoundMode==ABS_AND_PW_REL)
precision = absErrBound;
......@@ -651,7 +651,7 @@ int getPredictionCoefficients(int layers, int dimension, int **coeff_array, int
printf("Error: dimension must be no greater than 3 in the current version.\n");
*status = SZ_DERR;
}
*status = SZ_SCES;
*status = SZ_SUCCESS;
return size;
}
......
此差异已折叠。
......@@ -125,7 +125,7 @@ size_t checkFileSize(char *srcFilePath, int *status)
fseek(pFile, 0, SEEK_END);
filesize = ftell(pFile);
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
return filesize;
}
......@@ -153,13 +153,13 @@ unsigned char *readByteData(char *srcFilePath, size_t *byteLength, int *status)
}
fread(byteBuf, 1, *byteLength, pFile);
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
return byteBuf;
}
double *readDoubleData(char *srcFilePath, size_t *nbEle, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
if(dataEndianType==sysEndianType)
{
double *daBuf = readDoubleData_systemEndian(srcFilePath, nbEle,&state);
......@@ -196,7 +196,7 @@ double *readDoubleData(char *srcFilePath, size_t *nbEle, int *status)
int8_t *readInt8Data(char *srcFilePath, size_t *nbEle, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
int8_t *daBuf = readInt8Data_systemEndian(srcFilePath, nbEle, &state);
*status = state;
return daBuf;
......@@ -204,7 +204,7 @@ int8_t *readInt8Data(char *srcFilePath, size_t *nbEle, int *status)
int16_t *readInt16Data(char *srcFilePath, size_t *nbEle, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
if(dataEndianType==sysEndianType)
{
int16_t *daBuf = readInt16Data_systemEndian(srcFilePath, nbEle, &state);
......@@ -240,7 +240,7 @@ int16_t *readInt16Data(char *srcFilePath, size_t *nbEle, int *status)
uint16_t *readUInt16Data(char *srcFilePath, size_t *nbEle, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
if(dataEndianType==sysEndianType)
{
uint16_t *daBuf = readUInt16Data_systemEndian(srcFilePath, nbEle, &state);
......@@ -276,7 +276,7 @@ uint16_t *readUInt16Data(char *srcFilePath, size_t *nbEle, int *status)
int32_t *readInt32Data(char *srcFilePath, size_t *nbEle, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
if(dataEndianType==sysEndianType)
{
int32_t *daBuf = readInt32Data_systemEndian(srcFilePath, nbEle, &state);
......@@ -312,7 +312,7 @@ int32_t *readInt32Data(char *srcFilePath, size_t *nbEle, int *status)
uint32_t *readUInt32Data(char *srcFilePath, size_t *nbEle, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
if(dataEndianType==sysEndianType)
{
uint32_t *daBuf = readUInt32Data_systemEndian(srcFilePath, nbEle, &state);
......@@ -348,7 +348,7 @@ uint32_t *readUInt32Data(char *srcFilePath, size_t *nbEle, int *status)
int64_t *readInt64Data(char *srcFilePath, size_t *nbEle, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
if(dataEndianType==sysEndianType)
{
int64_t *daBuf = readInt64Data_systemEndian(srcFilePath, nbEle, &state);
......@@ -384,7 +384,7 @@ int64_t *readInt64Data(char *srcFilePath, size_t *nbEle, int *status)
uint64_t *readUInt64Data(char *srcFilePath, size_t *nbEle, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
if(dataEndianType==sysEndianType)
{
uint64_t *daBuf = readUInt64Data_systemEndian(srcFilePath, nbEle, &state);
......@@ -421,7 +421,7 @@ uint64_t *readUInt64Data(char *srcFilePath, size_t *nbEle, int *status)
float *readFloatData(char *srcFilePath, size_t *nbEle, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
if(dataEndianType==sysEndianType)
{
float *daBuf = readFloatData_systemEndian(srcFilePath, nbEle, &state);
......@@ -481,7 +481,7 @@ double *readDoubleData_systemEndian(char *srcFilePath, size_t *nbEle, int *statu
}
fread(daBuf, 8, *nbEle, pFile);
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
return daBuf;
}
......@@ -518,7 +518,7 @@ int8_t *readInt8Data_systemEndian(char *srcFilePath, size_t *nbEle, int *status)
}
fread(daBuf, 1, *nbEle, pFile);
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
return daBuf;
}
......@@ -555,7 +555,7 @@ int16_t *readInt16Data_systemEndian(char *srcFilePath, size_t *nbEle, int *statu
}
fread(daBuf, 2, *nbEle, pFile);
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
return daBuf;
}
......@@ -591,7 +591,7 @@ uint16_t *readUInt16Data_systemEndian(char *srcFilePath, size_t *nbEle, int *sta
}
fread(daBuf, 2, *nbEle, pFile);
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
return daBuf;
}
......@@ -627,7 +627,7 @@ int32_t *readInt32Data_systemEndian(char *srcFilePath, size_t *nbEle, int *statu
}
fread(daBuf, 4, *nbEle, pFile);
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
return daBuf;
}
......@@ -663,7 +663,7 @@ uint32_t *readUInt32Data_systemEndian(char *srcFilePath, size_t *nbEle, int *sta
}
fread(daBuf, 4, *nbEle, pFile);
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
return daBuf;
}
......@@ -699,7 +699,7 @@ int64_t *readInt64Data_systemEndian(char *srcFilePath, size_t *nbEle, int *statu
}
fread(daBuf, 8, *nbEle, pFile);
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
return daBuf;
}
......@@ -735,7 +735,7 @@ uint64_t *readUInt64Data_systemEndian(char *srcFilePath, size_t *nbEle, int *sta
}
fread(daBuf, 8, *nbEle, pFile);
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
return daBuf;
}
......@@ -771,7 +771,7 @@ float *readFloatData_systemEndian(char *srcFilePath, size_t *nbEle, int *status)
}
fread(daBuf, 4, *nbEle, pFile);
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
return daBuf;
}
......@@ -787,7 +787,7 @@ void writeByteData(unsigned char *bytes, size_t byteLength, char *tgtFilePath, i
fwrite(bytes, 1, byteLength, pFile); //write outSize bytes
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
}
void writeDoubleData(double *data, size_t nbEle, char *tgtFilePath, int *status)
......@@ -809,7 +809,7 @@ void writeDoubleData(double *data, size_t nbEle, char *tgtFilePath, int *status)
}
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
}
void writeFloatData(float *data, size_t nbEle, char *tgtFilePath, int *status)
......@@ -833,12 +833,12 @@ void writeFloatData(float *data, size_t nbEle, char *tgtFilePath, int *status)
}
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
}
void writeDataSZ(void *data, int dataType, size_t nbEle, char *tgtFilePath, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
if(dataType == SZ_FLOAT)
{
float* dataArray = (float *)data;
......@@ -861,7 +861,7 @@ void writeDataSZ(void *data, int dataType, size_t nbEle, char *tgtFilePath, int
void writeFloatData_inBytes(float *data, size_t nbEle, char* tgtFilePath, int *status)
{
size_t i = 0;
int state = SZ_SCES;
int state = SZ_SUCCESS;
lfloat buf;
unsigned char* bytes = (unsigned char*)malloc(nbEle*sizeof(float));
for(i=0;i<nbEle;i++)
......@@ -882,7 +882,7 @@ void writeFloatData_inBytes(float *data, size_t nbEle, char* tgtFilePath, int *s
void writeDoubleData_inBytes(double *data, size_t nbEle, char* tgtFilePath, int *status)
{
size_t i = 0, index = 0;
int state = SZ_SCES;
int state = SZ_SUCCESS;
ldouble buf;
unsigned char* bytes = (unsigned char*)malloc(nbEle*sizeof(double));
for(i=0;i<nbEle;i++)
......@@ -907,7 +907,7 @@ void writeDoubleData_inBytes(double *data, size_t nbEle, char* tgtFilePath, int
void writeShortData_inBytes(short *states, size_t stateLength, char *tgtFilePath, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
size_t byteLength = stateLength*2;
unsigned char* bytes = (unsigned char*)malloc(byteLength*sizeof(char));
convertShortArrayToBytes(states, stateLength, bytes);
......@@ -918,7 +918,7 @@ void writeShortData_inBytes(short *states, size_t stateLength, char *tgtFilePath
void writeUShortData_inBytes(unsigned short *states, size_t stateLength, char *tgtFilePath, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
size_t byteLength = stateLength*2;
unsigned char* bytes = (unsigned char*)malloc(byteLength*sizeof(char));
convertUShortArrayToBytes(states, stateLength, bytes);
......@@ -929,7 +929,7 @@ void writeUShortData_inBytes(unsigned short *states, size_t stateLength, char *t
void writeIntData_inBytes(int *states, size_t stateLength, char *tgtFilePath, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
size_t byteLength = stateLength*4;
unsigned char* bytes = (unsigned char*)malloc(byteLength*sizeof(char));
convertIntArrayToBytes(states, stateLength, bytes);
......@@ -940,7 +940,7 @@ void writeIntData_inBytes(int *states, size_t stateLength, char *tgtFilePath, in
void writeUIntData_inBytes(unsigned int *states, size_t stateLength, char *tgtFilePath, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
size_t byteLength = stateLength*4;
unsigned char* bytes = (unsigned char*)malloc(byteLength*sizeof(char));
convertUIntArrayToBytes(states, stateLength, bytes);
......@@ -951,7 +951,7 @@ void writeUIntData_inBytes(unsigned int *states, size_t stateLength, char *tgtFi
void writeLongData_inBytes(int64_t *states, size_t stateLength, char *tgtFilePath, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
size_t byteLength = stateLength*8;
unsigned char* bytes = (unsigned char*)malloc(byteLength*sizeof(char));
convertLongArrayToBytes(states, stateLength, bytes);
......@@ -962,7 +962,7 @@ void writeLongData_inBytes(int64_t *states, size_t stateLength, char *tgtFilePat
void writeULongData_inBytes(uint64_t *states, size_t stateLength, char *tgtFilePath, int *status)
{
int state = SZ_SCES;
int state = SZ_SUCCESS;
size_t byteLength = stateLength*8;
unsigned char* bytes = (unsigned char*)malloc(byteLength*sizeof(char));
convertULongArrayToBytes(states, stateLength, bytes);
......@@ -974,7 +974,7 @@ void writeULongData_inBytes(uint64_t *states, size_t stateLength, char *tgtFileP
unsigned short* readShortData(char *srcFilePath, size_t *dataLength, int *status)
{
size_t byteLength = 0;
int state = SZ_SCES;
int state = SZ_SUCCESS;
unsigned char * bytes = readByteData(srcFilePath, &byteLength, &state);
*dataLength = byteLength/2;
unsigned short* states = convertByteDataToUShortArray(bytes, byteLength);
......@@ -1002,69 +1002,5 @@ void writeStrings(int nbStr, char *str[], char *tgtFilePath, int *status)
}
fclose(pFile);
*status = SZ_SCES;
*status = SZ_SUCCESS;
}
/*
//@deprecated
//binToPFM_float is to convert the floating-point data to PFM supported by Jpeg XT
//But wrong version!
//In order to do the conversion, we need to use https://github.com/thorfdbg/difftest_ng according to Thomas Richter.
void convertToPFM_float(float *data, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, int endianType, char *tgtFilePath, int *status)
{
size_t i, nbEle = computeDataLength(r5, r4, r3, r2, r1);
int dim = computeDimension(r5, r4, r3, r2, r1);
FILE *pFile = fopen(tgtFilePath, "wb");
if (pFile == NULL)
{
printf("Failed to open input file. 3\n");
*status = SZ_NSCS;
return;
}
fputs("PF\n", pFile);
char strBuf[256];
switch(dim)
{
case 1:
sprintf(strBuf, "%zu\n", r1);
break;
case 2:
sprintf(strBuf, "%zu %zu\n", r1, r2);
break;
case 3:
sprintf(strBuf, "%zu %zu %zu\n", r1, r2, r3);
break;
case 4:
sprintf(strBuf, "%zu %zu %zu %zu\n", r1, r2, r3, r4);
break;
case 5:
sprintf(strBuf, "%zu %zu %zu %zu %zu\n", r1, r2, r3, r4, r5);
break;
}
fputs(strBuf, pFile);
if(endianType==LITTLE_ENDIAN)
fputs("-1.0\n", pFile);
else
fputs("1.0\n", pFile);
size_t byteLength = nbEle*sizeof(float);
lfloat buf;
unsigned char* bytes = (unsigned char*)malloc(byteLength);
for(i=0;i<nbEle;i++)
{
buf.value = data[i];
bytes[i*4+0] = buf.byte[0];
bytes[i*4+1] = buf.byte[1];
bytes[i*4+2] = buf.byte[2];
bytes[i*4+3] = buf.byte[3];
}
fwrite(bytes, 1, byteLength, pFile); //write outSize bytes
fclose(pFile);
free(bytes);
*status = SZ_SCES;
}*/
......@@ -15,7 +15,6 @@
#include "sz.h"
#include "CompressElement.h"
#include "DynamicByteArray.h"
#include "DynamicIntArray.h"
#include "TightDataPointStorageD.h"
#include "TightDataPointStorageF.h"
#include "zlib.h"
......@@ -23,14 +22,14 @@
#include "Huffman.h"
#include "conf.h"
#include "utility.h"
#include "exafelSZ.h"
//#include "CurveFillingCompressStorage.h"
int versionNumber[4] = {SZ_VER_MAJOR,SZ_VER_MINOR,SZ_VER_BUILD,SZ_VER_REVISION};
//int SZ_SIZE_TYPE = 8;
int dataEndianType = LITTLE_ENDIAN_DATA; //*endian type of the data read from disk
int sysEndianType; //*sysEndianType is actually set automatically.
int sysEndianType = LITTLE_ENDIAN_SYSTEM ; //*sysEndianType is actually set automatically.
//the confparams should be separate between compression and decopmression, in case of mutual-affection when calling compression/decompression alternatively
sz_params *confparams_cpr = NULL; //used for compression
......@@ -56,9 +55,17 @@ HuffmanTree* SZ_Reset()
int SZ_Init(const char *configFilePath)
{
// check CPU EndianType
int x = 1;
char *y = (char*)&x;
if(*y==1)
sysEndianType = LITTLE_ENDIAN_SYSTEM;
else //=0
sysEndianType = BIG_ENDIAN_SYSTEM;
int loadFileResult = SZ_LoadConf(configFilePath);
if(loadFileResult==SZ_NSCS)
return SZ_NSCS;
if(loadFileResult==SZ_FAILED)
return SZ_FAILED;
exe_params->SZ_SIZE_TYPE = sizeof(size_t);
......@@ -66,7 +73,7 @@ int SZ_Init(const char *configFilePath)
{
initSZ_TSC();
}
return SZ_SCES;
return SZ_SUCCESS;
}
int SZ_Init_Params(sz_params *params)
......@@ -84,71 +91,12 @@ int SZ_Init_Params(sz_params *params)
if(params->quantization_intervals%2!=0)
{
printf("Error: quantization_intervals must be an even number!\n");
return SZ_NSCS;
return SZ_FAILED;
}
return SZ_SCES;
return SZ_SUCCESS;
}
int computeDimension(size_t r5, size_t r4, size_t r3, size_t r2, size_t r1)
{
int dimension;
if(r1==0)
{
dimension = 0;
}
else if(r2==0)
{
dimension = 1;
}
else if(r3==0)
{
dimension = 2;
}
else if(r4==0)
{
dimension = 3;
}
else if(r5==0)
{
dimension = 4;
}
else
{
dimension = 5;
}
return dimension;
}
size_t computeDataLength(size_t r5, size_t r4, size_t r3, size_t r2, size_t r1)
{
size_t dataLength;
if(r1==0)
{
dataLength = 0;
}
else if(r2==0)
{
dataLength = r1;
}
else if(r3==0)
{
dataLength = r1*r2;
}
else if(r4==0)
{
dataLength = r1*r2*r3;
}
else if(r5==0)
{
dataLength = r1*r2*r3*r4;
}
else
{
dataLength = r1*r2*r3*r4*r5;
}
return dataLength;
}
/*-------------------------------------------------------------------------*/
/**
......@@ -160,72 +108,34 @@ size_t computeDataLength(size_t r5, size_t r4, size_t r3, size_t r2, size_t r1)
**/
/*-------------------------------------------------------------------------*/
unsigned char* SZ_compress_args(int dataType, void *data, size_t *outSize, int errBoundMode, double absErrBound,
double relBoundRatio, double pwrBoundRatio, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1)
//
// compress output data to outData and return outSize
//
size_t SZ_compress_args(int dataType, void *data, size_t r1, unsigned char* outData, sz_params* params)
{
if(confparams_cpr == NULL)
SZ_Init(NULL);
else if(exe_params == NULL)
{
exe_params = (sz_exedata*)malloc(sizeof(sz_exedata));
memset(exe_params, 0, sizeof(sz_exedata));
}
if(exe_params->intvCapacity == 0)
{
exe_params->intvCapacity = confparams_cpr->maxRangeRadius*2;
exe_params->intvRadius = confparams_cpr->maxRangeRadius;
exe_params->optQuantMode = 1;
}
confparams_cpr->dataType = dataType;
size_t outSize = 0;
if(dataType==SZ_FLOAT)
{
unsigned char *newByteData = NULL;
SZ_compress_args_float(-1, confparams_cpr->withRegression, &newByteData, (float *)data, r5, r4, r3, r2, r1,
outSize, errBoundMode, absErrBound, relBoundRatio, pwrBoundRatio);
return newByteData;
SZ_compress_args_float((float *)data, r1, outData, &outSize, params);
}
else if(dataType==SZ_DOUBLE)
{
unsigned char *newByteData;
SZ_compress_args_double(-1, confparams_cpr->withRegression, &newByteData, (double *)data, r5, r4, r3, r2, r1,
outSize, errBoundMode, absErrBound, relBoundRatio, pwrBoundRatio);
return newByteData;
SZ_compress_args_double((double *)data, r1, outData, &outSize, params);
}
else
{
printf("Error: dataType can only be SZ_FLOAT, SZ_DOUBLE, SZ_INT8/16/32/64 or SZ_UINT8/16/32/64.\n");
return NULL;
printf("Error: dataType can only be SZ_FLOAT, SZ_DOUBLE .\n");
return 0;
}
}
unsigned char *SZ_compress(int dataType, void *data, size_t *outSize, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1)
{
unsigned char *newByteData = SZ_compress_args(dataType, data, outSize, confparams_cpr->errorBoundMode, confparams_cpr->absErrBound, confparams_cpr->relBoundRatio,
confparams_cpr->pw_relBoundRatio, r5, r4, r3, r2, r1);
return newByteData;
return outSize;
}
//////////////////
/*-------------------------------------------------------------------------*/
/**
@brief Perform Compression
@param data data to be compressed
@param reservedValue the reserved value
@param outSize the size (in bytes) after compression
@param r5,r4,r3,r2,r1 the sizes of each dimension (supporting only 5 dimensions at most in this version.
@return compressed data (in binary stream)
**/
/*-------------------------------------------------------------------------*/
void *SZ_decompress(int dataType, unsigned char *bytes, size_t byteLength, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1)
//
// decompress output data to outData and return outSize
//
size_t SZ_decompress(int dataType, unsigned char *bytes, size_t byteLength, size_t r1, unsigned char* outData)
{
sz_exedata de_exe;
memset(&de_exe, 0, sizeof(sz_exedata));
......@@ -234,80 +144,37 @@ void *SZ_decompress(int dataType, unsigned char *bytes, size_t byteLength, size_
sz_params de_params;
memset(&de_params, 0, sizeof(sz_params));
int x = 1;
char *y = (char*)&x;
if(*y==1)
sysEndianType = LITTLE_ENDIAN_SYSTEM;
else //=0
sysEndianType = BIG_ENDIAN_SYSTEM;
size_t outSize = 0;
if(dataType == SZ_FLOAT)
{
float *newFloatData;
SZ_decompress_args_float(&newFloatData, r5, r4, r3, r2, r1, bytes, byteLength, 0, NULL, &de_exe, &de_params);
return newFloatData;
int status = SZ_decompress_args_float((float*)outData, r1, bytes, byteLength, 0, NULL, &de_exe, &de_params);
if(status == SZ_SUCCESS)
{
return r1*sizeof(float);
}
return 0;
}
else if(dataType == SZ_DOUBLE)
{
double *newDoubleData;
SZ_decompress_args_double(&newDoubleData, r5, r4, r3, r2, r1, bytes, byteLength, 0, NULL, &de_exe, &de_params);
return newDoubleData;
{
int status = SZ_decompress_args_double((double*)outData, r1, bytes, byteLength, 0, NULL, &de_exe, &de_params);
if(status == SZ_SUCCESS)
{
return r1*sizeof(double);
}
return 0;
}
else
{
printf("Error: data type cannot be the types other than SZ_FLOAT or SZ_DOUBLE\n");
return NULL;
printf("Error: data type cannot be the types other than SZ_FLOAT or SZ_DOUBLE\n");
}
}
/**
*
*
* return number of elements or -1 if any errors
* */
size_t SZ_decompress_args(int dataType, unsigned char *bytes, size_t byteLength, void* decompressed_array, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1)
{
//size_t i;
size_t nbEle = computeDataLength(r5,r4,r3,r2,r1);
if(dataType == SZ_FLOAT)
{
float* data = (float *)SZ_decompress(dataType, bytes, byteLength, r5, r4, r3, r2, r1);
float* data_array = (float *)decompressed_array;
memcpy(data_array, data, nbEle*sizeof(float));
//for(i=0;i<nbEle;i++)
// data_array[i] = data[i];
free(data); //this free operation seems to not work with BlueG/Q system.
}
else if (dataType == SZ_DOUBLE)
{
double* data = (double *)SZ_decompress(dataType, bytes, byteLength, r5, r4, r3, r2, r1);
double* data_array = (double *)decompressed_array;
memcpy(data_array, data, nbEle*sizeof(double));
//for(i=0;i<nbEle;i++)
// data_array[i] = data[i];
free(data); //this free operation seems to not work with BlueG/Q system.
}
else
{
printf("Error: data type cannot be the types other than SZ_FLOAT or SZ_DOUBLE\n");
return SZ_NSCS; //indicating error
}
return nbEle;
return outSize;
}
void SZ_Finalize()
{
#ifdef HAVE_TIMECMPR
if(sz_varset!=NULL)
SZ_freeVarSet(SZ_MAINTAIN_VAR_DATA);
#endif
if(confparams_dec!=NULL)
{
free(confparams_dec);
......@@ -323,198 +190,5 @@ void SZ_Finalize()
free(exe_params);
exe_params = NULL;
}
//#ifdef HAVE_TIMECMPR
// if(sz_tsc!=NULL && sz_tsc->metadata_file!=NULL)
// fclose(sz_tsc->metadata_file);
//#endif
}
/**
*
* Inits the compressor for SZ_compress_customize
*
* with SZ_Init(NULL) if not previously initialized and no params passed
* with SZ_InitParam(userPara) otherwise if params are passed
* and doesn't not initialize otherwise
*
* @param sz_params* userPara : the user configuration or null
* @param sz_params* confparams : the current configuration
*/
static void sz_maybe_init_with_user_params(struct sz_params* userPara, struct sz_params* current_params) {
if(userPara==NULL && current_params == NULL)
SZ_Init(NULL);
else if(userPara != NULL)
SZ_Init_Params((sz_params*)userPara);
}
/**
*
* The interface for the user-customized compression method
*
* @param char* comprName : the name of the specific compression approach
* @param void* userPara : the pointer of the user-customized data stracture containing the cusotmized compressors' requried input parameters
* @param int dataType : data type (SZ_FLOAT, SZ_DOUBLE, SZ_INT8, SZ_UINT8, SZ_INT16, SZ_UINT16, ....)
* @param void* data : input dataset
* @param size_t r5 : the size of dimension 5
* @param size_t r4 : the size of dimension 4
* @param size_t r3 : the size of dimension 3
* @param size_t r2 : the size of dimension 2
* @param size_t r1 : the size of dimension 1
* @param size_t outSize : the number of bytes after compression
* @param int *status : the execution status of the compression operation (success: SZ_SCES or fail: SZ_NSCS)
*
* */
unsigned char* SZ_compress_customize(const char* cmprName, void* userPara, int dataType, void* data, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, int *status)
{
unsigned char* result = NULL;
if(strcmp(cmprName, "SZ2.0")==0 || strcmp(cmprName, "SZ2.1")==0 || strcmp(cmprName, "SZ")==0)
{
sz_maybe_init_with_user_params(userPara, confparams_cpr);
result = SZ_compress(dataType, data, outSize, r5, r4, r3, r2, r1);
*status = SZ_SCES;
}
else if(strcmp(cmprName, "SZ1.4")==0)
{
sz_maybe_init_with_user_params(userPara, confparams_cpr);
confparams_cpr->withRegression = SZ_NO_REGRESSION;
result = SZ_compress(dataType, data, outSize, r5, r4, r3, r2, r1);
*status = SZ_SCES;
}
else if(strcmp(cmprName, "SZ_Transpose")==0)
{
void* transData = transposeData(data, dataType, r5, r4, r3, r2, r1);
sz_maybe_init_with_user_params(userPara, confparams_cpr);
size_t n = computeDataLength(r5, r4, r3, r2, r1);
result = SZ_compress(dataType, transData, outSize, 0, 0, 0, 0, n);
}
else if(strcmp(cmprName, "ExaFEL")==0){
assert(dataType==SZ_FLOAT);
assert(r5==0);
result = exafelSZ_Compress(userPara,data, r4, r3, r2, r1,outSize);
*status = SZ_SCES;
}
else
{
*status = SZ_NSCS;
}
return result;
}
unsigned char* SZ_compress_customize_threadsafe(const char* cmprName, void* userPara, int dataType, void* data, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, size_t *outSize, int *status)
{
unsigned char* result = NULL;
if(strcmp(cmprName, "SZ2.0")==0 || strcmp(cmprName, "SZ2.1")==0 || strcmp(cmprName, "SZ")==0)
{
SZ_Init(NULL);
struct sz_params* para = (struct sz_params*)userPara;
if(dataType==SZ_FLOAT)
{
SZ_compress_args_float(-1, SZ_WITH_LINEAR_REGRESSION, &result, (float *)data, r5, r4, r3, r2, r1,
outSize, para->errorBoundMode, para->absErrBound, para->relBoundRatio, para->pw_relBoundRatio);
}
else if(dataType==SZ_DOUBLE)
{
SZ_compress_args_double(-1, SZ_WITH_LINEAR_REGRESSION, &result, (double *)data, r5, r4, r3, r2, r1,
outSize, para->errorBoundMode, para->absErrBound, para->relBoundRatio, para->pw_relBoundRatio);
}
*status = SZ_SCES;
return result;
}
else if(strcmp(cmprName, "SZ1.4")==0)
{
SZ_Init(NULL);
struct sz_params* para = (struct sz_params*)userPara;
if(dataType==SZ_FLOAT)
{
SZ_compress_args_float(-1, SZ_NO_REGRESSION, &result, (float *)data, r5, r4, r3, r2, r1,
outSize, para->errorBoundMode, para->absErrBound, para->relBoundRatio, para->pw_relBoundRatio);
}
else if(dataType==SZ_DOUBLE)
{
SZ_compress_args_double(-1, SZ_NO_REGRESSION, &result, (double *)data, r5, r4, r3, r2, r1,
outSize, para->errorBoundMode, para->absErrBound, para->relBoundRatio, para->pw_relBoundRatio);
}
*status = SZ_SCES;
return result;
}
else if(strcmp(cmprName, "SZ_Transpose")==0)
{
void* transData = transposeData(data, dataType, r5, r4, r3, r2, r1);
struct sz_params* para = (struct sz_params*)userPara;
size_t n = computeDataLength(r5, r4, r3, r2, r1);
result = SZ_compress_args(dataType, transData, outSize, para->errorBoundMode, para->absErrBound, para->relBoundRatio, para->pw_relBoundRatio, 0, 0, 0, 0, n);
*status = SZ_SCES;
}
else if(strcmp(cmprName, "ExaFEL")==0){ //not sure if this part is thread safe!
assert(dataType==SZ_FLOAT);
assert(r5==0);
result = exafelSZ_Compress(userPara,data, r4, r3, r2, r1,outSize);
*status = SZ_SCES;
}
else
{
*status = SZ_NSCS;
}
return result;
}
/**
*
* The interface for the user-customized decompression method
*
* @param char* comprName : the name of the specific compression approach
* @param void* userPara : the pointer of the user-customized data stracture containing the cusotmized compressors' requried input parameters
* @param int dataType : data type (SZ_FLOAT, SZ_DOUBLE, SZ_INT8, SZ_UINT8, SZ_INT16, SZ_UINT16, ....)
* @param unsigned char* bytes : input bytes (the compressed data)
* @param size_t r5 : the size of dimension 5
* @param size_t r4 : the size of dimension 4
* @param size_t r3 : the size of dimension 3
* @param size_t r2 : the size of dimension 2
* @param size_t r1 : the size of dimension 1
* @param int *status : the execution status of the compression operation (success: SZ_SCES or fail: SZ_NSCS)
*
* */
void* SZ_decompress_customize(const char* cmprName, void* userPara, int dataType, unsigned char* bytes, size_t byteLength, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, int *status)
{
void* result = NULL;
if(strcmp(cmprName, "SZ2.0")==0 || strcmp(cmprName, "SZ")==0 || strcmp(cmprName, "SZ1.4")==0)
{
result = SZ_decompress(dataType, bytes, byteLength, r5, r4, r3, r2, r1);
* status = SZ_SCES;
}
else if(strcmp(cmprName, "SZ_Transpose")==0)
{
size_t n = computeDataLength(r5, r4, r3, r2, r1);
void* tmpData = SZ_decompress(dataType, bytes, byteLength, 0, 0, 0, 0, n);
result = detransposeData(tmpData, dataType, r5, r4, r3, r2, r1);
}
else if(strcmp(cmprName, "ExaFEL")==0){
assert(dataType==SZ_FLOAT);
assert(r5==0);
result = exafelSZ_Decompress(userPara,bytes, r4, r3, r2, r1,byteLength);
*status = SZ_SCES;
}
else
{
*status = SZ_NSCS;
}
return result;
}
void* SZ_decompress_customize_threadsafe(const char* cmprName, void* userPara, int dataType, unsigned char* bytes, size_t byteLength, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, int *status)
{
return SZ_decompress_customize(cmprName, userPara, dataType, bytes, byteLength, r5, r4, r3, r2, r1, status);
}
此差异已折叠。
......@@ -17,7 +17,6 @@
#include "sz.h"
#include "CompressElement.h"
#include "DynamicByteArray.h"
#include "DynamicIntArray.h"
#include "TightDataPointStorageD.h"
#include "sz_double.h"
#include "sz_double_pwr.h"
......@@ -149,7 +148,7 @@ unsigned int optimize_intervals_double_1D_pwr(double *oriData, size_t dataLength
}
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr(unsigned char** newByteData, double *oriData, double globalPrecision,
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr(unsigned char* newByteData, double *oriData, double globalPrecision,
size_t dataLength, size_t *outSize, double min, double max)
{
size_t pwrLength = dataLength%confparams_cpr->segment_size==0?dataLength/confparams_cpr->segment_size:dataLength/confparams_cpr->segment_size+1;
......@@ -327,25 +326,25 @@ size_t dataLength, size_t *outSize, double min, double max)
unsigned char dsLengthBytes[exe_params->SZ_SIZE_TYPE];
intToBytes_bigEndian(dsLengthBytes, dataLength);//4
for (i = 0; i < 3; i++)//3
(*newByteData)[k++] = versionNumber[i];
newByteData[k++] = versionNumber[i];
if(exe_params->SZ_SIZE_TYPE==4)
{
(*newByteData)[k++] = 16; //=00010000
newByteData[k++] = 16; //=00010000
}
else
{
(*newByteData)[k++] = 80;
newByteData[k++] = 80;
}
for (i = 0; i < exe_params->SZ_SIZE_TYPE; i++)//4 or 8
(*newByteData)[k++] = dsLengthBytes[i];
newByteData[k++] = dsLengthBytes[i];
if(sysEndianType==BIG_ENDIAN_SYSTEM)
memcpy((*newByteData)+4+exe_params->SZ_SIZE_TYPE, oriData, dataLength*doubleSize);
memcpy(newByteData+4+exe_params->SZ_SIZE_TYPE, oriData, dataLength*doubleSize);
else
{
unsigned char* p = (*newByteData)+4+exe_params->SZ_SIZE_TYPE;
unsigned char* p = newByteData+4+exe_params->SZ_SIZE_TYPE;
for(i=0;i<dataLength;i++,p+=doubleSize)
doubleToBytes(p, oriData[i]);
}
......@@ -404,7 +403,7 @@ void compressGroupIDArray_double(char* groupID, TightDataPointStorageD* tdps)
}
TightDataPointStorageD* SZ_compress_double_1D_MDQ_pwrGroup(double* oriData, size_t dataLength, int errBoundMode,
double absErrBound, double relBoundRatio, double pwrErrRatio, double valueRangeSize, double medianValue_f)
double absErrBound, double relBoundRatio, double pwrErrRatio, double valueRangeSize, double medianValue_f)
{
size_t i;
double *posGroups, *negGroups, *groups;
......@@ -642,7 +641,7 @@ double absErrBound, double relBoundRatio, double pwrErrRatio, double valueRangeS
return tdps;
}
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwrgroup(unsigned char** newByteData, double *oriData,
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwrgroup(unsigned char* newByteData, double *oriData,
size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio, double valueRangeSize, double medianValue_f, size_t *outSize)
{
TightDataPointStorageD* tdps = SZ_compress_double_1D_MDQ_pwrGroup(oriData, dataLength, confparams_cpr->errorBoundMode,
......@@ -659,7 +658,7 @@ size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio,
#include <stdbool.h>
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr_pre_log(unsigned char** newByteData, double *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, double min, double max){
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr_pre_log(unsigned char* newByteData, double *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, double min, double max){
double * log_data = (double *) malloc(dataLength * sizeof(double));
......@@ -719,7 +718,7 @@ void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr_pre_log(unsigned char** newBy
free_TightDataPointStorageD(tdps);
}
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr_pre_log_MSST19(unsigned char** newByteData, double *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, double valueRangeSize, double medianValue_f,
void SZ_compress_args_double_NoCkRngeNoGzip_1D_pwr_pre_log_MSST19(unsigned char* newByteData, double *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, double valueRangeSize, double medianValue_f,
unsigned char* signs, bool* positive, double min, double max, double nearZero){
double multiplier = pow((1+pwrErrRatio), -3.0001);
for(int i=0; i<dataLength; i++){
......
此差异已折叠。
......@@ -150,7 +150,7 @@ unsigned int optimize_intervals_float_1D_pwr(float *oriData, size_t dataLength,
return powerOf2;
}
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr(unsigned char** newByteData, float *oriData, double globalPrecision,
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr(unsigned char* newByteData, float *oriData, double globalPrecision,
size_t dataLength, size_t *outSize, float min, float max)
{
size_t pwrLength = dataLength%confparams_cpr->segment_size==0?dataLength/confparams_cpr->segment_size:dataLength/confparams_cpr->segment_size+1;
......@@ -284,8 +284,6 @@ size_t dataLength, size_t *outSize, float min, float max)
listAdd_float(last3CmprsData, vce->data);
}//end of for
// char* expSegmentsInBytes;
// int expSegmentsInBytes_size = convertESCToBytes(esc, &expSegmentsInBytes);
int exactDataNum = exactLeadNumArray->size;
TightDataPointStorageF* tdps;
......@@ -297,17 +295,6 @@ size_t dataLength, size_t *outSize, float min, float max)
resiBitLengthArray->array, resiBitLengthArray->size,
realPrecision, medianValue, (char)reqLength, quantization_intervals, pwrErrBoundBytes, pwrErrBoundBytes_size, radExpo);
//sdi:Debug
/* int sum =0;
for(i=0;i<dataLength;i++)
if(type[i]==0) sum++;
printf("opt_quantizations=%d, exactDataNum=%d, sum=%d\n",quantization_intervals, exactDataNum, sum);
*/
// writeUShortData(type, dataLength, "compressStateBytes.sb");
// unsigned short type_[dataLength];
// SZ_Reset();
// decode_withTree(tdps->typeArray, tdps->typeArray_size, type_);
// printf("tdps->typeArray_size=%d\n", tdps->typeArray_size);
//free memory
free_DBA(resiBitLengthArray);
......@@ -328,25 +315,25 @@ size_t dataLength, size_t *outSize, float min, float max)
unsigned char dsLengthBytes[exe_params->SZ_SIZE_TYPE];
intToBytes_bigEndian(dsLengthBytes, dataLength);//4
for (i = 0; i < 3; i++)//3
(*newByteData)[k++] = versionNumber[i];
newByteData[k++] = versionNumber[i];
if(exe_params->SZ_SIZE_TYPE==4)
{
(*newByteData)[k++] = 16; //=00010000
newByteData[k++] = 16; //=00010000
}
else
{
(*newByteData)[k++] = 80;
newByteData[k++] = 80;
}
for (i = 0; i < exe_params->SZ_SIZE_TYPE; i++)//4 or 8
(*newByteData)[k++] = dsLengthBytes[i];
newByteData[k++] = dsLengthBytes[i];
if(sysEndianType==BIG_ENDIAN_SYSTEM)
memcpy((*newByteData)+4+exe_params->SZ_SIZE_TYPE, oriData, dataLength*floatSize);
memcpy(newByteData+4+exe_params->SZ_SIZE_TYPE, oriData, dataLength*floatSize);
else
{
unsigned char* p = (*newByteData)+4+exe_params->SZ_SIZE_TYPE;
unsigned char* p = newByteData+4+exe_params->SZ_SIZE_TYPE;
for(i=0;i<dataLength;i++,p+=floatSize)
floatToBytes(p, oriData[i]);
}
......@@ -643,7 +630,7 @@ double absErrBound, double relBoundRatio, double pwrErrRatio, float valueRangeSi
return tdps;
}
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwrgroup(unsigned char** newByteData, float *oriData,
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwrgroup(unsigned char* newByteData, float *oriData,
size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio, float valueRangeSize, float medianValue_f, size_t *outSize)
{
TightDataPointStorageF* tdps = SZ_compress_float_1D_MDQ_pwrGroup(oriData, dataLength, confparams_cpr->errorBoundMode,
......@@ -660,7 +647,7 @@ size_t dataLength, double absErrBound, double relBoundRatio, double pwrErrRatio,
#include <stdbool.h>
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr_pre_log(unsigned char** newByteData, float *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, float min, float max){
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr_pre_log(unsigned char* newByteData, float *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, float min, float max){
float * log_data = (float *) malloc(dataLength * sizeof(float));
......@@ -722,7 +709,7 @@ void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr_pre_log(unsigned char** newByt
}
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr_pre_log_MSST19(unsigned char** newByteData, float *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, float valueRangeSize, float medianValue_f,
void SZ_compress_args_float_NoCkRngeNoGzip_1D_pwr_pre_log_MSST19(unsigned char* newByteData, float *oriData, double pwrErrRatio, size_t dataLength, size_t *outSize, float valueRangeSize, float medianValue_f,
unsigned char* signs, bool* positive, float min, float max, float nearZero){
float multiplier = pow((1+pwrErrRatio), -3.0001);
for(int i=0; i<dataLength; i++){
......
/**
* @file sz_float.c
* @author Sheng Di and Dingwen Tao
* @date Aug, 2016
* @brief SZ_Init, Compression and Decompression functions
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include "sz.h"
#include "CompressElement.h"
#include "DynamicByteArray.h"
#include "DynamicIntArray.h"
#include "TightDataPointStorageF.h"
#include "zlib.h"
#include "rw.h"
#include "sz_float_ts.h"
unsigned int optimize_intervals_float_1D_ts(float *oriData, size_t dataLength, float* preData, double realPrecision)
{
size_t i = 0, radiusIndex;
float pred_value = 0, pred_err;
size_t *intervals = (size_t*)malloc(confparams_cpr->maxRangeRadius*sizeof(size_t));
memset(intervals, 0, confparams_cpr->maxRangeRadius*sizeof(size_t));
size_t totalSampleSize = dataLength/confparams_cpr->sampleDistance;
for(i=2;i<dataLength;i++)
{
if(i%confparams_cpr->sampleDistance==0)
{
pred_value = preData[i];
pred_err = fabs(pred_value - oriData[i]);
radiusIndex = (unsigned long)((pred_err/realPrecision+1)/2);
if(radiusIndex>=confparams_cpr->maxRangeRadius)
radiusIndex = confparams_cpr->maxRangeRadius - 1;
intervals[radiusIndex]++;
}
}
//compute the appropriate number
size_t targetCount = totalSampleSize*confparams_cpr->predThreshold;
size_t sum = 0;
for(i=0;i<confparams_cpr->maxRangeRadius;i++)
{
sum += intervals[i];
if(sum>targetCount)
break;
}
if(i>=confparams_cpr->maxRangeRadius)
i = confparams_cpr->maxRangeRadius-1;
unsigned int accIntervals = 2*(i+1);
unsigned int powerOf2 = roundUpToPowerOf2(accIntervals);
if(powerOf2<32)
powerOf2 = 32;
free(intervals);
return powerOf2;
}
TightDataPointStorageF* SZ_compress_float_1D_MDQ_ts(float *oriData, size_t dataLength, sz_multisteps* multisteps,
double realPrecision, float valueRangeSize, float medianValue_f)
{
float* preStepData = (float*)(multisteps->hist_data);
//store the decompressed data
//float* decData = (float*)malloc(sizeof(float)*dataLength);
//memset(decData, 0, sizeof(float)*dataLength);
float* decData = preStepData;
unsigned int quantization_intervals;
if(exe_params->optQuantMode==1)
quantization_intervals = optimize_intervals_float_1D_ts(oriData, dataLength, preStepData, realPrecision);
else
quantization_intervals = exe_params->intvCapacity;
updateQuantizationInfo(quantization_intervals);
size_t i;
int reqLength;
float medianValue = medianValue_f;
short radExpo = getExponent_float(valueRangeSize/2);
computeReqLength_float(realPrecision, radExpo, &reqLength, &medianValue);
int* type = (int*) malloc(dataLength*sizeof(int));
float* spaceFillingValue = oriData; //
DynamicIntArray *exactLeadNumArray;
new_DIA(&exactLeadNumArray, DynArrayInitLen);
DynamicByteArray *exactMidByteArray;
new_DBA(&exactMidByteArray, DynArrayInitLen);
DynamicIntArray *resiBitArray;
new_DIA(&resiBitArray, DynArrayInitLen);
unsigned char preDataBytes[4];
intToBytes_bigEndian(preDataBytes, 0);
int reqBytesLength = reqLength/8;
int resiBitsLength = reqLength%8;
FloatValueCompressElement *vce = (FloatValueCompressElement*)malloc(sizeof(FloatValueCompressElement));
LossyCompressionElement *lce = (LossyCompressionElement*)malloc(sizeof(LossyCompressionElement));
//add the first data
type[0] = 0;
compressSingleFloatValue(vce, spaceFillingValue[0], realPrecision, medianValue, reqLength, reqBytesLength, resiBitsLength);
updateLossyCompElement_Float(vce->curBytes, preDataBytes, reqBytesLength, resiBitsLength, lce);
memcpy(preDataBytes,vce->curBytes,4);
addExactData(exactMidByteArray, exactLeadNumArray, resiBitArray, lce);
decData[0] = vce->data;
//add the second data
type[1] = 0;
compressSingleFloatValue(vce, spaceFillingValue[1], realPrecision, medianValue, reqLength, reqBytesLength, resiBitsLength);
updateLossyCompElement_Float(vce->curBytes, preDataBytes, reqBytesLength, resiBitsLength, lce);
memcpy(preDataBytes,vce->curBytes,4);
addExactData(exactMidByteArray, exactLeadNumArray, resiBitArray, lce);
decData[1] = vce->data;
int state = 0;
double checkRadius = 0;
float curData = 0;
float pred = 0;
float predAbsErr = 0;
checkRadius = (exe_params->intvCapacity-1)*realPrecision;
double interval = 2*realPrecision;
for(i=2;i<dataLength;i++)
{
curData = spaceFillingValue[i];
pred = preStepData[i];
predAbsErr = fabs(curData - pred);
if(predAbsErr<=checkRadius)
{
state = (predAbsErr/realPrecision+1)/2;
if(curData>=pred)
{
type[i] = exe_params->intvRadius+state;
pred = pred + state*interval;
}
else //curData<pred
{
type[i] = exe_params->intvRadius-state;
pred = pred - state*interval;
}
//double-check the prediction error in case of machine-epsilon impact
if(fabs(curData-pred)>realPrecision)
{
type[i] = 0;
compressSingleFloatValue(vce, curData, realPrecision, medianValue, reqLength, reqBytesLength, resiBitsLength);
updateLossyCompElement_Float(vce->curBytes, preDataBytes, reqBytesLength, resiBitsLength, lce);
memcpy(preDataBytes,vce->curBytes,4);
addExactData(exactMidByteArray, exactLeadNumArray, resiBitArray, lce);
decData[i] = vce->data;
}
else
{
decData[i] = pred;
}
continue;
}
//unpredictable data processing
type[i] = 0;
compressSingleFloatValue(vce, curData, realPrecision, medianValue, reqLength, reqBytesLength, resiBitsLength);
updateLossyCompElement_Float(vce->curBytes, preDataBytes, reqBytesLength, resiBitsLength, lce);
memcpy(preDataBytes,vce->curBytes,4);
addExactData(exactMidByteArray, exactLeadNumArray, resiBitArray, lce);
decData[i] = vce->data;
}//end of for
size_t exactDataNum = exactLeadNumArray->size;
TightDataPointStorageF* tdps;
new_TightDataPointStorageF(&tdps, dataLength, exactDataNum,
type, exactMidByteArray->array, exactMidByteArray->size,
exactLeadNumArray->array,
resiBitArray->array, resiBitArray->size,
resiBitsLength,
realPrecision, medianValue, (char)reqLength, quantization_intervals, NULL, 0, 0);
//free memory
free_DIA(exactLeadNumArray);
free_DIA(resiBitArray);
free(type);
free(vce);
free(lce);
free(exactMidByteArray); //exactMidByteArray->array has been released in free_TightDataPointStorageF(tdps);
//memcpy(preStepData, decData, dataLength*sizeof(float)); //update the data
//free(decData);
return tdps;
}
此差异已折叠。
......@@ -18,11 +18,11 @@
#include "szd_double_ts.h"
#include "utility.h"
int SZ_decompress_args_double(double** newData, size_t r5, size_t r4, size_t r3, size_t r2, size_t r1, unsigned char* cmpBytes,
size_t cmpSize, int compressionType, double* hist_data, sz_exedata* pde_exe, sz_params* pde_params)
int SZ_decompress_args_double(double* newData, size_t r1, unsigned char* cmpBytes,
size_t cmpSize, int compressionType, double* hist_data, sz_exedata* pde_exe, sz_params* pde_params)
{
int status = SZ_SCES;
size_t dataLength = computeDataLength(r5,r4,r3,r2,r1);
int status = SZ_SUCCESS;
size_t dataLength = r1;
//unsigned char* tmpBytes;
size_t targetUncompressSize = dataLength <<3; //i.e., *8
......@@ -39,6 +39,8 @@ size_t cmpSize, int compressionType, double* hist_data, sz_exedata* pde_exe, sz_
else
pde_params->szMode = SZ_BEST_SPEED;
}
if(pde_params->szMode==SZ_BEST_SPEED)
{
tmpSize = cmpSize;
......@@ -68,20 +70,20 @@ size_t cmpSize, int compressionType, double* hist_data, sz_exedata* pde_exe, sz_
TightDataPointStorageD* tdps;
int errBoundMode = new_TightDataPointStorageD_fromFlatBytes(&tdps, szTmpBytes, tmpSize, pde_exe, pde_params);
int dim = computeDimension(r5,r4,r3,r2,r1);
int dim = r1;
int doubleSize = sizeof(double);
if(tdps->isLossless)
{
*newData = (double*)malloc(doubleSize*dataLength);
// *newData = (double*)malloc(doubleSize*dataLength); comment by tickduan
if(sysEndianType==BIG_ENDIAN_SYSTEM)
{
memcpy(*newData, szTmpBytes+4+MetaDataByteLength_double+exe_params->SZ_SIZE_TYPE, dataLength*doubleSize);
memcpy(newData, szTmpBytes+4+MetaDataByteLength_double+exe_params->SZ_SIZE_TYPE, dataLength*doubleSize);
}
else
{
unsigned char* p = szTmpBytes+4+MetaDataByteLength_double+exe_params->SZ_SIZE_TYPE;
for(i=0;i<dataLength;i++,p+=doubleSize)
(*newData)[i] = bytesToDouble(p);
newData[i] = bytesToDouble(p);
}
}
else if(pde_params->sol_ID==SZ_Transpose)
......@@ -92,29 +94,17 @@ size_t cmpSize, int compressionType, double* hist_data, sz_exedata* pde_exe, sz_
{
if(tdps->raBytes_size > 0) //v2.0
{
if (dim == 1)
getSnapshotData_double_1D(newData,r1,tdps, errBoundMode, 0, hist_data, pde_params);
else
{
printf("Error: currently support only at most 4 dimensions!\n");
status = SZ_DERR;
}
getSnapshotData_double_1D(newData,r1,tdps, errBoundMode, 0, hist_data, pde_params);
}
else //1.4.13 or time-based compression
{
if (dim == 1)
getSnapshotData_double_1D(newData,r1,tdps, errBoundMode, compressionType, hist_data, pde_params);
else
{
printf("Error: currently support only at most 4 dimensions!\n");
status = SZ_DERR;
}
getSnapshotData_double_1D(newData,r1,tdps, errBoundMode, compressionType, hist_data, pde_params);
}
}
if(pde_params->protectValueRange)
{
double* nd = *newData;
double* nd = newData;
double min = pde_params->dmin;
double max = pde_params->dmax;
for(i=0;i<dataLength;i++)
......@@ -135,7 +125,7 @@ size_t cmpSize, int compressionType, double* hist_data, sz_exedata* pde_exe, sz_
return status;
}
void decompressDataSeries_double_1D(double** data, size_t dataSeriesLength, double* hist_data, TightDataPointStorageD* tdps)
void decompressDataSeries_double_1D(double* data, size_t dataSeriesLength, double* hist_data, TightDataPointStorageD* tdps)
{
//updateQuantizationInfo(tdps->intervals);
int intvRadius = tdps->intervals/2;
......@@ -147,7 +137,7 @@ void decompressDataSeries_double_1D(double** data, size_t dataSeriesLength, doub
double interval = tdps->realPrecision*2;
convertByteArray2IntArray_fast_2b(tdps->exactDataNum, tdps->leadNumArray, tdps->leadNumArray_size, &leadNum);
*data = (double*)malloc(sizeof(double)*dataSeriesLength);
//*data = (double*)malloc(sizeof(double)*dataSeriesLength); comment by tickduan
int* type = (int*)malloc(dataSeriesLength*sizeof(int));
......@@ -212,30 +202,25 @@ void decompressDataSeries_double_1D(double** data, size_t dataSeriesLength, doub
}
exactData = bytesToDouble(curBytes);
(*data)[i] = exactData + medianValue;
data[i] = exactData + medianValue;
memcpy(preBytes,curBytes,8);
break;
default:
//predValue = 2 * (*data)[i-1] - (*data)[i-2];
predValue = (*data)[i-1];
(*data)[i] = predValue + (type_-intvRadius)*interval;
//predValue = 2 * data[i-1] - data[i-2];
predValue = data[i-1];
data[i] = predValue + (type_-intvRadius)*interval;
break;
}
//printf("%.30G\n",(*data)[i]);
//printf("%.30G\n",data[i]);
}
#ifdef HAVE_TIMECMPR
if(confparams_dec->szMode == SZ_TEMPORAL_COMPRESSION)
memcpy(hist_data, (*data), dataSeriesLength*sizeof(double));
#endif
free(leadNum);
free(type);
return;
}
/*MSST19*/
void decompressDataSeries_double_1D_MSST19(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps)
void decompressDataSeries_double_1D_MSST19(double* data, size_t dataSeriesLength, TightDataPointStorageD* tdps)
{
//updateQuantizationInfo(tdps->intervals);
int intvRadius = tdps->intervals/2;
......@@ -248,7 +233,7 @@ void decompressDataSeries_double_1D_MSST19(double** data, size_t dataSeriesLengt
//double interval = tdps->realPrecision*2;
convertByteArray2IntArray_fast_2b(tdps->exactDataNum, tdps->leadNumArray, tdps->leadNumArray_size, &leadNum);
*data = (double*)malloc(sizeof(double)*dataSeriesLength);
//*data = (double*)malloc(sizeof(double)*dataSeriesLength); comment by tickduan
int* type = (int*)malloc(dataSeriesLength*sizeof(int));
......@@ -318,52 +303,39 @@ void decompressDataSeries_double_1D_MSST19(double** data, size_t dataSeriesLengt
}
exactData = bytesToDouble(curBytes);
(*data)[i] = exactData;
data[i] = exactData;
memcpy(preBytes,curBytes,8);
predValue = (*data)[i];
predValue = data[i];
break;
default:
//predValue = 2 * (*data)[i-1] - (*data)[i-2];
//predValue = (*data)[i-1];
//predValue = 2 * data[i-1] - data[i-2];
//predValue = data[i-1];
predValue = fabs(predValue) * precisionTable[type_];
(*data)[i] = predValue;
data[i] = predValue;
break;
}
}
#ifdef HAVE_TIMECMPR
if(confparams_dec->szMode == SZ_TEMPORAL_COMPRESSION)
memcpy(multisteps->hist_data, (*data), dataSeriesLength*sizeof(double));
#endif
free(precisionTable);
free(leadNum);
free(type);
return;
}
void getSnapshotData_double_1D(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps, int errBoundMode, int compressionType, double* hist_data, sz_params* pde_params)
void getSnapshotData_double_1D(double* data, size_t dataSeriesLength, TightDataPointStorageD* tdps, int errBoundMode, int compressionType, double* hist_data, sz_params* pde_params)
{
size_t i;
if (tdps->allSameData) {
double value = bytesToDouble(tdps->exactMidBytes);
*data = (double*)malloc(sizeof(double)*dataSeriesLength);
//*data = (double*)malloc(sizeof(double)*dataSeriesLength); comment by tickduan
for (i = 0; i < dataSeriesLength; i++)
(*data)[i] = value;
data[i] = value;
} else {
if (tdps->rtypeArray == NULL) {
if(errBoundMode < PW_REL)
{
#ifdef HAVE_TIMECMPR
if(confparams_dec->szMode == SZ_TEMPORAL_COMPRESSION)
{
if(multisteps->compressionType == 0) //snapshot
decompressDataSeries_double_1D(data, dataSeriesLength, hist_data, tdps);
else
decompressDataSeries_double_1D_ts(data, dataSeriesLength, hist_data, tdps);
}
else
#endif
decompressDataSeries_double_1D(data, dataSeriesLength, hist_data, tdps);
decompressDataSeries_double_1D(data, dataSeriesLength, hist_data, tdps);
}
else
{
......
......@@ -22,7 +22,7 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wchar-subscripts"
void decompressDataSeries_double_1D_pwr(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps)
void decompressDataSeries_double_1D_pwr(double* data, size_t dataSeriesLength, TightDataPointStorageD* tdps)
{
updateQuantizationInfo(tdps->intervals);
unsigned char tmpPrecBytes[8] = {0}; //used when needing to convert bytes to double values
......@@ -36,7 +36,7 @@ void decompressDataSeries_double_1D_pwr(double** data, size_t dataSeriesLength,
double interval = 0;// = (double)tdps->realPrecision*2;
convertByteArray2IntArray_fast_2b(tdps->exactDataNum, tdps->leadNumArray, tdps->leadNumArray_size, &leadNum);
*data = (double*)malloc(sizeof(double)*dataSeriesLength);
//*data = (double*)malloc(sizeof(double)*dataSeriesLength); comment by tickduan
int* type = (int*)malloc(dataSeriesLength*sizeof(int));
......@@ -117,16 +117,16 @@ void decompressDataSeries_double_1D_pwr(double** data, size_t dataSeriesLength,
}
exactData = bytesToDouble(curBytes);
(*data)[i] = exactData + medianValue;
data[i] = exactData + medianValue;
memcpy(preBytes,curBytes,8);
break;
default:
//predValue = 2 * (*data)[i-1] - (*data)[i-2];
predValue = (*data)[i-1];
(*data)[i] = predValue + (type_-exe_params->intvRadius)*interval;
//predValue = 2 * data[i-1] - data[i-2];
predValue = data[i-1];
data[i] = predValue + (type_-exe_params->intvRadius)*interval;
break;
}
//printf("%.30G\n",(*data)[i]);
//printf("%.30G\n",data[i]);
}
free(leadNum);
free(type);
......@@ -135,7 +135,7 @@ void decompressDataSeries_double_1D_pwr(double** data, size_t dataSeriesLength,
void decompressDataSeries_double_1D_pwrgroup(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps)
void decompressDataSeries_double_1D_pwrgroup(double* data, size_t dataSeriesLength, TightDataPointStorageD* tdps)
{
double *posGroups, *negGroups, *groups;
double pos_01_group, neg_01_group;
......@@ -148,7 +148,7 @@ void decompressDataSeries_double_1D_pwrgroup(double** data, size_t dataSeriesLen
convertByteArray2IntArray_fast_2b(tdps->exactDataNum, tdps->leadNumArray, tdps->leadNumArray_size, &leadNum);
*data = (double*)malloc(sizeof(double)*dataSeriesLength);
//*data = (double*)malloc(sizeof(double)*dataSeriesLength); comment by tickduan
int* type = (int*)malloc(dataSeriesLength*sizeof(int));
......@@ -266,7 +266,7 @@ void decompressDataSeries_double_1D_pwrgroup(double** data, size_t dataSeriesLen
exactData = bytesToDouble(curBytes);
exactData = exactData + medianValue;
(*data)[i] = exactData;
data[i] = exactData;
memcpy(preBytes,curBytes,8);
groups[indexGrpID] = exactData;
......@@ -292,7 +292,7 @@ void decompressDataSeries_double_1D_pwrgroup(double** data, size_t dataSeriesLen
// curValue = rawGrpID>0?pow(2,groupNum):-pow(2,groupNum);
//}
(*data)[i] = curValue;
data[i] = curValue;
groups[indexGrpID] = curValue;
break;
}
......@@ -309,7 +309,7 @@ void decompressDataSeries_double_1D_pwrgroup(double** data, size_t dataSeriesLen
free(groupID);
}
void decompressDataSeries_double_1D_pwr_pre_log(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps) {
void decompressDataSeries_double_1D_pwr_pre_log(double* data, size_t dataSeriesLength, TightDataPointStorageD* tdps) {
decompressDataSeries_double_1D(data, dataSeriesLength, NULL, tdps);
double threshold = tdps->minLogValue;
......@@ -318,22 +318,22 @@ void decompressDataSeries_double_1D_pwr_pre_log(double** data, size_t dataSeries
sz_lossless_decompress(ZSTD_COMPRESSOR, tdps->pwrErrBoundBytes, tdps->pwrErrBoundBytes_size, &signs, dataSeriesLength);
for(size_t i=0; i<dataSeriesLength; i++){
if((*data)[i] < threshold) (*data)[i] = 0;
else (*data)[i] = exp2((*data)[i]);
if(signs[i]) (*data)[i] = -((*data)[i]);
if(data[i] < threshold) data[i] = 0;
else data[i] = exp2(data[i]);
if(signs[i]) data[i] = -(data[i]);
}
free(signs);
}
else{
for(size_t i=0; i<dataSeriesLength; i++){
if((*data)[i] < threshold) (*data)[i] = 0;
else (*data)[i] = exp2((*data)[i]);
if(data[i] < threshold) data[i] = 0;
else data[i] = exp2(data[i]);
}
}
}
void decompressDataSeries_double_1D_pwr_pre_log_MSST19(double** data, size_t dataSeriesLength, TightDataPointStorageD* tdps)
void decompressDataSeries_double_1D_pwr_pre_log_MSST19(double* data, size_t dataSeriesLength, TightDataPointStorageD* tdps)
{
decompressDataSeries_double_1D_MSST19(data, dataSeriesLength, tdps);
double threshold = tdps->minLogValue;
......@@ -349,12 +349,12 @@ void decompressDataSeries_double_1D_pwr_pre_log_MSST19(double** data, size_t dat
else
sz_lossless_decompress(ZSTD_COMPRESSOR, tdps->pwrErrBoundBytes, tdps->pwrErrBoundBytes_size, &signs, dataSeriesLength);
for(size_t i=0; i<dataSeriesLength; i++){
if((*data)[i] < threshold && (*data)[i] >= 0){
(*data)[i] = 0;
if(data[i] < threshold && data[i] >= 0){
data[i] = 0;
continue;
}
if(signs[i]){
ptr = (uint64_t*)(*data) + i;
ptr = (uint64_t*)data + i;
*ptr |= 0x8000000000000000;
}
}
......@@ -362,7 +362,7 @@ void decompressDataSeries_double_1D_pwr_pre_log_MSST19(double** data, size_t dat
}
else{
for(size_t i=0; i<dataSeriesLength; i++){
if((*data)[i] < threshold) (*data)[i] = 0;
if(data[i] < threshold) data[i] = 0;
}
}
}
......
/**
* @file szd_double_ts.c
* @author Sheng Di and Dingwen Tao
* @date Aug, 2016
* @brief
* (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "szd_double.h"
#include "TightDataPointStorageD.h"
#include "sz.h"
#include "Huffman.h"
#include "szd_double_ts.h"
void decompressDataSeries_double_1D_ts(double** data, size_t dataSeriesLength, double* hist_data, TightDataPointStorageD* tdps)
{
double* lastSnapshotData = hist_data;
updateQuantizationInfo(tdps->intervals);
size_t i, j, k = 0, p = 0, l = 0; // k is to track the location of residual_bit
// in resiMidBits, p is to track the
// byte_index of resiMidBits, l is for
// leadNum
unsigned char* leadNum;
double interval = tdps->realPrecision*2;
convertByteArray2IntArray_fast_2b(tdps->exactDataNum, tdps->leadNumArray, tdps->leadNumArray_size, &leadNum);
*data = (double*)malloc(sizeof(double)*dataSeriesLength);
int* type = (int*)malloc(dataSeriesLength*sizeof(int));
HuffmanTree* huffmanTree = createHuffmanTree(tdps->stateNum);
decode_withTree(huffmanTree, tdps->typeArray, dataSeriesLength, type);
SZ_ReleaseHuffman(huffmanTree);
unsigned char preBytes[8];
unsigned char curBytes[8];
memset(preBytes, 0, 8);
size_t curByteIndex = 0;
int reqBytesLength, resiBitsLength, resiBits;
unsigned char leadingNum;
double medianValue, exactData, predValue = 0;
reqBytesLength = tdps->reqLength/8;
resiBitsLength = tdps->reqLength%8;
medianValue = tdps->medianValue;
int type_;
for (i = 0; i < dataSeriesLength; i++) {
type_ = type[i];
switch (type_) {
case 0:
// compute resiBits
resiBits = 0;
if (resiBitsLength != 0) {
int kMod8 = k % 8;
int rightMovSteps = getRightMovingSteps(kMod8, resiBitsLength);
if (rightMovSteps > 0) {
int code = getRightMovingCode(kMod8, resiBitsLength);
resiBits = (tdps->residualMidBits[p] & code) >> rightMovSteps;
} else if (rightMovSteps < 0) {
int code1 = getLeftMovingCode(kMod8);
int code2 = getRightMovingCode(kMod8, resiBitsLength);
int leftMovSteps = -rightMovSteps;
rightMovSteps = 8 - leftMovSteps;
resiBits = (tdps->residualMidBits[p] & code1) << leftMovSteps;
p++;
resiBits = resiBits
| ((tdps->residualMidBits[p] & code2) >> rightMovSteps);
} else // rightMovSteps == 0
{
int code = getRightMovingCode(kMod8, resiBitsLength);
resiBits = (tdps->residualMidBits[p] & code);
p++;
}
k += resiBitsLength;
}
// recover the exact data
memset(curBytes, 0, 8);
leadingNum = leadNum[l++];
memcpy(curBytes, preBytes, leadingNum);
for (j = leadingNum; j < reqBytesLength; j++)
curBytes[j] = tdps->exactMidBytes[curByteIndex++];
if (resiBitsLength != 0) {
unsigned char resiByte = (unsigned char) (resiBits << (8 - resiBitsLength));
curBytes[reqBytesLength] = resiByte;
}
exactData = bytesToDouble(curBytes);
(*data)[i] = exactData + medianValue;
memcpy(preBytes,curBytes,8);
break;
default:
//predValue = (*data)[i-1];
if(confparams_dec->szMode == SZ_TEMPORAL_COMPRESSION)
predValue = lastSnapshotData[i];
(*data)[i] = predValue + (type_-exe_params->intvRadius)*interval;
break;
}
//printf("%.30G\n",(*data)[i]);
}
memcpy(hist_data, (*data), dataSeriesLength*sizeof(double));
free(leadNum);
free(type);
return;
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -2,21 +2,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "td_sz.h"
#include "CompressElement.h"
#include "DynamicByteArray.h"
#include "DynamicIntArray.h"
#include "TightDataPointStorageD.h"
#include "TightDataPointStorageF.h"
#include "zlib.h"
#include "rw.h"
#include "Huffman.h"
#include "conf.h"
#include "utility.h"
#include "exafelSZ.h"
#include "sz.h"
#include "defines.h"
//
......@@ -24,15 +13,11 @@
//
int tdszCompress(int type, const char * input, const int nelements, const char * output)
{
size_t outSize = 0;
void* pOut = SZ_compress(type, (void*)input, &outSize, 0, 0, 0, 0, (size_t)nelements);
if(pOut == NULL)
return 0;
// check valid
sz_params comp_params = *confparams_cpr;
// copy to dest
memcpy(output, pOut, outSize);
free(pOut);
return outSize;
size_t outSize = SZ_compress_args(type, input, (size_t)nelements, (unsigned char*)output, &comp_params);
return (int)outSize;
}
//
......@@ -40,24 +25,6 @@ int tdszCompress(int type, const char * input, const int nelements, const char *
//
int tdszDecompress(int type, const char * input, int compressedSize, const int nelements, const char * output)
{
int width = 0;
if(type == SZ_FLOAT)
width = sizeof(float);
else if(type == SZ_DOUBLE)
width = sizeof(double);
else
return 0;
void* pOut = SZ_decompress(type, (void*)input, compressedSize, 0, 0, 0, 0, (size_t)nelements);
if(pOut == NULL)
return 0;
size_t outSize = nelements * width;
// copy to dest
memcpy(output, pOut, outSize);
free(pOut);
return outSize;
size_t outSize = SZ_decompress(type, (void*)input, compressedSize, (size_t)nelements, (unsigned char*)output);
return (int)outSize;
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册