Kyungsik Lee | c14a958 | 2013-07-08 16:01:45 -0700 | [diff] [blame^] | 1 | #ifndef __LZ4_H__ |
| 2 | #define __LZ4_H__ |
| 3 | /* |
| 4 | * LZ4 Kernel Interface |
| 5 | * |
| 6 | * Copyright (C) 2013, LG Electronics, Kyungsik Lee <kyungsik.lee@lge.com> |
| 7 | * |
| 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. |
| 11 | */ |
| 12 | |
| 13 | /* |
| 14 | * lz4_compressbound() |
| 15 | * Provides the maximum size that LZ4 may output in a "worst case" scenario |
| 16 | * (input data not compressible) |
| 17 | */ |
| 18 | static inline size_t lz4_compressbound(size_t isize) |
| 19 | { |
| 20 | return isize + (isize / 255) + 16; |
| 21 | } |
| 22 | |
| 23 | /* |
| 24 | * lz4_decompress() |
| 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() |
| 33 | */ |
| 34 | int lz4_decompress(const char *src, size_t *src_len, char *dest, |
| 35 | size_t actual_dest_len); |
| 36 | |
| 37 | /* |
| 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 |
| 44 | * decompress done |
| 45 | * return : Success if return 0 |
| 46 | * Error if return (< 0) |
| 47 | * note : Destination buffer must be already allocated. |
| 48 | */ |
| 49 | int lz4_decompress_unknownoutputsize(const char *src, size_t src_len, |
| 50 | char *dest, size_t *dest_len); |
| 51 | #endif |