blosclz.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*********************************************************************
  2. Blosc - Blocked Shuffling and Compression Library
  3. Author: Francesc Alted <francesc@blosc.org>
  4. See LICENSES/BLOSC.txt for details about copyright and rights to use.
  5. **********************************************************************/
  6. /*********************************************************************
  7. The code in this file is heavily based on FastLZ, a lightning-fast
  8. lossless compression library. See LICENSES/FASTLZ.txt for details
  9. about copyright and rights to use.
  10. **********************************************************************/
  11. #ifndef BLOSCLZ_H
  12. #define BLOSCLZ_H
  13. #if defined (__cplusplus)
  14. extern "C" {
  15. #endif
  16. /**
  17. Compress a block of data in the input buffer and returns the size of
  18. compressed block. The size of input buffer is specified by
  19. length. The minimum input buffer size is 16.
  20. The output buffer must be at least 5% larger than the input buffer
  21. and can not be smaller than 66 bytes.
  22. If the input is not compressible, or output does not fit in maxout
  23. bytes, the return value will be 0 and you will have to discard the
  24. output buffer.
  25. The acceleration parameter is related with the frequency for
  26. updating the internal hash. An acceleration of 1 means that the
  27. internal hash is updated at full rate. A value < 1 is not allowed
  28. and will be silently set to 1.
  29. The input buffer and the output buffer can not overlap.
  30. */
  31. int blosclz_compress(const int opt_level, const void* input, int length,
  32. void* output, int maxout);
  33. /**
  34. Decompress a block of compressed data and returns the size of the
  35. decompressed block. If error occurs, e.g. the compressed data is
  36. corrupted or the output buffer is not large enough, then 0 (zero)
  37. will be returned instead.
  38. The input buffer and the output buffer can not overlap.
  39. Decompression is memory safe and guaranteed not to write the output buffer
  40. more than what is specified in maxout.
  41. */
  42. int blosclz_decompress(const void* input, int length, void* output, int maxout);
  43. #if defined (__cplusplus)
  44. }
  45. #endif
  46. #endif /* BLOSCLZ_H */