diff --git a/eigerApp/src/Makefile b/eigerApp/src/Makefile index b6cbe2f..67fbb53 100755 --- a/eigerApp/src/Makefile +++ b/eigerApp/src/Makefile @@ -34,7 +34,7 @@ endif PROD += test_lz4 test_lz4_SRCS += test_lz4.cpp test_lz4_LIBS += dectrisCompression -test_lz4_SYS_LIBS += lz4 +test_lz4_LIBS += bitshuffle lz4hdf5 include $(ADCORE)/ADApp/commonLibraryMakefile diff --git a/eigerApp/src/stream2Api.cpp b/eigerApp/src/stream2Api.cpp index be10863..2c7bb09 100644 --- a/eigerApp/src/stream2Api.cpp +++ b/eigerApp/src/stream2Api.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include @@ -36,6 +36,7 @@ static int uncompress (const unsigned char *pInput, char *dest, char *encoding, orig_size = be64toh(orig_size); uint32_t block_size = *(uint32_t *)(pInput + 8); block_size = be32toh(block_size); + int result; switch (dataType) { case NDUInt32: elemSize=4; break; @@ -46,17 +47,11 @@ static int uncompress (const unsigned char *pInput, char *dest, char *encoding, return STREAM_ERROR; } if (strcmp(encoding, "lz4") == 0) { -// ERR("calling LZ4_decompress_fast"); -// size_t result = LZ4_decompress_fast((const char *)pInput, dest, (int)uncompressedSize); - size_t result = compression_decompress_buffer(COMPRESSION_LZ4, - dest, - uncompressedSize, - (const char *)pInput, - compressedSize, - elemSize); - if (result < 0) + result = decompress_lz4hdf5((const char *)pInput, dest, uncompressedSize); + + if (result <= 0) { - ERR_ARGS("LZ4_decompress failed, result=%lu\n", result); + ERR_ARGS("decompress_lz4hdf5 failed, result=%d\n", result); return STREAM_ERROR; } } @@ -289,7 +284,7 @@ int Stream2API::getFrame (NDArray **pArrayOut, NDArrayPool *pNDArrayPool, int th const unsigned char *pInput = pSB->ptr; if (strcmp(encoding, "lz4") == 0) { - pArray->codec.name = "lz4"; + pArray->codec.name = "lz4hdf5"; } else if (strcmp(encoding, "bslz4") == 0) { diff --git a/eigerApp/src/test_lz4.cpp b/eigerApp/src/test_lz4.cpp index 5bf1d92..14f69a4 100644 --- a/eigerApp/src/test_lz4.cpp +++ b/eigerApp/src/test_lz4.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include int main(int argc, char *argv[]) @@ -29,8 +30,8 @@ int main(int argc, char *argv[]) compressedSize = fread(compressedBuff, 1, MAX_COMPRESSED_SIZE, fp); fclose(fp); - decompressedSize = LZ4_decompress_safe(compressedBuff, (char *)decompressedBuff, compressedSize, MAX_DECOMPRESSED_SIZE); - printf("Stream2_lz4_data decompressed with lz4_decompress_safe, compressedSize=%d, decompressedSize=%d\n", (int)compressedSize, (int)decompressedSize); + decompressedSize = decompress_lz4hdf5(compressedBuff, (char *)decompressedBuff, MAX_DECOMPRESSED_SIZE); + printf("Stream2_lz4_data decompressed with decompress_lz4hdf5, compressedSize=%d, decompressedSize=%d\n", (int)compressedSize, (int)decompressedSize); // Decompress with the Dectris routine decompressedSize = compression_decompress_buffer(COMPRESSION_LZ4, decompressedBuff, MAX_DECOMPRESSED_SIZE, compressedBuff, compressedSize, 4);