/* Copyright (c) 2014 Francesc Alted https://blosc.org License: BSD 3-Clause (see LICENSE.txt) Example program demonstrating use of the Blosc filter from C code. To compile this program: $ gcc simple.c -o simple -lblosc or, if you don't have the blosc library installed: $ gcc -O3 -msse2 simple.c -I../blosc -o simple -L../build/blosc Using MSVC on Windows: $ cl /arch:SSE2 /Ox /Fesimple.exe /Iblosc examples\simple.c blosc\blosc.c blosc\blosclz.c blosc\shuffle.c blosc\shuffle-sse2.c blosc\shuffle-generic.c blosc\bitshuffle-generic.c blosc\bitshuffle-sse2.c To run: $ ./simple Blosc version info: 1.4.2.dev ($Date:: 2014-07-08 #$) Compression: 4000000 -> 158494 (25.2x) Decompression successful! Successful roundtrip! */ #include #include #define SIZE 100*100*100 int main(){ static float data[SIZE]; static float data_out[SIZE]; static float data_dest[SIZE]; int isize = SIZE*sizeof(float), osize = SIZE*sizeof(float); int dsize = SIZE*sizeof(float), csize; int i; for(i=0; i %d (%.1fx)\n", isize, csize, (1.*isize) / csize); /* Decompress */ dsize = blosc_decompress(data_out, data_dest, dsize); if (dsize < 0) { printf("Decompression error. Error code: %d\n", dsize); return dsize; } printf("Decompression successful!\n"); /* After using it, destroy the Blosc environment */ blosc_destroy(); for(i=0;i