diff --git a/sz/include/defines.h b/sz/include/defines.h index f471ca0..dbb756c 100644 --- a/sz/include/defines.h +++ b/sz/include/defines.h @@ -14,7 +14,7 @@ #define SZ_VER_MAJOR 2 #define SZ_VER_MINOR 1 #define SZ_VER_BUILD 12 -#define SZ_VER_REVISION 3 +#define SZ_VER_REVISION 4 #define PASTRI 103 #define HZ 102 //deprecated diff --git a/sz/include/sz_stats.h b/sz/include/sz_stats.h index 8707c0c..d4c3da1 100644 --- a/sz/include/sz_stats.h +++ b/sz/include/sz_stats.h @@ -42,6 +42,8 @@ typedef struct sz_stats float zstdCompressionRatio; //not available yet unsigned int quantization_intervals; + + size_t pre_encoding_size; } sz_stats; extern sz_stats sz_stat; @@ -53,6 +55,7 @@ void writeZstdCompressionRatio(float zstdCompressionRatio); void writeConstantFlag(int flag); void writeUnpredictDataCounts(size_t unpredictCount, size_t totalNumElements); void writeQuantizationInfo(unsigned int quantization_intervals); +void writePreEncodingSize(size_t pre_encoding_size); void printSZStats(); #ifdef __cplusplus diff --git a/sz/src/sz_double.c b/sz/src/sz_double.c index 558403c..9e103e5 100644 --- a/sz/src/sz_double.c +++ b/sz/src/sz_double.c @@ -2717,6 +2717,9 @@ int errBoundMode, double absErr_Bound, double relBoundRatio, double pwRelBoundRa } else if(confparams_cpr->szMode==SZ_BEST_COMPRESSION || confparams_cpr->szMode==SZ_DEFAULT_COMPRESSION || confparams_cpr->szMode==SZ_TEMPORAL_COMPRESSION) { +#if HAVE_WRITESTATS + writePreEncodingSize(tmpOutSize); +#endif *outSize = sz_lossless_compress(confparams_cpr->losslessCompressor, confparams_cpr->gzipMode, tmpByteData, tmpOutSize, newByteData); free(tmpByteData); } diff --git a/sz/src/sz_float.c b/sz/src/sz_float.c index 4615c69..52d7b4f 100644 --- a/sz/src/sz_float.c +++ b/sz/src/sz_float.c @@ -3020,6 +3020,9 @@ int errBoundMode, double absErr_Bound, double relBoundRatio, double pwRelBoundRa } else if(confparams_cpr->szMode==SZ_BEST_COMPRESSION || confparams_cpr->szMode==SZ_DEFAULT_COMPRESSION || confparams_cpr->szMode==SZ_TEMPORAL_COMPRESSION) { +#if HAVE_WRITESTATS + writePreEncodingSize(tmpOutSize); +#endif *outSize = sz_lossless_compress(confparams_cpr->losslessCompressor, confparams_cpr->gzipMode, tmpByteData, tmpOutSize, newByteData); free(tmpByteData); } diff --git a/sz/src/sz_stats.c b/sz/src/sz_stats.c index 4ef588c..160c352 100644 --- a/sz/src/sz_stats.c +++ b/sz/src/sz_stats.c @@ -41,6 +41,10 @@ void writeUnpredictDataCounts(size_t unpredictCount, size_t totalNumElements) sz_stat.unpredictPercent = 1.0f*unpredictCount/totalNumElements; } +void writePreEncodingSize(size_t pre_encoding_size) { + sz_stat.pre_encoding_size = pre_encoding_size; +} + void printSZStats() { printf("===============stats about sz================\n"); @@ -71,4 +75,5 @@ void printSZStats() printf("unpredictPercent %f\n", sz_stat.unpredictPercent); printf("quantization_intervals %u\n", sz_stat.quantization_intervals); + printf("pre_encoding_size %zu\n", sz_stat.pre_encoding_size); }