6 * Copyright (C) 2013, LG Electronics, Kyungsik Lee <kyungsik.lee@lge.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
15 * Provides the maximum size that LZ4 may output in a "worst case" scenario
16 * (input data not compressible)
18 static inline size_t lz4_compressbound(size_t isize)
20 return isize + (isize / 255) + 16;
25 * src : source address of the compressed data
26 * src_len : is the input size, whcih is returned after decompress done
27 * dest : output buffer address of the decompressed data
28 * actual_dest_len: is the size of uncompressed data, supposing it's known
29 * return : Success if return 0
30 * Error if return (< 0)
31 * note : Destination buffer must be already allocated.
32 * slightly faster than lz4_decompress_unknownoutputsize()
34 int lz4_decompress(const char *src, size_t *src_len, char *dest,
35 size_t actual_dest_len);
38 * lz4_decompress_unknownoutputsize()
39 * src : source address of the compressed data
40 * src_len : is the input size, therefore the compressed size
41 * dest : output buffer address of the decompressed data
42 * dest_len: is the max size of the destination buffer, which is
43 * returned with actual size of decompressed data after
45 * return : Success if return 0
46 * Error if return (< 0)
47 * note : Destination buffer must be already allocated.
49 int lz4_decompress_unknownoutputsize(const char *src, size_t src_len,
50 char *dest, size_t *dest_len);