Skip to content

Commit

Permalink
update compress api
Browse files Browse the repository at this point in the history
  • Loading branch information
ayzk committed Aug 16, 2024
1 parent ad47f20 commit 75c906d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/SZ3/api/impl/SZAlgoInterp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace SZ3 {
HuffmanEncoder<int>(),
Lossless_zstd());

std::vector<uchar> buffer(num * 2);
std::vector<uchar> buffer(num * sizeof(T));
size_t outSize = sz.compress(conf, data1.data(), buffer.data(), buffer.size());
// delete[]cmpData;
auto compression_ratio = num * sizeof(T) * 1.0 / outSize;
Expand Down
8 changes: 4 additions & 4 deletions include/SZ3/lossless/Lossless_zstd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ namespace SZ3 {
// uchar *compressBytes = new uchar[estimatedCompressedSize];
// uchar *dstPos = dst;
// write(srcLen, dstPos);
if (dstCap < srcLen) {
throw std::invalid_argument(
"dstCap not large enough for zstd");
}
// if (dstCap < srcLen) {
// throw std::invalid_argument(
// "dstCap not large enough for zstd");
// }
return ZSTD_compress(dst, dstCap, src, srcLen, compression_level);
// dstLen += sizeof(size_t);
// return compressBytes;
Expand Down
8 changes: 4 additions & 4 deletions tools/H5Z-SZ3/src/H5Z_SZ3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ void process_data(SZ3::Config &conf, void **buf, size_t *buf_size, size_t nbytes
*buf = processedData;
*buf_size = conf.num * sizeof(T);
} else {
size_t outSize = 0;
char *processedData = SZ_compress(conf, (T *) *buf, outSize);
size_t cmpCap = sizeof(T) * conf.num;
char *cmpData = (char *) malloc(cmpCap);
*buf_size = SZ_compress(conf, (T *) *buf, cmpData, cmpCap);
free(*buf);
*buf = processedData;
*buf_size = outSize;
*buf = cmpData;
}
}

Expand Down
4 changes: 2 additions & 2 deletions tools/H5Z-SZ3/test/dsz3FromHDF5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ int main(int argc, char *argv[]) {
int i;
printf("reconstructed data = ");
for (i = 0; i < 20; i++)
printf("%ld ", data[i]);
printf("%llu ", data[i]);
printf("\n");
free(data);
}
Expand Down Expand Up @@ -260,7 +260,7 @@ int main(int argc, char *argv[]) {
int i;
printf("reconstructed data = ");
for (i = 0; i < 20; i++)
printf("%ld ", data[i]);
printf("%lld ", data[i]);
printf("\n");
free(data);
}
Expand Down

0 comments on commit 75c906d

Please sign in to comment.