| 1 | /********************************************************************* |
|---|
| 2 | Blosc - Blocked Suffling and Compression Library |
|---|
| 3 | |
|---|
| 4 | Author: Francesc Alted (faltet@pytables.org) |
|---|
| 5 | |
|---|
| 6 | See LICENSES/BLOSC.txt for details about copyright and rights to use. |
|---|
| 7 | **********************************************************************/ |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | #ifndef BLOSC_H |
|---|
| 11 | #define BLOSC_H |
|---|
| 12 | |
|---|
| 13 | /* Version numbers */ |
|---|
| 14 | #define BLOSC_VERSION_MAJOR 0 /* for major interface/format changes */ |
|---|
| 15 | #define BLOSC_VERSION_MINOR 9 /* for minor interface/format changes */ |
|---|
| 16 | #define BLOSC_VERSION_RELEASE 0 /* for tweaks, bug-fixes, or development */ |
|---|
| 17 | |
|---|
| 18 | #define BLOSC_VERSION_STRING "0.9.0.dev" /* string version. Sync with above! */ |
|---|
| 19 | #define BLOSC_VERSION_DATE "2010-03-30" /* date version */ |
|---|
| 20 | |
|---|
| 21 | /* The *_VERS_FORMAT should be just 1-byte long */ |
|---|
| 22 | #define BLOSC_VERSION_FORMAT 1 /* Blosc format version, starting at 1 */ |
|---|
| 23 | #define BLOSCLZ_VERSION_FORMAT 1 /* Blosclz format version, starting at 1 */ |
|---|
| 24 | |
|---|
| 25 | /* The combined blosc and blosclz formats */ |
|---|
| 26 | #define BLOSC_VERSION_CFORMAT (BLOSC_VERSION_FORMAT << 8) & (BLOSCLZ_VERSION_FORMAT) |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | /* Initialize pool of threads and other structures */ |
|---|
| 30 | int blosc_init_threads(int nthreads); |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | /** |
|---|
| 34 | |
|---|
| 35 | Compress a block of data in the `src` buffer and returns the size of |
|---|
| 36 | compressed block. The size of `src` buffer is specified by |
|---|
| 37 | `nbytes`. |
|---|
| 38 | |
|---|
| 39 | `clevel` is the desired compression level and must be a number |
|---|
| 40 | between 0 (no compression) and 9 (maximum compression). |
|---|
| 41 | |
|---|
| 42 | `doshuffle` specifies whether the shuffle compression preconditioner |
|---|
| 43 | should be applyied or not. 0 means not applying it and 1 means |
|---|
| 44 | applying it. |
|---|
| 45 | |
|---|
| 46 | `bytesoftype` is the number of bytes for the atomic type in binary |
|---|
| 47 | `src` buffer. This is only useful for the shuffle preconditioner. |
|---|
| 48 | Only a bytesoftype > 1 the will allow the shuffle to work. |
|---|
| 49 | |
|---|
| 50 | The minimum `src` buffer size is 16. The `dest` buffer must have at |
|---|
| 51 | least the size of the `src` buffer and can not be smaller than 66 |
|---|
| 52 | bytes. The `src` buffer and the `dest` buffer can not overlap. |
|---|
| 53 | |
|---|
| 54 | If `src` buffer is not compressible (len(`dest`) >= len(`src`)), the |
|---|
| 55 | return value is zero and you should discard the contents of the |
|---|
| 56 | `dest` buffer. |
|---|
| 57 | |
|---|
| 58 | A negative return value means that an internal error happened. This |
|---|
| 59 | should never happen. If you see this, please report it back |
|---|
| 60 | together with the buffer data causing this and compression settings. |
|---|
| 61 | |
|---|
| 62 | Compression is memory safe and guaranteed not to write the `dest` |
|---|
| 63 | buffer more than what is specified in `nbytes`. |
|---|
| 64 | |
|---|
| 65 | */ |
|---|
| 66 | |
|---|
| 67 | unsigned int |
|---|
| 68 | blosc_compress(int clevel, int doshuffle, size_t bytesoftype, size_t nbytes, |
|---|
| 69 | const void *src, void *dest); |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | /** |
|---|
| 73 | |
|---|
| 74 | Decompress a block of compressed data in `src`, put the result in |
|---|
| 75 | `dest` and returns the size of the decompressed block. If error |
|---|
| 76 | occurs, e.g. the compressed data is corrupted or the output buffer |
|---|
| 77 | is not large enough, then 0 (zero) or a negative value will be |
|---|
| 78 | returned instead. |
|---|
| 79 | |
|---|
| 80 | The `src` buffer and the `dest` buffer can not overlap. |
|---|
| 81 | |
|---|
| 82 | Decompression is memory safe and guaranteed not to write the `dest` |
|---|
| 83 | buffer more than what is specified in `dest_size`. |
|---|
| 84 | |
|---|
| 85 | */ |
|---|
| 86 | |
|---|
| 87 | unsigned int |
|---|
| 88 | blosc_decompress(const void *src, void *dest, size_t dest_size); |
|---|
| 89 | |
|---|
| 90 | #endif |
|---|