1 | /** |
---|
2 | * @file utility.h |
---|
3 | * @author Sheng Di, Sihuan Li |
---|
4 | * @date July, 2018 |
---|
5 | * @brief Header file for the utility.c. |
---|
6 | * (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory. |
---|
7 | * See COPYRIGHT in top-level directory. |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef _UTILITY_H |
---|
11 | #define _UTILITY_H |
---|
12 | |
---|
13 | #include "sz.h" |
---|
14 | |
---|
15 | #ifdef __cplusplus |
---|
16 | extern "C" { |
---|
17 | #endif |
---|
18 | |
---|
19 | //sihuan added: use a assistant struct to do sorting and swap that are easy to implement: should |
---|
20 | //consider optimizing the performance later. |
---|
21 | typedef struct sort_ast_particle{ |
---|
22 | int64_t id; |
---|
23 | float var[6]; |
---|
24 | } sort_ast_particle; |
---|
25 | |
---|
26 | int compare_struct(const void* obj1, const void* obj2);//sihuan added: the compare function in the qsort parameter for 2 structures |
---|
27 | void reorder_vars(SZ_VarSet* vset);//sihuan added: reorder the variables increasingly by their index |
---|
28 | size_t intersectAndsort(int64_t* preIndex, size_t preLen, SZ_VarSet* curVar, size_t dataLen, unsigned char* bitarray); |
---|
29 | //sihuan added: find intersection and keep new var sorted by id |
---|
30 | void write_reordered_tofile(SZ_VarSet* curVar, size_t dataLen); |
---|
31 | //sihuan added: write the reordered input to files for further decompression validation |
---|
32 | float calculate_delta_t(size_t size);//sihuan added |
---|
33 | |
---|
34 | int is_lossless_compressed_data(unsigned char* compressedBytes, size_t cmpSize); |
---|
35 | unsigned long sz_lossless_compress(int losslessCompressor, int level, unsigned char* data, unsigned long dataLength, unsigned char** compressBytes); |
---|
36 | unsigned long sz_lossless_decompress(int losslessCompressor, unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData, unsigned long targetOriSize); |
---|
37 | unsigned long sz_lossless_decompress65536bytes(int losslessCompressor, unsigned char* compressBytes, unsigned long cmpSize, unsigned char** oriData); |
---|
38 | |
---|
39 | #ifdef __cplusplus |
---|
40 | } |
---|
41 | #endif |
---|
42 | |
---|
43 | #endif /* ----- #ifndef _UTILITY_H ----- */ |
---|