Function blosc_sys::blosc_compress [] [src]

pub unsafe extern "C" fn blosc_compress(
    clevel: c_int,
    doshuffle: c_int,
    typesize: size_t,
    nbytes: size_t,
    src: *const c_void,
    dest: *mut c_void,
    destsize: size_t
) -> c_int

Compress a block of data in the src buffer and returns the size of compressed block. The size of src buffer is specified by nbytes. There is not a minimum for src buffer size (nbytes).

clevel is the desired compression level and must be a number between 0 (no compression) and 9 (maximum compression).

doshuffle specifies whether the shuffle compression preconditioner should be applied or not. BLOSC_NOSHUFFLE means not applying it, BLOSC_SHUFFLE means applying it at a byte level and BLOSC_BITSHUFFLE at a bit level (slower but may achieve better entropy alignment).

typesize is the number of bytes for the atomic type in binary src buffer. This is mainly useful for the shuffle preconditioner. For implementation reasons, only a 1 < typesize < 256 will allow the shuffle filter to work. When typesize is not in this range, shuffle will be silently disabled.

The dest buffer must have at least the size of destsize. Blosc guarantees that if you set destsize to, at least, (nbytes+BLOSC_MAX_OVERHEAD), the compression will always succeed. The src buffer and the dest buffer can not overlap.

Compression is memory safe and guaranteed not to write the dest buffer more than what is specified in destsize.

If src buffer cannot be compressed into destsize, the return value is zero and you should discard the contents of the dest buffer.

A negative return value means that an internal error happened. This should never happen. If you see this, please report it back together with the buffer data causing this and compression settings.